Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
polyblep.hpp File Reference

Polynomial BLEP kernels, and the sub-frame time of a crossing. More...

Detailed Description

Polynomial BLEP kernels, and the sub-frame time of a crossing.

A BLEP kernel band-limits a discontinuity at a known time between frames. The kernel is the smoothing function the naive waveform is convolved with before sampling. Its integral is the band-limited step, and where that differs from the naive step on the frames the kernel touches is the step residual; the slope residual is the same for a corner, from the kernel's second integral. Corrected output is the naive waveform convolved with the kernel, and residuals from events closer than a kernel's span add linearly. A non-negative kernel with unit area, as Bspline4 and Linear2 are, never takes the output outside the naive range. Sinc16 rings: its step overshoots by 8.2 % of the step's height on either side, so a pulse between -1 and 1 reaches 1.16.

A kernel is a policy type for BlepCorrector<Kernel>:

static constexpr uint8_t FRAMES; // frames the kernel touches
static constexpr uint8_t LATENCY; // of those, how many lie before the event
static constexpr BlepResidual<FRAMES> step(float t); // a unit step
static constexpr BlepResidual<FRAMES> slope(float t); // a unit slope change per frame

t is the fraction of a frame elapsed since the event, read at the first frame after it, in [0, 1). at[i] corrects frame i - LATENCY relative to that frame; a caller adds height * at[i] for a step of height and delta * at[i] for a slope change of delta per frame, so its output trails the naive waveform by LATENCY frames.

Definition in file polyblep.hpp.

#include <cstdint>
#include <sbl/dsp/math/sinc16_coefficients.hpp>

Go to the source code of this file.

Classes

struct  sbl::dsp::math::BlepResidual< N >
 A kernel's corrections for the N frames it touches, oldest first. More...
 
struct  sbl::dsp::math::Bspline4
 The cubic B-spline over four frames, two before the event and two after. More...
 
struct  sbl::dsp::math::Linear2
 The triangular kernel over two frames, one before the event and one after: Plaits' polyBLEP. More...
 
struct  sbl::dsp::math::Sinc16
 A Kaiser-windowed sinc over sixteen frames, eight before the event and eight after. More...
 

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::dsp
 The audio stack.
 
namespace  sbl::dsp::math
 Math for the audio stack.
 

Functions

constexpr float sbl::dsp::math::polyblep_time (float before, float after, float threshold_before, float threshold_after)
 Sub-frame time at which a linear segment crossed a moving threshold.
 
constexpr float sbl::dsp::math::polyblep_time (float before, float after, float threshold)
 Sub-frame time at which a linear segment crossed a fixed threshold.
 

Variables

constexpr float sbl::dsp::math::POLYBLEP_T_MAX = 0.99999994f
 The largest float below 1, the upper bound of a sub-frame time.