I'm trying to program a very basic FLAC player using 100% C# completely from scratch. My understanding of this type of thing is very limited, so I'm using this project as a way to learn about compression and decompression. I'm a computer science and math major currently in university, so I'm not adverse to learning whatever math may be involved.

I've looked up the format specifications on xiph.org and I understand how the headers and all are structured, but I can't seem to find a concise explanation of how the audio compression works. How do I go about converting the frames to pcm?

Sadly, my knowledge of C/C++ is extremely limited, as I only have experience with Java and C#. As such, trying to navigate the c++ code already out there is not a great starting point. I looked at FlacBox and learned quite a bit from it, but it's barely commented at all and I am lost trying to figure out how the conversion from flac to pcm works.

So what should I read as far as math goes so I can get started with this? Where can I find a basic algorithm for converting the audio frames to wav? Thanks.

1 Answer 1


You need to look a little closer at the format page on the FLAC website. The "prediction" paragraph leads to this article, which describes the AudioPak algorithm in detail, and also Shorten.

You should learn and understand these algorithms and the associated math before digging into the source code. That might take awhile.

  • Thanks for pointing me to those documents. I don't mind it taking a while, as long as I can get all the information I need to decode a stream, as opposed to just encoding one.
    – Mirrana
    Commented Apr 25, 2014 at 2:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.