An open source FLAC decoder.
Download dr_flac.h
dr_flac is an open source library for decoding FLAC 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.
  • Seamless Ogg encapsulation with support for multiplexed streams.
  • Supports metadata.
  • Decode from any data source including files, a block of memory or from callbacks.
  • A consistent API with dr_wav and dr_mp3.
Example 1: Decoding from a file.
#include "dr_flac.h"

int main()
    drflac* pFlac = drflac_open_file("my_song.flac", NULL);
    if (pFlac == NULL) {
        return -1;

    int32_t* pSampleData = (int32_t*)malloc((size_t)pFlac->totalPCMFrameCount * pFlac->channels * sizeof(int32_t));
    drflac_read_pcm_frames_s32(pFlac, pFlac->totalPCMFrameCount, pSampleData);

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

    return 0;
Developed by David Reid -