Core engine (wauvio/core)
mod.hpp — LFO and automation
Namespace wauvio::mod.
See it in action: A filter sweep with automation · Under the hood: sample by sample
LFO
Enums: LFOShape { Sine, Triangle, Square, SampleHold } and LFOTarget { Pitch, Amplitude, FilterCutoff, Pan }. Fields: shape, target, rate_hz (4), depth (0.5), phase_off. tick(sample_rate) returns a value in [-1, 1]; modulate(sample_rate) returns it scaled by depth. SampleHold picks a new random value each phase wrap using a fixed internal seed, so it is deterministic. The target field is a label for the caller: the LFO does not itself modify any other object.
Automation
AutoPoint {time_sec, value}. auto_eval(points, t) linearly interpolates a time-sorted list (clamping before the first and after the last point; empty list returns 0).
| Function | Effect |
|---|---|
apply_volume_automation(buf, points, sr) | Multiplies a mono or stereo buffer by the interpolated curve. |
apply_filter_automation(src, cutoff_points, Q, mode, sr) | Runs an SVFilter whose cutoff follows the curve (floored at 20 Hz), recomputing coefficients every sample. Returns a new buffer. |
Full API listing
wauvio/core/mod.hpp
wauvio::mod::enum class LFOShape
// §12 LFO SYSTEM
// Can target: pitch (freq multiplier), amplitude, filter cutoff, pan.
enum class LFOShape { Sine, Triangle, Square, SampleHold };
wauvio::mod::enum class LFOTarget
enum class LFOTarget { Pitch, Amplitude, FilterCutoff, Pan };
wauvio::mod::class LFO
class LFO
public:
LFOShape shape = LFOShape::Sine;
LFOTarget target = LFOTarget::Amplitude;
double rate_hz = 4.0; ///< Oscillation frequency
double depth = 0.5; ///< Modulation depth [0,1]
double phase_off = 0.0; ///< Phase offset (radians)
LFO() = default;
LFO(LFOShape sh, LFOTarget tgt, double rate, double depth_)
: shape(sh), target(tgt), rate_hz(rate), depth(depth_) {}
/// Returns the current LFO value in [-1, 1].
float tick(int sample_rate) noexcept
/// Returns depth-scaled modulation value.
float modulate(int sample_rate) noexcept
void reset() noexcept { phase_ = 0.0; }
wauvio::mod::struct AutoPoint
// §22 AUTOMATION SYSTEM
// Parameter automation curves applied to buffer data (volume, filter, pitch).
/// An automation point: time + value.
struct AutoPoint { double time_sec; float value; };
/// Compute the linearly interpolated value at `t` from a sorted point list.
inline float auto_eval(const std::vector<AutoPoint>& pts, double t) noexcept
/// Apply a volume automation curve to a buffer in-place.
inline void apply_volume_automation(Buffer& buf,
const std::vector<AutoPoint>& pts,
int sample_rate = 0)
/// Apply a volume automation curve to a stereo buffer in-place.
inline void apply_volume_automation(StereoBuffer& buf,
const std::vector<AutoPoint>& pts,
int sample_rate = 0)
/// Apply an SVF cutoff automation - filter moves from point to point.
inline Buffer apply_filter_automation(const Buffer& src,
const std::vector<AutoPoint>& cutoff_pts,
double Q,
wauvio::filter::SVFilter::Mode mode = wauvio::filter::SVFilter::Mode::LowPass,
int sample_rate = 0)