Audio filter design - how to calculate kernel order from cutoff frequency

I have written a filter design wizzard to go with an audio DSP application, which offers the following FIR windowing functions as kernels: Blackman, Hamming, Hanning, Triangular and Rectangular. It allows low pass and high pass filtering. It works fine, but I just don't know how to calculate an appropriate filter order to give the desired cutoff frequency. I need to know how to calculate this for EACH of the above windowing functions.
Thanks.
Who is Participating?

Commented:

given order, CAN calculate cutoff;
given cutoff,CANNOT calculate order.

why don't you just pre-calc some table of (order, cutoff) value pairs, and then use some sort of interpolation on that data to select order that result into given cutoff ?..

yeah, that's called cheating.
0

Commented:
I don't quite get your question.   IIRC the cutoff frequency of each filter is not a function of the filter order.    The filter order determines the steepness of the dropoff, the maximum attenuation, and the number of artifacts in the rejection band.

0

Commented:
For example, for the same cutoff frequency,  an order 13 filter gives about 40 db attenuation in the stop band, a 26 order one gives about 80db attenuation.
0

Commented:
grg99: perhaps by "cutoff" he mean freakuency, for which attenuation is more than <some-special-value-here> db?
0

Commented:
Maybe!

I suspect there is no simple formula for this.  I'd do a simple binary cut-and-try:  See if order 30 is good enough, if so, try 15, if not try 60, divide and conquer.  The applets I've used do each calculation in less than a second, so time is not a big issue.

0

Commented:
that's virtually the same I have suggested :-P
0

Commented:
You can't really interpolate from tables, as there are all kinds of oscillating cyclic peaks that vary depending on ALL the parameters.  If the curves of attenuation vs poles was monotonically increasing, you'd have a chance, but in general you don't and can't.

it gets even worse with things like Tsybchev filters with nulls, these can get really wild.

0

Author Commented:
Okay thanks. I'll just leave this question up a little while longer.
0

Author Commented:
I am using the term cutoff frequency not to mean the lowest frequency that is attenuated, but the the frequency at which a given amount of attenuation (say 10% of the stopband attenuation) has occurred. That has always been the idea presented in textbooks I have read. But I'm 100% self taught, so forgive me if I sound like I'm out to lunch on this. But changing the filter order CERTAINLY DOES have an effect on which frequency is attenuated by a given amont. (I tested it again just now). I want to know how to work out what order will give provide users with the cutoff they specifiy with a known sampling rate.
0

Commented:
That sounds like my guess. If "order" is an only varying parameter, use my suggestion, if no, grg99 way would be easier (you don't want to mess with multidimensional interpolation just to find your cutoff).
0

Commented:
Ok, we have a problem with terminoligy.

Thee are two different parameters mixed up here:

#1 is the "cutoff frequency", which is usually specified as the point where the response is down to half power (.707 voltage).

#2 is the "attenuation slope", which is usually characterized as so many db per octave.

Most of the design equations are set up so that #1 doesnt change with filter order, but of course #2 does.

As noted before, there's probably no simple formula for this, if there was, it would be easier to design filters without all the fancy math and iteration.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.