Exemple #1
0
	void onAudio(AudioIOData& io){
		while(io()){
			if(syncMode()){
				softSync^=true;
				printf("%s sync\n", softSync?"soft":"hard");
			}

			// When the sync osc completes cycle, reset the phase of the formant osc
			float w = sync.up();
			if(sync.cycled()) formant.phase(0);

			// Set the pitch of the formants
			formant.freq(mod.triU()*2200+200);

			// The formant oscillator determines the spectral envelope
			float s = formant.tri();

			// Drop amp to zero at sync points?
			if(softSync){
				w = 1.f - scl::pow8(w);	// flattop window
				s *= w;					// apply window
			}

			io.out(0) = io.out(1) = s*0.2;
		}
	}
Exemple #2
0
	MyApp()
	:	stft(4096, 4096/4, 0, HANN, COMPLEX),
		chrA1(0.31, 0.002, 0.20111, -0.7, 0.9),
		chrA2(0.22, 0.002, 0.10151, -0.7, 0.9),
		chrA3(0.13, 0.002, 0.05131, -0.7, 0.9),
		chrB1(0.31, 0.002, 0.20141, -0.7, 0.9),
		chrB2(0.22, 0.002, 0.10171, -0.7, 0.9),
		chrB3(0.13, 0.002, 0.05111, -0.7, 0.9)
	{
		tmr.period(10);
		osc1.freq(40);
		osc2.freq(40.003);
		oscA.freq(62);
		oscB.freq(62.003);
		mix.period(60);
		modfs1.period(101);
		modfs2.period(102);
	}
Exemple #3
0
void audioCB(AudioIOData& io){

	while(io()){
		using namespace gam::rnd;

		if(tmr()){
			env0 = uni(0.4, 0.39);
			if(prob(0.8)){
				float r = uni(1.);
				tmr.period(r * 4);
				env0.period(r * 4);
			}
			
			int a = pick(8,6, 0.7);
			if(prob(0.2)) osc0.freq(quanOct(a, 440.));
			if(prob(0.1)) osc1.freq(quanOct(a, 220.));
			if(prob(0.1)) osc2.freq(quanOct(a, 110.));
			if(prob(0.1)) osc3.freq(quanOct(a,  55.));
			if(prob(0.2)) frq0 = lin(8000, 400);
			if(prob(0.2)) frq1 = lin(8000, 400);//printf("d");
		}
		
		float e = lag(env0());
		del0.delay(e);
		del1.delay(e * 0.9);
		
		float s = (osc0.up() * mod0() + osc1.up() * mod1() + osc2.up() * mod2() + osc3.up() * mod3()) * 0.05;
		res0.freq(frq0()); res1.freq(frq1());
		s = res0(s) + res1(s);

		float sl = ech0(del0(s), ap0(ech0()));
		float sr = ech1(del1(s), ap1(ech1()));

		io.out(0) = sl;
		io.out(1) = sr;
	}
	
}
void audioCB(AudioIOData& io){

	while(io()){
	
		if(tmr()){
			if(cnt()){
				modMode ^= true;			// increment LFO type, switch mod mode when wraps
				printf("\nMod mode: %s modulation\n", modMode? "Amp" : "Freq");
			}
		}
			
		env.mod(mod.cosU());	// modulate modifier parameter with unipolar cosine wave

		float s = 0.f;			// initialize current sample to zero

		switch(cnt.val){			
				
			// non-modifiable generators ordered from smooth to sharp:
			case  0: s = env.cosU();	break;	// unipolar cosine
			case  1: s = env.hann();	break;	// a computed hann window (inverted cosU)
			case  2: s = env.triU();	break;	// unipolar triangle
			case  3: s = env.upU();		break;  // unipolar upward ramp
			case  4: s = env.downU();	break;  // unipolar downward ramp
			case  5: s = env.sqrU();	break;	// unipolar square

			// modifiable generator ordered from smooth to sharp:
			case  6: s = env.pulseU();	break;	// Mix between upward ramp and downward ramp
			case  7: s = env.stairU();	break;	// Mix between a square and impulse. 
			case  8: s = env.line2U();	break;	// Mix between a ramp and a triangle
			case  9: s = env.up2U();	break;  // Mix between two ramps			
		}
		
		if(modMode){			// amplitude modulate noise with envelope
			s *= noise();
		}
		else{					   // frequency modulate oscillator with envelope
			osc.freq(s*400 + 200); // between 100 and 200 hz
			s = osc.cos();
		}
		
		io.out(0) = io.out(1) = s*0.2;
	}
}
Exemple #5
0
void audioCB(AudioIOData& io){

	while(io()){

		if(tmr()){
			for(int i=0; i<filt.size(); ++i){
				filt.set(i,
					Vowel::freq(Vowel::WOMAN, (Vowel::Phoneme)ivowel(), i),
					Vowel::amp(Vowel::WOMAN, (Vowel::Phoneme)ivowel(), i)
				);
			}
			++ivowel;
		}

		osc.freq(330.5 + vib()*3);
		osc.mod(0.2);

		float s = osc.pulse();
		
		s = filt(s);

		io.out(0) = io.out(1) = s * 0.1f;
	}
}
Exemple #6
0
	MyApp(){
		tmr.period(2);
		mod.period(2);
		osc.freq(220);
		waveform=0;
	}