The Ideal Filter and Its Fatal Flaw
Every signal processing textbook begins FIR filter design with the same thought experiment: what would the perfect low-pass filter look like? The answer is mathematically clean — a rectangular frequency response that passes all frequencies below the cutoff ω_c with gain 1 and blocks everything above with gain 0. No ripple, no transition band, instantaneous roll-off.
Taking the inverse DTFT of this ideal brick-wall response, we find the impulse response that corresponds to it. It is the sinc function:
The fatal flaw is immediated apparent: h_ideal[n] is infinite in length and non-causal (it extends to n = −∞). No real system can store or process infinitely many coefficients. We need a strategy to convert this ideal, infinite impulse response into a finite, causal one — without catastrophically degrading the filter's frequency response. That strategy is windowing.
Truncation and the Window Function
The simplest approach to making h_ideal[n] finite is to multiply it by a window function w[n] that equals 1 for a finite range of n and 0 everywhere else. The resulting windowed impulse response is:
The window w[n] smoothly tapers the sinc to zero at its edges rather than cutting it off abruptly. This tapering is crucial: an abrupt rectangular cut creates severe ripple in the frequency response (Gibbs phenomenon), while a smooth taper trades ripple for a wider transition band.
Design Steps
Designing a windowed-sinc FIR filter involves four concrete steps:
Choosing the Right Window
The window function is the primary design knob. Different windows offer different trade-offs between the main-lobe width (which controls transition band width) and the peak side-lobe level (which controls stopband attenuation). Peak side-lobe figures below follow Harris (1978), the same source used in Module 5 — window tables in the literature differ by a decibel or two depending on the reference.
| Window | Peak Side-lobe (dB) | Min Stopband Att. (dB) | Transition Width |
|---|---|---|---|
| Rectangular | −13 | 21 | 0.9/N |
| Hann | −31 | 44 | 3.1/N |
| Hamming | −43 | 53 | 3.3/N |
| Blackman | −58 | 74 | 5.5/N |
| Kaiser (β = 8.6) | −63 | 80+ | Adjustable |
The peak side-lobe column belongs to the window w[n] on its own: it is the tallest ripple in |W(ejω)| relative to the main lobe. The minimum stopband attenuation column belongs to the finished filter, after the window has been multiplied into the ideal sinc, and it is the one the order rules below use. They are not the same number and they are not close.
Kaiser at β = 8.6 is the clearest case. Its peak side lobe measures −63 dB, while the Kaiser design rule β = 0.1102(A − 8.7) inverts to A ≈ 87 dB of stopband attenuation — about 24 dB apart. If you meet a Kaiser side-lobe figure near −70 dB, it is the attenuation column that has leaked into the side-lobe column.
Side lobe = a property of w[n]. Stopband attenuation = a property of the filter you built with it.The Hamming window is the most widely used general-purpose choice: it achieves 53 dB of stopband attenuation — enough for most audio and instrumentation applications — with a modest transition band. When you need more attenuation, step up to Blackman or Kaiser. When the transition band must be as narrow as possible and ripple is acceptable, use the rectangular window.
Selecting Filter Order
For a given window, the filter order M (number of taps = M+1) directly controls the transition bandwidth Δω (in radians per sample). The tighter the transition band, the higher the order required and the more computation per sample. An approximate rule for common windows:
For example, a Hamming-windowed filter (A ≈ 53 dB) with a transition bandwidth of Δf = 0.05 (e.g., 2.4 kHz at 48 kHz sample rate) requires M ≈ 53 · 0.9 / 0.05 = 954, giving 955 taps. This is manageable for offline processing or an overlap-add FFT implementation, but may be too expensive for a tight real-time embedded loop.
You cannot simultaneously achieve narrow transition band and high stopband attenuation with a short filter. To get both, you must increase M. This is the fundamental design trade-off: every additional dB of stopband attenuation or halving of the transition width roughly doubles the filter length.
Better specs → longer filter → more computation. There is no free lunch.The Kaiser Window — Parametric Control
All the windows discussed so far are fixed shapes. The Kaiser window is unique because it is parameterised by a single number β that continuously varies the trade-off between main-lobe width and side-lobe level. Increasing β increases attenuation and widens the transition band; decreasing β does the opposite. At β = 0, the Kaiser window reduces to a rectangular window.
Given a target stopband attenuation A (in dB), the Kaiser window parameter and filter order can be computed analytically:
The Kaiser window is implemented using the modified zeroth-order Bessel function I₀(·), which is available in every scientific computing library. It is the preferred window whenever stopband attenuation requirements are tight or must be precisely met.
Frequency Sampling — An Alternative Design Route
The windowed-sinc method starts from the ideal time-domain impulse response and applies a window. The frequency sampling method takes the opposite route: directly specify the desired frequency response at N equally spaced frequencies, then take the inverse DFT to get the impulse response.
The result is a length-N FIR filter whose frequency response exactly interpolates the specified values at the design frequencies — a compelling property when you need precise control at specific frequencies (e.g., equalizer curves). The drawback is that the frequency response oscillates unpredictably between the design points unless the transition samples are carefully optimised, often by adding a small number of optimised "transition samples" between the passband and stopband frequencies.
Windowed-Sinc in Practice
The windowed-sinc method is the workhorse of FIR filter design. It is used whenever:
- The ideal low-pass filter has a sinc impulse response that is infinite in length and non-causal — it cannot be implemented directly.
- Windowing multiplies the ideal sinc by a finite-length taper to produce a practical FIR filter: h[n] = h_ideal[n] · w[n].
- The four design steps are: specify requirements → choose window → compute sinc → apply window and shift to make causal.
- The window choice sets the trade-off: rectangular offers the narrowest transition band but only 21 dB attenuation; Kaiser is adjustable and can achieve 80+ dB.
- Hamming is the standard general-purpose choice: 53 dB stopband attenuation with a well-controlled transition band.
- Filter order M is inversely proportional to transition bandwidth — cutting Δf in half roughly doubles the number of taps.
- The Kaiser window is parameterised by β and allows analytic calculation of M and β from the stopband specification.
- Frequency sampling is an alternative that directly specifies the frequency response at N points and uses the inverse DFT to find coefficients.