DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
FIRFilter.h File Reference

FIR (Finite Impulse Response) filter with windowed-sinc coefficient design. More...

#include "AudioBuffer.h"
#include "SimdOps.h"
#include "WindowFunctions.h"
#include <algorithm>
#include <atomic>
#include <cassert>
#include <cmath>
#include <numbers>
#include <span>
#include <vector>
Include dependency graph for FIRFilter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  dspark::FIRDesign< T >
 Static methods for designing FIR filter coefficients. More...
 
class  dspark::FIRFilter< T >
 FIR filter using direct-form convolution with a mirrored delay line. More...
 

Namespaces

namespace  dspark
 Main namespace for the DSPark framework.
 

Detailed Description

FIR (Finite Impulse Response) filter with windowed-sinc coefficient design.

FIR filters provide linear phase response – they do not distort the phase of the signal. This makes them essential for:

  • Mastering-grade equalisation
  • Linear-phase crossovers
  • Sample rate conversion (anti-aliasing)
  • Any application where phase accuracy matters

Trade-offs vs IIR (Biquad):

IIR (Biquad) FIR
Phase Non-linear Linear (symmetric)
Efficiency Very few coefficients Many coefficients needed
Latency Minimal N/2 samples
Stability Always stable Always stable

For short FIR filters (<= ~256 taps), direct convolution is used via the FIRFilter class, which features a lock-free ping-pong coefficient publish for safe real-time updates and SIMD (simd::dotProduct) convolution.

Coefficient design (FIRDesign) always runs its maths in double precision and casts to T on return: design is setup-time work, so float builds get full float accuracy for free.

Dependencies: WindowFunctions.h, SimdOps.h, AudioBuffer.h.

Definition in file FIRFilter.h.