Sunday, July 4, 2010

Audio Codecs

@nickromyn is someone I follow on Twitter, today, he posted a question about Android and it's capabilities regarding ALAC, the Apple Lossless Audio Codec.

Though Nick is an avid MAC user, he's not completely hopeless when it comes to PCs and related technologies. He's not a complete Apple Fanboy, in the sense that he'll give credit where it's due. Where most Apple Fanboys won't even recognize that a product has any merits that may be in any way shape or form better than their beloved apple product (link NSFW, language).

His message was focused around managing playlists/media using a centralized system (like iTunes), which I'm not sure is universal on all Android based devices.

Before I get to my main point, I'll go over this first: I have the Motorola Milestone, which has the capability of using the motorola media center software, which will do a lot of that; additionally, I'm sure that there's more than a few apps that will do it, if google hasn't made something that will interface with the device already... I'd also be fairly certain HTC has put something out to go along with the Sense media player too, so there's that.

My main point is on Audio Codecs. Since Nick pointed out support for ALAC specifically, I have a few points to make about the matter that I'd like to go over now.

First of all, as far as Lossless audio codecs go, I would never use ALAC, because FLAC exists. FLAC, or Free Loss-less Audio Codec, is an open source developed, lossless codec freely available to anyone, or any developer, to include in their device or project. Most media players have picked up support for this relatively obscure format, and are fully supporting it. Additionally, FLAC support has been incorporated into Andoroid's core system, so the native media player can use FLAC files transparently. ON TOP OF THAT, if you're adamant about using ALAC, there's applications in the market that WILL play ALAC format files.

My second point is file size. I don't care what compressor you use, if you're doing lossless encoding, that's going to take up a lot of space. Additionally, the sound renderer (aka sound card) on your portable device will NEVER be able to render all the detail in a lossless file, and even if it could, the quality lost on the connectors, headphones, integrated amplifier, etc, plus crosstalk and static, you might as well have saved the time and space, and not used lossless.

Which brings me to my next point: "lossy" audio codecs.

MP3, or MPEG-1, Layer 3, is a fantastic format, widely adopted by almost everyone and everything for every purpose you could imagine sound being used for. It renders a fair quality representation of the original media and maintains a low processing overhead, plus reasonable size constraints for the quality rendered.

That being said, it's ancient. MP3 players can date back to the early 90's. and in regard to computers, that's like king tut.

other, better, and more versatile formats have been created. The movement started in 2000, with Vorbis and OGG, A format I still love. It's an entirely open source format (similar to FLAC in concept, just, lossy), but it never caught on. The open source community couldn't compete with the thousands of "MP3" players on the market that simply did not support OGG/Vorbis.

A few years later, MPEG teamed up with ISO and IEC to create AAC, or Advanced Audio Codec, rendering higher quality audio at the same bit-rates as MP3. in direct comparison, there is no down-side to AAC over MP3. What they needed now, was a way to get it into our hearts, minds and "MP3" players.

Being that it was the next major format to be blessed by the MPEG, getting implimentation wasn't entirely difficult. It was slow at first, and the success of AAC relies heavily on it's sister codec for video, AVC (Advanced Video Codec), better known as m4v. Combining AVC and AAC produced the ever-familiar mp4 files, which are multimedia files. Almost every modern cellphone will natively record (and decode) mp4.

And the hard work was done. With cellphones quickly replacing both digital cameras and MP3 players, plus having built-in, usually dedicated (on chip) decoding of AAC and AVC, the MPEG and partners have paved the way for wide-scale implementation of .m4a files.

... now if we could only get people to start USING them. ha.

but honestly, in the race for audio codecs, you're not going to find something better than AAC by any significant margin, anytime soon... and definitely not something you can decode on the fly using an integrated dedicated decoder chip (which significantly reduces power consumption, and therefore reduces overall power drain, which therefore increases battery life).

If you're really determined to use ALAC or FLAC on your android powered device, you're more than welcome to burn the batteries and do it, but you probably wouldn't notice much, if any difference over the m4a version of the file... except of course, with your battery life ;)

To note, I believe most AAC decoder chips will also handle MP3, so fear not, using your trusty old MP3s won't drain your battery dry either... they just might not sound as good as their m4a equivalents.

2 comments:

  1. I use ALAC for two reasons:

    1) iTunes cannot read FLAC files, for several reasons. Apple has decided to ignore Open Source A/V codecs for valid patent claim fears, but if they supported FLAC I would use it. iTunes is the only sane way of managing music on any platform that I have found (not that I'd consider switching platforms for an audio player). It's just simpler to organize and access my music in a user-friendly way.

    2) My car, despite having an audio system that is decried by rap fans and audiophiles as just god-fucking-awful, manages to pick up on every part of a compressed song and amplify the compressed parts to make it quite miserable to listen to.

    Ogg is highly versatile but anything that is versatile includes far too many options and overhead for someone who is simply interested in ripping their CD for their iPod or listening to music they leeched from gnutella to fiddle with. The overhead detracts from its attractiveness in embedded systems as an open format, because embedded systems must have as much of a bare-minimum overhead as possible.

    Lossless music is not like using $500 cat5 cables to connect your home theatre components. There is a very audible difference between a "lightly" compressed file and a lossless file. If you are unable to distinguish the difference, it can save you a lot of money, but I have had the misfortune of listening to a lot of lossless music and now swear by it.

    I spent all of 10 minutes reading this article and writing the response. There's bound to be holes. Enjoy, but please don't feed the trolls. I've got that under control!

    ReplyDelete
  2. I figured you'd have reasons. Not everyone shares in that, I'm sure. IMO, Many don't even know the options, or what the difference is.

    Honestly, I would blame the decoder more than the sound file for the jitter, but that's me.

    I hope the combination of posts gives people a well-rounded perspective on what's the difference between formats and what's best to pick for them.

    ReplyDelete