FIR Filter Design Back
Digital Signal Processing Simulator

FIR Filter Design Simulator — Window Method

Design a linear-phase FIR low-pass filter by multiplying the ideal sinc impulse response with windows such as Hamming or Blackman. Adjust tap count and cutoff to visualize impulse and dB magnitude response in real time.

Parameters
Cutoff frequency f_c
Hz
Sampling frequency f_s
Hz
Filter order M
order
Window function
Results
Tap count N
Transition width Δf
Stopband attenuation
Group delay τ_d
Impulse response h[n] and window
Magnitude response |H(f)| [dB]
Theory & Key Formulas

Ideal low-pass impulse response (sinc) multiplied by a window gives the FIR coefficients:

$$h_d[n] = \dfrac{2 f_c}{f_s}\,\mathrm{sinc}\!\left(\dfrac{2 f_c}{f_s}\left(n - \dfrac{M}{2}\right)\right),\quad h[n] = h_d[n]\,w[n]$$

Tap count, transition width and group delay:

$$N = M+1,\quad \Delta f \approx \dfrac{A \, f_s}{M},\quad \tau_d = \dfrac{M}{2 f_s}$$

$A$ depends on the window (Rectangular 0.9, Hann 3.1, Hamming 3.3, Blackman 5.5). Typical stopband attenuation: Rectangular -21 dB, Hann -44 dB, Hamming -53 dB, Blackman -74 dB.

What is FIR filter design by the window method?

🙋
Why do we have to multiply by a window? Why not just use the sinc?
🎓
An ideal rectangular spectrum has an infinite sinc as its impulse response. We can't realize an infinite FIR, so we truncate. But the abrupt cut at both ends creates Gibbs ringing both in the passband and the stopband. A window tapers the sinc smoothly to zero so the truncation is "soft".
🙋
So Hamming, Hann, Blackman and so on are just different "smoothing shapes"?
🎓
Exactly. Rectangular (no taper) only reaches about -21 dB stopband attenuation. Hamming drops the ends to 0.08 and gets -53 dB. Blackman adds a second cosine and reaches -74 dB. The deeper the attenuation, the wider the transition band — that's the fundamental trade-off.
🙋
If I just keep raising the tap count, do I get sharper and deeper?
🎓
Transition width shrinks as 1/M, but the group delay τ_d = M/(2·f_s) grows in the same proportion. In real-time control or audio, you have to set M from the maximum tolerable latency, not from steepness alone. Move the sliders and watch both effects together.
🙋
Where do engineers actually use these filters?
🎓
Anywhere you need linear phase: ECG and EEG processing, digital audio crossovers, matched filters in wireless comms, image edge processing. When phase distortion would change the waveform shape, FIR is almost always preferred over IIR.

Physical model and key equations

The ideal "brick-wall" low-pass spectrum $H_d(f) = 1$ for $|f| \le f_c$ and $0$ otherwise has the infinite sinc as its inverse DTFT.

$$h_d[n] = \dfrac{2 f_c}{f_s}\,\mathrm{sinc}\!\left(\dfrac{2 f_c}{f_s}\left(n - \dfrac{M}{2}\right)\right)$$

Truncate to $0 \le n \le M$ and multiply by a window $w[n]$ to obtain the FIR coefficients $h[n] = h_d[n]\,w[n]$. The Hamming window is

$$w_{\rm Hamming}[n] = 0.54 - 0.46\cos\!\left(\dfrac{2\pi n}{M}\right),\quad 0 \le n \le M$$

The transition width is $\Delta f \approx A\,f_s/M$ with a window-specific factor ($A \approx 3.3$ for Hamming). Symmetric coefficients $h[n] = h[M-n]$ ensure exact linear phase with constant group delay $\tau_d = M/(2 f_s)$.

Real-world applications

Digital audio: Linear-phase FIR loudspeaker crossovers and anti-imaging filters in DAC oversampling chains preserve transients and stereo image without phase smearing.

Wireless pulse shaping: Root-raised-cosine FIR filters at the transmitter and receiver minimise inter-symbol interference and act as matched filters in PSK and QAM links.

Sensors and biomedical: ECG, EEG and inertial signals use FIR low-pass after anti-aliasing to extract slow components and suppress muscle or line noise without distorting peak shapes.

Image processing: Gaussian blur, sharpening kernels and steerable edge filters are 2D FIR. Separable kernels reduce a 2D filter to two 1D FIR passes, slashing computation.

Common misconceptions and caveats

Myth 1: any spec can be met by picking the right window. The window method ties stopband attenuation to the window itself (Hamming gives roughly -53 dB). For tight specs you need equiripple design (Parks-McClellan / Remez).

Myth 2: doubling M doubles the sharpness for free. Δf scales as 1/M but the group delay τ_d = M/(2·f_s) scales linearly with M. If latency matters, minimise M with Parks-McClellan or switch to an IIR.

Myth 3: FIR is always slower than IIR. An FIR usually needs more taps for the same spec, but symmetry halves the multipliers, and long filters can run as FFT-based convolution at O(N log N). SIMD and GPU implementations favour FIR.

FAQ

An even M (so N = M+1 is odd) gives a center tap and well-behaved DC gain. Type-I filters with an even M are the safest default for low-pass; odd M forces a zero at f_s/2 which is fine for high-pass but unwanted otherwise.
The simplest path is to raise M (with the matching latency penalty). Otherwise switch to the Kaiser window with adjustable β, or to an equiripple Parks-McClellan / Remez design that meets stopband attenuation and Δf jointly.
Direct-form FIR needs (M+1) multiply-adds per output sample; symmetric coefficients halve that. Long filters can run as overlap-add or overlap-save FFT convolution at O(N log N), and map well to SIMD or DSP MAC arrays.
Yes. High-pass = all-pass minus low-pass, band-pass = difference of two ideal low-pass impulse responses, and band-stop = all-pass minus band-pass. Apply the same window to the constructed h_d[n].