An IIR filter that can perform low, band and high-pass filtering on an audio signal, with 12 dB of attenuation per octave, using a TPT structure, designed for fast modulation (see Vadim Zavalishin's documentation about TPT structures for more information). More...
#include <juce_StateVariableTPTFilter.h>
Public Types | |
using | Type = StateVariableTPTFilterType |
Public Member Functions | |
StateVariableTPTFilter () | |
Constructor. | |
void | setType (Type newType) |
Sets the filter type. | |
void | setCutoffFrequency (SampleType newFrequencyHz) |
Sets the cutoff frequency of the filter. | |
void | setResonance (SampleType newResonance) |
Sets the resonance of the filter. | |
Type | getType () const noexcept |
Returns the type of the filter. | |
SampleType | getCutoffFrequency () const noexcept |
Returns the cutoff frequency of the filter. | |
SampleType | getResonance () const noexcept |
Returns the resonance of the filter. | |
void | prepare (const ProcessSpec &spec) |
Initialises the filter. | |
void | reset () |
Resets the internal state variables of the filter. | |
void | reset (SampleType newValue) |
Resets the internal state variables of the filter to a given value. | |
void | snapToZero () noexcept |
Ensure that the state variables are rounded to zero if the state variables are denormals. | |
template<typename ProcessContext > | |
void | process (const ProcessContext &context) noexcept |
Processes the input and output samples supplied in the processing context. | |
SampleType | processSample (int channel, SampleType inputValue) |
Processes one sample at a time on a given channel. | |
An IIR filter that can perform low, band and high-pass filtering on an audio signal, with 12 dB of attenuation per octave, using a TPT structure, designed for fast modulation (see Vadim Zavalishin's documentation about TPT structures for more information).
Its behaviour is based on the analog state variable filter circuit.
Note: The bandpass here is not the one in the RBJ CookBook as its gain can be higher than 0 dB. For the classic 0 dB bandpass, we need to multiply the result by R2.
Note 2: Using this class prevents some loud audio artefacts commonly encountered when changing the cutoff frequency using other filter simulation structures and IIR filter classes. However, this class may still require additional smoothing for cutoff frequency changes.
see IIRFilter, SmoothedValue
using dsp::StateVariableTPTFilter< SampleType >::Type = StateVariableTPTFilterType |
dsp::StateVariableTPTFilter< SampleType >::StateVariableTPTFilter | ( | ) |
Constructor.
void dsp::StateVariableTPTFilter< SampleType >::setType | ( | Type | newType | ) |
Sets the filter type.
void dsp::StateVariableTPTFilter< SampleType >::setCutoffFrequency | ( | SampleType | newFrequencyHz | ) |
Sets the cutoff frequency of the filter.
newFrequencyHz | the new cutoff frequency in Hz. |
void dsp::StateVariableTPTFilter< SampleType >::setResonance | ( | SampleType | newResonance | ) |
Sets the resonance of the filter.
Note: The bandwidth of the resonance increases with the value of the parameter. To have a standard 12 dB / octave filter, the value must be set at 1 / sqrt (2).
|
noexcept |
Returns the type of the filter.
|
noexcept |
Returns the cutoff frequency of the filter.
|
noexcept |
Returns the resonance of the filter.
void dsp::StateVariableTPTFilter< SampleType >::prepare | ( | const ProcessSpec & | spec | ) |
Initialises the filter.
void dsp::StateVariableTPTFilter< SampleType >::reset | ( | ) |
Resets the internal state variables of the filter.
void dsp::StateVariableTPTFilter< SampleType >::reset | ( | SampleType | newValue | ) |
Resets the internal state variables of the filter to a given value.
|
noexcept |
Ensure that the state variables are rounded to zero if the state variables are denormals.
This is only needed if you are doing sample by sample processing.
Referenced by dsp::StateVariableTPTFilter< SampleType >::process().
|
noexcept |
Processes the input and output samples supplied in the processing context.
References jassert, dsp::StateVariableTPTFilter< SampleType >::processSample(), and dsp::StateVariableTPTFilter< SampleType >::snapToZero().
SampleType dsp::StateVariableTPTFilter< SampleType >::processSample | ( | int | channel, |
SampleType | inputValue ) |
Processes one sample at a time on a given channel.
Referenced by dsp::StateVariableTPTFilter< SampleType >::process().