mackron/miniaudio

Public

Audio playback and capture library written in C, in a single source file.

  • Stars7.4k+27 tuần này
  • Forks624
  • Watchers101
  • Issues0
  • Ngày tạo21/10/2016
  • Cập nhật gần nhất31/10/2026
  • Ngôn ngữC
  • Giấy phép—
README.md15.2 KBRaw

miniaudio

An audio playback and capture library in a single source file.

discord x

Features - Examples - Building - Documentation - Supported Platforms - Security - License

miniaudio is written in C with no dependencies except the standard library and should compile clean on all major compilers without the need to install any additional development packages. All major desktop and mobile platforms are supported.

Features

  • Simple build system with no external dependencies.
  • Simple and flexible API.
  • Low-level API for direct access to raw audio data.
  • High-level API for sound management, mixing, effects and optional 3D spatialization.
  • Flexible node graph system for advanced mixing and effect processing.
  • Resource management for loading sound files.
  • Decoding, with built-in support for WAV, FLAC, and MP3, in addition to being able to plug in custom decoders.
  • Encoding (WAV only).
  • Data conversion.
  • Resampling, including custom resamplers.
  • Channel mapping.
  • Basic generation of waveforms and noise.
  • Basic effects and filters.

Refer to the Programming Manual for a more complete description of available features in miniaudio.

Examples

This example shows one way to play a sound using the high level API.

#include "miniaudio/miniaudio.h"

#include <stdio.h>

int main()
{
    ma_result result;
    ma_engine engine;

    result = ma_engine_init(NULL, &engine);
    if (result != MA_SUCCESS) {
        return -1;
    }

    ma_engine_play_sound(&engine, "sound.wav", NULL);

    printf("Press Enter to quit...");
    getchar();

    ma_engine_uninit(&engine);

    return 0;
}

This example shows how to decode and play a sound using the low level API.

#include "miniaudio/miniaudio.h"

#include <stdio.h>

void data_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount)
{
    ma_decoder* pDecoder = (ma_decoder*)pDevice->pUserData;
    if (pDecoder == NULL) {
        return;
    }

    ma_decoder_read_pcm_frames(pDecoder, pOutput, frameCount

Nội dung README thuộc về mackron và cộng đồng đóng góp, giấy phép Không có giấy phép. Nguồn: github.com/mackron/miniaudio