Sound Byte Libs 0.5.1-121-g3358a44
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::dsp::widgets::PolyBlepOsc Class Reference

Detailed Description

Definition at line 48 of file polyblep_osc.hpp.

#include <polyblep_osc.hpp>

Public Member Functions

 PolyBlepOsc ()=default
 Default constructor (Saw waveform).
 
 PolyBlepOsc (Waveform w)
 Construct with a specific waveform.
 
void set_waveform (Waveform w)
 Set active waveform (discrete — no _su suffix)
 
void set_pitch_su (float su)
 Set pitch from normalized [0,1] signal unit.
 
void set_pulse_width_su (float su)
 Set pulse width from normalized [0,1] signal unit.
 
void set_amplitude_su (float su)
 Set output amplitude from normalized [0,1] signal unit.
 
void process (float *out, uint16_t frames, const float *fm_mod=nullptr, float fm_depth=0.0f)
 Generate audio samples, optionally with per-sample FM modulation.
 
void sync ()
 Hard sync — reset phase to zero.
 
void sync (float phase)
 Reset phase to a specific value (0.0–1.0)
 
uint32_t phase () const
 Current phase as uint32_t.
 
float frequency () const
 Current normalized frequency (freq_hz / sample_rate)
 

Friends

struct PolyBlepOscTestAccess
 
template<uint16_t >
class sbl::dsp::modules::MorphOsc
 

Constructor & Destructor Documentation

◆ PolyBlepOsc() [1/2]

sbl::dsp::widgets::PolyBlepOsc::PolyBlepOsc ( )
default

Default constructor (Saw waveform).

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

◆ PolyBlepOsc() [2/2]

sbl::dsp::widgets::PolyBlepOsc::PolyBlepOsc ( Waveform  w)
inlineexplicit

Construct with a specific waveform.

Definition at line 56 of file polyblep_osc.hpp.

Member Function Documentation

◆ set_waveform()

void sbl::dsp::widgets::PolyBlepOsc::set_waveform ( Waveform  w)
inline

Set active waveform (discrete — no _su suffix)

Definition at line 61 of file polyblep_osc.hpp.

◆ set_pitch_su()

void sbl::dsp::widgets::PolyBlepOsc::set_pitch_su ( float  su)
inline

Set pitch from normalized [0,1] signal unit.

Parameters
suUnipolar [0,1] — maps to MIDI 24–120 (C1–C9)

Definition at line 69 of file polyblep_osc.hpp.

◆ set_pulse_width_su()

void sbl::dsp::widgets::PolyBlepOsc::set_pulse_width_su ( float  su)
inline

Set pulse width from normalized [0,1] signal unit.

Parameters
suUnipolar [0,1] — linear map to 0.05–0.95

Definition at line 80 of file polyblep_osc.hpp.

◆ set_amplitude_su()

void sbl::dsp::widgets::PolyBlepOsc::set_amplitude_su ( float  su)
inline

Set output amplitude from normalized [0,1] signal unit.

Parameters
suUnipolar [0,1] — linear map to amplitude 0–1

Definition at line 90 of file polyblep_osc.hpp.

◆ process()

void sbl::dsp::widgets::PolyBlepOsc::process ( float *  out,
uint16_t  frames,
const float *  fm_mod = nullptr,
float  fm_depth = 0.0f 
)
inline

Generate audio samples, optionally with per-sample FM modulation.

When fm_mod is provided, per-sample exponential FM is applied around the stored frequency (set via set_pitch_su / set_frequency): freq = frequency_ * 2^(fm_mod[i] * fm_depth)

Parameters
outOutput buffer (float, [-1.0, 1.0])
framesNumber of samples
fm_modFM modulation signal [-1,1] (nullptr = no modulation)
fm_depthFM depth in octaves (e.g., 1.0 = ±1 octave)

Definition at line 108 of file polyblep_osc.hpp.

References sbl::dsp::math::fast_exp2f().

Referenced by sbl::dsp::modules::MorphOsc< MaxFrames >::process().

◆ sync() [1/2]

void sbl::dsp::widgets::PolyBlepOsc::sync ( )
inline

Hard sync — reset phase to zero.

Definition at line 143 of file polyblep_osc.hpp.

Referenced by sbl::dsp::modules::MorphOsc< MaxFrames >::reset().

◆ sync() [2/2]

void sbl::dsp::widgets::PolyBlepOsc::sync ( float  phase)
inline

Reset phase to a specific value (0.0–1.0)

Definition at line 150 of file polyblep_osc.hpp.

References phase().

◆ phase()

uint32_t sbl::dsp::widgets::PolyBlepOsc::phase ( ) const
inline

Current phase as uint32_t.

Definition at line 156 of file polyblep_osc.hpp.

Referenced by sync().

◆ frequency()

float sbl::dsp::widgets::PolyBlepOsc::frequency ( ) const
inline

Current normalized frequency (freq_hz / sample_rate)

Definition at line 161 of file polyblep_osc.hpp.

Friends And Related Symbol Documentation

◆ PolyBlepOscTestAccess

friend struct PolyBlepOscTestAccess
friend

Definition at line 164 of file polyblep_osc.hpp.

◆ sbl::dsp::modules::MorphOsc

template<uint16_t >
friend class sbl::dsp::modules::MorphOsc
friend

Definition at line 165 of file polyblep_osc.hpp.


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