MyApp(){ lpf.type(LOW_PASS); // Set filter to low-pass response lpf.res(4); // Set resonance amount to emphasize filter env.attack(0.01); // Set short (10 ms) attack env.decay(0.4); // Set longer (400 ms) decay tmr.freq(120./60.*4.); // Set timer frequency to 120 BPM tmr.phaseMax(); // Ensures timer triggers on first sample modCutoff.period(30); // Set period of cutoff modulation modCutoff.phase(0.5); // Start half-way through cycle freq.lag(0.1); // Lag time of portamento effect step=0; }
int main() { tmr.period(3); // Reset the envelope every 3 seconds env.attack(0.01); // Attack time env.decay(0.05); // Decay time // Delays, lowpass, and allpass filters setup code goes here // lpf.type(LOW_PASS); lpf.freq(2600); lpf.res(sqrt(2.0)/2.0); AudioIO audioIO(frameCount, samplingRate, audioCallBack, NULL, channelsOut, channelsIn); Sync::master().spu(audioIO.framesPerSecond()); audioIO.start(); printf("Press 'enter' to quit...\n"); getchar(); return 0; }
void audioCB(AudioIOData& io){ while(io()){ if(tmr()){ switch(cnt){ case 0: filt.type(Filter::LP); printf("Low-pass\n"); break; case 1: filt.type(Filter::HP); printf("High-pass\n"); break; case 2: filt.type(Filter::BP); printf("Band-pass\n"); break; case 3: filt.type(Filter::BR); printf("Band-reject\n"); break; } ++cnt %= 4; } float cutoff = scl::pow3(mod.triU()) * 10000; filt.res(4); filt.freq(cutoff); float s = filt(src()); io.out(0) = io.out(1) = s * 0.1f; } }