Core engine (wauvio/core)
fx_basic.hpp — basic effects
Namespace wauvio::fx::basic. Small mono effects bundled with the core. All stateful effects follow the pattern: set public parameters → call init(sample_rate) (allocates delay memory) → tick(x) or process(buffer); reset() clears memory. Always call init() after changing time-based parameters.
See it in action: Delay and reverb
| Effect | Parameters (defaults) | Notes |
|---|---|---|
distortion::soft_clip / hard_clip / waveshaper | drive 2.0 / threshold 0.5 / knee 0.7 | Free functions plus apply_* buffer versions. |
DelayLine | time_ms 250, feedback 0.4, wet 0.5, dry 1.0 | Feedback delay; compute time_ms from tempo for sync. |
Reverb | room_size 0.8, damping 0.5, wet 0.3, dry 1.0 | Schroeder: 4 parallel combs into 2 series all-passes. |
Chorus | rate_hz 0.5, depth_ms 1.5, delay_ms 8, wet 0.5 | LFO-modulated delay. |
Flanger | rate_hz 0.25, depth_ms 2, delay_ms 3, feedback 0.5 | Negative feedback gives through-zero character. |
Phaser | stages 4, rate_hz 0.5, depth 0.9, base_hz 400, range_hz 1600, feedback 0.4 | All-pass chain swept by an LFO. |
SidechainCompressor | attack_ms 1, release_ms 100, strength 0.9, threshold 0.05 | apply(target, trigger): ducks target using the envelope of trigger; buffers must be equal length. Stereo target overload exists. |
Full API listing
wauvio/core/fx_basic.hpp
wauvio::fx::basic::Free functions, constants and aliases
// §16 DISTORTION
/// Soft clip via hyperbolic tangent. drive > 1 = more distortion.
inline float soft_clip(float x, float drive = 2.0f) noexcept
/// Hard clip at ±threshold.
inline float hard_clip(float x, float threshold = 0.5f) noexcept
/// Asymmetric waveshaper: polynomial with tunable knee.
/// knee = 0.0 → linear; knee = 1.0 → maximum curvature
inline float waveshaper(float x, float knee = 0.7f) noexcept
/// Process a buffer in place with a chosen distortion function.
inline void apply_soft_clip(Buffer& buf, float drive = 2.0f)
inline void apply_hard_clip(Buffer& buf, float threshold = 0.5f)
inline void apply_waveshaper(Buffer& buf, float knee = 0.7f)
wauvio::fx::basic::class DelayLine
// §17 DELAY LINE
// Feedback digital delay. Supports tempo-synced delays (pass time_ms).
class DelayLine
public:
double time_ms = 250.0; ///< Delay time in milliseconds
float feedback = 0.4f; ///< Feedback amount [0,1)
float wet = 0.5f; ///< Wet level
float dry = 1.0f; ///< Dry level
void init(int sample_rate = 0)
float tick(float x) noexcept
void process(Buffer& buf)
void reset() noexcept { std::fill(buf_.begin(), buf_.end(), 0.0f); head_ = 0; }
wauvio::fx::basic::class Reverb
// §18 REVERB - Schroeder structure
// 4 parallel feedback comb filters → 2 series allpass filters.
// Classic digital reverb suitable for atmospheric tails.
class Reverb
public:
float room_size = 0.8f; ///< [0,1] - longer = larger room
float damping = 0.5f; ///< [0,1] - higher = duller high frequencies
float wet = 0.3f;
float dry = 1.0f;
void init(int sample_rate = 0)
float tick(float x) noexcept
void process(Buffer& buf)
void reset() noexcept
wauvio::fx::basic::class Chorus
// §19 CHORUS
// Modulated delay line that creates pitch/timbre widening.
// Uses an LFO to vary delay time, detuning copies of the signal slightly.
class Chorus
public:
double rate_hz = 0.5; ///< LFO rate
double depth_ms = 1.5; ///< Modulation depth in ms
double delay_ms = 8.0; ///< Centre delay time in ms
float wet = 0.5f;
float dry = 1.0f;
void init(int sample_rate = 0)
float tick(float x) noexcept
void process(Buffer& buf)
wauvio::fx::basic::class Flanger
// §19b FLANGER
// Short modulated delay (0.1–10 ms) mixed with the dry signal, creating
// comb-filter notches that sweep with the LFO. Feedback intensifies the
// metallic/jet-plane sweep.
class Flanger
public:
double rate_hz = 0.25; ///< LFO rate
double depth_ms = 2.0; ///< Modulation depth in ms
double delay_ms = 3.0; ///< Centre delay time in ms (keep < 10 ms)
float feedback = 0.5f; ///< Feedback amount [-1, 1]; negative = through-zero
float wet = 0.5f;
float dry = 1.0f;
void init(int sample_rate = 0)
float tick(float x) noexcept
void process(Buffer& buf)
void reset() noexcept
wauvio::fx::basic::class Phaser
// §19c PHASER
// N all-pass stages whose centre frequency is modulated by an LFO.
// The phase-shifted signal is mixed with dry, creating notches that sweep
// through the spectrum — smoother and more musical than flanging.
// Default: 4 stages (classic phaser); 8 stages = richer sweep.
class Phaser
public:
int stages = 4; ///< Number of all-pass stages (2, 4, 6, 8 …)
double rate_hz = 0.5; ///< LFO rate
double depth = 0.9; ///< LFO depth [0, 1]
double base_hz = 400.0; ///< Lowest sweep frequency
double range_hz = 1600.0; ///< Frequency range of the sweep
float feedback = 0.4f; ///< Feedback amount [0, 1)
float wet = 0.5f;
float dry = 1.0f;
void init(int sample_rate = 0)
float tick(float x) noexcept
void process(Buffer& buf)
void reset() noexcept
wauvio::fx::basic::class SidechainCompressor
// §21 SIDECHAIN COMPRESSOR
// Ducker: attenuates `target` buffer based on an envelope follower applied
// to the `trigger` buffer. Classic pumping / sidechaining effect.
class SidechainCompressor
public:
float attack_ms = 1.0f; ///< Envelope follower attack (ms)
float release_ms = 100.0f; ///< Envelope follower release (ms)
float strength = 0.9f; ///< Duck depth [0=no effect, 1=full silence]
float threshold = 0.05f; ///< RMS level above which ducking begins
/// Apply sidechain ducking: modulate `target` using envelope of `trigger`.
/// Both buffers must have the same length.
void apply(Buffer& target, const Buffer& trigger, int sample_rate = 0) const
/// Stereo version - applies same gain reduction to both channels.
void apply(StereoBuffer& target, const Buffer& trigger, int sample_rate = 0) const