Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::osc::WtOscillator Class Reference

Modern wavetable oscillator over a set of band-limited WavetableTs. More...

#include <wt.hpp>

Public Member Functions

void set_wavetable_set (std::vector< Wavetable64 > tables)
 Install the table set (off the audio thread).
void prepare (double sample_rate)
 Set the sample rate.
void reset ()
 Reset phase and crossfade state to the start of the cycle, and snap the scan position to its target (a reset render starts settled, not mid-slew).
void set_position (double pos)
 Target scan position across the table set, 0..1 (0 = first table, 1 = last).
double position () const
 The audible (slewed) scan position — what the bank is actually morphing at.
void set_scan_time_ms (double ms)
 Scan slew time, in ms.
double scan_time_ms () const
double next (double increment)
 Generate one sample and advance by increment cycles (frequency ÷ sample rate).
std::size_t band_count () const
 Number of bands in the table set's readout (from the first table).
double band_max_frequency_hz (std::size_t i) const
 Upper alias-free playback frequency of band i (its ceiling).
std::size_t table_count () const
 Number of tables the scan morphs across.

Static Public Attributes

static constexpr double kDefaultScanTimeMs = 5.0
 Default scan slew time (ms): the one-pole time constant that turns a stepped position control into a smooth sweep.

Detailed Description

Modern wavetable oscillator over a set of band-limited WavetableTs.

Member Function Documentation

◆ band_count()

std::size_t pulp::signal::osc::WtOscillator::band_count ( ) const
inline

Number of bands in the table set's readout (from the first table).

◆ band_max_frequency_hz()

double pulp::signal::osc::WtOscillator::band_max_frequency_hz ( std::size_t i) const
inline

Upper alias-free playback frequency of band i (its ceiling).

0 for an out-of-range index or an empty set.

◆ next()

double pulp::signal::osc::WtOscillator::next ( double increment)
inline

Generate one sample and advance by increment cycles (frequency ÷ sample rate).

The increment drives the bank's frequency — hence its band selection and crossfade — and the scan position is advanced one slew step toward its target first, so the morph is smooth under a stepped control.

◆ position()

double pulp::signal::osc::WtOscillator::position ( ) const
inline

The audible (slewed) scan position — what the bank is actually morphing at.

◆ prepare()

void pulp::signal::osc::WtOscillator::prepare ( double sample_rate)
inline

Set the sample rate.

Call before next is meaningful; safe to call again on a rate change (it re-derives the scan coefficient and re-arms the bank).

◆ reset()

void pulp::signal::osc::WtOscillator::reset ( )
inline

Reset phase and crossfade state to the start of the cycle, and snap the scan position to its target (a reset render starts settled, not mid-slew).

The band also starts settled: the first next after this snaps straight to its band rather than crossfading up from the default band, so a fresh voice has no aliased band-switch onset.

No phase-seed parameter: the wavetable engine resets to phase 0 and exposes no seed, and — unlike the discontinuity-corrected shapes, where a clean start phase matters — a wavetable is smooth everywhere, so there is no phase worth seeding to. Offering a parameter the engine cannot honor would be the misleading option.

◆ scan_time_ms()

double pulp::signal::osc::WtOscillator::scan_time_ms ( ) const
inline

◆ set_position()

void pulp::signal::osc::WtOscillator::set_position ( double pos)
inline

Target scan position across the table set, 0..1 (0 = first table, 1 = last).

Clamped. The audible position slews toward this target at scan_time_ms, so a block-rate step does not zipper.

◆ set_scan_time_ms()

void pulp::signal::osc::WtOscillator::set_scan_time_ms ( double ms)
inline

Scan slew time, in ms.

0 makes the scan instantaneous (the position jumps to its target every sample — the stepped path the modern tier avoids by default). Larger is a slower, smoother sweep.

◆ set_wavetable_set()

void pulp::signal::osc::WtOscillator::set_wavetable_set ( std::vector< Wavetable64 > tables)
inline

Install the table set (off the audio thread).

Each entry is a fully band-limited WavetableT; the set is morphed across by set_position. One entry is a plain single-wavetable oscillator (no scan). The band ceilings are read from the first table so band_max_frequency_hz can report them without exposing the bank's internals.

◆ table_count()

std::size_t pulp::signal::osc::WtOscillator::table_count ( ) const
inline

Number of tables the scan morphs across.

Member Data Documentation

◆ kDefaultScanTimeMs

double pulp::signal::osc::WtOscillator::kDefaultScanTimeMs = 5.0
staticconstexpr

Default scan slew time (ms): the one-pole time constant that turns a stepped position control into a smooth sweep.

Short enough to feel immediate, long enough that a full 0→1 jump does not click.


The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/signal/include/pulp/signal/osc/wt.hpp