58 Saxofony( StkFloat lowestFrequency );
79 void noteOn( StkFloat frequency, StkFloat amplitude );
82 void noteOff( StkFloat amplitude );
88 StkFloat
tick(
unsigned int channel = 0 );
109 StkFloat outputGain_;
111 StkFloat vibratoGain_;
118 StkFloat pressureDiff;
119 StkFloat breathPressure;
123 breathPressure = envelope_.
tick();
124 breathPressure += breathPressure * noiseGain_ * noise_.
tick();
125 breathPressure += breathPressure * vibratoGain_ * vibrato_.
tick();
127 temp = -0.95 * filter_.
tick( delays_[0].
lastOut() );
128 lastFrame_[0] = temp - delays_[1].
lastOut();
129 pressureDiff = breathPressure - lastFrame_[0];
130 delays_[1].
tick( temp );
131 delays_[0].
tick( breathPressure - (pressureDiff * reedTable_.
tick(pressureDiff)) - temp );
133 lastFrame_[0] *= outputGain_;
134 return lastFrame_[0];
139 unsigned int nChannels = lastFrame_.
channels();
140 #if defined(_STK_DEBUG_) 141 if ( channel > frames.
channels() - nChannels ) {
142 oStream_ <<
"Saxofony::tick(): channel and StkFrames arguments are incompatible!";
147 StkFloat *samples = &frames[channel];
148 unsigned int j, hop = frames.
channels() - nChannels;
149 if ( nChannels == 1 ) {
150 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop )
154 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop ) {
156 for ( j=1; j<nChannels; j++ )
157 *samples++ = lastFrame_[j];
STK faux conical bore reed instrument class.
Definition: Saxofony.h:51
void noteOff(StkFloat amplitude)
Stop a note with the given amplitude (speed of decay).
static void handleError(const char *message, StkError::Type type)
Static function for error reporting and handling using c-strings.
Saxofony(StkFloat lowestFrequency)
Class constructor, taking the lowest desired playing frequency.
void startBlowing(StkFloat amplitude, StkFloat rate)
Apply breath pressure to instrument with given amplitude and rate of increase.
StkFloat tick(void)
Compute and return one output sample.
Definition: Noise.h:59
void noteOn(StkFloat frequency, StkFloat amplitude)
Start a note with the given frequency and amplitude.
void stopBlowing(StkFloat rate)
Decrease breath pressure with given rate of decrease.
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
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
~Saxofony(void)
Class destructor.
The STK namespace.
Definition: ADSR.h:6
STK linear line envelope class.
Definition: Envelope.h:21
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
StkFloat tick(unsigned int channel=0)
Compute and return one output sample.
Definition: Saxofony.h:116
StkFloat tick(StkFloat input)
Input one sample to the filter and return one output.
Definition: DelayL.h:136
void setBlowPosition(StkFloat aPosition)
Set the "blowing" position between the air column terminations (0.0 - 1.0).
STK linear interpolating delay line class.
Definition: DelayL.h:27
void controlChange(int number, StkFloat value)
Perform the control change specified by number and value (0.0 - 128.0).
StkFloat lastOut(unsigned int channel=0)
Return the specified channel value of the last computed frame.
Definition: Instrmnt.h:88
An STK class to handle vectorized audio data.
Definition: Stk.h:272
void setFrequency(StkFloat frequency)
Set instrument parameters for a particular frequency.
STK instrument abstract base class.
Definition: Instrmnt.h:19
StkFloat tick(void)
Compute and return one output sample.
Definition: Envelope.h:88
STK noise generator.
Definition: Noise.h:21
void clear(void)
Reset and clear all internal state.
STK reed table class.
Definition: ReedTable.h:27