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;
	}
Example #2
0
	void onAudio(AudioIOData& io){

		tmr.period(0.25);

		// Set time taken to reach new frequency value
		freq.lag(0.1);

		while(io()){

			if(tmr()){
				// Set new target frequency of one-pole
				freq = pow(2, rnd::uniS(1.))*440;
			}

			// Use smoothed output of one-pole for oscillator frequency
			src.freq(freq());
			
			float s = src();
				
			io.out(0) = io.out(1) = s * 0.2f;
		}
	}