A single file audio playback and capture library.
Download miniaudio.h
miniaudio is a single file audio playback and capture library written in C. Written from scratch, it has no external dependencies with the exception of the C standard library and necessary platform-specific backends.
Works Out of the Box
Just add to your source tree and go. There's no need to install any dependencies or development packages, nor are there any build systems to waste time on.
Cross Platform
miniaudio works on all the major desktop and mobile platforms, including Windows, macOS, Linux, BSD, iOS, Android and Web (via Emscripten).
miniaudio has a simple, yet flexible low-level API that gets out of your way. Just initialize a device and start sending audio data via a callback.
And best of all, it's free and open-source!
You can find miniaudio on GitHub
  • Supports playback, capture, full-duplex and loopback (WASAPI only).
  • Device enumeration for connecting to specific devices, not just defaults.
  • Connect to multiple devices at once.
  • Shared and exclusive mode on supported backends.
  • Backend-specific configuration options.
  • Device capability querying.
  • Automatic data conversion between your application and the internal device.
  • Sample format conversion with optional dithering.
  • Channel conversion and channel mapping.
  • Resampling with support for multiple algorithms.
    • Simple linear resampling with anti-aliasing.
    • Optional Speex resampling (must opt-in).
  • Filters.
    • Biquad
    • Low-pass (first, second and high order)
    • High-pass (first, second and high order)
    • Second order band-pass
    • Second order notch
    • Second order peaking
    • Second order low shelf
    • Second order high shelf
  • Waveform generation.
    • Sine
    • Square
    • Triangle
    • Sawtooth
  • Noise generation.
    • White
    • Pink
    • Brownian
  • Decoding (requires external single-file libraries).
    • WAV
    • FLAC
    • MP3
    • Vorbis via stb_vorbis (not built in - must be included separately).
  • Encoding (requires external single-file libraries).
    • WAV
  • Lock free ring buffer (single producer, single consumer).
  • Your choice of either public domain or MIT No Attribution.
  • Entirely contained within a single file for easy integration into your source tree.
  • No external dependencies except for the C standard library and backend libraries.
  • Written in C and compilable as C++, enabling miniaudio to work on almost all compilers.
  • Supports all major desktop and mobile platforms, with multiple backends for maximum compatibility.
    • WASAPI (Windows Vista+)
    • DirectSound (Windows XP+)
    • WinMM (Windows)
    • Core Audio (macOS, iOS)
    • ALSA (Linux)
    • PulseAudio (Cross platform, disabled on Windows, BSD and Android)
    • JACK (Cross platform, disabled on BSD and Android)
    • sndio (OpenBSD)
    • audio(4) (NetBSD, OpenBSD)
    • OSS (FreeBSD)
    • AAudio (Android 8+)
    • OpenSL|ES (Android API level 16+)
    • Web Audio (Web, via Emscripten)
    • Null (Cross platform, not used on Web)
  • Supports custom backends.
Copyright © 2021 David Reid
Developed by David Reid - mackron@gmail.com