当前位置: 首页>>代码示例>>C++>>正文


C++ maxiOsc::phasor方法代码示例

本文整理汇总了C++中maxiOsc::phasor方法的典型用法代码示例。如果您正苦于以下问题:C++ maxiOsc::phasor方法的具体用法?C++ maxiOsc::phasor怎么用?C++ maxiOsc::phasor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在maxiOsc的用法示例。


在下文中一共展示了maxiOsc::phasor方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: play

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];//
	
}
开发者ID:Clivia,项目名称:Maximilian,代码行数:25,代码来源:11.Mixing.cpp

示例2: play

void play(double *output) {//this is where the magic happens. Very slow magic.

	currentCount=(int)timer.phasor(9);//this sets up a metronome that ticks every so often

	if (lastCount!=currentCount) {//if we have a new timer int this sample, play the sound
		trigger=1;//play the arpeggiator line
		trigger2=leadLineTrigger[playHead%256];//play the lead line
		if (trigger2==1) {//if we are going to play a note
			leadPitch=mtof.mtof(leadLinePitch[newnote]);//get the next pitch val
			newnote++;//and iterate
			if (newnote>14) {
				newnote=0;//make sure we don't go over the edge of the array
			}
		}
		currentPitch=mtof.mtof(pitch[(playHead%4)]+chord[currentChord%8]);//write the frequency val into currentPitch
		playHead++;//iterate the playhead
		if (playHead%32==0) {//wrap every 4 bars
			currentChord++;//change the chord
		}
		//cout << "tick\n";//the clock ticks
		lastCount=0;//set lastCount to 0
	}

	bassout=filter2.lores(envelope.adsr(bass.saw(currentPitch*0.5)+sound.pulse(currentPitch*0.5,mod.phasor(1)),1,0.9995, 0.25, 0.9995, 1, trigger),9250,2);//new, simple ADSR. 
	leadout=filter.lores(leadenvelope.ar(lead2.saw(leadPitch*4)+lead.pulse(leadPitch+(leadmod.sinebuf(1.9)*1.5), 0.6), 0.00005, 0.999975, 50000, trigger2),5900,10);//leadline

	delayout=(leadout+(delay.dl(leadout, 14000, 0.8)*0.5))/2;//add some delay

	if(trigger!=0)trigger=0;//set the trigger to off if you want it to trigger immediately next time.


	output[0]=(bassout+delayout)/2;//sum output
	output[1]=(bassout+delayout)/2;

}
开发者ID:Clivia,项目名称:Maximilian,代码行数:35,代码来源:16.Replicant.cpp

示例3: play

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=1;
        
        cout << "tick\n";//the clock ticks
        
        lastCount=0;//set lastCount to 0
    }
    
    //and this is where we build the synth
    
    ADSRout=ADSR.adsr(1.0,ADSR.trigger);
    
    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, ADSRout*10000, 10);//now we stick the VCO's into the VCF, using the ADSR as the filter cutoff
    
    double finalSound=VCFout*ADSRout;//finally we add the ADSR as an amplitude modulator
    ADSR.trigger=0;
    output[0]=finalSound;
    output[1]=finalSound;
}
开发者ID:Craigson,项目名称:Maximilian,代码行数:32,代码来源:14.monosynth.cpp

示例4: play

void play(double *output) {
    
    //Using the phasor we can create a ramp, and use this ramp to set the frequency of one of the waves.
    //When the frequency of the lower waveform passes over the threshold of 20hz, we start to hear two new waveforms.
    //The frequency of the first new wave is the sum of the two original waves.
    //The frequency of the second new wave is the difference of the two original waves.
    //So you hear two new waves, one going up, one going down.
    
    output[0]=mySine.sinewave(440)*myOtherSine.sinewave(myPhasor.phasor(0.01,0,440));
    output[1]=output[0];
    
}
开发者ID:Craigson,项目名称:Maximilian,代码行数:12,代码来源:4.AM2.cpp

示例5: play

