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