void processAudio(AudioInputBuffer &input, AudioOutputBuffer &output){ int totalBits = 8; float bitReduce = floor((getParameterValue(PARAMETER_A) * (totalBits -1)) + .5); int bitStutter = (int)floor((getParameterValue(PARAMETER_B) * 50) + .5); int gain = (int)ceil((getParameterValue(PARAMETER_C) * 25) + .5); int crushedMax = pow(2, totalBits - bitReduce) - 1; int loopCount = bitStutter; float currentSample = 0; float* in = input.getSamples(); float* out = output.getSamples(); int size = input.getSize(); for(int i = 0; i < size; i++) { if(--loopCount <= 0) { float x = in[i]; x = (x + 1.0) * crushedMax; x = x > 0 ? floor(x + 0.5) : ceil(x - 0.5); x = (x / crushedMax) - 1.0; x = x * gain; currentSample = x; loopCount = bitStutter; } out[i] = currentSample; } }
void processAudio(AudioInputBuffer &input, AudioOutputBuffer &output){ int size = input.getSize(); float gain = getParameterValue(PARAMETER_A); float* buf = input.getFloats(); for(int i=0; i<size; ++i) buf[i] = gain*buf[i]; output.setFloats(buf); }
void processAudio(AudioInputBuffer &input, AudioOutputBuffer &output){ float drive = 1+ getParameterValue(PARAMETER_A) * 30 ; // get input drive value float gain = getParameterValue(PARAMETER_C) / 2.0 ; // get output gain value int size = input.getSize(); float* x = input.getSamples(); float* y = output.getSamples(); for(int i=0; i<size; i++) y[i] = gain*clip(nonLinear((x[i])*drive)); // process each sample }
void processAudio(AudioInputBuffer &input, AudioOutputBuffer &output){ // update filter coefficients float fn = getFrequency()/getSampleRate(); float Q = getQ(); float g = getDbGain(); peq.setCoeffsPEQ(fn, Q, g) ; // get samples int size = input.getSize(); float* inBuf = input.getSamples(); float* outBuf = output.getSamples(); // filter samples peq.process(size, inBuf, outBuf); }
void processAudio(AudioInputBuffer &input, AudioOutputBuffer &output) { const int size = input.getSize(); // samples in block float* x = input.getSamples(); // arrays to hold sample data std::vector<float> y(size); delayTime = getParameterValue(PARAMETER_A); // delay time feedback = getParameterValue(PARAMETER_B); // delay feedback wetDry = getParameterValue(PARAMETER_D); // wet/dry balance float delaySamples = delayTime * (DELAY_BUFFER_LENGTH-1); for (int n = 0; n < size; n++){ // for each sample y[n] = x[n] + feedback * delayBuffer.read(delaySamples); x[n] = wetDry * y[n] + (1.f - wetDry) * x[n]; // crossfade for wet/dry balance delayBuffer.write(x[n]); } output.setSamples(x); }
void processAudio(AudioInputBuffer &input, AudioOutputBuffer &output){ float gain = getParameterValue(PARAMETER_A); float o1g = getParameterValue(PARAMETER_B); float o2g = getParameterValue(PARAMETER_C); float* x = input.getSamples(); float* y = output.getSamples(); int size = input.getSize(); for(int i=0; i<size; ++i) { float in = x[i]; float inFilt = inLpf.process(in); bool rect = inFilt>0; // the flip flops if(lastRect && !rect) { oct1 ^= true; if(lastOct1 && !oct1) { oct2 ^= true; } } float o1 = in * out1Lpf.process(oct1?1:-1); float o2 = in * out2Lpf.process(oct2?1:-1); lastOct1 = oct1; lastRect = rect; y[i] = in * gain + o1*o1g + o2*o2g;//*0.1*in; } }
void processAudio(AudioInputBuffer &input, AudioOutputBuffer &output){ int size = input.getSize(); float* buf = input.getFloats(); output.setFloats(buf); }