Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::Interpolator Struct Reference

Collection of interpolation algorithms for reading between samples. More...

#include <interpolator.hpp>

Static Public Member Functions

template<typename SampleType>
static SampleType linear (SampleType frac, SampleType y0, SampleType y1)
 Linear interpolation between two samples.
template<typename SampleType>
static SampleType hermite (SampleType frac, SampleType ym1, SampleType y0, SampleType y1, SampleType y2)
 Cubic Hermite (Catmull-Rom) interpolation.
template<typename SampleType>
static SampleType lagrange (SampleType frac, SampleType ym1, SampleType y0, SampleType y1, SampleType y2)
 4-point Lagrange interpolation.
template<typename SampleType>
static SampleType sinc6 (SampleType frac, SampleType ym2, SampleType ym1, SampleType y0, SampleType y1, SampleType y2, SampleType y3)
 Windowed-sinc interpolation (6-point).

Detailed Description

Collection of interpolation algorithms for reading between samples.

All functions take a fractional position and neighboring samples. Use with delay lines, wavetable oscillators, and resamplers.

RT contract: all interpolation functions are stateless scalar helpers and allocate no memory.

// In a delay line read:
float frac = delay - std::floor(delay);
int i = static_cast<int>(std::floor(delay));
float out = Interpolator::hermite(frac, buf[i-1], buf[i], buf[i+1], buf[i+2]);
@ delay
Definition envelope.hpp:57
@ i
Definition formant_filter_bank.hpp:20
static SampleType hermite(SampleType frac, SampleType ym1, SampleType y0, SampleType y1, SampleType y2)
Cubic Hermite (Catmull-Rom) interpolation.
Definition interpolator.hpp:41

Member Function Documentation

◆ hermite()

template<typename SampleType>
SampleType pulp::signal::Interpolator::hermite ( SampleType frac,
SampleType ym1,
SampleType y0,
SampleType y1,
SampleType y2 )
inlinestatic

Cubic Hermite (Catmull-Rom) interpolation.

Requires 4 points: ym1 (pos -1), y0 (pos 0), y1 (pos 1), y2 (pos 2). Good balance of quality vs cost for most audio applications.

◆ lagrange()

template<typename SampleType>
SampleType pulp::signal::Interpolator::lagrange ( SampleType frac,
SampleType ym1,
SampleType y0,
SampleType y1,
SampleType y2 )
inlinestatic

4-point Lagrange interpolation.

Requires 4 points: ym1, y0, y1, y2 (same layout as hermite). Slightly different character than Hermite — no overshoot guarantee but mathematically exact for polynomials up to degree 3.

◆ linear()

template<typename SampleType>
SampleType pulp::signal::Interpolator::linear ( SampleType frac,
SampleType y0,
SampleType y1 )
inlinestatic

Linear interpolation between two samples.

Requires 2 points: y0 (at position 0), y1 (at position 1).

◆ sinc6()

template<typename SampleType>
SampleType pulp::signal::Interpolator::sinc6 ( SampleType frac,
SampleType ym2,
SampleType ym1,
SampleType y0,
SampleType y1,
SampleType y2,
SampleType y3 )
inlinestatic

Windowed-sinc interpolation (6-point).

Highest quality, suitable for mastering-grade resampling. Requires 6 points: ym2, ym1, y0, y1, y2, y3.


The documentation for this struct was generated from the following file: