43 #ifndef STATEVARIABLE_H_
44 #define STATEVARIABLE_H_
49 #include "mozzi_fixmath.h"
50 #include "mozzi_utils.h"
51 #include "ResonantFilter.h"
83 scale = (
Q0n8)sqrt((
unsigned int)resonance << 8);
99 (AUDIO_RATE_AS_LSHIFT));
131 low += ((f * band) >> 16);
132 int high = (((long)input - low - (((
long)band * q) >> 8)) * scale) >> 8;
133 band += ((f * high) >> 16);
146 low += ((f * band) >> 16);
147 int high = (((long)input - low - (((
long)band * q) >> 8)) * scale) >> 8;
148 band += ((f * high) >> 16);
161 low += ((f * band) >> 16);
162 int high = (((long)input - low - (((
long)band * q) >> 8)) * scale) >> 8;
163 band += ((f * high) >> 16);
176 low += ((f * band) >> 16);
177 int high = (((long)input - low - (((
long)band * q) >> 8)) * scale) >> 8;
178 band += ((f * high) >> 16);
179 int notch = high + low;
State Variable Filter (approximation of Chamberlin version) Informed by pseudocode at http://www....
int next(int input)
Calculate the next sample, given an input signal.
void setCentreFreq(unsigned int centre_freq)
Set the centre or corner frequency of the filter.
void setResonance(Q0n8 resonance)
Set how resonant the filter will be.
StateVariable()
Constructor.
uint8_t Q0n8
unsigned fractional number using 8 fractional bits, represents 0.0 to 0.996
int32_t Q15n16
signed fractional number using 15 integer bits and 16 fractional bits, represents -32767....
#define Q16n16_2PI
2*PI in Q16n16 format
Enables you to instantiate a template based on an integer value.