2
$\begingroup$

Are there any good published approach for designing parametric EQs as FIR filters. The standard techniques discussed in DSP textbooks are frequency-domain-sampling or using Parks-McClellan, which this involves passband, stopband, transition band, etc. This is nice for rejecting a certain portion of the frequency spectrum, or mimicking and existing analog/digital filter. However what if I want to design a filter directly as an FIR filter, for example a peaking/notching/shelving/low-pass/high-pass filter which takes frequency, gain, and bandwidth parameters? Is there a standard technique for designing parametric EQs directly as FIR filters?

$\endgroup$
3
  • $\begingroup$ Are you asking how to convert frequency, gain, bandwidth parameters into pass/stop/transition band parameters? Or about alternatives to Remez/et.al. for FIR kernel generation? $\endgroup$
    – hotpaw2
    Commented Aug 27, 2013 at 17:28
  • $\begingroup$ Why do you want to do this as FIR instead of the usual IIR way? $\endgroup$
    – endolith
    Commented Aug 28, 2013 at 19:57
  • $\begingroup$ I want to do this as an FIR instead of IIR so that I can do an FFT implementation of these filters. The scenario is that I have many user-controllable delays/gains/EQs with a complex signal flow. I know that I can perform the entire operation by doing FFT convolution, but this is less desirable if I don't know ahead of time how long the impulse response should be or what the SNR would be for a frequency-domain sampled version of the same filters. $\endgroup$
    – xaviersjs
    Commented Aug 28, 2013 at 22:24

4 Answers 4

2
$\begingroup$

These filter types are well covered here http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt

However these are all single biquad IIR implementations. To turn this into an FIR, you could simply calculate the impulse response of these filters and window to a finite size with the desired amount of accuracy. Another option is to design the filter as IIR, sample the frequency response and then do any of the many FIR fitting techniques.

In general you will find that FIR filters are not well suited for this and the number of taps required will heavily depend on the relationship between the corner frequency and the sample rate and also on the Q of the filter.

$\endgroup$
5
  • $\begingroup$ I'm not sure this approach makes sense. The potential benefit of using an FIR filter would be the capacity for a linear phase response. By implementing an IIR as an FIR (as you suggest) the result is a compromised phase response in addition to the high tap count of an FIR. I would prefer an approach that starts with a frequency domain specification and transforms it directly into an impulse response. I'm not aware of a neat, standardised way to parameterise this though. $\endgroup$
    – Speedy
    Commented Aug 28, 2013 at 11:01
  • 1
    $\begingroup$ @Speedy: Isn't the frequency response sampling method linear phase? Linear phase response is not desirable for audio EQ, anyway, which is why this is always done with IIR. $\endgroup$
    – endolith
    Commented Aug 28, 2013 at 19:54
  • 1
    $\begingroup$ @endolith I think you're right, under the assumption that a symmetrical impulse response is rebuilt from the IIR response (which would also square the magnitude response). I agree with you about linear phase for equalisation too, although I still believe it has applications in system inversion in the audio path. $\endgroup$
    – Speedy
    Commented Aug 29, 2013 at 8:39
  • 1
    $\begingroup$ @Speedy: What do you mean by system inversion? I've also heard it's good for reducing lobing in speaker crossovers? But generally not a good idea for filtering like EQ $\endgroup$
    – endolith
    Commented Aug 29, 2013 at 14:00
  • 1
    $\begingroup$ @endolith: In systems where group delay is of limited concern you can automatically generate FIRs to flatten magnitude responses (i.e. force speakers into a nicer behaviour). It's particularly good for measurement systems where you're not fussed about the length of your filter. $\endgroup$
    – Speedy
    Commented Aug 29, 2013 at 15:34
1
$\begingroup$

Well to answer my own question, I have found one reference to designing FIR filters on the wonderful page from Julius Smith: https://ccrma.stanford.edu/~jos/filters/Two_Zero.html. (It was naive of me to not check there first). It's not exactly what I was going for, but much closer to a parametric design then using IR or freq-domain sampling of IIR filters.

$\endgroup$
0
$\begingroup$

I would just partition the frequency domain into something like 4 areas and create 4 low order filters so there's some nice smooth overlap between them. That would require you to create 1 lowpass, 1 highpass, and two bandpasss filters where you scale the gain of each filter independently. Run the data through each filter and sum the results. Here's some MATLAB code to illustrate what I'm talking about run on some random data.

x = randn(1,65536);
b1 = fir2(12, [0 0.25 0.5 1], [1 1 0 0]);
b2 = fir2(12, [0 0.24 0.51 1], [0 1 1 0]);
b3 = fir2(12, [0 0.49 0.75 1], [0 1 1 0]);
b4 = fir2(12, [0 0.5 0.75 1], [0 0 1 1]);
g1 = 1.0;
g2 = 0.5;
g3 = 0.2;
g4 = 0.2;
y = g1*filter(b1, 1, x) + g2*filter(b2, 1, x) + ...
    g3*filter(b3, 1, x) + g4*filter(b4, 1, x);
plot(20*log10(abs(fft(y))))
$\endgroup$
-2
$\begingroup$

Matlab's documentation for filter design should have the references you are looking for.

For example fir2 might do it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.