How can I read the M4A (AAC / ALAC) format in-code?

I’m writing a game that does audio processing (like Audiosurf) and it’s crucial that I be able to support Apple’s M4A container format and the audio formats within. All I need to do is read the raw wave data + any metadata tagged with the file, all the processing is then handled by my own code, but I simply CANNOT find any solutions for doing this (in Unity) anywhere.

I see there is faad2 which looks really nice but it’s just a C++ library and I can’t do much with it, beyond port it all to C# myself (which I really don’t want to have to do).

Does anybody know of any way I might be able to achieve this? Licensing is not an issue, I just really want to find a solution to this without having to pull out the format specification and write one myself.

On the topic of writing things for myself, if it does come down to that, how might one write a plugin to interface with the FAAD2 .dll? Are there any resources for that? Sorry, kind of a second question, I know. Let’s bring it back on topic.

TL;DR I really need to support Apple’s M4A format in-code. How do?

Building a plugin is not that difficult. You basically write a wrapper that defines C# functions which trigger extern calls into the native code and the native code can also send limited messages into unity.

This manual page covers the basics, and there’s a link at the bottom to a sample plugin for iOS.

It’s probably the easiest way to go, much easier than porting the library to C#.