Slashdot Mirror


Opensource Apple Lossless Decoder Released

Cody Brocious writes "David Hammerton has released version 1.0 of an ALAC decoder. This allows users of operating systems not supported by iTunes/QuickTime to listen to their Apple Lossless files, a proprietary competitor to FLAC. This is a large leap forward in audio codec interoperability, and paves the way for an ALAC encoder." The site also asks for additional help on the project.

25 of 294 comments (clear)

  1. Small correction by bajo77 · · Score: 5, Informative

    This initial release is version is 0.1, not 1.0

  2. Re:Stream Ripping? by crazney · · Score: 5, Informative

    Hey,

    I'm the author of the decoder in quesiton.

    I originally started doing the decoder so I could have my own little Airport Express emulator.

    However, Apple have (for once) secured their system pretty well, and I have been unable to break their encryption so far. I know exactly what I need to do, and I'm fairly confident that I'll be able to do it... But first I actually need to get one of these devices.

    So yeah, It's certinately on the table. Shouldn't be too far off.

    --
    stuff
  3. Re:Pardon me for asking... by SuperQ · · Score: 3, Informative

    According to an article by a developer of the Rio Karma, they needed something that could be decoded by the iPod's CPU.

    The Rev 1-3 iPods have a smaller CPU cache than the Rio Karma, or the iPod Rev 4 and the iPod Mini. The preformance hit for accessing memory while decoding is too great, so you must fit the decoder in the cache.

    ALAC was designed for the simple reason that it has a smaller decoder on the iPod than FLAC.

    Same reason why OGG can't be used on iPod Rev 1-3. (and for consistancy, not on the other two) Not enough CPU cache to decode.

  4. Re:Pardon me for asking... by mrchaotica · · Score: 4, Informative

    In addition to SuperQ's answer regarding the iPod, they needed a codec that could be encoded in realtime, to work with the Airport Express. FLAC is significantly smaller, but it takes significantly longer to encode so it wasn't suitable for their purpose.

    --

    "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

  5. Re:Pardon me for asking... by crazney · · Score: 5, Informative

    I don't really believe that. As I mention on the web page, ALAC is very similar to FLAC - however it is slightly more complicated, not less. It requires more CPU power to decode ALAC than it does to decode FLAC. That said, it should generally have a better rate of compression.

    --
    stuff
  6. If you think they've been doing that "lately", by mcc · · Score: 4, Informative

    Then you really weren't paying attention to Apple before that point where all the slashdot editors bought powerbooks. Apple Legal has always* fallen on any and all leaks in their wall of silence like rabid dogs on a barbeque-sauce-covered Pre-K student. It's just that the media's never actually paid attention before this latest event, so if you're only listening to the media it seems like this is a new development.

    But as far as this project goes, if they performed their reverse engineering in a proper manner they shouldn't have anything to worry about.

    * At least since Spindler left. But even before that Apple Legal wasn't nice

    1. Re:If you think they've been doing that "lately", by Have+Blue · · Score: 2, Informative

      That's at least partly because no one has ever tried to defend the "right to leak" before; they just gave up the info and it blew over quickly.

  7. Re:But is it better? by mrchaotica · · Score: 2, Informative

    ALAC is different. Apple needed it because FLAC is too good -- it takes too much time/CPU power to encode. I think they would have used FLAC if they could have, but it's too heavy to work in the (original) iPod and the Airport Express.

    --

    "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

  8. Re:Pardon me for asking... by damiam · · Score: 4, Informative
    Same reason why OGG can't be used on iPod Rev 1-3

    I wouldn't say that quite so authoritatively. At the moment, the reason Vorbis can't be played on the ipod is because no one's put much effort into optimizing the decoder. It may be that it's impossible, but I've heard several Vorbis and iPodLinux developers say they think the iPod has the potential to play Vorbis, albeit maybe with reduced battery life.

    --
    It's hard to be religious when certain people are never incinerated by bolts of lightning.
  9. Re:Pardon me for asking... by Anonymous Coward · · Score: 1, Informative
    FLAC is significantly smaller, but it takes significantly longer to encode

    That's a lie.
  10. Re:Stream Ripping? by crazney · · Score: 4, Informative

    Nope. That's the public key that's been hacked - that lets you encrypt data. Decrypting data requires the private key. This has not been hacked yet.

    David

    --
    stuff
  11. Re:questions by cbrocious · · Score: 3, Informative

    Not yet. There are people working to integrate it into ffmpeg/libavcodec... from there it should work in MPlayer at least.

    --
    Disconnect and self-destruct, one bullet at a time.
  12. Re:Pardon me for asking... by Anonymous Coward · · Score: 5, Informative
    I don't really believe that. As I mention on the web page, ALAC is very similar to FLAC - however it is slightly more complicated, not less. It requires more CPU power to decode ALAC than it does to decode FLAC. That said, it should generally have a better rate of compression.
    Huh? Comparison tests have found that ALAC compression is, on average, slightly worse than FLAC.

    http://members.home.nl/w.speek/comparison.htm
    http://flac.sourceforge.net/comparison.html

  13. Re:Let us rejoice! by znu · · Score: 3, Informative

    I get so tired of people misunderstanding QuickTime.

    QuickTime is not a codec. It's a media architecture. The MOV file format can theoretically embed arbitrary numbers of tracks (of audio, video, 3D, animated sprites, vector graphics) in any format, and QuickTime supports several dozen formats of various sorts out of the box. ALAC, like every other codec Apple implements on OS X, is just a QuickTime plugin.

    Not much of the QuickTime content you find around the web uses it, though, so I don't see how this is going to help QuickTime movie playback on Linux much. But Apple is really pushing MPEG-4 these days, so if Linux has a good MPEG-4 implementation, compatibility problems should go away eventually.

    --
    This space unintentionally left unblank.
  14. Re:Pardon me for asking... by Anonymous Coward · · Score: 1, Informative

    How exactly does a company avoid patent infringment by writing their own code, instead of using and contributing to someone elses code? Apple could well be infringing on any number of patents with ALAC (Not that I think they are), just as easily as they could with FLAC (Again, not that I think FLAC infringes). In todays climate, any code can easily infringe and large companies like Apple have legal departments whos job it is to perform patent searches for any code they're working on. It is just as easy to perform a search on a peice of Open Source code as it is on their own in house code.

  15. Re:Pardon me for asking... by cbrocious · · Score: 5, Informative

    You're very, very far off.

    ALAC has absolutely nothing to do with the MPEG-4 lossless encoding. (I should know, as I worked on the decoder as well. See the authors list on the site)
    This is a common misconception that having an opensource decoder (and encoder soon... I have a prototype already) will hopefully fix.

    --
    Disconnect and self-destruct, one bullet at a time.
  16. Honest answer by mcc · · Score: 4, Informative
    Nah. "Proprietary format" just means "the real world doesn't know how to decode it yet". There isn't some inherent right for proprietary formats to remain proprietary.

    There are only a handful of ways a proprietary format can remain proprietary:
    1. License agreements. This is the most common one, and almost certainly Apple is using this one. The idea is that if you give someone a document describing how your formats work you say "if you don't agree to use this information only in certain ways you can't have it", or if you give someone a decoder for the format you say "if you don't agree not to take apart this decoder and see how it works you can't have it". I'd guess the iTunes clickthrough agreement says something like the latter. But this is sort of the entire idea of cleanroom reverse engineering; license agreements like those on iTunes really are no hindrance whatsoever to a reverse engineer, so long as they choose to do that reverse engineering in a way that doesn't violate the license agreement. And that's not really that hard. Pretty much just don't use a disassembler and you're fine.
    2. Patents. I'm pretty sure this one really doesn't work. As far as I am aware-- I can't find an explicit cite for this in a brief google search, maybe someone else can give us one-- reverse engineered implementations created for purposes of compatibility can provide protection against patent claims. Since "formats" and "compatibility" are almost the same word, this makes it often implausible to use patents as a block on unauthorized use or interpretation of a format, such as an audio codec or a video game API. Apple probably has some sort of patent on ALAC-- like all research-oriented commercial software developers, they patent absolutely everything they do-- but I've never known Apple to use patents in this exact fashion and as far as I can tell their success would be incredibly questionable even if they tried. I'd ask the guy who reverse engineered the decoder to look through apple's entries in the USPTO database to see if he can find anything that might refer to ALAC, but he really shouldn't, since hilariously you're safer from patent damage claims if you culture a state of blissful ignorance as to what patents exist out there.
    3. The Digital Millennium Copyright Act. This one is scary, as it grants powers which are essentially stronger than copyrights or patents to anyone who can construe what they do as involving in some way "DRM". The DMCA seems to assert that "mechanisms which effectively control access to a copyrighted work" have some sort of inherent right to remain unbroken. This seems to imply people with proprietary formats do have a right to keep them proprietary so long as they can pretend there's "DRM" in it. However there's a few problems here. It has been questioned whether the nature and implementation of the law is enforceable against a serious challenge, and some uses of the law-- for example putting some kind of "DRM" in a printer cartridge and then using the DMCA to shut down anyone who makes compatible printer cartridges-- have already been smacked down by the courts. Apple has already used the DMCA to keep down software which removes the "DRM" from iTunes Music Store purchases, though the best they can do is force that software to use hosting providers outside the U.S.. But, well, even though the law is wrong, that's actually sort of exactly what the letter and intent of the law are intended to do-- protect things like Fairplay. But attacking unauthorized use of ALAC would follow neither. Attempting to claim ALAC is covered by the DMCA is simply laughable; as has been observed elsewhere in this discussion, it is not and does not contain "DRM" and it provides no limitations on the flow of copyrighted material whatsoever.
    4. Technical barriers. The idea here is, as Microsoft does with SMB or Word, you design your format in such a way as to naturally resist reverse engineering. This is sort of a moot point with ALAC. The decoder's alre
  17. Re:Pardon me for asking... by DavidTC · · Score: 5, Informative
    To keep people from having to read that, FLAC is not significantly smaller (1), but a hell of a lot faster if you use it right.

    The important stats:
    FLAC at 8 took 55:02 to encode, 7:07 to decode, at a ratio of 1:0.5437.

    ALAC took 19:53 to encode, and 10:01 to decode, at a ratio of 1:0.5496.

    So, yes, FLAC at the tightest takes much longer than ALAC. (Alghought it's only 3/4th the CPU to play!)

    However FLAC at 5 took 12:54 to encode and 7:08 to decode, at a ration of 1:0.5459. Much faster than ALAC, barely smaller, and decodes much easier than ALAC.

    So, yes, if you ramp FLAC all the way up it takes much longer to encode, and slightly longer to decode, and you don't gain anything. So obviously doing that is a bit silly unless you're talking about long term storage.

    If you leave it at the default, though, it beats ALAC in every single way, unless there's some differences in CPU architechure that changes the relative decoding difficulties between an iPod and a PC. Which isn't that impossible. But I have to point out that a lot of people use iTunes sans iPod, on a PC.

    1) No lossless compression is significantly smaller than anything else. All the serious contenders are between 1:0.56 and 1:0.48 or so.

    --
    If corporations are people, aren't stockholders guilty of slavery?
  18. Re:Illegal codecs by Anonymous Coward · · Score: 1, Informative

    Go ahead and name the patents and copyrights that have been violated

    + Patents on MPEG-2 and MPEG-4 audio and video
    + MP3 patents
    + Micrsoft WMV patents
    + Micrsoft codec bundle, warez download from the mplayer site
    + Real codec bundle, warez download from the mplayer site
    + Apple codec bundle ...

    Not so hard.

  19. Re:Pardon me for asking... by Refrag · · Score: 2, Informative

    They needed cheap transcoding to a lossless format for the AirPort Express. Read the streaming sound section of this article.

    --
    I have a website. It's about Macs.
  20. Re:But is it better? by nolife · · Score: 2, Informative

    FLAC is too good -- it takes too much time/CPU power to encode.

    Not quite according to this post. Do you have any references that say otherwise? I've never used ALAC myself so I can not comment.

    --
    Bad boys rape our young girls but Violet gives willingly.
  21. FLAC quicktime plugin by Qwerpafw · · Score: 2, Informative
    I posted a simple guide on Mac Update to using the Quicktime FLAC plugin. I'm working on an Applescript to simplify the process of batch converting FLAC files into various AAC/MP4 files (without QTpro or iTunes) and still preserve the tag information, but I haven't quite ironed out the kinks (it crashes with some tag info, for some reason).

    Go to MacUpdate to download the plugin if you don't have it.

    (1) Once you've downloaded and uncompressed the file, you'll see two items in the plugin folder. One is a copy of the open source license, and the other is the FLAC_Decoder.component quicktime plugin.

    (2) Move the FLAC_Decoder.component file into

    /Library/Quicktime or if you don't have root access ~/Library/Quicktime

    if you don't have either of these folders, feel free to create them, either with the Finder (Command-Shift-N) or with Terminal (mkdir /Library/Quicktime)

    (3) Restart Quicktime if it's open--otherwise, open Quicktime (if you've deleted the link in your Dock, look in the /Applications folder).

    (4) Find a .flac file that you want to open--it should have no icon. Make sure it ends in the .flac extension--this will be important later. Using the Finder, select the file by left clicking on the file icon, and hit Apple-I (or select "Get Info" from the File menu).

    (5) In the file's info window, you'll see the heading "Open With:" Click the triangle next to the heading, and pull down the "Open With:" menu--select "Other..." from the "Open With:" menu.

    (6) You should now see a dialog box asking you to choose an application to open the unknown.flac file with--from the "Enable" menu, choose "All Applications" (the default setting is "Recommended Applications"). Navigate to /Applications and select Quicktime Player. If you didn't change the enabled applications to "All," then Quicktime Player will be grayed out and you will not be able to select it.

    (7) Once you've successfully changed the file binding so that it opens with Quicktime Player, go back to the Info menu on your .flac file. Under "Open With:" you should now see "Quicktime Player" as the selected choice. If this is not the case, retreat to Step 6 and try again. Otherwise, click on "Change All..." to instruct your computer to "Use this Application to open all documents like this." There should be a brief pause, and a dialog box box will appear asking you if you really want to open all your .flac files with Quicktime Player. Click continue at the dialog.

    (8) You now have installed the FLAC component and successfully bound quicktime to the .flac file extension. If you own Quicktime Pro, you can also convert and export .flac files into other formats.

    (9) You can play the flac files in iTunes if you rename them to .mov and drop them on the iTunes icon. You should be able to convert them to mp3/aac via iTunes. Most of iTunes' functions, however, won't work... and it will hog CPU and memory. I'd recommend converting them via quicktime or a similar application.
    It's also worth noting that if you convert the FLAC files into WMA lossless, iTunes will convert them automatically for you into ALAC (apple lossess) and preserve tag information.
  22. Re:AirTunes. by Ohreally_factor · · Score: 2, Informative

    You might want to look into Air Foil. It allows you to stream any audio to AP Express.

    It's OS X only at this point, unfortunately for users of other OSes.

    --
    It's not offtopic, dumbass. It's orthogonal.
  23. Re:Pardon me for asking... by dgatwood · · Score: 2, Informative
    Two 70 MHz ARM cores. Yeah, should be more than three times the horsepower needed. Reportedly, Tremor can function in as slow as a single 40 MHz core.

    Of course, I don't know if the cores are symmetric, and I think the iPod Linux stuff only supports the primary core, so in its current state, no, it probably isn't possible....

    At least conceptually, to get decent performance you want to do something like the following:

    1. Set up a worker thread on the main core (under Linux or whatever) that fetches blocks from the disk and places them in a ring buffer at a fixed memory location.
    2. Halt the second core, load a program into memory that does the decoding of a particular audio type from the ring buffer, set the PC of the second core to that program, and run it.
    3. The second core will shove raw audio data at the hardware, or if it can't access the hardware directly (not sure), you might end up doing a second ring buffer.
    4. Power manage the heck out of the primary core. Nap it unless it is doing something.
    Once you get that working, -then- work on real-time Ogg decoding. It should be a lot easier to get real-time decoding if you aren't trying to do all your work on a single core....

    --

    Check out my sci-fi/humor trilogy at PatriotsBooks.

  24. Re:Pardon me for asking... by Anonymous Coward · · Score: 1, Informative

    Look, you crazed Apple fag... as has already been pointed out, ALAC uses more CPU and memory than FLAC. Apple did it so they can control the format -- ala Microsoft. Get over it.