A State Variable filter which offers 12db resonant low, high, bandpass and notch modes.
More...
#include <StateVariable.h>
template<int8_t FILTER_TYPE>
class StateVariable< FILTER_TYPE >
A State Variable filter which offers 12db resonant low, high, bandpass and notch modes.
- Template Parameters
-
FILTER_TYPE | choose between LOWPASS, BANDPASS, HIGHPASS and NOTCH. |
- Note
- To save processing time, this version of the filter does not saturate internally, so any resonant peaks are unceremoniously truncated. It may be worth adding code to constrain the internal variables to enable resonant saturating effects.
Definition at line 65 of file StateVariable.h.
§ next()
template<int8_t FILTER_TYPE>
Calculate the next sample, given an input signal.
- Parameters
-
- Returns
- the signal output.
- Note
- Timing: 16 - 20 us
Definition at line 122 of file StateVariable.h.
§ setCentreFreq()
template<int8_t FILTER_TYPE>
void StateVariable< FILTER_TYPE >::setCentreFreq |
( |
unsigned int |
centre_freq | ) |
|
|
inline |
Set the centre or corner frequency of the filter.
- Parameters
-
centre_freq | 20 - 4096 Hz (AUDIO_RATE/4). This will be the cut-off frequency for LOWPASS and HIGHPASS, and the centre frequency to pass or reduce for BANDPASS and NOTCH. |
- Note
- Timing 25-30us
-
The frequency calculation is VERY "approximate". This really needs to be fixed.
Definition at line 105 of file StateVariable.h.
§ setResonance()
template<int8_t FILTER_TYPE>
Set how resonant the filter will be.
- Parameters
-
resonance | a uint8_t value between 1 and 255. The lower this value is, the more resonant the filter. At very low values, the filter can output loud peaks which can exceed Mozzi's output range, so you may need to attenuate the output in your sketch. |
- Note
- Timing < 500 ns
Definition at line 86 of file StateVariable.h.