void processAudio(AudioBuffer &buffer){ FloatArray left = buffer.getSamples(LEFT_CHANNEL); FloatArray right = buffer.getSamples(RIGHT_CHANNEL); leftBuffer->copyFrom(left); rightBuffer->copyFrom(right); leftPatch.processAudio(*leftBuffer); rightPatch.processAudio(*rightBuffer); left.copyFrom(*leftBuffer); right.copyFrom(*rightBuffer); }
void processAudio(AudioBuffer &buffer) { float tune = getParameterValue(PARAMETER_A)*10.0 - 6.0; float fc = getParameterValue(PARAMETER_B)*10.0 - 4.0; float q = getParameterValue(PARAMETER_C)*3+0.75; float shape = getParameterValue(PARAMETER_E)*2; float pw = 0.5; if(shape > 1.0){ pw += 0.49*(shape-1.0); // pw 0.5 to 0.99 shape = 1.0; // square wave } float df = getParameterValue(PARAMETER_D)*4; int di = (int)df; float gain = 0.0f; switch(di){ // a/d case 0: // l/s env.setAttack(1.0-df); env.setRelease(0.0); break; case 1: // s/s env.setAttack(0.0); env.setRelease(df-1); break; case 2: // s/l env.setAttack(df-2); env.setRelease(1.0); break; case 3: // l/l env.setAttack(1.0); env.setRelease(1.0); gain = df-3; break; } env.trigger(isButtonPressed(PUSHBUTTON), getSamplesSinceButtonPressed(PUSHBUTTON)); FloatArray left = buffer.getSamples(LEFT_CHANNEL); FloatArray right = buffer.getSamples(RIGHT_CHANNEL); // vco hz.setTune(tune); float lfreq = hz.getFrequency(left[0]); osc.setFrequency(lfreq); osc.setShape(shape); osc.setPulseWidth(pw); osc.getSamples(left); // vcf hz.setTune(fc); fc = hz.getFrequency(right[0]); fc = min(0.999, max(0.01, fc/(getSampleRate()*2))); // normalised and bounded filter->setLowPass(fc, q); right.copyFrom(left); filter->process(right); right.multiply(0.8-q*0.2); // gain compensation for high q // vca env.getEnvelope(envelope); envelope.add(gain); left.multiply(envelope); right.multiply(envelope); }
void processAudio(AudioBuffer &buffer) { float tune = getParameterValue(PARAMETER_A)*6.0 - 4.0; float b = getParameterValue(PARAMETER_B); float c = getParameterValue(PARAMETER_C); float d = getParameterValue(PARAMETER_D); float e = getParameterValue(PARAMETER_E); harms.setTimeStep(b*b); harms.setControl(1, c); harms.setControl(2, d); harms.setControl(3, e); harms.normalizeAmplitudes(); harms.calculateNormalized(wavetable, samples); harms.increment(); FloatArray left = buffer.getSamples(LEFT_CHANNEL); FloatArray right = buffer.getSamples(RIGHT_CHANNEL); hz.setTune(tune); float freq = hz.getFrequency(left[0]); osc->setFrequency(freq); osc->getSamples(left); right.copyFrom(left); }