You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.0KB

  1. /***************************************************/
  2. /*! \class BeeThree
  3. \brief STK Hammond-oid organ FM synthesis instrument.
  4. This class implements a simple 4 operator
  5. topology, also referred to as algorithm 8 of
  6. the TX81Z.
  7. \code
  8. Algorithm 8 is :
  9. 1 --.
  10. 2 -\|
  11. +-> Out
  12. 3 -/|
  13. 4 --
  14. \endcode
  15. Control Change Numbers:
  16. - Operator 4 (feedback) Gain = 2
  17. - Operator 3 Gain = 4
  18. - LFO Speed = 11
  19. - LFO Depth = 1
  20. - ADSR 2 & 4 Target = 128
  21. The basic Chowning/Stanford FM patent expired
  22. in 1995, but there exist follow-on patents,
  23. mostly assigned to Yamaha. If you are of the
  24. type who should worry about this (making
  25. money) worry away.
  26. by Perry R. Cook and Gary P. Scavone, 1995--2017.
  27. */
  28. /***************************************************/
  29. #include "BeeThree.h"
  30. namespace stk {
  31. BeeThree :: BeeThree( void )
  32. : FM()
  33. {
  34. // Concatenate the STK rawwave path to the rawwave files
  35. for ( unsigned int i=0; i<3; i++ )
  36. waves_[i] = new FileLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), true );
  37. waves_[3] = new FileLoop( (Stk::rawwavePath() + "fwavblnk.raw").c_str(), true );
  38. this->setRatio( 0, 0.999 );
  39. this->setRatio( 1, 1.997 );
  40. this->setRatio( 2, 3.006 );
  41. this->setRatio( 3, 6.009 );
  42. gains_[0] = fmGains_[95];
  43. gains_[1] = fmGains_[95];
  44. gains_[2] = fmGains_[99];
  45. gains_[3] = fmGains_[95];
  46. adsr_[0]->setAllTimes( 0.005, 0.003, 1.0, 0.01 );
  47. adsr_[1]->setAllTimes( 0.005, 0.003, 1.0, 0.01 );
  48. adsr_[2]->setAllTimes( 0.005, 0.003, 1.0, 0.01 );
  49. adsr_[3]->setAllTimes( 0.005, 0.001, 0.4, 0.03 );
  50. twozero_.setGain( 0.1 );
  51. }
  52. BeeThree :: ~BeeThree( void )
  53. {
  54. }
  55. void BeeThree :: noteOn( StkFloat frequency, StkFloat amplitude )
  56. {
  57. gains_[0] = amplitude * fmGains_[95];
  58. gains_[1] = amplitude * fmGains_[95];
  59. gains_[2] = amplitude * fmGains_[99];
  60. gains_[3] = amplitude * fmGains_[95];
  61. this->setFrequency( frequency );
  62. this->keyOn();
  63. }
  64. } // stk namespace