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

			if(tmr()) src.reset();

			float s = src();

			// Read the end of the delay line to get the echo
			float echo = delay();

			// Low-pass filter and attenuate the echo
			echo = lpf(echo) * 0.8;

			// Write sum of current sample and echo to delay line
			delay(s + echo);

			// Finally output sum of dry and wet signals
			s += echo;
		
			io.out(0) = io.out(1) = s;
		}
	}
void audioCB(AudioIOData& io){
		position pos;
		pos.x=-10;
		pos.y=0;
		pos.z=0;
	while(io()){
		float r;
		r=rand()%7;

	//	cout<<bpmInput<<endl;
	//	cout<<tmr2.freq()<<endl;
		float s = 0;
		float tone = 0;
		float bass = 0;
		if (tmr()){	

			src3.reset();
			envLPF.reset();
			}
	if(tmr3()){
			env.reset();
			env2.reset();
			//src3.reset();
			tmr3.freq(rnd::uni(beat,beat*2));
			src2.reset();
		}
		if(tmr2()){
//			src.reset();
			tmr2.freq(rnd::uni(beat,beat*3));
			src3.reset();
			src2.reset();
		}
		if (tmr4()){	
	//		src.reset();
			pos.x+=1;
			tmr4.freq(rnd::uni(beat,beat*2));
			src3.reset();
			envLPF.reset();
			}
		if (tmr5()){	
	//		src.reset();
			pos.x+=1;
			tmr5.freq(rnd::uni(beat/2,beat*2));
			src4.reset();
			envLPF.reset();
			}
		if (tmr6()){	
	//		src.reset();
			pos.x+=1;
			src5.reset();
			envLPF.reset();
			}
		if (tmr7()){	
	//		src.reset();
			pos.x+=1;
			src6.reset();
			envLPF.reset();
			}
		if (tmrRand())
		{
			envswell.reset();
			envpan.set(434200,-3);
//			beat*=(float)r;

		}
		if(sweep()){

				envwhite.reset();
		

		}
			
		float wet1, wet2;
		s=src()*env()*.3;
		hpfreq*=envLPF();
		tone = src2()*.2;
	 	bass = src3()*.3;
	 	s+=src4()*.2+src5()*.2+src6()*.2;
		tone+=bass;
		s+=tone;
		reverb(s,wet1, wet2);
		//double xplane =  pos.x/10;




		//define my sound variables with pan
		float batleft=swnoise()*envwhite()*envswell()*.15*envpan();
		float batright= swnoise()*envwhite()*(envswell())*.15*(1-envpan());









		float preout=LPF(s);
		float out = preout+LPF(wet1*.2);
		io.out(0) = out+batleft;
		io.out(1) = out+batright;
	}
}