1 /***************************************************/ 2 /*! \class Bowed 3 \brief STK bowed string instrument class. 4 5 This class implements a bowed string model, a 6 la Smith (1986), after McIntyre, Schumacher, 7 Woodhouse (1983). 8 9 This is a digital waveguide model, making its 10 use possibly subject to patents held by 11 Stanford University, Yamaha, and others. 12 13 Control Change Numbers: 14 - Bow Pressure = 2 15 - Bow Position = 4 16 - Vibrato Frequency = 11 17 - Vibrato Gain = 1 18 - Volume = 128 19 20 by Perry R. Cook and Gary P. Scavone, 1995 - 2005. 21 */ 22 /***************************************************/ 23 24 #ifndef STK_BOWED_H 25 #define STK_BOWED_H 26 27 #include "Instrmnt.h" 28 #include "DelayL.h" 29 #include "BowTable.h" 30 #include "OnePole.h" 31 #include "BiQuad.h" 32 #include "SineWave.h" 33 #include "ADSR.h" 34 35 namespace Nyq 36 { 37 38 class Bowed : public Instrmnt 39 { 40 public: 41 //! Class constructor, taking the lowest desired playing frequency. 42 Bowed(StkFloat lowestFrequency); 43 44 //! Class destructor. 45 ~Bowed(); 46 47 //! Reset and clear all internal state. 48 void clear(); 49 50 //! Set instrument parameters for a particular frequency. 51 void setFrequency(StkFloat frequency); 52 53 //! Set vibrato gain. 54 void setVibrato(StkFloat gain); 55 56 //! Apply breath pressure to instrument with given amplitude and rate of increase. 57 void startBowing(StkFloat amplitude, StkFloat rate); 58 59 //! Decrease breath pressure with given rate of decrease. 60 void stopBowing(StkFloat rate); 61 62 //! Start a note with the given frequency and amplitude. 63 void noteOn(StkFloat frequency, StkFloat amplitude); 64 65 //! Stop a note with the given amplitude (speed of decay). 66 void noteOff(StkFloat amplitude); 67 68 //! Perform the control change specified by \e number and \e value (0.0 - 128.0). 69 void controlChange(int number, StkFloat value); 70 71 protected: 72 73 StkFloat computeSample( void ); 74 75 DelayL neckDelay_; 76 DelayL bridgeDelay_; 77 BowTable bowTable_; 78 OnePole stringFilter_; 79 BiQuad bodyFilter_; 80 SineWave vibrato_; 81 ADSR adsr_; 82 StkFloat maxVelocity_; 83 StkFloat baseDelay_; 84 StkFloat vibratoGain_; 85 StkFloat betaRatio_; 86 87 }; 88 89 } // namespace Nyq 90 91 #endif 92