예제 #1
0
파일: echo.cpp 프로젝트: LancePutnam/Gamma
	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);
	}
예제 #2
0
	void onAudio(AudioIOData& io){
		while(io()){

			// Trigger a new random grain on a timer
			if(tmr()){
				seed *= 69069;
				float f = (seed%4000) + 200;
				src.set(f, 1, 16./f);				
			}

			// Get next grain sample
			float s = src();

			// Pass grain through reverberator and mix with dry source
			s += reverb(s) * 0.2;

			io.out(0) = s;
			io.out(1) = s;
		}
	}
예제 #3
0
	void onAudio(AudioIOData& io){

		// Set period of timer, in seconds
		tmr.period(1);

		while(io()){

			// Retrigger damped sine periodically
			if(tmr()){
				osc.set(
					rnd::uni(10, 1)*50,	// frequency, in Hz
					0.2,				// amplitude
					rnd::lin(2., 0.1)	// decay length, in seconds
				);
			}
			
			float s = osc();

			io.out(0) = io.out(1) = s;
		}
	}