I have been designing and using IIR filters to process audio for a while now but want to design some FIR filters for delay equalization. I have done some preliminary work using the following approach:

  1. I start with a desired "group delay EQ" curve. This starts at zero, and then has increasing delay at higher (audio) frequencies.

  2. I calculate the corresponding phase lag by integrating, using the definition of group delay. This is still on the audio log-frequency grid.

  3. In the next step, I interpolate the phase onto the equal-linear-spacing frequency grid that will be used for the discrete transform processing. I use 32768 samples for this step.

  4. I then generate the real and imaginary components of the complex number that results for this phase angle, with the magnitude of the response equal to 1.0. I make sure that H(k) = H*(N-k).

  5. I take the inverse DFT of the real and imaginary components to transform the response to the time domain. Although the output produces both a real and an imaginary component the imaginary component is essentially zero. The impulse is present in both short positive and negative times (at the beginning and end of the data set) but only spans about 20% of the full data set.

  6. I set the imaginary component values all to zero. I manipulate the real component of the time domain response (the impulse), shifting it "to the right" to move the part of the impulse that is at small negative times (at the "end") to positive time. I then apply a rectangular window to the data, setting everything outside the window to zero. From what I understand, the remaining non-zero values are the FIR filter coefficients.

  7. To find out what the filter response will look like I perform the forward DFT on the shifted, windowed impulse to bring the data back into the frequency domain. I then calculate and plot the filter magnitude (SPL), the phase, and finally the group delay.

The above procedure seems to give me the FIR filter response that I want to achieve. I can see the tradeoffs in the frequency domain when I set fewer or more taps to zero. So my approach seems to be working. Now on to the implementation and questions:

Because I am new to FIR filtering, I am confused about the data sample rate and number of coefficients calculated above and how that factors in when I want to implement the FIR filter. I may either write my own code or use some existing code or package to perform the correlation between filter and audio data stream.


A. How will the number of bins that I use in the inverse DFT (step 5 above) influence the resulting filter? Will using more bins help to fit sharper features and vice versa? Is the number of bins usually optimized when designing a filter to keep the calculation overhead low when the filter is implemented?

B. I performed all the steps above assuming a sample rate of 48kHz. The only time that the sample rate came into play was when I calculated the frequencies of each bin (e.g., df) for the iDFT and DFT calculations. Given my final set of non-zero filter coefficients (obtained in step 6 above) is the filter simply (naively) calculated as y(n) = SUM_over_m[h(m)*x(n-m)] where 'x' is a sample in my audio data stream at the same 48kHz sample rate? That seems too easy/simple... (I understand that a practical FIR filter implementation would not carry out the calculations in this way, but would use FFT, etc.)

What really puzzles me is this: any number of coefficients can be set to zero to approximate the filter, yet you may vary the number of bins in the iDFT/DFT operations (change resolution) and then truncate the resulting filters to the same number of taps. Is it correct that the coefficients would be different even if they are the same in number, and that the coefficient values are the only thing that is "encoding" the sample rate used in the filter design and the resolution that was chosen???

Please help me understand these concepts a little more clearly. Thanks!

  • $\begingroup$ Did you see this question? It would seem like a good place to start. $\endgroup$ Oct 31, 2015 at 13:27

1 Answer 1


I'm unable to visualize the real-valued inverse-DFT FIR filter coefficients you describe in your Step 5. But no matter. My answer for A: When you use a large number of DFT bins to yield fine granularity of your frequency-domain representation of your desired frequency response, the greater will be the number of nonzero coefficients remaining after you window the output of your inverse DFT. And the larger the number of nonzero coefficients, the greater will be the number of filter computations needed per filter input sample. Only you can decide how many multiplications and additions you're willing to perform per filter input sample. By the way, I'm wondering how many nonzero coefficients you're contemplating at this time.

My answer for B: I'm not sure what the asterisk symbol means in your y(n) = SUM_over_m[h(m)*x(n-m)] expression. In any case, you typically implement your FIR filter by convolving your filter's input sequence with your filter's nonzero coefficients. If your have 100 nonzero coefficients then you must perform 100 multiplies and 99 additions per filter input sample. (Depending on your computing hardware, there may be a way to reduce the number of multiplies per input sample to 50. Ask me how.) Now if you have many hundreds of nonzero coefficients then in that case, yes, you'll use what's called the "fast convolution" filtering method which involves both forward- and inverse-DFTs. But CA Charlie, all of this discussion depends on whether your filtering is "real-time" of "offline." As for the 48 kHz data rate, it affects two things: (1) it means your input signal's spectrum can contain no spectral components greater than 48/2 = 24 kHz; and (2) in a real-time implementation you must perform all your "per sample" filtering computations in less than 1/48,000th of a second. (Sorry CA Charlie, I don't understand the question in your final paragraph.)


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.