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::modules::MorphOsc< MaxFrames > Class Template Reference

Detailed Description

template<uint16_t MaxFrames = 48>
class sbl::dsp::modules::MorphOsc< MaxFrames >

Morphable PolyBLEP oscillator with three dedicated voices.

Template Parameters
MaxFramesMaximum block size for internal scratch buffers. Default 48 matches standard DMA block size.

Definition at line 59 of file morph_osc.hpp.

#include <morph_osc.hpp>

Public Member Functions

void set_pitch_su (float su)
 Set pitch from normalized signal. [0,1] → C1–C9 (MIDI 24–120).
 
void set_morph_su (float su)
 Set morph position from normalized signal. [0,1] → triangle→pulse→saw.
 
void set_pulse_width_su (float su)
 Set pulse width from normalized signal. [0,1] → [0.05, 0.95].
 
void set_drift_amount_su (float su)
 Set analog drift amount from normalized signal. [0,1] → [0, 0.10] semitones.
 
void set_amplitude_su (float su)
 Set output amplitude from normalized signal. [0,1] → [0, 1].
 
void set_detune_cents (float cents)
 Set detune offset in cents (±1200). Applied as a frequency ratio.
 
void set_drift_rate (float hz)
 Set drift control rate in Hz. Call once at init.
 
void tick_drift ()
 
void reset ()
 Reset all oscillator phases and drift state to zero.
 
void process (float *out, uint16_t frames, const float *fm_mod=nullptr, float fm_depth=0.0f)
 

Friends

struct MorphOscTestAccess
 

Member Function Documentation

◆ set_pitch_su()

template<uint16_t MaxFrames = 48>
void sbl::dsp::modules::MorphOsc< MaxFrames >::set_pitch_su ( float  su)
inline

Set pitch from normalized signal. [0,1] → C1–C9 (MIDI 24–120).

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

Definition at line 74 of file morph_osc.hpp.

References sbl::dsp::math::note_of_su(), and sbl::dsp::math::note_to_frequency().

◆ set_morph_su()

template<uint16_t MaxFrames = 48>
void sbl::dsp::modules::MorphOsc< MaxFrames >::set_morph_su ( float  su)
inline

Set morph position from normalized signal. [0,1] → triangle→pulse→saw.

Definition at line 81 of file morph_osc.hpp.

◆ set_pulse_width_su()

template<uint16_t MaxFrames = 48>
void sbl::dsp::modules::MorphOsc< MaxFrames >::set_pulse_width_su ( float  su)
inline

Set pulse width from normalized signal. [0,1] → [0.05, 0.95].

Definition at line 86 of file morph_osc.hpp.

◆ set_drift_amount_su()

template<uint16_t MaxFrames = 48>
void sbl::dsp::modules::MorphOsc< MaxFrames >::set_drift_amount_su ( float  su)
inline

Set analog drift amount from normalized signal. [0,1] → [0, 0.10] semitones.

Definition at line 92 of file morph_osc.hpp.

◆ set_amplitude_su()

template<uint16_t MaxFrames = 48>
void sbl::dsp::modules::MorphOsc< MaxFrames >::set_amplitude_su ( float  su)
inline

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

Definition at line 98 of file morph_osc.hpp.

◆ set_detune_cents()

template<uint16_t MaxFrames = 48>
void sbl::dsp::modules::MorphOsc< MaxFrames >::set_detune_cents ( float  cents)
inline

Set detune offset in cents (±1200). Applied as a frequency ratio.

Definition at line 106 of file morph_osc.hpp.

◆ set_drift_rate()

template<uint16_t MaxFrames = 48>
void sbl::dsp::modules::MorphOsc< MaxFrames >::set_drift_rate ( float  hz)
inline

Set drift control rate in Hz. Call once at init.

Definition at line 109 of file morph_osc.hpp.

References sbl::dsp::comp::AnalogDrift::set_rate().

◆ tick_drift()

template<uint16_t MaxFrames = 48>
void sbl::dsp::modules::MorphOsc< MaxFrames >::tick_drift ( )
inline

Advance drift state by one control tick. Call at control rate (~200 Hz). The ratios are applied internally on the next process() call.

Definition at line 117 of file morph_osc.hpp.

References sbl::dsp::comp::AnalogDrift::process(), and sbl::dsp::math::semitones_to_ratio().

◆ reset()

template<uint16_t MaxFrames = 48>
void sbl::dsp::modules::MorphOsc< MaxFrames >::reset ( )
inline

Reset all oscillator phases and drift state to zero.

Definition at line 133 of file morph_osc.hpp.

References sbl::dsp::comp::AnalogDrift::reset(), and sbl::dsp::widgets::PolyBlepOsc::sync().

◆ process()

template<uint16_t MaxFrames = 48>
void sbl::dsp::modules::MorphOsc< MaxFrames >::process ( float *  out,
uint16_t  frames,
const float *  fm_mod = nullptr,
float  fm_depth = 0.0f 
)
inline

Render block, 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 = apply_detune(freq_hz_) * 2^(fm_mod[i] * fm_depth)

Parameters
outOutput buffer
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 155 of file morph_osc.hpp.

References sbl::dsp::math::fast_exp2f(), and sbl::dsp::widgets::PolyBlepOsc::process().

Friends And Related Symbol Documentation

◆ MorphOscTestAccess

template<uint16_t MaxFrames = 48>
friend struct MorphOscTestAccess
friend

Definition at line 232 of file morph_osc.hpp.


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