Filter coefficients.
More...
#include <biquad.hpp>
|
| Coeffs () |
| Default constructor.
|
|
void | setPoleLP (const float pole) |
| Calculate coefficients for single pole low pass filter. More...
|
|
void | setPoleHP (const float pole) |
| Calculate coefficients for single pole high pass filter. More...
|
|
void | setFODC (const float pole) |
| Calculate coefficients for single pole DC filter. More...
|
|
void | setFOLP (const float k) |
| Calculate coefficients for first order low pass filter. More...
|
|
void | setFOHP (const float k) |
| Calculate coefficients for first order high pass filter. More...
|
|
void | setFOAP (const float k) |
| Calculate coefficients for first order all pass filter. More...
|
|
void | setFOAP2 (const float wc) |
| Calculate coefficients for first order all pass filter. More...
|
|
void | setSODC (const float pole) |
| Calculate coefficients for second order DC filter. More...
|
|
void | setSOLP (const float k, const float q) |
| Calculate coefficients for second order low pass filter. More...
|
|
void | setSOHP (const float k, const float q) |
| Calculate coefficients for second order high pass filter. More...
|
|
void | setSOBP (const float k, const float q) |
| Calculate coefficients for second order band pass filter. More...
|
|
void | setSOBR (const float k, const float q) |
| Calculate coefficients for second order band reject filter. More...
|
|
void | setSOAP1 (const float k, const float q) |
| Calculate coefficients for second order all pass filter. More...
|
|
void | setSOAP2 (const float delta, const float gamma) |
| Calculate coefficients for second order all pass filter. More...
|
|
void | setSOAP3 (const float delta, const float radius) |
| Calculate coefficients for second order all pass filter. More...
|
|
|
static float | wc (const float fc, const float fsrecip) |
| Convert Hz frequency to radians. More...
|
|
|
float | ff0 |
|
float | ff1 |
|
float | ff2 |
|
float | fb1 |
|
float | fb2 |
|
Filter coefficients.
Definition at line 65 of file biquad.hpp.
◆ setFOAP()
void dsp::BiQuad::Coeffs::setFOAP |
( |
const float |
k | ) |
|
|
inline |
Calculate coefficients for first order all pass filter.
- Parameters
-
k | Tangent of PI x cutoff frequency in radians: tan(pi*wc) |
Definition at line 168 of file biquad.hpp.
170 const float kp1 = k+1.f;
171 const float km1 = k-1.f;
172 ff0 = fb1 = km1 / kp1;
◆ setFOAP2()
void dsp::BiQuad::Coeffs::setFOAP2 |
( |
const float |
wc | ) |
|
|
inline |
Calculate coefficients for first order all pass filter.
- Parameters
-
wc | cutoff frequency in radians |
- Note
- Alternative implementation with no tangeant lookup
Definition at line 185 of file biquad.hpp.
187 const float g1 = 1.f -
wc;
◆ setFODC()
void dsp::BiQuad::Coeffs::setFODC |
( |
const float |
pole | ) |
|
|
inline |
Calculate coefficients for single pole DC filter.
- Parameters
-
pole | Pole position in radians |
Definition at line 125 of file biquad.hpp.
◆ setFOHP()
void dsp::BiQuad::Coeffs::setFOHP |
( |
const float |
k | ) |
|
|
inline |
Calculate coefficients for first order high pass filter.
- Parameters
-
k | Tangent of PI x cutoff frequency in radians: tan(pi*wc) |
Definition at line 152 of file biquad.hpp.
154 const float kp1 = k+1.f;
155 const float km1 = k-1.f;
◆ setFOLP()
void dsp::BiQuad::Coeffs::setFOLP |
( |
const float |
k | ) |
|
|
inline |
Calculate coefficients for first order low pass filter.
- Parameters
-
k | Tangent of PI x cutoff frequency in radians: tan(pi*wc) |
Definition at line 138 of file biquad.hpp.
139 const float kp1 = k+1.f;
140 const float km1 = k-1.f;
◆ setPoleHP()
void dsp::BiQuad::Coeffs::setPoleHP |
( |
const float |
pole | ) |
|
|
inline |
Calculate coefficients for single pole high pass filter.
- Parameters
-
pole | Pole position in radians |
Definition at line 113 of file biquad.hpp.
116 fb2 = ff2 = ff1 = 0.f;
◆ setPoleLP()
void dsp::BiQuad::Coeffs::setPoleLP |
( |
const float |
pole | ) |
|
|
inline |
Calculate coefficients for single pole low pass filter.
- Parameters
-
pole | Pole position in radians |
Definition at line 101 of file biquad.hpp.
104 fb2 = ff2 = ff1 = 0.f;
◆ setSOAP1()
void dsp::BiQuad::Coeffs::setSOAP1 |
( |
const float |
k, |
|
|
const float |
q |
|
) |
| |
|
inline |
Calculate coefficients for second order all pass filter.
- Parameters
-
k | Tangent of PI x cutoff frequency in radians: tan(pi*wc) |
q | Inverse of relative bandwidth (Fc / Fb) |
Definition at line 286 of file biquad.hpp.
289 const float qk2 = q * k * k;
290 const float qk2_k_q_r = 1.f / (qk2 + k + q);
291 ff0 = fb2 = (qk2 - k + q) * qk2_k_q_r;
292 ff1 = fb1 = 2.f * (qk2 - q) * qk2_k_q_r;
◆ setSOAP2()
void dsp::BiQuad::Coeffs::setSOAP2 |
( |
const float |
delta, |
|
|
const float |
gamma |
|
) |
| |
|
inline |
Calculate coefficients for second order all pass filter.
- Parameters
-
delta | cos(2pi*wc) |
gamma | tan(pi * wb) |
- Note
- q is inverse of relative bandwidth (wc / wb)
-
Alternative implementation, so called "tunable" in DAFX second edition.
Definition at line 306 of file biquad.hpp.
309 const float c = (gamma - 1.f) / (gamma + 1.f);
310 const float d = -delta;
312 ff1 = fb1 = d * (1.f - c);
◆ setSOAP3()
void dsp::BiQuad::Coeffs::setSOAP3 |
( |
const float |
delta, |
|
|
const float |
radius |
|
) |
| |
|
inline |
Calculate coefficients for second order all pass filter.
- Parameters
-
- Note
- Another alternative implementation.
Definition at line 325 of file biquad.hpp.
328 const float a1 = -2.f * radius * delta;
329 const float a2 = radius * radius;
◆ setSOBP()
void dsp::BiQuad::Coeffs::setSOBP |
( |
const float |
k, |
|
|
const float |
q |
|
) |
| |
|
inline |
Calculate coefficients for second order band pass filter.
- Parameters
-
k | Tangent of PI x cutoff frequency in radians: tan(pi*wc) |
q | Resonance with flat response at q = sqrt(2) |
Definition at line 250 of file biquad.hpp.
253 const float qk2 = q * k * k;
254 const float qk2_k_q_r = 1.f / (qk2 + k + q);
258 fb1 = 2.f * (qk2 - q) * qk2_k_q_r;
259 fb2 = (qk2 - k + q) * qk2_k_q_r;
◆ setSOBR()
void dsp::BiQuad::Coeffs::setSOBR |
( |
const float |
k, |
|
|
const float |
q |
|
) |
| |
|
inline |
Calculate coefficients for second order band reject filter.
- Parameters
-
k | Tangent of PI x cutoff frequency in radians: tan(pi*wc) |
q | Resonance with flat response at q = sqrt(2) |
Definition at line 269 of file biquad.hpp.
272 const float qk2 = q * k * k;
273 const float qk2_k_q_r = 1.f / (qk2 + k + q);
274 ff0 = ff2 = (qk2 + q) * qk2_k_q_r;
275 ff1 = fb1 = 2.f * (qk2 - q) * qk2_k_q_r;
276 fb2 = (qk2 - k + q) * qk2_k_q_r;
◆ setSODC()
void dsp::BiQuad::Coeffs::setSODC |
( |
const float |
pole | ) |
|
|
inline |
Calculate coefficients for second order DC filter.
- Parameters
-
pole | Pole position in radians |
Definition at line 200 of file biquad.hpp.
◆ setSOHP()
void dsp::BiQuad::Coeffs::setSOHP |
( |
const float |
k, |
|
|
const float |
q |
|
) |
| |
|
inline |
Calculate coefficients for second order high pass filter.
- Parameters
-
k | Tangent of PI x cutoff frequency in radians: tan(pi*wc) |
q | Resonance with flat response at q = sqrt(2) |
Definition at line 232 of file biquad.hpp.
235 const float qk2 = q * k * k;
236 const float qk2_k_q_r = 1.f / (qk2 + k + q);
237 ff0 = ff2 = q * qk2_k_q_r;
239 fb1 = 2.f * (qk2 - q) * qk2_k_q_r;
240 fb2 = (qk2 - k + q) * qk2_k_q_r;
◆ setSOLP()
void dsp::BiQuad::Coeffs::setSOLP |
( |
const float |
k, |
|
|
const float |
q |
|
) |
| |
|
inline |
Calculate coefficients for second order low pass filter.
- Parameters
-
k | Tangent of PI x cutoff frequency in radians: tan(pi*wc) |
q | Resonance with flat response at q = sqrt(2) |
Definition at line 214 of file biquad.hpp.
217 const float qk2 = q * k * k;
218 const float qk2_k_q_r = 1.f / (qk2 + k + q);
219 ff0 = ff2 = qk2 * qk2_k_q_r;
221 fb1 = 2.f * (qk2 - q) * qk2_k_q_r;
222 fb2 = (qk2 - k + q) * qk2_k_q_r;
◆ wc()
static float dsp::BiQuad::Coeffs::wc |
( |
const float |
fc, |
|
|
const float |
fsrecip |
|
) |
| |
|
inlinestatic |
Convert Hz frequency to radians.
- Parameters
-
fc | Frequency in Hz |
fsrecip | Reciprocal of sampling frequency (1/Fs) |
Definition at line 89 of file biquad.hpp.
The documentation for this struct was generated from the following file:
- /home/etienne/Documents/_projects/logue-sdk/logue-sdk-alt/platform/nutekt-digital/inc/dsp/biquad.hpp