State Variable Filter (approximation of Chamberlin version) Informed by pseudocode at http://www.musicdsp.org/showone.php?id=23 and. More...
#include <StateVariable.h>
State Variable Filter (approximation of Chamberlin version) Informed by pseudocode at http://www.musicdsp.org/showone.php?id=23 and.
cutoff = cutoff freq in Hz fs = sampling frequency //(e.g. 44100Hz) f = 2 sin (pi * cutoff / fs) //[approximately] q = resonance/bandwidth [0 < q <= 1] most res: q=1, less: q=0 low = lowpass output high = highpass output band = bandpass output notch = notch output
scale = q
low=high=band=0;
–beginloop low = low + f * band; high = scale * input - low - q*band; band = f * high + band; notch = high + low;
References : Hal Chamberlin, Musical Applications of Microprocessors, 2nd Ed, Hayden Book Company 1985. pp 490-492. Jon Dattorro, Effect Design Part 1, J. Audio Eng. Soc., Vol 45, No. 9, 1997 September A State Variable filter which offers 12db resonant low, high, bandpass and notch modes.
FILTER_TYPE | choose between LOWPASS, BANDPASS, HIGHPASS and NOTCH. |
Definition at line 65 of file StateVariable.h.
Public Member Functions | |
StateVariable () | |
Constructor. | |
void | setResonance (Q0n8 resonance) |
Set how resonant the filter will be. More... | |
void | setCentreFreq (unsigned int centre_freq) |
Set the centre or corner frequency of the filter. More... | |
int | next (int input) |
Calculate the next sample, given an input signal. More... | |
|
inline |
Calculate the next sample, given an input signal.
input | the signal input. |
Definition at line 112 of file StateVariable.h.
|
inline |
Set the centre or corner frequency of the filter.
centre_freq | 20 - 4096 Hz (MOZZI_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. |
Definition at line 94 of file StateVariable.h.
|
inline |
Set how resonant the filter will be.
resonance | a byte 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. |
Definition at line 79 of file StateVariable.h.