Ohmic Audio Labs Knowledge Base

⚙️ ENGINEER LEVEL: FIR Filter Mathematics

Linear Phase FIR Filter Design

A linear-phase FIR filter of length N has coefficients h[n] that are symmetric:

h[n] = h[N−1−n]

This symmetry forces the phase response to be exactly linear (constant group delay = (N−1)/2 samples).

Frequency response:

H(e^jω) = Σ h[n] × e^(-jωn)    for n = 0 to N-1

For a lowpass filter with cutoff ωc:

Ideal (infinite) impulse response:

h_ideal[n] = ωc/π × sinc(ωc(n − N/2) / π)

Windowing:

Truncating to N samples creates spectral leakage. Apply a window function:

h[n] = h_ideal[n] × w[n]

Window types and performance:

Window Transition BW Sidelobe attenuation
Rectangular Narrowest −13 dB (poor)
Hann Medium −44 dB
Blackman Wide −74 dB
Kaiser (β=10) Wide −100 dB

Parks-McClellan (Equiripple) design:

The optimal equiripple FIR achieves the minimum filter length for a given specification. The filter coefficients are found via the Remez exchange algorithm.

For car audio DSP work: miniDSP Studio allows importing custom FIR coefficients. Design filters in MATLAB, Python (scipy.signal.remez), or free tools like FIR Designer M. Export coefficients as text file, import to DSP.

Filter length vs frequency resolution:

Δf = fs / N    [frequency resolution in Hz]

For 48 kHz sample rate, N = 4096:

Δf = 48000 / 4096 = 11.7 Hz

A 4096-tap FIR resolves frequency features down to 11.7 Hz — more than adequate for audio work.

Latency:

Latency = N / (2 × fs) = 4096 / (2 × 48000) = 42.7 ms

All non-FIR channels must be delayed by this same amount to maintain inter-channel coherence. A system using FIR on some channels and IIR on others must apply 42.7ms of additional IIR delay to the IIR channels.



12.7 Complete DSP Setup Walkthrough — Real-World Example