An open source WAV decoder.
Download dr_wav.h
dr_wav is an open source library for decoding WAV files. It's written in C in a single file with no dependencies except for the C standard library, and is released into the public domain.
  • Public domain.
  • Single file.
  • No dependencies except for the C standard library.
  • Sample exact reading and seeking.
  • Decode from any data source including files, a block of memory or from callbacks.
  • Seamless conversion of common internal data formats to signed 32-bit PCM, signed 16-bit PCM or IEEE 32-bit floating point. Supported internal formats include:
    • Unsigned 8-bit PCM
    • Signed 12-bit PCM
    • Signed 16-bit PCM
    • Signed 24-bit PCM
    • Signed 32-bit PCM
    • IEEE 32-bit floating point
    • IEEE 64-bit floating point
    • A-law and μ-law
    • Microsoft ADPCM
    • IMA ADPCM (DVI, format code 0x11)
  • Seamless support for Sony Wave64 (W64).
  • A consistent API with dr_flac.
Example 1: Decoding from a file.
#include "dr_wav.h"

int main()
    drwav wav;
    if (!drwav_init_file(&wav, "my_sound.wav", NULL)) {
        return -1;

    int32_t* pSampleData = (int32_t*)malloc((size_t)wav.totalPCMFrameCount * wav.channels * sizeof(int32_t));
    drwav_read_pcm_frames_s32(&wav, wav.totalPCMFrameCount, pSampleData);

    // At this point pSampleData contains every decoded sample as signed 32-bit PCM.

    return 0;
Developed by David Reid -