Ejemplo n.º 1
0
void test_waveshaper2() {
	Sine vox;					// declare oscillator
	ADSR env = ADSR(5, 0.5, 0.5, 0.5, 0.5); 
	int chebyHarmonics[NUMHARMONICS] = {1, 2, 4,  MAXHARMONIC};		 //What harmonic content we want
	sample chebyWeights[NUMHARMONICS] = {1, 0.3, 0.17, 1/10};   //Weight of each harmonic
	sample chebyCoefficients[MAXHARMONIC + 1];	         //Array to store cheby coefficients
	Polynomial f = {MAXHARMONIC, chebyCoefficients};     //Descriptor for cheby coefficients

	EvaluateCheby(chebyCoefficients, chebyHarmonics, chebyWeights, NUMHARMONICS, 
		MAXHARMONIC);  //Produce the summation of Cheby polynomials corresponding to harmonics

#ifndef USE_STATIC_WAVETABLE
	VWaveShaper vox2(vox, (void *)&f, simpleWaveShaperFxn);
#else
	VWaveShaper vox2(vox, (void *)&f, simpleWaveShaperFxn, 1000); //use static table
#endif
	vox.set_frequency(200);					// set the carrier's frequency
	vox.set_scale(env);					// set the carrier's frequency	

	logMsg("CSL playing waveshaper...");

	env.trigger();

    run_test(vox2);
	logMsg("CSL done.");
}
Ejemplo n.º 2
0
void test_filter_sweep() {		
	WhiteNoise wnoise;
	Sine centerSin;
	centerSin.set_frequency(0.5);
	MulOp centerMod(centerSin, 500.0);
	StaticVariable centerOffset(1000);
	AddOp centerSweep(centerMod, 1000.0);
	Sine BWSin;
	BWSin.set_frequency(5);
	MulOp BWMod(BWSin, 50.0);
	AddOp BWSweep(BWMod, 100.0);
	Butter lpfilter(wnoise, wnoise.sample_rate(), Butter::BW_BAND_PASS, centerSweep, BWSweep);
	logMsg("playing filter_sweep...");
	run_test(lpfilter);
	logMsg("filter_sweep done.");
}
Ejemplo n.º 3
0
void test_frequency_envelope() {
	Sine vox;
	Envelope env(3, 0, 220, 0.7, 280, 1.3, 180, 2.0, 200, 3, 1000);
	vox.set_frequency(env);
	logMsg("playing sin envelope on frequency");
	env.trigger();	
	run_test(vox);
	logMsg("sin envelope on frequency done.");
}
Ejemplo n.º 4
0
void test_gliss_sin() {
	Sine vox;
	LineSegment line(3, 100, 800);
	vox.set_frequency(line);
	StaticVariable vol(0.1);
	MulOp mul(vox, vol);
	logMsg("playing gliss sin...");
	run_test(mul);
	logMsg("gliss sin done.");
}
Ejemplo n.º 5
0
void test_notch() {
// 	WhiteNoise osc;
	Sine osc(600);
//	LineSegment cutoffSweep(3, 2000.0, 200.0);
	Sine sweep;
	sweep.set_frequency(1);
	sweep.set_scale(550);
	sweep.set_offset(600);
	Notch lpfilter(osc, osc.sample_rate(), sweep, 0.99995F );
	logMsg("playing band-reject (notch) filter...");
	run_test(lpfilter);
	logMsg("notch test done.");
}
Ejemplo n.º 6
0
void test_envelopes() {
	Sine vox;
	LineSegment line(3, 600, 100);
	vox.set_frequency(line);
//	ADSR env(3, 0.1, 0.1, 0.25, 1.5);			// sharp ADSR
//	AR env(3, 1, 1.5);					// gentle AR
	Triangle env(3, 1); 					// 3-sec triangle
	env.dump();
	vox.set_scale(env);
	logMsg("playing gliss sin with envelope...");
	env.trigger();
	run_test(vox);
	logMsg("gliss sin done.");
}
Ejemplo n.º 7
0
void test_formant() {
//	WhiteNoise osc;
	Sawtooth osc;
	osc.set_frequency(400);
	Sine sweep;
	sweep.set_frequency(1);
	sweep.set_scale(200);
	sweep.set_offset(600);
//	LineSegment cutoffSweep(3, 2000.0, 200.0);
//	StaticVariable cutoffSweep(2000);
	Formant lpfilter(osc, osc.sample_rate(), sweep, 0.995F );
//	Formant lpfilter(osc, osc.sample_rate(), 600, 0.995F );
//	lpfilter.set_normalize(false);
//	Filter lpfilter(osc);
	logMsg("playing Formant...");
	run_test(lpfilter, 10);
	logMsg("Formant done.");
}
Ejemplo n.º 8
0
void test_waveshaper() {
	Sine vox;					// declare oscillator
	ADSR env = ADSR(5, 0.5, 0.5, 0.5, 0.5); 

#ifndef USE_STATIC_TABLE
	VWaveShaper vox2(vox, NULL, linearWaveShaperFxn);
#else
	VWaveShaper vox2(vox, NULL, linearWaveShaperFxn, 1000);  //Using static table
#endif
	vox.set_frequency(200);			// set the carrier's frequency
	vox.set_scale(env);					// set the carrier's envelop	

	logMsg("CSL playing waveshaper...");

	env.trigger();
    run_test(vox2);

	logMsg("CSL done.");
}