Key Questions to Ask When Ordering filter working

08 Apr.,2024

 

$\begingroup$

my experience in audio is that for IIR filters, there is usually a cascaded Second-order Section (SOS) for every little feature (a bump or an edge in the frequency response deliberately placed there by the user). often just a single second-order IIR is used for many little jobs where some frequency is given a little boost or cut. we call those IIR filters a Parametric Equalizer.

however, for a fixed and sharp feature (like a brickwall of some sort), then the order of the IIR filter will be related to the sharpeness of that feature. for a brickwall, there is a 6 dB per octave of steepness in the wall for every integer order of the filter.

for FIR, Fat's answer is good. the order of the filter is 1 less than the number of taps of the FIR. the minimum order again is related to the sharpness of some particular feature in the frequency response. there are a couple of heuristic formula for initial guessing at what order you will need. i will try to express them in a way to compare apples-to-apples.

using a Kaiser-windowed FIR design the filter order (one less than the number of taps) is about:

$$ N \ge \frac{(A-7.95)F_\text{s}}{14.357 \cdot \Delta f} $$

where $A$ is the amount of attenuation in dB of the brickwall, $\Delta f$ is the frequency width of the transition between the nominally un-attenuated and attenuated portions of the frequency response, and $F_\text{s}$ is the sample rate.

using Parks-McClellan will reduce $N$ a bit:

$$ N \ge \frac{(\tfrac12 A + \frac{4.343}{r_\text{p}} - 29.7)F_\text{s}}{14.602 \cdot \Delta f} $$

where the new symbol $r_\text{p}$ is the passband ripple in dB.

this appears to be twice as good as i was expecting. so i am not sure i did this right, but i was being very careful with the equations from O&S about the P-McC alg.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Pick a username
Email Address
Password

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key Questions to Ask When Ordering filter working

[OrderingFilter] Question / Feature request: Allow to specify arbitrary Django ORM expression for ordering · Issue #1021 · carltongibson/django-filter