void play(double *output) {
    
    mix=0;//we're adding up the samples each update and it makes sense to clear them each time first.
    
    //so this first bit is just a basic metronome so we can hear what we're doing.
    
    currentCount=(int)timer.phasor(8);//this sets up a metronome that ticks 8 times a second
    
    if (lastCount!=currentCount) {//if we have a new timer int this sample, play the sound
        
        if (voice==6) {
            voice=0;
        }
        
        ADSR[voice].trigger=1;//trigger the envelope from the start
        pitch[voice]=voice+1;
        voice++;
        
    }
    
    //and this is where we build the synth
    
    for (int i=0; i<6; i++) {
        
        
        ADSRout[i]=ADSR[i].adsr(1.,ADSR[i].trigger);//our ADSR env is passed a constant signal of 1 to generate the transient.
        
        LFO1out[i]=LFO1[i].sinebuf(0.2);//this lfo is a sinewave at 0.2 hz
        
        VCO1out[i]=VCO1[i].pulse(55*pitch[i],0.6);//here's VCO1. it's a pulse wave at 55 hz, with a pulse width of 0.6
        VCO2out[i]=VCO2[i].pulse((110*pitch[i])+LFO1out[i],0.2);//here's VCO2. it's a pulse wave at 110hz with LFO modulation on the frequency, and width of 0.2
        
        
        VCFout[i]=VCF[i].lores((VCO1out[i]+VCO2out[i])*0.5, 250+((pitch[i]+LFO1out[i])*1000), 10);//now we stick the VCO's into the VCF, using the ADSR as the filter cutoff
        
        mix+=VCFout[i]*ADSRout[i]/6;//finally we add the ADSR as an amplitude modulator
        
        
    }
    
    output[0]=mix*0.5;//left channel
    output[1]=mix*0.5;//right channel
    
    
    // This just sends note-off messages.
    for (int i=0; i<6; i++) {
        ADSR[i].trigger=0;
    }
    
}
开发者ID:Craigson,项目名称:Maximilian,代码行数:50,代码来源:15.polysynth.cpp

示例6: play

void play(double *output) {
    
    // A pulse wave!!! Yay
    out = osc.pulse(90, ramp.phasor(.2));
    
    // Fill our output buffer
    output[0]=out;
    output[1]=out;

    // After we have filled our output array, send the array
    // and the size of the array (in this case the amount of
    // channels, but in ofx or juce you might need to do 
    // something like channels*bufferSize).
    recorder.passData(output, maxiSettings::channels);
}
开发者ID:kimon-satan,项目名称:Maximilian,代码行数:15,代码来源:21.Recording.cpp

示例7: play

void play(double *output) {
    
    CurrentCount=myCounter.phasor(1*((another.sawn(0.1)+1)/2), 1, 9);//phasor can take three arguments; frequency, start value and end value.
    
    if (CurrentCount<5) {//simple if statement
        
        myOscOutput=mySwitchableOsc.square(myArray[CurrentCount]);
    }
    
    else if (CurrentCount>=5) {//and the 'else' bit.
        
        myOscOutput=mySwitchableOsc.sawn(myArray[CurrentCount]);//one osc object can produce whichever waveform you want.
    }
    output[0]=myOscOutput;//point me at your speakers and fire.
    output[1]=output[0];
    
}
开发者ID:Craigson,项目名称:Maximilian,代码行数:17,代码来源:8.Counting4.cpp

示例8: play

void play(double *output) {
	
	CurrentCount=myCounter.phasor(1, 1, 9);//phasor can take three arguments; frequency, start value and end value.

// here we use a conditional to make something happen at a specific time.	

	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. 
	
    output[0]=myOscOutput;
    output[1]=output[0];

}
开发者ID:Craigson,项目名称:Maximilian,代码行数:18,代码来源:8.Counting3.cpp

示例9: play

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.
}
开发者ID:Clivia,项目名称:Maximilian,代码行数:20,代码来源:9.Envelopes.cpp


注:本文中的maxiOsc::phasor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。