17.01.2013 Views

musicdsp.org source code archive - WSInf

musicdsp.org source code archive - WSInf

musicdsp.org source code archive - WSInf

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Type : LPF 24dB/Oct (click this to go back to the index)<br />

Type : Bessel Lowpass<br />

References : Posted by Christian[AT]savioursofsoul[DOT]de<br />

Notes :<br />

The filter tends to be unsable for low frequencies in the way, that it seems to flutter, but it never explode. At least here it doesn't.<br />

Code :<br />

First calculate the prewarped digital frequency:<br />

K = tan(Pi * Frequency / Samplerate);<br />

K2 = K*K; // speed improvement<br />

Then calc the digital filter coefficients:<br />

A0 = ((((105*K + 105)*K + 45)*K + 10)*K + 1);<br />

A1 = -( ((420*K + 210)*K2 - 20)*K - 4)*t;<br />

A2 = -( (630*K2 - 90)*K2 + 6)*t;<br />

A3 = -( ((420*K - 210)*K2 + 20)*K - 4)*t;<br />

A4 = -((((105*K - 105)*K + 45)*K - 10)*K + 1)*t;<br />

B0 = 105*K2*K2;<br />

B1 = 420*K2*K2;<br />

B2 = 630*K2*K2;<br />

B3 = 420*K2*K2;<br />

B4 = 105*K2*K2;<br />

Per sample calculate:<br />

Output = B0*Input + State0;<br />

State0 = B1*Input + A1/A0*Output + State1;<br />

State1 = B2*Input + A2/A0*Output + State2;<br />

State2 = B3*Input + A3/A0*Output + State3;<br />

State3 = B4*Input + A4/A0*Output;<br />

For high speed substitude A1/A0 with A1' = A1/A0...<br />

Comments<br />

from : Christian@savioursofsoul.de<br />

comment : It turns out, that the filter is only unstable if the coefficient/state precision isn't high enough. Using double instead of single precision<br />

already makes it a lot more stable.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!