本文整理汇总了C++中LFO::hann方法的典型用法代码示例。如果您正苦于以下问题:C++ LFO::hann方法的具体用法?C++ LFO::hann怎么用?C++ LFO::hann使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LFO
的用法示例。
在下文中一共展示了LFO::hann方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
示例2: 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);
}
}
示例3: 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;
}
}
示例4: 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;
}
}
示例5: audioCB
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;
}
}
示例6: 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;
}
}
示例7: onAudio
void onAudio(AudioIOData& io){
while(io()){
// Generate new seed?
if(tmr()){ if(rnd::prob()) seed++; }
// Modulated mix between pulse waves
float mx = mix.hann();
float s = (oscA.up() - oscB.up())*mx + (osc1.up() - osc2.up())*(1-mx);
// Add frequency shifted versions of signal to get barberpole combs
fshift1.freq(modfs1.tri()*2);
fshift2.freq(modfs2.tri()*2);
s += (fshift1(s) + fshift2(s))*0.5;
if(stft(s)){
// Apply spectral thin
rnd::push(seed);
float prb = rnd::uni(0.3, 0.1);
for(unsigned k=0; k<stft.numBins(); ++k){
//float frac = double(k)/stft.numBins();
float m = rnd::pick(rnd::pick(2,1, 0.1),0, prb);
stft.bin(k) *= m;
}
rnd::pop();
stft.zeroEnds();
}
s = stft()*0.5;
// "Spatialize" with modulated echoes
float s0 = chrA3(chrA2(chrA1(s)));
float s1 = chrB3(chrB2(chrB1(s)));
io.out(0) = s0;
io.out(1) = s1;
}
}