Debian Codegraph @

lib-src/libnyquist/nyquist/nyqstk/include/Clarinet.h

raw
1 /***************************************************/
2 /*! \class Clarinet
3 \brief STK clarinet physical model class.
4
5 This class implements a simple clarinet
6 physical model, as discussed by Smith (1986),
7 McIntyre, Schumacher, Woodhouse (1983), and
8 others.
9
10 This is a digital waveguide model, making its
11 use possibly subject to patents held by Stanford
12 University, Yamaha, and others.
13
14 Control Change Numbers:
15 - Reed Stiffness = 2
16 - Noise Gain = 4
17 - Vibrato Frequency = 11
18 - Vibrato Gain = 1
19 - Breath Pressure = 128
20
21 by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
22 */
23 /***************************************************/
24
25 #ifndef STK_CLARINET_H
26 #define STK_CLARINET_H
27
28 #include "Instrmnt.h"
29 #include "DelayL.h"
30 #include "ReedTable.h"
31 #include "OneZero.h"
32 #include "Envelope.h"
33 #include "Noise.h"
34 #include "SineWave.h"
35
36 namespace Nyq
37 {
38
39 class Clarinet : public Instrmnt
40 {
41 public:
42 //! Class constructor, taking the lowest desired playing frequency.
43 /*!
44 An StkError will be thrown if the rawwave path is incorrectly set.
45 */
46 Clarinet(StkFloat lowestFrequency);
47
48 //! Class destructor.
49 ~Clarinet();
50
51 //! Reset and clear all internal state.
52 void clear();
53
54 //! Set instrument parameters for a particular frequency.
55 void setFrequency(StkFloat frequency);
56
57 //! Apply breath pressure to instrument with given amplitude and rate of increase.
58 void startBlowing(StkFloat amplitude, StkFloat rate);
59
60 //! Decrease breath pressure with given rate of decrease.
61 void stopBlowing(StkFloat rate);
62
63 //! Start a note with the given frequency and amplitude.
64 void noteOn(StkFloat frequency, StkFloat amplitude);
65
66 //! Stop a note with the given amplitude (speed of decay).
67 void noteOff(StkFloat amplitude);
68
69 //! Perform the control change specified by \e number and \e value (0.0 - 128.0).
70 void controlChange(int number, StkFloat value);
71
72 protected:
73
74 StkFloat computeSample( void );
75
76 DelayL delayLine_;
77 ReedTable reedTable_;
78 OneZero filter_;
79 Envelope envelope_;
80 Noise noise_;
81 SineWave vibrato_;
82 long length_;
83 StkFloat outputGain_;
84 StkFloat noiseGain_;
85 StkFloat vibratoGain_;
86
87 };
88
89 } // namespace Nyq
90
91 #endif