explaingit

mackron/miniaudio

6,761CAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A single C source file that adds audio playback and recording to any program, no external dependencies, works on Windows, macOS, Linux, iOS, Android, and web browsers via Emscripten.

Mindmap

mindmap
  root((miniaudio))
    What It Is
      Single C file
      No dependencies
    Platforms
      Windows macOS Linux
      iOS Android
      Web via Emscripten
    API Levels
      High-level playback
      Low-level raw audio
      Node graph effects
    Features
      WAV FLAC MP3 decode
      Resampling
      Spatial audio
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add sound effects and background music to a C or C++ game by dropping in a single header file.

USE CASE 2

Build a cross-platform command-line audio player that runs on Windows, macOS, and Linux with no install steps.

USE CASE 3

Process raw audio streams or build a custom effects chain using the low-level node graph API.

USE CASE 4

Create a voice recorder app on Android or iOS using the built-in capture API.

Tech stack

C

Getting it running

Difficulty · easy Time to first run · 30min

Drop in one header file and compile, no external dependencies needed on Windows or macOS.

Use freely for any purpose including commercial use, choose between public domain with no restrictions or MIT which asks you to keep the copyright notice.

In plain English

miniaudio is a C library that handles audio playback and audio capture for programs. The entire library ships as a single source file, which means you add one file to your project and start playing sounds, rather than installing or configuring a separate audio system. The library requires no external dependencies beyond what is already included with any standard C compiler. On Windows and macOS it requires nothing extra at all. On Linux and similar systems you link two standard system libraries. This keeps the setup simple: drop in the files, compile, and it works. It runs on a wide range of platforms, including Windows, macOS, iOS, Linux, the BSD family of operating systems, Android, Raspberry Pi, and web browsers via Emscripten. Each platform uses the audio backend that fits it best, such as WASAPI on Windows, Core Audio on Apple devices, ALSA or PulseAudio on Linux, and Web Audio in browsers. There are two levels of API. The high-level API lets you load a sound file and play it in just a few lines of code. The low-level API gives you direct access to raw audio data, which is useful if you need precise control over how audio is processed. Between these two, miniaudio includes a node graph system for building custom audio processing chains, mixing multiple sounds, adding effects, and optional 3D spatial audio positioning. Decoding is built in for WAV, FLAC, and MP3. Encoding is supported for WAV. The library also includes resampling (converting between different sample rates), channel mapping, basic waveform generation for things like sine waves and noise, and a set of built-in filters and effects. Documentation lives at miniaud.io and also inside the header file itself. The license gives you a choice between public domain terms or a permissive no-attribution MIT variant.

Copy-paste prompts

Prompt 1
Using the miniaudio C library, write code to load and play an MP3 file on Windows using the high-level API.
Prompt 2
Show me how to use miniaudio's node graph to mix two audio streams together and apply a low-pass filter.
Prompt 3
Help me integrate miniaudio into my Emscripten web app so it plays WAV files in the browser.
Prompt 4
Write a minimal C program using miniaudio that captures microphone input and saves it to a WAV file.
Open on GitHub → Explain another repo

← mackron on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.