mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 14:30:36 +00:00
added biquad allpass filter
This commit is contained in:
parent
ca7a7ad56f
commit
55048b527b
2 changed files with 17 additions and 0 deletions
|
|
@ -41,6 +41,7 @@ The following [infinite impulse response](https://en.wikipedia.org/wiki/Infinite
|
||||||
* [2n-order Butterworth cascade of second-order low or high pass filters](https://en.wikipedia.org/wiki/Butterworth_filter)
|
* [2n-order Butterworth cascade of second-order low or high pass filters](https://en.wikipedia.org/wiki/Butterworth_filter)
|
||||||
* [second-order notch filter](https://en.wikipedia.org/wiki/Band-stop_filter)
|
* [second-order notch filter](https://en.wikipedia.org/wiki/Band-stop_filter)
|
||||||
* [second-order bandpass filter](https://en.wikipedia.org/wiki/Band-pass_filter)
|
* [second-order bandpass filter](https://en.wikipedia.org/wiki/Band-pass_filter)
|
||||||
|
* [second-order allpass filter](https://en.wikipedia.org/wiki/All-pass_filter)
|
||||||
|
|
||||||
### [blockdc.hh](blockdc.hh)
|
### [blockdc.hh](blockdc.hh)
|
||||||
|
|
||||||
|
|
|
||||||
16
biquad.hh
16
biquad.hh
|
|
@ -86,6 +86,22 @@ public:
|
||||||
a1a0 = a1 / a0;
|
a1a0 = a1 / a0;
|
||||||
a2a0 = a2 / a0;
|
a2a0 = a2 / a0;
|
||||||
}
|
}
|
||||||
|
void allpass(int n, int N, VALUE QdB)
|
||||||
|
{
|
||||||
|
VALUE alpha = UnitCircle<VALUE>::sin(n, N) / (VALUE(2) * idecibel(QdB)),
|
||||||
|
cn = UnitCircle<VALUE>::cos(n, N),
|
||||||
|
b0 = VALUE(1) - alpha,
|
||||||
|
b1 = -VALUE(2) * cn,
|
||||||
|
b2 = VALUE(1) + alpha,
|
||||||
|
a0 = VALUE(1) + alpha,
|
||||||
|
a1 = -VALUE(2) * cn,
|
||||||
|
a2 = VALUE(1) - alpha;
|
||||||
|
b0a0 = b0 / a0;
|
||||||
|
b1a0 = b1 / a0;
|
||||||
|
b2a0 = b2 / a0;
|
||||||
|
a1a0 = a1 / a0;
|
||||||
|
a2a0 = a2 / a0;
|
||||||
|
}
|
||||||
TYPE operator()(TYPE x0)
|
TYPE operator()(TYPE x0)
|
||||||
{
|
{
|
||||||
TYPE y0 = b0a0*x0 + b1a0*x1 + b2a0*x2
|
TYPE y0 = b0a0*x0 + b1a0*x1 + b2a0*x2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue