23 if (cutoff_freq <= 0.0
f || dt <= 0.0
f) {
27 float rc = 1.0f/(
M_2PI*cutoff_freq);
29 _output += (sample - _output) * alpha;
35 _output += (sample - _output) * alpha;
41 if (cutoff_freq <= 0.0
f || sample_freq <= 0.0
f) {
44 float dt = 1.0/sample_freq;
45 float rc = 1.0f/(
M_2PI*cutoff_freq);
89 _filter.compute_alpha(sample_freq, cutoff_freq);
float get_cutoff_freq(void) const
T apply(const T &sample, float cutoff_freq, float dt)
void set_cutoff_frequency(float cutoff_freq)
void compute_alpha(float sample_freq, float cutoff_freq)
A class to implement a low pass filter without losing precision even for int types the downside being...
float constrain_float(const float amt, const float low, const float high)
T apply(T sample, float dt)