Guides & examples

Concepts for beginners

You do not need to know audio programming to use Wauvio, but a handful of ideas come up everywhere. This page explains them in plain terms. Skim it once, then jump to the guide for the part of the library you need.

How to read these docs

  • Guides (this section) are task-based, with complete programs you can compile and run. Start here.
  • Reference pages (Core, Music layer, FX, …) explain what each class does and list every declaration. Use them when you know what you are looking for.
  • Every example is downloadable and was compiled and run against this version of the source.

Core ideas

Audio is a list of numbers

Sound on a computer is a long list of numbers (samples), each describing the speaker position at one instant. In Wauvio that list is a Buffer (a std::vector<float>) for mono sound, or a StereoBuffer (two buffers, L and R) for stereo. Values normally sit between -1 and +1. Everything in the engine takes or returns buffers, so you can always inspect or modify the audio yourself.

Sample rate

The sample rate is how many numbers make up one second. The default is 44100 per second (CD quality). Most functions take a sample_rate argument that you can leave at its default.

Rendering is offline

Wauvio computes whole sounds at once and hands you the result; it is not a real-time plugin host. You describe music, call render(), then save a WAV file (or play the buffer). Rendering a long piece takes real compute time, so compile with -O2.

Notes: three ways to say “which pitch”

FormExampleWhere it is used
Frequency in Hz440.0, theory::notes::A4Core: oscillators, seq::Track
MIDI note number69 (A4), 60 (middle C)Music layer, MIDI, vocals, SFX pitch parameters. Each +1 is one semitone; +12 is one octave
Name constanttheory::notes::Cs4 (C♯4)Core. Sharps are spelled Cs, Ds… flats use the enharmonic sharp

theory::midi_to_freq(n) converts a MIDI note to Hz.

Time: seconds, beats and ticks

The core and music layer use seconds. Use Tempo(bpm).beat_seconds() to convert from beats. MIDI files and the vocal Singer use ticks (480 ticks = one quarter note by default). The SFX engine accepts both seconds and beats.

Loudness and clipping

If a sample goes beyond ±1 it is clipped when saved, which sounds harsh. Use normalize(buffer, 0.9) to scale the loudest peak to 0.9, or the RenderOptions normalisation in the music layer. For finished music, the FX suite can set a target loudness (LUFS).

Determinism

Anything random in Wauvio (noise, humanisation, SFX variation, vocal imperfection) is seeded. Same program, same seed, same audio. Change the seed to get a different but repeatable result.

Which part do I need?

I want to…UseGuide
Make a synth sound from oscillators, filters, envelopesCoreCore guide
Write music for realistic instrumentsMusic layerMusic layer guide
Mix, EQ, compress, reverb, masterFX suiteFX guide
Play a MIDI file with instruments (or a SoundFont)MIDI + SF2MIDI guide
Generate risers, impacts, glitches, game/video SFXSFX engineSFX guide
Make a synthetic voice sing or speak JapaneseVocal engineVocal guide

Troubleshooting

SymptomLikely cause and fix
Compile error about C++ standardCompile with -std=c++17 (or newer).
Windows: linker error mentioning waveOutLink winmm.lib (-lwinmm with MinGW). Only needed for playback.
Linux: play() makes no soundPlayback pipes audio to FFmpeg; install it. Saving WAVs does not need it.
The WAV is silentCheck you did not render a rest, that note durations are > 0, and that the instrument/part exists. Try normalize().
Reverb or echo tail is cut offLeave room: in the music layer set RenderOptions::render_tail_sec; with fx::Chain::process the tail is kept automatically; in the core, append zeros to the buffer first.
Sound is distorted/crunchyPeaks above ±1. Lower gains or normalise before saving.
Crash or garbage after adding tracksInstruments are held by pointer in tracks. Keep each instrument object alive until after render().
SFX: sfx::Error on set()The value is outside the parameter’s range. The message lists valid parameter names; ranges are in the dictionary.
Vocal: wrong or missing syllablesUse hiragana, katakana or romaji, one syllable per note. See Lyric input; Singer::diagnostics() reports problems.

Glossary

TermMeaning
ADSRAttack, Decay, Sustain, Release: the shape of a note’s volume over time
LFOLow-frequency oscillator: a slow wobble used to modulate pitch, volume or filter
FormantA resonance of the vocal tract; the pattern of formants is what makes vowels sound different
Insert / bus / sendMixer routing: an insert processes one track; a bus is a shared channel (e.g. a reverb); a send feeds some of a track to a bus
SidechainUsing one signal (e.g. a kick) to control an effect on another (e.g. ducking a pad)
LUFSA loudness unit that models human hearing; streaming services target around −14
IRImpulse response: a recording of a room used by convolution reverb
SeedA number that makes “random” results repeatable

What next?

Open the Core guide for the simplest possible programs, or listen to what Wauvio can do.