Mac OS 9 Discussion > Development & Programming

Apple Lossless Audio Codec (ALAC) on Mac OS 9

(1/3) > >>

ivan_holmes:
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!

Philgood:
Amazing what is still done for our beloved OS9. Thanks a lot.

I personally use it a lot. Mostly for the VST instruments I grew up with through the early 2000.

IIO:
good work, thank you.

from my perspective it would be even more useful to be able to directly play files.

can you elaborate on how realistic a quicktime codec for a previous unsupported format would be?

IIO:
damn, once more i posted a reply before i´ve read the last two sentences.

yes, that ogg for quicktime should be open source, good idea.

ivan_holmes:

--- Quote from: Philgood on February 02, 2020, 12:25:32 PM ---Amazing what is still done for our beloved OS9. Thanks a lot.

--- End quote ---

--- Quote from: IIO on February 02, 2020, 01:03:42 PM ---good work, thank you.

--- End quote ---
No problem, although I should emphasise that this initial proof of concept involved very little work!

--- Quote from: Philgood on February 02, 2020, 12:25:32 PM ---I personally use it a lot. Mostly for the VST instruments I grew up with through the early 2000.

--- End quote ---
I'm not old enough to have used it back in the day, but I really like the simplicity and charm of OS 9. There's also something very cool about giving new functionality to a supposedly dead system.


--- Quote from: IIO on February 02, 2020, 01:03:42 PM ---from my perspective it would be even more useful to be able to directly play files.
can you elaborate on how realistic a quicktime codec for a previous unsupported format would be?

--- End quote ---

--- Quote from: IIO on February 02, 2020, 01:06:10 PM ---yes, that ogg for quicktime should be open source, good idea.

--- End quote ---
I agree with you and this would be my ultimate goal. I think a port is absolutely realistic as a possibility because third party components are not at all out of the ordinary. The problem will more likely be my skills! As you say the OGG Vorbis component will almost certainly be open source so that will hopefully be a good place to start.
At the moment, a drag and drop application is more reachable for me as a goal so I will see how I get on with that.

Navigation

[0] Message Index

[#] Next page

Go to full version