Beispiel #1
0
	MyApp(){
		// Allocate 200 ms in the delay line
		delay.maxDelay(0.2);

		tmr.period(4);
		tmr.phaseMax();

		// Configure a short cosine grain
		src.set(1000, 0.8, 0.04, 0.25);

		// Set up low-pass filter
		lpf.type(gam::LOW_PASS);
		lpf.freq(2000);
	}
	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;
	}
void audioCB(AudioIOData& io){

	while(io()){
		
		float cutoff = scl::pow3(mod.triU()) * 10000;
		
		filt.freq(cutoff);
		
		float s = filt(src());
			
		io.out(0) = io.out(1) = s * 0.2f;
	}
}
Beispiel #4
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;
		}
	}