42 Brass( StkFloat lowestFrequency = 8.0 );
54 void setLip( StkFloat frequency );
63 void noteOn( StkFloat frequency, StkFloat amplitude );
66 void noteOff( StkFloat amplitude );
72 StkFloat
tick(
unsigned int channel = 0 );
93 StkFloat slideTarget_;
94 StkFloat vibratoGain_;
95 StkFloat maxPressure_;
101 StkFloat breathPressure = maxPressure_ * adsr_.
tick();
102 breathPressure += vibratoGain_ * vibrato_.
tick();
104 StkFloat mouthPressure = 0.3 * breathPressure;
105 StkFloat borePressure = 0.85 * delayLine_.
lastOut();
106 StkFloat deltaPressure = mouthPressure - borePressure;
107 deltaPressure = lipFilter_.
tick( deltaPressure );
108 deltaPressure *= deltaPressure;
109 if ( deltaPressure > 1.0 ) deltaPressure = 1.0;
112 lastFrame_[0] = deltaPressure * mouthPressure + ( 1.0 - deltaPressure) * borePressure;
113 lastFrame_[0] = delayLine_.
tick( dcBlock_.
tick( lastFrame_[0] ) );
115 return lastFrame_[0];
120 unsigned int nChannels = lastFrame_.
channels();
121 #if defined(_STK_DEBUG_) 122 if ( channel > frames.
channels() - nChannels ) {
123 oStream_ <<
"Brass::tick(): channel and StkFrames arguments are incompatible!";
128 StkFloat *samples = &frames[channel];
129 unsigned int j, hop = frames.
channels() - nChannels;
130 if ( nChannels == 1 ) {
131 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop )
135 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop ) {
137 for ( j=1; j<nChannels; j++ )
138 *samples++ = lastFrame_[j];
static void handleError(const char *message, StkError::Type type)
Static function for error reporting and handling using c-strings.
void clear()
Reset and clear all internal state.
StkFloat tick(StkFloat input)
Input one sample to the filter and return one output.
Definition: PoleZero.h:79
STK simple brass instrument class.
Definition: Brass.h:35
unsigned int frames(void) const
Return the number of sample frames represented by the data.
Definition: Stk.h:380
StkFloat tick(StkFloat input)
Input one sample to the filter and return one output.
Definition: DelayA.h:137
STK sinusoid oscillator class.
Definition: SineWave.h:25
~Brass()
Class destructor.
The STK namespace.
Definition: ADSR.h:6
StkFloat tick(void)
Compute and return one output sample.
Definition: SineWave.h:99
Brass(StkFloat lowestFrequency=8.0)
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.
void setLip(StkFloat frequency)
Set the lips frequency.
STK allpass interpolating delay line class.
Definition: DelayA.h:28
void setFrequency(StkFloat frequency)
Set instrument parameters for a particular frequency.
unsigned int channels(void) const
Return the number of channels represented by the data.
Definition: Stk.h:377
STK biquad (two-pole, two-zero) filter class.
Definition: BiQuad.h:20
StkFloat tick(unsigned int channel=0)
Compute and return one output sample.
Definition: Brass.h:99
void noteOff(StkFloat amplitude)
Stop a note with the given amplitude (speed of decay).
STK ADSR envelope class.
Definition: ADSR.h:24
An STK class to handle vectorized audio data.
Definition: Stk.h:272
void controlChange(int number, StkFloat value)
Perform the control change specified by number and value (0.0 - 128.0).
STK one-pole, one-zero filter class.
Definition: PoleZero.h:21
void stopBlowing(StkFloat rate)
Decrease breath pressure with given rate of decrease.
STK instrument abstract base class.
Definition: Instrmnt.h:19
StkFloat tick(void)
Compute and return one output sample.
Definition: ADSR.h:115
StkFloat lastOut(void) const
Return the last computed output value.
Definition: DelayA.h:80
void noteOn(StkFloat frequency, StkFloat amplitude)
Start a note with the given frequency and amplitude.
StkFloat tick(StkFloat input)
Input one sample to the filter and return a reference to one output.
Definition: BiQuad.h:119