Music layer (wauvio/ext)

Rendering and WAV output

Header wauvio/ext/core/render.hpp, namespace wauvio.

See it in action: Output options

RenderOptions

FieldDefaultMeaning
sample_rate44100Output rate written to the file
channels2Channel count
bit_depth1616, 24 or 32 (32 is IEEE float). Other values throw std::runtime_error
normalize, normalize_peaktrue, 0.95Peak-normalise the final mix
ditherDitherType::NoneNone or Triangular
render_tail_sec0Silence appended so effect tails are not cut off
loop_count1Repeat the rendered audio N times
interpolationLinearSample-playback interpolation
worker_threads00 = auto-resolve worker count
deterministic_seed_enabled, seedfalse, 0Seed dither noise for reproducible output

Functions

  • apply_render_options(buf, opts) โ€” tail, then loop, then normalise, then clamp.
  • render(StereoBuffer, path, opts) and render(Arrangement, path, opts) โ€” apply options and write a WAV.
  • music::render_to_buffer(arrangement, opts) โ€” returns the processed buffer without writing a file.

Full API listing

wauvio/ext/core/render.hpp

wauvio::enum class DitherType

enum class DitherType { None, Triangular };

wauvio::struct RenderOptions

struct RenderOptions
    int    sample_rate      = 44100;
    int    channels         = 2;
    int    bit_depth        = 16;
    bool   normalize        = true;
    float  normalize_peak   = 0.95f;
    DitherType dither       = DitherType::None;
    double render_tail_sec  = 0.0;
    int    loop_count       = 1;
    wauvio::music::InterpolationQuality interpolation = wauvio::music::InterpolationQuality::Linear;
    unsigned worker_threads = 0;
    bool     deterministic_seed_enabled = false;
    uint64_t seed = 0;
    inline unsigned resolve_worker_count(unsigned requested)
    inline void write_u32le(std::vector<unsigned char>& out, uint32_t v)
    inline void write_u16le(std::vector<unsigned char>& out, uint16_t v)
    inline float dither_sample(float s, DitherType dither, std::mt19937& rng)
    inline void write_wav_custom(const StereoBuffer& buf, const std::string& path, int sample_rate,
                                  int bit_depth, DitherType dither, uint64_t seed, bool use_seed)

inline void apply_render_options(StereoBuffer& buf, const RenderOptions& opts)
inline void render(const StereoBuffer& buf_in, const std::string& path, const RenderOptions& opts = RenderOptions())
    inline StereoBuffer render_to_buffer(const Arrangement& arr, const RenderOptions& opts = RenderOptions())
inline void render(const wauvio::music::Arrangement& arr, const std::string& path, const RenderOptions& opts = RenderOptions())