예제 #1
0
 CymbalVoice(float sr) : fs(sr) {
   osc[0] = new SquareFMOscillator(sr);
   osc[1] = new SquareFMOscillator(sr);
   osc[2] = new SquareFMOscillator(sr);
   eg[0] = new AdsrEnvelope(sr);
   eg[1] = new AdsrEnvelope(sr);
   eg[2] = new AdsrEnvelope(sr);
   eg[0]->setAttack(0.0f);
   eg[0]->setDecay(0.4f);
   eg[0]->setSustain(0.0f);
   eg[0]->setRelease(0.0f);
   eg[1]->setAttack(0.0f);
   eg[0]->setDecay(0.2f);
   eg[1]->setSustain(0.8f);
   eg[1]->setRelease(0.2f);
   bp = BiquadFilter::create(2);
   hp = BiquadFilter::create(2);
   bp->setBandPass(0.6, FilterStage::BUTTERWORTH_Q);
   hp->setHighPass(0.6, FilterStage::BUTTERWORTH_Q);
   osc[0]->setFrequency(835.34);
   osc[0]->setGain(2.5);
   osc[0]->setModulatorFrequency(310.47);
   osc[0]->setModulatorGain(0.016);
   osc[1]->setFrequency(1875.62);
   osc[1]->setGain(1.5);
   osc[1]->setModulatorFrequency(536.22);
   osc[1]->setModulatorGain(0.0414);
   osc[2]->setFrequency(7436.77);
   osc[2]->setGain(1);
   osc[2]->setModulatorFrequency(936.8196);
   osc[2]->setModulatorGain(0.1052);
 }
예제 #2
0
 void setFilter(float f){
   bp->setBandPass(f, FilterStage::BUTTERWORTH_Q);
   hp->setHighPass(f, FilterStage::BUTTERWORTH_Q);
 }