24#ifndef SBL_DSP_COMP_LFO_HPP_
25#define SBL_DSP_COMP_LFO_HPP_
38template<u
int16_t TableSize>
61 if (su < 0.0f) su = 0.0f;
62 if (su > 1.0f) su = 1.0f;
72 if (su < 0.0f) su = 0.0f;
73 if (su > 1.0f) su = 1.0f;
84 void process(
float* out, uint16_t frames) {
85 for (uint16_t i = 0; i < frames; ++i) {
87 out[i] = reader_.
read(phase_.
phase()) * depth_;
98 return reader_.
read(phase_.
phase()) * depth_;
111 static constexpr float kMinRateHz = 0.05f;
112 static constexpr float kMaxRateHz = 30.0f;
113 static constexpr float kRateOctaves = 9.228819f;
117 void set_rate(
float freq_hz) {
122 void set_depth(
float depth) { depth_ = depth; }
void process(float *out, uint16_t frames)
Generate modulation signal (bipolar: -depth to +depth)
void sync()
Hard sync — reset phase to zero.
void set_depth_su(float su)
Set output amplitude from normalized [0,1] signal unit.
void set_rate_su(float su)
Set LFO rate from normalized [0,1] signal unit.
void set_increment(uint32_t inc)
Set phase increment directly.
friend struct LfoTestAccess
uint32_t phase() const
Current phase.
void set_wavetable(const float *table)
Set wavetable (must have guard points for interpolation)
uint32_t increment() const
Current phase increment.
float value() const
Current LFO value (bipolar, float)
void set_increment(uint32_t inc)
Set the phase increment per sample.
static uint32_t freq_to_inc(float freq_hz, float sr=types::SAMPLE_RATE_F)
Convert frequency in Hz to phase increment.
void reset()
Reset phase to zero.
uint32_t phase() const
Current phase value.
uint32_t increment() const
Current phase increment.
void advance()
Advance phase by one sample.
void set_table(const float *table)
Set the wavetable to read from (must have Size+1 guard points for linear)
float read(uint32_t phase) const
Read a single sample with linear interpolation.
Fast analytical approximations (Audio Stack — Atoms)
Fixed-point constants and audio sample types.
Compositions: subcircuits of primitives.
float fast_exp2f(float x)
Phase accumulator for oscillators and LFOs.
Wavetable reader with interpolation.