45 Clarinet( StkFloat lowestFrequency = 8.0 );
63 void noteOn( StkFloat frequency, StkFloat amplitude );
66 void noteOff( StkFloat amplitude );
72 StkFloat
tick(
unsigned int channel = 0 );
95 StkFloat vibratoGain_;
100 StkFloat pressureDiff;
101 StkFloat breathPressure;
104 breathPressure = envelope_.
tick();
105 breathPressure += breathPressure * noiseGain_ * noise_.
tick();
106 breathPressure += breathPressure * vibratoGain_ * vibrato_.
tick();
109 pressureDiff = -0.95 * filter_.
tick( delayLine_.
lastOut() );
112 pressureDiff = pressureDiff - breathPressure;
115 lastFrame_[0] = delayLine_.
tick(breathPressure + pressureDiff * reedTable_.
tick(pressureDiff));
118 lastFrame_[0] *= outputGain_;
120 return lastFrame_[0];
125 unsigned int nChannels = lastFrame_.
channels();
126 #if defined(_STK_DEBUG_) 127 if ( channel > frames.
channels() - nChannels ) {
128 oStream_ <<
"Clarinet::tick(): channel and StkFrames arguments are incompatible!";
133 StkFloat *samples = &frames[channel];
134 unsigned int j, hop = frames.
channels() - nChannels;
135 if ( nChannels == 1 ) {
136 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop )
140 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop ) {
142 for ( j=1; j<nChannels; j++ )
143 *samples++ = lastFrame_[j];
static void handleError(const char *message, StkError::Type type)
Static function for error reporting and handling using c-strings.
StkFloat tick(void)
Compute and return one output sample.
Definition: Noise.h:59
Clarinet(StkFloat lowestFrequency=8.0)
Class constructor, taking the lowest desired playing frequency.
STK sinusoid oscillator class.
Definition: SineWave.h:25
unsigned int channels(void) const
Return the number of channels represented by the data.
Definition: Stk.h:377
StkFloat tick(StkFloat input)
Take one sample input and map to one sample of output.
Definition: ReedTable.h:81
StkFloat tick(unsigned int channel=0)
Compute and return one output sample.
Definition: Clarinet.h:98
STK one-zero filter class.
Definition: OneZero.h:20
StkFloat tick(StkFloat input)
Input one sample to the filter and return one output.
Definition: OneZero.h:79
The STK namespace.
Definition: ADSR.h:6
STK linear line envelope class.
Definition: Envelope.h:21
void noteOn(StkFloat frequency, StkFloat amplitude)
Start a note with the given frequency and amplitude.
StkFloat tick(void)
Compute and return one output sample.
Definition: SineWave.h:99
unsigned int frames(void) const
Return the number of sample frames represented by the data.
Definition: Stk.h:380
StkFloat lastOut(void) const
Return the last computed output value.
Definition: DelayL.h:76
void clear(void)
Reset and clear all internal state.
void stopBlowing(StkFloat rate)
Decrease breath pressure with given rate of decrease.
StkFloat tick(StkFloat input)
Input one sample to the filter and return one output.
Definition: DelayL.h:136
STK linear interpolating delay line class.
Definition: DelayL.h:27
~Clarinet(void)
Class destructor.
An STK class to handle vectorized audio data.
Definition: Stk.h:272
STK instrument abstract base class.
Definition: Instrmnt.h:19
StkFloat tick(void)
Compute and return one output sample.
Definition: Envelope.h:88
STK clarinet physical model class.
Definition: Clarinet.h:38
STK noise generator.
Definition: Noise.h:21
void controlChange(int number, StkFloat value)
Perform the control change specified by number and value (0.0 - 128.0).
void noteOff(StkFloat amplitude)
Stop a note with the given amplitude (speed of decay).
void startBlowing(StkFloat amplitude, StkFloat rate)
Apply breath pressure to instrument with given amplitude and rate of increase.
STK reed table class.
Definition: ReedTable.h:27
void setFrequency(StkFloat frequency)
Set instrument parameters for a particular frequency.