本文整理汇总了C++中Sine::set_frequency方法的典型用法代码示例。如果您正苦于以下问题:C++ Sine::set_frequency方法的具体用法?C++ Sine::set_frequency怎么用?C++ Sine::set_frequency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sine
的用法示例。
在下文中一共展示了Sine::set_frequency方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_waveshaper2
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.");
}
示例2: test_filter_sweep
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.");
}
示例3: test_frequency_envelope
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.");
}
示例4: test_gliss_sin
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.");
}
示例5: test_notch
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.");
}
示例6: test_envelopes
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.");
}
示例7: test_formant
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.");
}
示例8: test_waveshaper
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.");
}