Maul Audio

Audio devices and spatial sound in C, for games, tools and voice applications, with no dependencies beyond each platform's own audio API.

CI License: MIT Release

A program that makes sound has to find the output, play to it without dropouts, follow the user when they plug in headphones, and survive the sound server restarting. A game also wants its sources placed around the listener, muffled behind walls, and ringing in the room they are in. Maul Audio does both, in two parts a program can use apart:

It owns no mixer, voices or decoders: the program mixes, and the library moves its frames to and from the device or renders the sources it is given. Nothing on the audio thread allocates, locks or waits.

Work Time One core in real time
A binaural source, moving 12.2 us about 820 sources
A binaural source, still (with the near field) 6.5 (9.2) us about 1,500 (1,100) sources
A source's direct effects (air absorption, a wall's transmission), moving 3.6 us about 2,800 sources
A source into the third-order bed 1.3 us about 7,700 sources
The bed decoded binaurally 72 us once per listener
A reverb 53 us about 190 reverbs
Noise suppression, mono (16 kHz, 48 kHz) 20, 41 us
Echo cancellation, mono (16 kHz, 48 kHz) 27, 76 us

Per 10 ms of 48 kHz audio on one core of an AMD Ryzen 9 5900X (Linux, Clang 20, Release).

Quick start

It builds with CMake 3.25 or newer and GCC 14 or newer, Clang 19 or newer, or Apple Clang. Ubuntu 24.04's default compiler is GCC 13, which the build refuses, so there install GCC 14, with Git and CMake, and tell CMake to use it:

sudo apt install git cmake gcc-14 pkg-config libpipewire-0.3-dev libasound2-dev libpulse-dev
export CC=gcc-14

Then, on Linux and macOS:

git clone https://github.com/Rawframe-Project/maul-audio.git
cd maul-audio
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
./build/sample_binaural data/hrtf/sadie2-ku100-48k.maudhrtf circle.wav
./build/sample_devices 10

sample_binaural renders a source circling the listener to a WAV file; sample_devices lists the devices and plays a tone for ten seconds. On a machine without a sound device, sample_devices exits 1 and names the cause, such as no stream: maud_errorPlatform. On Linux the build also needs pkg-config and the development headers of PipeWire, ALSA and PulseAudio, which the apt line above installs.

A build/ that GCC 13 already configured keeps that compiler and fails again ("GCC 14 or newer is required"). Remove it and configure again, with CC exported as above, then carry on with the rest of the block from cmake --build build:

rm -rf build && cmake -B build -DCMAKE_BUILD_TYPE=Release

On Windows the library builds with clang-cl, and on the web with Emscripten; Platforms lists what each needs.

Install with cmake --install build --prefix <prefix> and use it from CMake:

find_package(maul-audio REQUIRED CONFIG)
target_link_libraries(app PRIVATE maul-audio::maul-audio)

or through pkg-config as maul-audio. Getting started covers the build options and the model the API follows.

Platforms

Linux, Windows 10 and later, macOS, iOS, Android 11 and later, and browsers through Emscripten, with GCC 14 or Clang 19 and newer (clang-cl on Windows). The public headers are C17 and C++17, so any C or C++ program can include them. CI builds and tests every platform; Platforms lists what each one needs.

Documentation

Maul Audio belongs to the Maul family of standalone C libraries, which share one set of conventions.

Contributing

Issues are welcome. Pull requests are accepted for issues a maintainer has approved; see CONTRIBUTING.md. The project is developed with AI coding agents, directed and reviewed by its maintainers; outside contributions follow the AI policy.

License

MIT; see LICENSE. The default HRTF set in data/hrtf/ is made from the SADIE II database (University of York) under the Apache License 2.0; data/hrtf/sadie2-ku100.notice.txt carries its notice. tools/sofa_to_maudhrtf.py and tools/near_field_table.py use numpy and h5py (BSD 3-Clause); nothing outside the platform's own libraries is linked into the library.