Badass JavaScript

A showcase of awesome JavaScript that pushes the boundaries of what's possible on the web, by @devongovett.

AAC.js, the Latest Official.fm Labs JavaScript Audio Decoder

July 9th 2012

Official.fm Labs just released another JavaScript audio codec, and perhaps the next biggest in usage after MP3.  AAC.js is a pure JavaScript Advanced Audio Coding decoder built on Aurora.js.  AAC is now one of the most widely deployed audio codecs, and such names as the iTunes Store distribute music in the AAC format, so it’s great to have a decoder in JavaScript.

AAC.js is another codec of many now supported by the Aurora.js framework, and it should help enable and improve audio editors, DJ apps, Digital Audio Workstations, games and other audio applications in the browser.  Personally, I’d like to see something GarageBand like in the browser, but that will require JavaScript audio encoding as well, something else I’d like to tackle at some point.

Perhaps one of the more impressive things about it is its relatively low CPU usage.  It runs a little higher than the other codecs we’ve implemented so far, but AAC is more complex so that is to be expected.  However, it is usually under 8-10% CPU usage in my testing, which is pretty good I think.

AAC was quite an undertaking and it took me a couple months to get working properly, concluding with an awesome trip to Geneva to hang with the rest of the Official.fm Labs team for a few days.  Currently, it supports the Low Complexity profile, which is the most common profile in use today.  iTunes uses this the Low Complexity profile, so you should be able to play anything you purchased from the iTunes store with AAC.js just fine. Support for the Main, High Efficiency (Spectral Band Replication) and High Efficiency v2 (Spectral Band Replication + Parametric Stereo) profiles is planned.  If you want to implement another profile, have a crack at it and send us a pull request!

Check out the demo over on our codecs site along side our MP3, ALAC and FLAC decoders.  Note that we also added a button to play any file of each of these types to the player, so check it out and file bugs if you find a file that doesn’t work. :)  Also, be sure to check out AAC.js on Github and follow along as we add more features.