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”
| Form | Example | Where it is used |
|---|---|---|
| Frequency in Hz | 440.0, theory::notes::A4 | Core: oscillators, seq::Track |
| MIDI note number | 69 (A4), 60 (middle C) | Music layer, MIDI, vocals, SFX pitch parameters. Each +1 is one semitone; +12 is one octave |
| Name constant | theory::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… | Use | Guide |
|---|---|---|
| Make a synth sound from oscillators, filters, envelopes | Core | Core guide |
| Write music for realistic instruments | Music layer | Music layer guide |
| Mix, EQ, compress, reverb, master | FX suite | FX guide |
| Play a MIDI file with instruments (or a SoundFont) | MIDI + SF2 | MIDI guide |
| Generate risers, impacts, glitches, game/video SFX | SFX engine | SFX guide |
| Make a synthetic voice sing or speak Japanese | Vocal engine | Vocal guide |
Troubleshooting
| Symptom | Likely cause and fix |
|---|---|
| Compile error about C++ standard | Compile with -std=c++17 (or newer). |
Windows: linker error mentioning waveOut | Link winmm.lib (-lwinmm with MinGW). Only needed for playback. |
Linux: play() makes no sound | Playback pipes audio to FFmpeg; install it. Saving WAVs does not need it. |
| The WAV is silent | Check 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 off | Leave 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/crunchy | Peaks above ±1. Lower gains or normalise before saving. |
| Crash or garbage after adding tracks | Instruments 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 syllables | Use hiragana, katakana or romaji, one syllable per note. See Lyric input; Singer::diagnostics() reports problems. |
Glossary
| Term | Meaning |
|---|---|
| ADSR | Attack, Decay, Sustain, Release: the shape of a note’s volume over time |
| LFO | Low-frequency oscillator: a slow wobble used to modulate pitch, volume or filter |
| Formant | A resonance of the vocal tract; the pattern of formants is what makes vowels sound different |
| Insert / bus / send | Mixer 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 |
| Sidechain | Using one signal (e.g. a kick) to control an effect on another (e.g. ducking a pad) |
| LUFS | A loudness unit that models human hearing; streaming services target around −14 |
| IR | Impulse response: a recording of a room used by convolution reverb |
| Seed | A number that makes “random” results repeatable |
What next?
Open the Core guide for the simplest possible programs, or listen to what Wauvio can do.