Search code examples
cflacaudio-converter

How to programmatically convert audio (diy)?


I'm thinking about writing a FLAC to ALAC and/or FLAC to AAC converter, probably in C. Is it as simple as reading in one format and outputting another, according to format specs??

Any tips on method, language, etc would be great! Thanks!


Solution

  • Do it yourself all the way? Sounds difficult.

    It is as "simple" as reading in one format and outputting another, but the little details are actually huge behemoths with a lot of rather complex math.

    Basically, you'd have to read in FLAC, parse its container format, decode the FLAC audio into some intermediate form, encode it into Apple Lossless, and put that inside a MPEG4 audio container (because that's what ALAC uses).

    If you gave up on doing it all on your own, and used libraries for decoding FLAC and encoding ALAC, it wouldn't be at all difficult, mind you - it's just that encoders and decoders are not simple to write.

    Look into libflac and libavcodec for encoders/decoders, then writing your program around them shouldn't be too difficult.