On HTML5 audio formats - AAC and Ogg

by Ashley | 18th, July 2011

In your HTML5 games made with Construct 2, I'm sure you want sound effects. I've been thinking about the audio features that we need to add. I've ended up worrying a lot about audio formats, because there's no one format that all browsers support. Let's look at the situation as it is now.

There are basically four options to choose from: WAV, MP3, Ogg and AAC. Not all browsers support all of them, but we'll come to that.

Wave (WAV)

WAV (in its most common PCM format) is uncompressed audio. As a result, the files tend to be really big. It would be a shame if nobody played your game because instead of downloading in 10 seconds, it took 2 minutes, of which 1 minute 50 seconds was downloading WAV files. It's like having all the images on your website in BMP format. Nobody does that! So we really need a compressed format.

MP3

The best-known compressed format is MP3. However, it is stringed up with royalty payments. The license requirements for MP3 state you have to pay 2% of all revenue over $100k if you distribute MP3 files. More importantly, there's an ambiguous page stating if you distribute 5000 copies of a game using MP3 technology, you're obliged to pay a $2500 license. Does that mean 5000 pageviews of a HTML5 game? It's not clear, so MP3 is probably best avoided.

Ogg Vorbis

Ogg is basically an open-source, patent-free, royalty-free version of MP3. Great! Unfortunately Internet Explorer and Safari don't support it.

