Hi all,
A while ago I tried to play some music (encoded as ALAC .m4a) from my NAS on Mac OS 9 and it didn't work. I did a bit of a search on the issue and found this thread:
http://macos9lives.com/smforum/index.php/topic,4169.msg28636.html#msg28636 which confirmed my suspicions that it wasn't supported.
I have some limited experience in C(++) development, so I wanted to have a go at providing some sort of support for this format. As Apple open-sourced the ALAC code in about 2011 I thought that would be a good place to start. A little bit of wrangling (changing options to make errors go away) got it to compile in CodeWarrior. I used SIOUX and ccommand to get it up and running quickly. Once I'd done this I realised that the provided utility, alacconvert, only supported ALAC in the CAF container format, which is used by basically nobody.
I did some more digging online and found an unofficial ALAC decoder released by David Hammerton around 2005, last updated 2009. As no applications available for Mac OS 9 support the format, I don't think encoding support is very important. This code is more useful to me than the Apple supplied code because it reads .m4a files.
I imported it into CodeWarrior and after changing a few options and altering the code slightly to work with SIOUX I was able to convert my first file! Just to be sure I decoded the same file on my modern Hackintosh and compared the results – exactly the same!
I have attached the utility to this post, it can be used by:
- Open the 'alac' application
- In the text field enter '-f <path to output wave file>.wav <path to input m4a file>.m4a'. You can also enter '-h' to see the original help. The window will vanish and the computer will do nothing for as long as it takes to decode your file
- Play your freshly decoded file!
The logical next step to my mind is to create a drag-and-drop conversion utility so you can drop a few .m4a files and have them converted to .wav or raw PCM. It would be good if there was a progress bar too. I am working on this at the moment but as I say my experience of Mac OS 9 development is non-existent. Happily I have found an example for a drop utility bundled with CodeWarrior 8 Pro.
I am not clear on how to go from an FSSpec to a FILE pointer... maybe I am thinking too much into it. I am going to do some reading into the subject. EDIT: I have found the function I need, it's FSP_fopen.
I am intrigued by a comment made by the original author on his webpage – 'In theory one should be able to stream data to the decoder.' – this makes me think it would be theoretically possible to write a QuickTime plugin to allow the files to be played natively. From what I gather the way to do this in the Classic Mac OS is to write a Sound Manager component. If anyone knows more on this topic or can point me to documentation with minimal effort I would be interested.
I have downloaded OGG Vorbis components for Mac OS 9. I haven't had a chance to look at them yet but I am hoping the source is included or at least available somewhere...
Cheers,
Ivan
TL;DR Very basic command line utility to decode ALAC now available for Mac OS 9!