|
DSPark 1.8.0
Header-only C++20 DSP for real-time and offline audio
|
Band-limited fractional reader for read rates from 1 to 4. More...
#include <Interpolation.h>
Public Member Functions | |
| StretchedSincReader () | |
| Builds the kernel tables (allocates: construct on a setup thread). | |
| T | readRing (const T *ring, int64_t mask, int64_t intPos, double frac, int step) const noexcept |
| Reads a power-of-two ring buffer at intPos + frac with the kernel of a rate step. It needs the samples intPos - reach(step) + 1 through intPos + reach(step). | |
| int | reach (int step) const noexcept |
Static Public Member Functions | |
| static int | stepFor (double rate) noexcept |
| The table for a read rate: the nearest tabulated rate at or above it. Costs a log2, so look it up once per constant rate. | |
Static Public Attributes | |
| static constexpr int | kSteps = 16 |
| Tabulated rates. | |
| static constexpr int | kStepsPerOctave = 8 |
| Rate resolution. | |
| static constexpr int | kPhases = 64 |
| Phases per rate. | |
| static constexpr int | kMaxTaps = 128 |
| Kernel length at rate 4. | |
Band-limited fractional reader for read rates from 1 to 4.
A read point that advances by r > 1 samples per output sample decimates: content above Nyquist / r folds back unless the kernel's cutoff drops to Nyquist / r. This reader tabulates such kernels (the sinc stretched by r under a Kaiser window, beta 10, about 32 r taps) for 16 rates in eighth-octave steps from 2^(1/8) to 4, at 64 phases each, and reads with the kernel of the nearest tabulated rate at or above the requested one: nothing folds back from beyond the output Nyquist, and the band gives up at most an eighth of an octave at the top. Passband error stays below -76 dB up to three quarters of the cutoff. For rates at or below 1 use SincInterpolator.
Threading: the constructor builds about 60 k coefficients (allocates: setup thread); reads are const, allocation-free and safe from any thread.
| T | Sample type (float or double). |
Definition at line 446 of file Interpolation.h.
|
inline |
Builds the kernel tables (allocates: construct on a setup thread).
Definition at line 455 of file Interpolation.h.
|
inlinenoexcept |
Definition at line 552 of file Interpolation.h.
|
inlinenoexcept |
Reads a power-of-two ring buffer at intPos + frac with the kernel of a rate step. It needs the samples intPos - reach(step) + 1 through intPos + reach(step).
| ring | Ring storage. |
| mask | Ring size minus one (the size must be a power of two). |
| intPos | Integer read position (masked, so any value works). |
| frac | Fractional position in [0, 1). |
| step | Rate step from stepFor(). |
Definition at line 522 of file Interpolation.h.
|
inlinestaticnoexcept |
The table for a read rate: the nearest tabulated rate at or above it. Costs a log2, so look it up once per constant rate.
| rate | Read rate, clamped to [2^(1/8), 4]. |
Definition at line 505 of file Interpolation.h.
|
staticconstexpr |
Kernel length at rate 4.
Definition at line 452 of file Interpolation.h.
|
staticconstexpr |
Phases per rate.
Definition at line 451 of file Interpolation.h.
|
staticconstexpr |
Tabulated rates.
Definition at line 449 of file Interpolation.h.
|
staticconstexpr |
Rate resolution.
Definition at line 450 of file Interpolation.h.