|
| static WavetableT | make_sine (std::size_t table_length=2048, SampleType reference_sample_rate=SampleType{48000.0f}) |
| | Compose a stack of harmonic-based bands for one of the four classical shapes (sine, saw, square, triangle).
|
| static WavetableT | make_saw (std::size_t bands=10, std::size_t table_length=2048, SampleType reference_sample_rate=SampleType{48000.0f}) |
| static WavetableT | make_square (std::size_t bands=10, std::size_t table_length=2048, SampleType reference_sample_rate=SampleType{48000.0f}) |
| static WavetableT | make_triangle (std::size_t bands=10, std::size_t table_length=2048, SampleType reference_sample_rate=SampleType{48000.0f}) |
template<typename SampleType = float>
class pulp::signal::WavetableT< SampleType >
Wavetable oscillator with band-switching.
RT contract: constructors and factory helpers allocate table storage and must run off the audio thread. set_sample_rate(), set_frequency(), reset(), and next() allocate no memory after construction.
Construction: supply a pre-sorted list of bands (lowest max_frequency_hz first). set_frequency selects the smallest band whose budget covers the new frequency. When the selection changes, next() crossfades between the previous and new band across kCrossfadeSamples samples — short enough to be inaudible, long enough to keep transitions click-free.
template<typename SampleType>
Compose a stack of harmonic-based bands for one of the four classical shapes (sine, saw, square, triangle).
The result is fully bandlimited across the audible range: each band carries only harmonics whose frequency at the band's ceiling stays below half the assumed reference sample rate.
template<typename SampleType = float>
Select the band for hz with NO crossfade — snap straight to it.
For the first frequency after construction or reset, there is no previously audible band to fade FROM: a fresh voice must start already settled on the correct band. set_frequency would instead begin a crossfade UP from the default band, playing that band's harmonic content at the new pitch for the fade window (an aliased onset on every note-on). The mid-stream set_frequency still crossfades — that fade is between two real playing bands and must stay smooth.