FIR & IIR Filter Designer

Design real digital filters — five IIR prototypes or windowed-sinc FIR — and take complete, runnable C code to your firmware.

top: magnitude response (dB) · bottom: impulse response
Complete implementation — copy into your firmware:

The five IIR prototypes in one sentence each

Butterworth — maximally flat passband, gentle rolloff; the safe default. Chebyshev I — ripples in the passband to buy a steeper edge. Chebyshev II — flat passband, ripples (with true zeros) in the stopband; f₁ is the stopband edge. Elliptic (Cauer) — ripples in both bands; the steepest possible transition for a given order, designed here with genuine Jacobi elliptic functions. Bessel — sacrifices steepness for maximally flat group delay, so pulse shapes survive; the choice for time-domain work.

Each design is factored into second-order sections and mapped through the bilinear transform with the band edge prewarped by . Run the sections as a cascade and watch the pole-zero map: poles hugging the unit circle mean trouble in single precision.

Floating-point vs Q15

The float code is the reference. The Q15 code stores FIR taps as and biquad coefficients in Q14 (range ±2.0 covers the that real filters need), accumulates in int32_t, shifts back once per output and saturates. Two classic traps it already handles for you: the accumulator must be wider than the data (a 63-tap Q15 MAC chain peaks around 21 bits), and saturation must be explicit — integer wrap-around in a feedback filter turns into full-scale oscillation. For deep IIR filters at low ratios, stay in float or move to Q31: Q15 coefficient rounding visibly warps the response below about .