Render engine
Rendering
render(const Recipe&, uint64_t seed = 1, const RenderSettings& = {}) validates the recipe and settings (validate_recipe, validate_settings), renders every layer with a seed derived from the master seed, mixes, optionally reverses the whole mix, applies fades and a DC blocker, and normalises.
RenderSettings
| Field | Default | Meaning |
|---|---|---|
sample_rate | 44100 | 8000–192000 |
channels | 2 | 1 or 2 |
normalize | true | Scale so the peak equals peak_db |
peak_db | −1.0 | ≤ 0 dBFS |
max_seconds | 120 | Refuse longer renders (memory guard) |
dc_cutoff_hz | 12 | DC blocker; 0 = off |
Rendered
left, right, sample_rate, channels; frames(), seconds(), stats(), to_stereo(), to_mono(), save(path) (mono or stereo WAV via the core writers).
Stats
seconds, peak, rms, dc, clip_ratio, crest, silent; peak_db(), rms_db(). Useful for checking a render is not silent or clipped.
Source generators (render/sources.hpp)
One generator per source kind (gen_osc, gen_noise, gen_additive, gen_modal, gen_formant, gen_grain, gen_pluck, gen_chaos), dispatched by generate_source. Also a TPT state-variable filter (Svf) that stays stable under fast modulation, and wave helpers.
Processor implementations (render/processors.hpp)
One function per processor (proc_filter, proc_drive, proc_crush, proc_gate, proc_trem, proc_pulses, proc_stutter, proc_freeze, proc_dropout, proc_comb, proc_ring, proc_reverb, proc_echo, proc_spectral), dispatched by run_proc, with an internal FFT. These live in a detail namespace and are not part of the stable API.
Full API listing
wauvio/sfx/render/engine.hpp
wauvio::sfx::struct RenderSettings
struct RenderSettings
int sample_rate = 44100; ///< 8000 .. 192000
int channels = 2; ///< 1 (mono) or 2 (stereo)
bool normalize = true; ///< scale the finished effect so its peak equals peak_db
double peak_db = -1.0; ///< target peak when normalising (<= 0 dBFS)
double max_seconds = 120.0; ///< refuse to render anything longer (memory guard)
double dc_cutoff_hz = 12.0; ///< DC blocker (0 = off)
wauvio::sfx::struct Stats
struct Stats
double seconds = 0.0, peak = 0.0, rms = 0.0, dc = 0.0, clip_ratio = 0.0, crest = 0.0;
bool silent = true;
double peak_db() const { return lin_to_db(peak); }
double rms_db() const { return lin_to_db(rms); }
wauvio::sfx::struct Rendered
struct Rendered
Buffer left, right;
int sample_rate = 44100;
int channels = 2;
size_t frames() const noexcept { return left.size(); }
double seconds() const noexcept { return sample_rate > 0 ? static_cast<double>(left.size()) / sample_rate : 0.0; }
Stats stats() const
StereoBuffer to_stereo() const { StereoBuffer b; b.L = left; b.R = right; return b; }
Buffer to_mono() const { Buffer m(left.size()); for (size_t i = 0; i < m.size(); ++i) m[i] = 0.5f * (left[i] + right[i]); return m; }
void save(const std::string& path) const { if (channels == 1) save_wav(to_mono(), path, sample_rate); else save_wav_stereo(to_stereo(), path, sample_rate); }
inline void validate_settings(const RenderSettings& st)
inline void validate_recipe(const Recipe& r)
struct LayerCtx { double sr; double bpm; double duration; };
inline Buffer render_layer(const LayerSpec& L, const LayerCtx& c, uint64_t seed)
/// Render a recipe. `seed` makes every random decision reproducible; the same recipe, seed and
/// settings give the same audio (floating-point results can differ across platforms).
inline Rendered render(const Recipe& r, uint64_t seed = 1, const RenderSettings& st = RenderSettings())