The other day I linked to code that Mozilla is hoping to bake into the Firefox browser to natively handle PDF documents, today let's look at an example of JavaScript code that will decode MP3 files.

That's right, MP3 support with no Flash needed! I like! I like!

This is pretty cool. At present it's pretty limited in that it only works out-of-the-box in Firefox 4/5/6 (and Mozilla's concept browser Aurora). There's support in Chrome 12 Dev (Linux), Chrome 12 (OSX) and Chrome Canary (Windows) as long as you enable 'Web Audio API' in 'about:flags' (as long as you can tolerate the distortion as Chrome forces the samplerate to 48,000Hz). There's also no support for the necessary Audio Data and Web Audio APIs in Internet Explorer, Opera, Safari, Mobile Safari or Android Browser so it doesn't work.

There are a lot of future improvements in the pipeline - Chrome 10+ support, MPEG Layer 1/2/2.5 support, support for ID3v2.2 and v2.3 fully and buffering.

HTML 5 is going to make the web browser an even more powerful tool.

Code available on GitHub.