|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
|
Static utility generating window functions for DSP analysis/synthesis. More...
#include <WindowFunctions.h>
Public Member Functions | |
| WindowFunctions ()=delete | |
Static Public Member Functions | |
| static void | rectangular (T *output, int size) noexcept |
| Rectangular window (no windowing – all ones). | |
| static void | triangular (T *output, int size, bool periodic=true) noexcept |
| Triangular (Bartlett) window. | |
| static void | hann (T *output, int size, bool periodic=true) noexcept |
| Hann (raised cosine) window. | |
| static void | hamming (T *output, int size, bool periodic=true) noexcept |
| Hamming window. | |
| static void | blackman (T *output, int size, bool periodic=true) noexcept |
| Blackman window. | |
| static void | blackmanHarris (T *output, int size, bool periodic=true) noexcept |
| Blackman-Harris window (4-term, -92 dB side lobes). | |
| static void | flatTop (T *output, int size, bool periodic=true) noexcept |
| Flat-top window (amplitude-accurate: scallop loss < 0.01 dB). | |
| static void | kaiser (T *output, int size, T beta, bool periodic=true) noexcept |
| Kaiser window with configurable shape parameter beta. | |
| static void | apply (T *signal, const T *window, int size) noexcept |
| Applies a window to a signal buffer in-place. | |
| static T | coherentGain (const T *window, int size) noexcept |
| Computes the coherent gain of a window (mean of its samples). | |
| static T | energyGain (const T *window, int size) noexcept |
| Computes the energy gain (RMS) of a window. | |
Static utility generating window functions for DSP analysis/synthesis.
All functions write size values into the output array. Valid size must be > 0. A size of 1 produces a unit impulse (1.0).
The periodic flag selects the divisor of the phase term: periodic = true (the default) generates DFT-periodic windows whose overlap-add properties hold exactly (use for STFT/WOLA processing); false generates symmetric windows that start and end on the same value (use for FIR filter design, where symmetry gives exact linear phase).
| T | Processing type (float or double). |
Definition at line 59 of file WindowFunctions.h.
|
delete |
|
inlinestaticnoexcept |
Applies a window to a signal buffer in-place.
Real-time safe. No alignment requirements: the element-wise loop auto-vectorizes with unaligned loads (it is not a reduction).
| signal | Signal buffer to window (modified in-place). |
| window | Pre-computed window values. |
| size | Number of samples. |
Definition at line 196 of file WindowFunctions.h.
|
inlinestaticnoexcept |
Blackman window.
| output | Destination buffer. |
| size | Number of samples. |
| periodic | True for WOLA (default), false for symmetric FIR design. |
Definition at line 125 of file WindowFunctions.h.
|
inlinestaticnoexcept |
Blackman-Harris window (4-term, -92 dB side lobes).
| output | Destination buffer. |
| size | Number of samples. |
| periodic | True for WOLA (default), false for symmetric FIR design. |
Definition at line 137 of file WindowFunctions.h.
|
inlinestaticnoexcept |
Computes the coherent gain of a window (mean of its samples).
Useful for recovering the true amplitude of a peak in a spectral bin after applying a windowing function. Accumulates in double so large windows do not lose calibration accuracy in float.
| window | Pre-computed window values. |
| size | Number of samples. |
Definition at line 218 of file WindowFunctions.h.
|
inlinestaticnoexcept |
Computes the energy gain (RMS) of a window.
Used for scaling the noise floor accurately when calculating Power Spectral Density (PSD). Accumulates in double.
| window | Pre-computed window values. |
| size | Number of samples. |
Definition at line 240 of file WindowFunctions.h.
|
inlinestaticnoexcept |
Flat-top window (amplitude-accurate: scallop loss < 0.01 dB).
| output | Destination buffer. |
| size | Number of samples. |
| periodic | True for WOLA (default), false for symmetric FIR design. |
Definition at line 150 of file WindowFunctions.h.
|
inlinestaticnoexcept |
Hamming window.
| output | Destination buffer. |
| size | Number of samples. |
| periodic | True for WOLA (default), false for symmetric FIR design. |
Definition at line 113 of file WindowFunctions.h.
|
inlinestaticnoexcept |
Hann (raised cosine) window.
| output | Destination buffer. |
| size | Number of samples. |
| periodic | True for WOLA (default), false for symmetric FIR design. |
Definition at line 101 of file WindowFunctions.h.
|
inlinestaticnoexcept |
Kaiser window with configurable shape parameter beta.
| output | Destination buffer. |
| size | Number of samples. |
| beta | Shape parameter (typically 0.0 to 14.0; accurate to ~30). |
| periodic | True for WOLA (default), false for symmetric FIR design. |
Definition at line 165 of file WindowFunctions.h.
|
inlinestaticnoexcept |
Rectangular window (no windowing – all ones).
| output | Destination buffer. |
| size | Number of samples. |
Definition at line 69 of file WindowFunctions.h.
|
inlinestaticnoexcept |
Triangular (Bartlett) window.
| output | Destination buffer. |
| size | Number of samples. |
| periodic | True for WOLA (default), false for symmetric FIR design. |
Definition at line 82 of file WindowFunctions.h.