Reading
Stories Mode

Windowed-Sinc Method

~14 min read Lesson 2 of Module 7

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:

Ideal Low-Pass Impulse Response
h_{\text{ideal}}[n] = \frac{\omega_c}{\pi}\,\text{sinc}\!\left(\frac{\omega_c n}{\pi}\right) = \frac{\sin(\omega_c n)}{\pi n}
h_ideal[n] is nonzero for all n from −∞ to +∞. It is symmetric about n = 0, reaches its peak of ω_c/π at n = 0, and oscillates with ever-decreasing amplitude in both directions. It is impossible to implement directly.

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:

Windowed-Sinc Coefficients
h[n] = h_{\text{ideal}}[n] \cdot w[n] = \frac{\sin(\omega_c n)}{\pi n} \cdot w[n]
h[n] is the windowed impulse response. For a filter of length N (odd N is preferred for symmetry), n ranges from −(N−1)/2 to +(N−1)/2, then is shifted to be causal by replacing n with n − (N−1)/2.

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:

Step 1
Specify the filter
Choose filter type (low-pass, high-pass, …), cutoff frequency ω_c, filter order M (so length N = M+1), and the acceptable stopband attenuation in dB.
Step 2
Select a window
Based on the required stopband attenuation, pick a window (rectangular, Hann, Hamming, Blackman, or Kaiser). Higher attenuation demands a heavier window and a wider transition band.
Step 3
Compute the sinc
Evaluate h_ideal[n] = sin(ω_c · n) / (π · n) for n = −M/2 to +M/2, with h_ideal[0] = ω_c/π as the limit. This gives M+1 values centred on zero.
Step 4
Apply the window & shift
Multiply element-wise by w[n], then shift the indices so the first coefficient is at n = 0 (making the filter causal). The result is a symmetric, linear-phase FIR filter.

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
Two Different Quantities, One Table

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:

Filter Order Estimate
M \approx \frac{A \cdot 0.9}{\Delta f} \quad (\text{Hamming}), \qquad M \approx \frac{A - 8}{2.285\,\Delta\omega} \quad (\text{Kaiser})
A is the stopband attenuation in dB, Δf is the transition bandwidth as a fraction of the sample rate (i.e., Δω / (2π)), and M is the filter order. Round up to the next odd integer to maintain symmetry.

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.

The Attenuation–Order Trade-off

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:

β formula
Window Shape Parameter
β = 0.1102 · (A − 8.7) for A > 50 dB; β = 0.5842 · (A−21)^0.4 + 0.07886 · (A−21) for 21 ≤ A ≤ 50; β = 0 for A < 21.
Order formula
Filter Length
M = (A − 8) / (2.285 · Δω), where Δω is the transition width in radians. Round up to the next integer (odd if possible).

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:

Audio
Low-Pass / Band-Pass EQ
Linear-phase Hamming or Kaiser FIR filters shape audio frequency content without introducing audible phase distortion — critical for mastering and post-production.
Multirate
Anti-aliasing & Interpolation
Decimation and interpolation filters in sample-rate converters use windowed-sinc designs for predictable stopband suppression of spectral images and aliases.
Communications
Baseband Channel Filters
Receiver baseband filters in SDR and 5G NR baseband chips are windowed-sinc designs — their stopband attenuation prevents adjacent channel interference.
Biomedical
ECG / EEG Band Isolation
Isolating delta, theta, alpha, and beta brainwave bands from EEG uses windowed-sinc band-pass filters — linear phase is essential to preserve waveform timing.
Key Takeaways
  • 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.
Previous What is an FIR Filter? Module Overview Next Filter Types