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


C++ LFO类代码示例

本文整理汇总了C++中LFO的典型用法代码示例。如果您正苦于以下问题:C++ LFO类的具体用法?C++ LFO怎么用?C++ LFO使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: short

	MyApp(){
		lpf.type(LOW_PASS);		// Set filter to low-pass response
		lpf.res(4);				// Set resonance amount to emphasize filter
		env.attack(0.01);		// Set short (10 ms) attack
		env.decay(0.4);			// Set longer (400 ms) decay
		tmr.freq(120./60.*4.);	// Set timer frequency to 120 BPM
		tmr.phaseMax();			// Ensures timer triggers on first sample
		modCutoff.period(30);	// Set period of cutoff modulation
		modCutoff.phase(0.5);	// Start half-way through cycle
		freq.lag(0.1);			// Lag time of portamento effect
		step=0;
	}
开发者ID:LancePutnam,项目名称:Gamma,代码行数:12,代码来源:subtractiveBassline.cpp

示例2: audioCB

void audioCB(AudioIOData& io){

	while(io()){

		float s = src();

		// Input next sample for analysis
		// When this returns true, then we have a new spectral frame
		if(stft(s)){
		
			float frac = scl::pow3( edge.triU() );
			int N = stft.numBins();
			
			for(int k=0; k<N; ++k){
				int indKnee = frac * N;
				stft.bin(k) *= k < indKnee ? 1:0;
			}
		}
		
		// Get next resynthesized sample
		s = stft() * 0.2;
		
		io.out(0) = s;
		io.out(1) = s;
	}
}
开发者ID:AlloSphere-Research-Group,项目名称:Gamma,代码行数:26,代码来源:STFT.cpp

示例3: onAudio

	void onAudio(AudioIOData& io){
		while(io()){

			if(tmr()){
				// Our sequence of pitches
				float pitches[] = {0,0,12,0,0,10,-5,0};
				// Map pitch class to a frequency in Hz
				float f = 55 * pow(2, pitches[step]/12.);
				// Increment step counter
				step = (step + 1) % 8;
				// Set new target frequence of portamento
				freq = f;
				// Restart envelope using a soft reset (to avoid clicks)
				env.resetSoft();
			}

			// Set saw frequency from portamento filter
			saw.freq(freq());

			// Get next envelope value
			float e = env();
			// Map envelope value to cutoff frequency
			lpf.freq(e * (modCutoff.paraU()*6000 + 500) + 40);
			// Generate next saw sample
			float s = saw() * 0.3;
			// Filter saw sample
			s = lpf(s) * e;
			// Send sample to DAC
			io.out(0) = io.out(1) = s;
		}
	}
开发者ID:LancePutnam,项目名称:Gamma,代码行数:31,代码来源:subtractiveBassline.cpp

示例4: audioCB

void audioCB(AudioIOData& io){

	while(io()){
		
		if(tmr()){
			switch(flangeType){
			case 0:	printf("Low-pass feedforward\n");
				flanger.feeds(0.7, 0); break;
			case 1:	printf("High-pass feedforward\n");
				flanger.feeds(-0.7,0); break;
			case 2:	printf("Low-pass feedback\n");
				flanger.feeds(0,0.7); break;
			case 3:	printf("High-pass feedback\n");
				flanger.feeds(0,-0.7); break;
			case 4:	printf("Low-pass dual-feed\n");
				flanger.feeds(0.7,0.7); break;
			case 5:	printf("High-pass dual-feed\n");
				flanger.feeds(-0.7,-0.7); break;
			case 6:	printf("All-pass 1\n");
				flanger.feeds(0.9,-0.9); break;
			case 7:	printf("All-pass 2\n");
				flanger.feeds(-0.9,0.9); break;
			}
			(++flangeType) %= 8;
		}
		
		float s = src.up();
		s = flanger(s)*0.1;

		io.out(0) = io.out(1) = s;
	}
}
开发者ID:AlloSphere-Research-Group,项目名称:Gamma,代码行数:32,代码来源:flanger.cpp

示例5: onAudio

	void onAudio(AudioIOData& io){

		while(io()){

			if(tmr()){
				switch(feedType){
				case 0:	printf("Low-pass feedforward\n");
					comb.feeds( 1,0); break;
				case 1:	printf("High-pass feedforward\n");
					comb.feeds(-1,0); break;
				case 2:	printf("Low-pass feedback\n");
					comb.feeds(0,0.7); break;
				case 3:	printf("High-pass feedback\n");
					comb.feeds(0,-0.7); break;
				case 4:	printf("Low-pass dual-feed\n");
					comb.feeds(0.7,0.7); break;
				case 5:	printf("High-pass dual-feed\n");
					comb.feeds(-0.7,-0.7); break;
				case 6:	printf("All-pass 1\n");
					comb.feeds(0.9,-0.9); break;
				case 7:	printf("All-pass 2\n");
					comb.feeds(-0.9,0.9); break;
				}
				(++feedType) %= 8;
			}
			
			float s = src()*0.1;
			
			comb.ipolType(ipl::ROUND);
			comb.delay(mod.triU() * 1./400 + 1./10000);
			s = comb(s);

			io.out(0) = io.out(1) = s;
		}
	}