(Note: Ogg is the container and Vorbis is the audio codec, but I'll refer to it as Ogg for brevity.)

Advanced Audio Coding (AAC)

AAC, part of MPEG-4, is a successor to MP3 (which was part of MPEG-1 - MP3 derives from "MPEG-1 layer 3"). It's a modernised compressed audio format, which creates smaller files than MP3 which also sound better. Amazingly, the license fees for AAC are much more relaxed than MP3! You are free to use AAC as much as you like in your games. For us, we might need to use an encoder to save your sounds in AAC for you. I'm not certain so I've emailed them to check, but it looks like we need to pay a $0.98 royalty per unit sold. That's fine - no web developers have to pay, we're just a special case since we want to encode AAC files in Construct 2. AAC is a great technology developed over many years by hard-working individuals. It's not unfair they ask us for royalties to encode it, and in fact very generous to let web developers use it royalty-free. You'd never have to worry about license fees to use AAC in your games. Great - but Firefox doesn't support it!

HTML5 browser audio support

These browsers were tested on Windows 7. The AAC audio was in .m4a format.

Browser Ogg MP3 AAC Wav
Internet Explorer 9 No Yes Yes No
Firefox 5 Yes No No Yes
Chrome 12 Yes Yes Yes Yes
Safari 5 No Yes Yes Yes
Opera 11.5 Yes No No Yes

The format support headache

So, we have AAC that Firefox doesn't support, and Ogg that Internet Explorer and Safari don't support. (Shout out to Chrome: thanks for being awesome and supporting both! Opera, sorry but you're a bit too small to get angsty over AAC for. Good job supporting Ogg, though.) Ogg is an open standard and royalty free - there's really no reason for anyone not to support it. However, AAC is also very relaxed about its license. It doesn't cost anyone anything to use it, except Mozilla, who need to pay for a decoder license, and us, since we want to distribute an AAC encoder. I'm not in charge of the licensing, but judging by the site, it would cost Mozilla a one-off $300,000 to support AAC (for "PC enabling software"). Hopefully the developers of a browser over a quarter of all internet users use aren't so hard up that they can't afford this.

Mozilla argue that Ogg is better for the web because it's royalty and patent free. AAC may involve patented technology, but it's royalty free as well, for web developers! It's a good enough deal that Chrome, Internet Explorer and Safari all support AAC. In theory, the AAC license fees could change and they could start hounding users for money. However, this would be suicide with Ogg there as an option. I bet AAC would be dumped in favour of Ogg pretty quick! If Internet Explorer and Safari still didn't support it, I guess those users just wouldn't get sound, so there'd have to be a little message telling them another browser could be doing better so they should switch... but that's a question for if it happens. It probably won't - especially not if Ogg is a well-supported free alternative.

Internet Explorer and Safari have no good reason whatsoever to not support Ogg. Ogg is the preferable option, since we can encode it in Construct 2 for free. They might blow some security issues way out of proportion like Microsoft did with WebGL, but basically they're making life more difficult for us HTML5 developers for no good reason at all. Thanks, guys.

(If you're at Microsoft and reading this, hi! Please support Ogg in Internet Explorer! By the way, my internship was fun, thanks!)

Anyways, for the time being, we will grudgingly endorse this ridiculous technology circus and support two formats when one could have done the job just fine. Mozilla, please get over your bearded-hippy idealism and just pay the AAC license so we can have one format that works near enough everywhere. Internet Explorer and Safari, please get over your corporate feet-dragging over open standards so we can have one format that works everywhere, and to force AAC to stay free, and so smaller browser makers can get away with just Ogg ($300k might be a bit of a hit for Opera or any innovative new browsers). Come on everyone, this is stupid. Some of us are trying to develop for the web here. Thanks.

(P.S. Maybe the same is true in the video format war - if everyone supports both a patented codec and a free one, the patented one is forced to stay free. The patented one is probably also better, since it probably had commercial research put in to it, resulting in the patents. So if everyone supports both, we get a commercial-quality format for free, backed up by a good-enough patent-free format. Then, lo and behold, we can actually upload one file and have it work in all browsers! It might be a sane situation for web developers! Hurrah! Oh, well, one can dream.)

Edit 20th July: updated compatibility table, removed some over the top angsty-ness. :) But hey, it's a frustrating situation for us.

Now follow us and share this

Tags:

Comments

0
stiepan 1,325 rep

You should add optional mp3 support at least to the business version/licence, with a warning about the possible issue with royalties; this would be perfect for supporting sound out of the box in current mainstream iOS and Android versions.
With that feature, I'd buy a business licence immediately, and am sure many others would!

P.S.:
The suggestion to keep .wav files when available during export for small sfx files would also be a great thing to have!

Sunday, October 30, 2011 at 9:00:42 PM
0
Ashley 180.3k rep

@stiepan, there are extortionate royalty rates for using MP3 in games. See http://mp3licensing.com/royalty/games.html - once you've had 5000 downloads of your game *you're* liable for a $2500 license. Best to avoid it!

Sunday, October 30, 2011 at 9:07:21 PM
1
stiepan 1,325 rep

Ashley, thank you for the near-immediate reply!

I'm puzzled by the fact that people with legal rights to distribute some audio content they own (and in some cases even created), cannot do it for free independently of its format, at least on their website...

Does that rule apply to the whole world?

I sincerely doubt it; if my intuition is true, there could be a simple workaround for the publisher.

I'll do more in-depth research on the matter and post back when I make interesting findings.

Sunday, October 30, 2011 at 9:49:04 PM
1
stiepan 1,325 rep

Found an interesting faq article in commentcamarche, a very popular website for technical questions (in french): http://www.commentcamarche.net/faq/3994-mythes-le-format-mp3-est-payant
Don't know whether this information from 2009 is still valid, but the author seems to say that the licence provider had very little success when suing artists for "unauthorized" distribution of their own creation, while they are more serious about software providing mp3 encoder functionality...

Monday, October 31, 2011 at 12:16:53 AM
0
Jarzka 3,222 rep

How about FLAC?

Friday, December 16, 2011 at 8:40:44 AM
0
Bigheti 15.3k rep

More information disclosed by the team of Scirra ... thanks!

Friday, December 16, 2011 at 10:18:34 AM
0
Guif0DA 6,061 rep

Im trying m4a (AAC) in chrome but it's not playing, if I preview in IE it plays, u sure chrome can play that format???

Monday, July 29, 2013 at 12:36:42 AM
0
thehorseman007 13.2k rep

Never know something like this before, Thanks for sharing such good and valuable information with us.

Great.

Friday, August 16, 2013 at 7:24:45 PM
0
CharlieBraun 1,320 rep

for people who can not move from one format to another is a very interesting site online that you do audio.online-convert.com/es/convertir-a-ogg

Sunday, March 27, 2016 at 11:50:41 AM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.