update biquad (#2201)

This commit is contained in:
Matthew Kennedy 2021-01-08 16:48:56 -08:00 committed by GitHub
parent 99430a2508
commit d0c71d758b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -49,7 +49,6 @@ void Biquad::configureLowpass(float samplingFrequency, float cutoffFrequency, fl
float K = getK(samplingFrequency, cutoffFrequency); float K = getK(samplingFrequency, cutoffFrequency);
float norm = getNorm(K, Q); float norm = getNorm(K, Q);
norm = 1 / (1 + K / Q + K * K);
a0 = K * K * norm; a0 = K * K * norm;
a1 = 2 * a0; a1 = 2 * a0;
a2 = a0; a2 = a0;

View File

@ -17,8 +17,9 @@ public:
void configureBandpass(float samplingFrequency, float centerFrequency, float Q); void configureBandpass(float samplingFrequency, float centerFrequency, float Q);
// Default Q = 1/sqrt(2) = 0.707 gives a maximally flat passband without any overshoot near the cutoff (ie, Butterworth) // Default Q = 0.54, which is the maximum quality factor without time domain overshoot
void configureLowpass(float samplingFrequency, float cutoffFrequency, float Q = 0.707f); // note that it is less than the maximally flat (frequency domain) Q=0.707, which gives some overshoot
void configureLowpass(float samplingFrequency, float cutoffFrequency, float Q = 0.54f);
private: private:
float a0, a1, a2, b1, b2; float a0, a1, a2, b1, b2;