示例#1
0
void play(double *output) {
	
	CurrentCount=myCounter.phasor(1, 1, 9);//phasor can take three arguments; frequency, start value and end value.
	
	if (CurrentCount<5)//simple if statement
		
		myOscOutput=mySwitchableOsc.square(CurrentCount*100);
	
	else if (CurrentCount>=5)//and the 'else' bit.
		
		myOscOutput=mySwitchableOsc.saw(CurrentCount*50);//one osc object can produce whichever waveform you want. 
	
	if (CurrentCount==1) 
		
		myEnvelope.trigger(0,myEnvelopeData[0]); //trigger the envelope
	
	myFilteredOutput=myFilter.lores(myOscOutput,(myEnvelope.line(6, myEnvelopeData)),10);//lores takes an audio input, a frequency and a resonance factor (1-100)
	
	myPanPosition=myAutoPanner.sinewave(1);
	
	myOutputs.stereo(myFilteredOutput,myStereoOutput,myPanPosition);//Stereo, Quad or 8 Channel. Specify the input to be mixed, the output[numberofchannels], and the pan (0-1,equal power).	
	output[0]=myStereoOutput[0];//When working with mixing, you need to specify the outputs explicityly
	output[1]=myStereoOutput[1];//
	
}
示例#2
0
void play(double *output) {
	
	//so this first bit is just a basic metronome so we can hear what we're doing.
	
	currentCount=(int)timer.phasor(0.5);//this sets up a metronome that ticks every 2 seconds
	
	if (lastCount!=currentCount) {//if we have a new timer int this sample, play the sound
				
		ADSR.trigger(0, adsrEnv[0]);//trigger the envelope from the start
		
		cout << "tick\n";//the clock ticks
	
		lastCount=0;//set lastCount to 0
	}
	
	//and this is where we build the synth
	
		
	ADSRout=ADSR.line(8,adsrEnv);//our ADSR env has 8 value/time pairs.
	
	LFO1out=LFO1.sinebuf(0.2);//this lfo is a sinewave at 0.2 hz
	
	VCO1out=VCO1.pulse(55,0.6);//here's VCO1. it's a pulse wave at 55 hz, with a pulse width of 0.6
	VCO2out=VCO2.pulse(110+LFO1out,0.2);//here's VCO2. it's a pulse wave at 110hz with LFO modulation on the frequency, and width of 0.2


	VCFout=VCF.lores((VCO1out+VCO2out)*0.5, 250+(ADSRout*15000), 10);//now we stick the VCO's into the VCF, using the ADSR as the filter cutoff 
	
	*output=VCFout*ADSRout;//finally we add the ADSR as an amplitude modulator 
	
}
示例#3
0
void play(double *output) {
    
    
    if (counter ==0 || counter % 8820==0) {
        myEnv.trigger(true);
    }
    
    
    counter++;
    
    double out = myEnv.ar(0.01,1);
    
    output[0]=myOsc.sinewave(440)*out;
    
    output[1]=output[0];
    
}
示例#4
0
void play(double *output) {
	
	myCurrentVolume=myEnvelope.line(4,myEnvelopeData);
	
	CurrentCount=myCounter.phasor(1, 1, 9);//phasor can take three arguments; frequency, start value and end value.
	
	if (CurrentCount<5)//simple if statement
		
		myOscOutput=mySwitchableOsc.square(CurrentCount*100);
	
	else if (CurrentCount>=5)//and the 'else' bit.
		
		myOscOutput=mySwitchableOsc.sinewave(CurrentCount*50);//one osc object can produce whichever waveform you want. 
	
	if (CurrentCount==1) 
		
		myEnvelope.trigger(0,myEnvelopeData[0]); //trigger the envelope
	
	*output=myOscOutput*myCurrentVolume;//point me at your speakers and fire.
}