|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
|
Standard window functions for spectral analysis and FIR filter design. More...
#include <algorithm>#include <cassert>#include <cmath>#include <cstddef>#include <numbers>

Go to the source code of this file.
Classes | |
| struct | dspark::WindowFunctions< T > |
| Static utility generating window functions for DSP analysis/synthesis. More... | |
Namespaces | |
| namespace | dspark |
| Main namespace for the DSPark framework. | |
Standard window functions for spectral analysis and FIR filter design.
Window functions taper the edges of an audio frame to reduce spectral leakage when using the FFT. Each window has different trade-offs between main lobe width (frequency resolution) and side lobe level (leakage suppression).
All windows are computed internally in double precision and cast to T on store: window generation is setup-time work, so float builds get the full float accuracy for free (this matters for high-attenuation designs such as Kaiser beta 10+, where a float Bessel series would eat into the stopband).
Quick guide for choosing a window:
| Window | Main lobe | Side lobes | Best for |
|---|---|---|---|
| Hann | Medium | -31 dB | General-purpose spectral analysis |
| Hamming | Medium | -42 dB | Speech analysis, FIR design |
| Blackman | Wide | -58 dB | High dynamic range analysis |
| BlackmanHarris | Wide | -92 dB | Precision measurement |
| Kaiser | Variable | Variable | Configurable – FIR design |
| FlatTop | Very wide | -93 dB | Amplitude-accurate measurement |
| Rectangular | Narrowest | -13 dB | Transient analysis (no windowing) |
| Triangular | Medium | -26 dB | Simple overlap-add applications |
Dependencies: C++20 standard library only.
Definition in file WindowFunctions.h.