开发者ID:LancePutnam,项目名称:Gamma,代码行数:35,代码来源:comb.cpp

示例6:

	MyApp(){
		feedType=0;
		tmr.phaseMax();
		tmr.period(4);
		mod.period(4);
		src.freq(100);
		comb.maxDelay(1./100);
	}
开发者ID:LancePutnam,项目名称:Gamma,代码行数:8,代码来源:comb.cpp

示例7: audioCB

void audioCB(AudioIOData& io){
	using namespace gam::rnd;
	while(io()){

		if(tmr()){ if(prob()) rng++; }

		float mx = mix.hann();
		float s = (oscA.up() - oscB.up())*mx + (osc1.up() - osc2.up())*(1-mx);

		fshift1.freq(modfs1.tri()*2);
		fshift2.freq(modfs2.tri()*2);
		s = ((fshift1(s) + fshift2(s))/2 + s)/1;

		if(stft(s)){
		
			rnd::push(rng);
			float prb = rnd::uni(0.3, 0.1);
			for(unsigned k=0; k<stft.numBins(); ++k){
				//float frac = double(k)/stft.numBins();
				float m = pick(pick(2,1, 0.1),0, prb);
				stft.bins(k) *= m;
			}
			rnd::pop();
			stft.zeroEnds();
		}
			
		s = stft()*0.5;
		//float s0=s, s1=s;
		float s0 = chrA3(chrA2(chrA1(s)));
		float s1 = chrB3(chrB2(chrB1(s)));

		io.out(0) = s0;
		io.out(1) = s1;
	}
}
开发者ID:michaeldonovan,项目名称:wdl-md,代码行数:35,代码来源:luster.cpp

示例8: audioCB

void audioCB(AudioIOData& io){

	while(io()){

		float s = osc();
		io.out(0) = io.out(1) = s * 0.2f;
		
		osc.phaseAdd(s*0.01*mod.hann());
		//osc.freq((s*0.5+0.5)*mod.hann()*800 + 400);
	}
}
开发者ID:AlloSphere-Research-Group,项目名称:Gamma,代码行数:11,代码来源:modFreqFeedback.cpp

示例9: onAudio

	void onAudio(AudioIOData& io){

		// Set the frequency, in Hz
		buzz.freq(55);

		mod.period(16);

		while(io()){

			int nh = mod.triU() * 64;

			// Set number of harmonics
			buzz.harmonics(nh);
	
			float s = buzz() * 0.2;

			io.out(0) = s;
			io.out(1) = s;
		}
	}
开发者ID:LancePutnam,项目名称:Gamma,代码行数:20,代码来源:buzz.cpp

示例10: audioCB

void audioCB(AudioIOData& io){

	while(io()){

		oscM.freq(modFreq.hann() * 110 + 1);	// change modulator frequency

		float s = oscC() * (oscM() * 0.5 + 0.5) * 0.2;
		
		io.out(0) = io.out(1) = s;
	}
}
开发者ID:AlloSphere-Research-Group,项目名称:Gamma,代码行数:11,代码来源:modAmp.cpp

示例11: audioCB

void audioCB(AudioIOData& io){
	using namespace gam::rnd;
	while(io()){

		float s = osc.up()*0.1;

		// The Hilbert transform returns a complex number
		Complex<float> c = hil(s);
		
		// Perform a frequency shift
		shifter.freq(shiftMod.hann()*1000);
		c *= shifter();
		
		// Output the real and imaginary components
		float s0 = c.r;
		float s1 = c.i;
	
		io.out(0) = s0;
		io.out(1) = s1;
	}
}
开发者ID:michaeldonovan,项目名称:wdl-md,代码行数:21,代码来源:HilbertFilter.cpp

示例12: audioCB

void audioCB(AudioIOData& io){

	while(io()){

		oscM.freq(modFreq.hann() * 110 + 1);	// change modulator frequency
		oscC.freq(ff + oscM()*100);				// modulate frequency of carrier

		float s = oscC() * 0.2;
		
		io.out(0) = io.out(1) = s;
	}
}
开发者ID:AlloSphere-Research-Group,项目名称:Gamma,代码行数:12,代码来源:modFreqTransition.cpp

示例13: audioCB

void audioCB(AudioIOData& io){

	while(io()){
	
		int nh = mod.triU() * 64;
		buzz.harmonics(nh);
	
		float s = buzz();

		io.out(0) = io.out(1) = s*0.2;
	}
}
开发者ID:AlloSphere-Research-Group,项目名称:Gamma,代码行数:12,代码来源:oscBuzz.cpp

示例14: onAudio

	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;
		}
	}
开发者ID:LancePutnam,项目名称:Gamma,代码行数:26,代码来源:sync.cpp

示例15: audioCB

void audioCB(AudioIOData& io){

	while(io()){
		
		float cutoff = scl::pow3(mod.triU()) * 10000;
		
		filt.freq(cutoff);
		
		float s = filt(src());
			
		io.out(0) = io.out(1) = s * 0.2f;
	}
}
开发者ID:AlloSphere-Research-Group,项目名称:Gamma,代码行数:13,代码来源:onePole.cpp


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