[Stk] Shakers::NoteOn

Dmitry Kulikov Dmitry Kulikov <dmitry@parsek.spb.ru>
Thu, 18 Nov 2004 13:18:41 +0300


Hi all!

   In shakers.h we have:

  .....
  //! Start a note with the given instrument and amplitude.
  /*!
    Use the instrument numbers above, converted to frequency values
    as if MIDI note numbers, to select a particular instrument.
  */
  void noteOn(StkFloat instrument, StkFloat amplitude);
  .....
  
  In shakers.cpp:

  ....
   void Shakers :: noteOn(StkFloat frequency, StkFloat amplitude)
   {
     // Yep ... pretty kludgey, but it works!
     int noteNum = (int) ((12*log(frequency/220.0)/log(2.0)) + 57.01) % 32;
     if (instType_ !=  noteNum) instType_ = this->setupNum(noteNum);
  ....

  So if I want to have 'Shakers' are beginning on C-4 note (int 48?) I have to do

     int my_note;
     Shakers globparam;
     

     globparam.noteOn(1071+(my_note-48),32767);

  Am I right?



  Thanks.

Dmitry                          mailto:dmitry@parsek.spb.ru