Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsJul 14, 2026·3 min de lectura

miniaudio — Single-File Audio Playback and Capture Library in C

miniaudio is a single-file, public-domain audio library for playback, capture, and decoding. It supports all major platforms and audio backends with zero external dependencies, making it the simplest way to add audio to C/C++ applications.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
miniaudio
Comando de instalación directa
npx -y tokrepo@latest install 75b19b53-7f83-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con dry-run.

Introduction

miniaudio is a C library contained in a single header file that handles audio playback, recording, and decoding across all major platforms. It abstracts away platform-specific audio APIs while remaining lightweight enough for game engines, embedded apps, and quick prototypes.

What miniaudio Does

  • Plays and captures audio on Windows (WASAPI), macOS (Core Audio), Linux (PulseAudio, ALSA), and more
  • Decodes WAV, FLAC, and MP3 files with built-in decoders
  • Provides a high-level engine API for spatial audio and sound groups
  • Supports sample rate conversion, channel mapping, and format conversion
  • Runs on Android, iOS, Emscripten, and BSD in addition to desktop OSes

Architecture Overview

miniaudio has two layers: a low-level device API that talks to platform audio backends, and a high-level engine that manages sound instances, effects, and spatialization. All audio processing happens in a lock-free callback running on a dedicated audio thread to avoid glitches.

Self-Hosting & Configuration

  • Copy the single header file into your project; define MINIAUDIO_IMPLEMENTATION in one .c file
  • Choose a backend at compile time or let miniaudio auto-detect the best option
  • Configure buffer sizes and sample rates via ma_device_config
  • Use the engine API for game audio with 3D spatialization and groups
  • Link no additional libraries; miniaudio loads platform APIs at runtime

Key Features

  • Truly single-file with zero external dependencies
  • Public-domain (Unlicense or MIT-0) — no licensing concerns
  • Low-latency audio suitable for real-time games and music apps
  • Built-in WAV, FLAC, and MP3 decoders
  • Lock-free design prevents audio glitches from main-thread stalls

Comparison with Similar Tools

  • SDL_mixer — requires SDL; miniaudio is fully standalone
  • OpenAL Soft — 3D audio focus but heavier; miniaudio is simpler to integrate
  • FMOD/Wwise — commercial game audio middleware; miniaudio is free and open source
  • PortAudio — low-level only with no decoders; miniaudio adds playback and decoding in one file

FAQ

Q: Can I use miniaudio in a commercial project? A: Yes. It is dual-licensed under Unlicense and MIT-0, both of which allow unrestricted commercial use.

Q: Does miniaudio support MIDI? A: No. miniaudio focuses on PCM audio playback, capture, and decoding. Use a separate library for MIDI.

Q: How do I add effects like reverb? A: miniaudio includes a node graph system for chaining effects. Built-in nodes include low-pass filter, delay, and splitter.

Q: What is the latency? A: With default settings, latency is typically 10-30ms depending on the platform and backend.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados