## ALAC

Back to home / software / itunes.

Located here is a basic decoder for Apple Lossless Audio Codec files (ALAC). ALAC is a proprietary lossless audio compression scheme. Apple never released any documents on the format.
What I provide here is a C implementation of a decoder, written from reverse engineering the file format. It turns out that most of the algorithms in the codec are fairly well known. ALAC uses an adaptive FIR prediction algorithm and stores the error values using a modified rice or golumb algorithm. Further details are in alac.c.

Although an encoder is not provided, by using the decoder as a sort of specification it should be fairly trivial to write an encoder. By exploiting other lossless audio encoders, such as FLAC, the task will be much easier. Although one wouldn't be able to copy the compression algorithms verbatim, as adaptive compression is used in ALAC and not in FLAC. There are, however, a bunch of academic papers on the issue.

The program located here will not be able to handle all ALAC files, it can only handle mono or stereo files. ALAC allows up to 8 channels. It should be trivial to finish the implementation once I find files that I can test it with. The ALAC decoder supports both 16 and 24 bit sample sizes.

The decoder is fairly self explanatory, it can read an ALAC stream from either a file or from stdin, and write it as raw PCM data or as a WAV file to either stdout or a file. In theory one should be able to stream data to the decoder.

Download & Changelog:

- 0.2.0 - September 5, 2009: Added support for decoding 24-bit ALAC files, various clean ups and bug fixes. Added project files for XCode and Visual Studio. Download Now!
  MD5: cec75c35f010d36e7bed91935b57f2d1
- 0.1.3 - September 30, 2006: Several fixes, supporting files created with random programs, better AMD64 support, etc. Download Now!
  MD5: e2aa1eecefb3c105f2507f3c1dfb1293
- 0.1.1 - November 26, 2005: Supports ALAC files created with newer versions of quicktime, a number of speed optimisations that vastly improve performance, ability to decode m4a files with data before headers and windows improvements. Download Now!
  MD5: 06f358b8aa185dcb3d1e2d80f89570c3
- 0.1.0 - March 5, 2005: Initial release. Download Now!
  MD5: f554fc11ee41a30bc5baf15a0fd07256

Authors / Contributors:

- This program was written by David Hammerton, http://crazney.net/. The audio codec was also reverse engineered by David Hammerton.
- Cody Brocious made some very valuable contributions during the reverse engineering of the codec.
- Thanks to Illustrate (dbPoweramp) for their significant financial support of this project.

Contact info:
See the front page for contact details.

License:

> Copyright (c) 2004 David Hammerton.
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Please let me know what you think of this software!

Apple is a registered trademark of Apple Computer, Inc.