Repolode
mackron

mackron/miniaudio

A C audio playback and capture library distributed as a single source file, with no external dependencies.

Stars
7,383
Forks
620
Open issues
4
Last commit
5 hours ago

What is it?

miniaudio is a C library for playing and capturing audio. It is distributed as one source file and one header, and it depends only on the C standard library, so it can be added directly to a project without installing additional packages.

The library offers a low-level API for direct access to raw audio data and a high-level API for sound management, mixing, effects, and optional 3D spatialization. It includes a node graph for building custom mixing and effect chains, built-in decoding for WAV, FLAC, and MP3 with support for custom decoders, WAV encoding, resampling, and channel mapping.

miniaudio targets Windows, macOS, iOS, Linux, BSD variants, Android, Raspberry Pi, and Emscripten/HTML5. Each platform uses its native audio backend, such as WASAPI, Core Audio, ALSA, PulseAudio, or AAudio, and custom backends can be added without modifying the library source.

Key features

  • 01Ships as a single C source file with no external dependencies beyond the standard library.
  • 02Offers both low-level access to raw audio data and a high-level API for sound playback and mixing.
  • 03Decodes WAV, FLAC, and MP3 out of the box and accepts custom decoders.
  • 04Provides a node graph for flexible mixing and effect processing.
  • 05Supports resampling, channel mapping, and data format conversion.
  • 06Uses native audio backends on Windows, macOS, Linux, BSD, Android, and the web.

Use cases

  • Adding sound effects or background music playback to a C or C++ game.
  • Recording microphone input in a cross-platform desktop or embedded application.
  • Decoding audio files to raw PCM for analysis or processing.
  • Playing audio in a WebAssembly build via Emscripten.

Quick start

  1. 1

    Add miniaudio.c and miniaudio.h to your source tree

  2. 2

    Compile miniaudio.c like any other source file (on Linux and BSD, link -lpthread and -lm)

    cc -o app app.c miniaudio.c -lpthread -lm
  3. 3

    Include miniaudio.h in your code and call the API, e.g. ma_engine_play_sound

Things to know

  • The license is a choice of public domain or MIT No Attribution, but the metadata lists it as NOASSERTION, so verify terms before use.
  • ABI compatibility is not guaranteed between versions, so vendoring the source is recommended over using a shared library.

Topics

FAQ

What is miniaudio?
A C audio playback and capture library distributed as a single source file, with no external dependencies. miniaudio is a C library for playing and capturing audio. It is distributed as one source file and one header, and it depends only on the C standard library, so it can be added directly to a project without installing additional packages.
Is miniaudio free to use? What license does it have?
miniaudio is open source under the Other license. Check the license terms before using it in commercial products.
Is miniaudio still maintained?
Actively maintained. The last commit to miniaudio was on Oct 21, 2026.
What can I use miniaudio for?
Adding sound effects or background music playback to a C or C++ game. Recording microphone input in a cross-platform desktop or embedded application. Decoding audio files to raw PCM for analysis or processing. Playing audio in a WebAssembly build via Emscripten.
How do I install miniaudio?
Add miniaudio.c and miniaudio.h to your source tree Compile miniaudio.c like any other source file (on Linux and BSD, link -lpthread and -lm): cc -o app app.c miniaudio.c -lpthread -lm Include miniaudio.h in your code and call the API, e.g. ma_engine_play_sound
Where can I get miniaudio?
The source code and installation instructions are on GitHub: https://github.com/mackron/miniaudio

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects