Overview

Getting started

Requirements

  • A C++17 compiler (GCC, Clang or MSVC).
  • No libraries to build or link, with one exception: on Windows, link winmm.lib for audio playback (-lwinmm with MinGW).
  • For sound on Linux, FFmpeg must be installed: playback pipes PCM to ffmpeg (ALSA, then PulseAudio) or ffplay. Rendering to WAV needs nothing.
  • Wauvio is header-only: add the repository root to your include path and include the header you need.

Which header?

IncludeGives you
"wauvio.hpp"The core (wauvio/core/*)
"wauvio/ext.hpp"Core + music layer + instruments + sampling + genre system
"wauvio/fx.hpp"Core + full FX suite
"wauvio/fx/ext.hpp"FX + music layer + Arrangement→Mixer bridge and fx::write_wav
"wauvio/midi.hpp"Music layer + MIDI loading, rendering, writing, genre
"wauvio/fx/midi.hpp"MIDI + FX + MIDI→Mixer bridge
"wauvio/sf2.hpp"Music layer + SoundFont loader
"wauvio/sfx.hpp"SFX engine (needs only the core)
"wauvio/vocal/v3.hpp"Vocal engine v3 (also v1.hpp, v2.hpp; v3_fx.hpp adds the FX chain)

Compile

g++ -std=c++17 -O2 -I/path/to/wauvio-repo my_program.cpp -o my_program
# Windows (MinGW): add -lwinmm

Headers are large; -O2 is recommended for rendering speed (the vocal and SFX engines are CPU-heavy).

First sound — core

#include "wauvio.hpp"
using namespace wauvio;

int main() {
    seq::Instrument ins;
    ins.shape = osc::WaveShape::BL_Sawtooth;
    seq::Track t;
    t.instrument = ins;
    t.add(theory::notes::C4, 0.5, 0.8).add(theory::notes::E4, 0.5, 0.8)
     .rest(0.25).add(theory::notes::G4, 0.5, 0.8);
    Buffer b = t.render();
    normalize(b);
    save_wav(b, "first.wav");      // 44.1 kHz, 16-bit mono
    // play(b);                    // blocking playback
}

First arrangement — music layer

#include "wauvio/ext.hpp"
using namespace wauvio;

int main() {
    music::Arrangement arr;
    instruments::Trumpet trumpet;
    music::Melody m = { {60, 0.5}, {64, 0.5}, music::rest(0.5), {72, 1.0} };
    arr.add(trumpet, m);
    arr.limiter();
    render(arr, "arrangement.wav");
}

Next

Conventions worth knowing

  • Sample rate defaults to 44100 Hz (global_config().sample_rate); functions taking sample_rate = 0 use it.
  • Parameters are public fields. Where coefficients are cached, call the matching init()/update_coeffs()/prepare() after changing them.
  • Instruments are referenced by pointer from tracks; keep them alive while rendering.
  • Rendering is deterministic wherever a seed exists (SFX, vocal, genre, noise).