Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Public Member Functions | List of all members
sbl::widgets::source::WavetableOsc< TableSize > Class Template Reference

#include <wavetable_osc.hpp>

Collaboration diagram for sbl::widgets::source::WavetableOsc< TableSize >:

Public Member Functions

void set_wavetable (const float *table)
 Set wavetable (must have guard points for interpolation)
 
void set_frequency (float freq_hz, float sr=48000.0f)
 Set frequency in Hz.
 
void set_note (float midi_note, float sample_rate=48000.0f)
 Set frequency from MIDI note number (requires FPU)
 
void set_increment (uint32_t inc)
 Set phase increment directly.
 
void set_amplitude (float amp)
 Set output amplitude (0.0 = silence, 1.0 = full scale)
 
void process (float *out, uint16_t frames)
 Generate audio samples.
 
void sync ()
 Hard sync — reset phase to zero.
 
void sync (uint32_t phase)
 Reset phase to a specific value.
 
uint32_t phase () const
 Current phase.
 
uint32_t increment () const
 Current phase increment.
 

Detailed Description

template<uint16_t TableSize>
class sbl::widgets::source::WavetableOsc< TableSize >

Definition at line 23 of file wavetable_osc.hpp.

Member Function Documentation

◆ increment()

template<uint16_t TableSize>
uint32_t sbl::widgets::source::WavetableOsc< TableSize >::increment ( ) const
inline

Current phase increment.

Definition at line 76 of file wavetable_osc.hpp.

References sbl::dsp::PhaseAccumulator::increment().

Here is the call graph for this function:

◆ phase()

template<uint16_t TableSize>
uint32_t sbl::widgets::source::WavetableOsc< TableSize >::phase ( ) const
inline

Current phase.

Definition at line 73 of file wavetable_osc.hpp.

References sbl::dsp::PhaseAccumulator::phase().

Referenced by sbl::widgets::source::WavetableOsc< TableSize >::sync().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ process()

template<uint16_t TableSize>
void sbl::widgets::source::WavetableOsc< TableSize >::process ( float *  out,
uint16_t  frames 
)
inline

Generate audio samples.

Parameters
outOutput buffer (float, [-1.0, 1.0])
framesNumber of samples

Definition at line 59 of file wavetable_osc.hpp.

References sbl::dsp::PhaseAccumulator::advance(), sbl::dsp::PhaseAccumulator::phase(), and sbl::dsp::WavetableReader< Size >::read().

Here is the call graph for this function:

◆ set_amplitude()

template<uint16_t TableSize>
void sbl::widgets::source::WavetableOsc< TableSize >::set_amplitude ( float  amp)
inline

Set output amplitude (0.0 = silence, 1.0 = full scale)

Definition at line 52 of file wavetable_osc.hpp.

◆ set_frequency()

template<uint16_t TableSize>
void sbl::widgets::source::WavetableOsc< TableSize >::set_frequency ( float  freq_hz,
float  sr = 48000.0f 
)
inline

Set frequency in Hz.

Parameters
freq_hzFrequency in Hz (e.g., 440.0f)
srSample rate (default 48000)

Definition at line 35 of file wavetable_osc.hpp.

References sbl::dsp::PhaseAccumulator::freq_to_inc(), and sbl::dsp::PhaseAccumulator::set_increment().

Here is the call graph for this function:

◆ set_increment()

template<uint16_t TableSize>
void sbl::widgets::source::WavetableOsc< TableSize >::set_increment ( uint32_t  inc)
inline

Set phase increment directly.

Definition at line 49 of file wavetable_osc.hpp.

References sbl::dsp::PhaseAccumulator::set_increment().

Here is the call graph for this function:

◆ set_note()

template<uint16_t TableSize>
void sbl::widgets::source::WavetableOsc< TableSize >::set_note ( float  midi_note,
float  sample_rate = 48000.0f 
)
inline

Set frequency from MIDI note number (requires FPU)

Parameters
midi_noteMIDI note (69 = A4 = 440 Hz)
sample_rateSample rate

Definition at line 44 of file wavetable_osc.hpp.

References sbl::dsp::note_to_phase_increment(), and sbl::dsp::PhaseAccumulator::set_increment().

Here is the call graph for this function:

◆ set_wavetable()

template<uint16_t TableSize>
void sbl::widgets::source::WavetableOsc< TableSize >::set_wavetable ( const float *  table)
inline

Set wavetable (must have guard points for interpolation)

Note
All public methods are ISR-safe — bounded computation, no I/O.

Definition at line 28 of file wavetable_osc.hpp.

References sbl::dsp::WavetableReader< Size >::set_table().

Here is the call graph for this function:

◆ sync() [1/2]

template<uint16_t TableSize>
void sbl::widgets::source::WavetableOsc< TableSize >::sync ( )
inline

Hard sync — reset phase to zero.

Definition at line 67 of file wavetable_osc.hpp.

References sbl::dsp::PhaseAccumulator::reset().

Here is the call graph for this function:

◆ sync() [2/2]

template<uint16_t TableSize>
void sbl::widgets::source::WavetableOsc< TableSize >::sync ( uint32_t  phase)
inline

Reset phase to a specific value.

Definition at line 70 of file wavetable_osc.hpp.

References sbl::widgets::source::WavetableOsc< TableSize >::phase(), and sbl::dsp::PhaseAccumulator::reset().

Here is the call graph for this function:

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