|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
|
Shared minimum-phase band-limited step (minBLEP) residual table. More...
#include <MinBlepTable.h>
Public Member Functions | |
| T | residual (T t) const noexcept |
Residual of the minimum-phase band-limited step at position t. | |
Static Public Member Functions | |
| static const MinBlepTable & | instance () noexcept |
| Returns the process-wide shared table, building it on first call. | |
Static Public Attributes | |
| static constexpr int | kTaps = 64 |
| Correction span in base-rate samples (power of two, ring-buffer friendly). | |
| static constexpr int | kOversample = 64 |
| static constexpr int | kTableSize = kTaps * kOversample + 1 |
| Total table entries (one guard point at the end for interpolation). | |
Shared minimum-phase band-limited step (minBLEP) residual table.
A discontinuity rendered naively into a sample stream aliases. The classic fix is to replace the ideal step with a band-limited one; the minimum-phase variant (Brandt, ICMC 2001) concentrates all of its energy at and after the discontinuity, which has two practical consequences:
The table is built once per process from first principles (no baked-in magic data): a Blackman-Harris windowed sinc cutting at the base-rate Nyquist is converted to minimum phase via the real cepstrum, integrated into a step, and stored as the residual minBlepStep(t) - unitStep(t) at kOversample sub-sample positions per output sample.
Usage – for a discontinuity of amplitude jump occurring frac samples before output sample n (frac in [0, 1)), add jump * residual(j + frac) to output sample n + j for j = 0 .. kTaps - 1. The naive signal must already contain the raw step.
prepare() – never from the audio thread. After construction the table is immutable and lock-free to read from any thread. The build is noexcept by design: an allocation failure during it terminates (fail-fast; the only caller path is a noexcept prepare() anyway).| T | Sample type (float or double). Table generation always runs in double precision internally. |
Definition at line 71 of file MinBlepTable.h.
|
inlinestaticnoexcept |
Returns the process-wide shared table, building it on first call.
Thread-safe (C++11 magic static). The one-time build performs FFTs and temporary allocations – touch it from prepare(), not the audio thread.
Definition at line 90 of file MinBlepTable.h.
|
inlinenoexcept |
Residual of the minimum-phase band-limited step at position t.
| t | Time since the discontinuity, in samples (fractional). Must be >= 0; values beyond the table return 0 (the step has settled). |
minBlepStep(t) - 1 – starts near -1 right at the event (the band-limited transition has barely begun) and decays to exactly 0 at the end of the table. Definition at line 105 of file MinBlepTable.h.
|
staticconstexpr |
Sub-sample table resolution. Linear interpolation between entries keeps the sampling error near -80 dB, matching the window's stopband class.
Definition at line 80 of file MinBlepTable.h.
|
staticconstexpr |
Total table entries (one guard point at the end for interpolation).
Definition at line 82 of file MinBlepTable.h.
|
staticconstexpr |
Correction span in base-rate samples (power of two, ring-buffer friendly).
Definition at line 77 of file MinBlepTable.h.