Scirra cog

About Us

We're a London based startup that develops Construct 2, software that lets you make your own computer games!

Archives

Browse all our blog posts

Latest Blog Entries

We love brains!

Join us! Joiiinnn ussss! Mooooree brains!

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

5
Candescence 11.3k rep

Oh, very much, this, especially on the OGG side, Microsoft and Apple should just get over themselves and actually support an open-source standard.

Especially Microsoft. Seriously, guys, stop trying to make everyone else do things your way.

Monday, July 18, 2011 at 6:55:27 PM
1
zenox98 60.5k rep

Agree totally re: OGG and AAC, but was wondering: since C2 isn't distributing MP3, only decoding and playing, then distribution licencing wouldn't apply, would it? The onus would be on the creator of the game, as they are enabling MP3 to be downloaded/played. So my question is: do they also rip you off, sorry charge, for decoding the MP3 within C2?

Monday, July 18, 2011 at 7:38:45 PM
1
Ashley 196.1k rep

@zenox98, no, C2 doesn't even need to decode MP3, although it might need to encode it. The bigger worry is $2500 for a game title "distributed" 5000 times though. Separate from that is a 2% royalty for distributing MP3 content once revenue is over $100k. IMO that's fair, not a rip off. It's unnecessary when there are zero charges for you to use AAC though.

Monday, July 18, 2011 at 7:47:43 PM
1
bigcatrik 5,894 rep

So our assets can be WAV and C2 will convert them into the appropriate format(s) on export? And then when the program runs it will select the appropriate format for the detected browser?

In some cases, if audio fidelity is of paramount importance, it might be helpful to have a "use uncompressed WAVs" option when exporting if the source files are WAV (not checked by default, of course).

Monday, July 18, 2011 at 8:01:45 PM
0
zenox98 60.5k rep

@Ashley
I understand what you're saying, but as you'll agree, OGG is preferable but MP3 is far more prevalent.

Which is why I was asking if you would be liable for licencing, as it wouldn't actually be you distributing MP3s, but the creators? Or am I totally off the plot (most likely!).
zen

Monday, July 18, 2011 at 8:12:29 PM
2
Ashley 196.1k rep

@bigcatrik, you could use WAV, but the files tend to be so big it's impractical for the internet. When is audio fidelity of paramount importance for a game (beyond AAC quality)? And yes, we're planning to encode to the necessary formats on export.

@zenox98, the creators are liable, but there's no point using MP3 when AAC is both better and royalty free. It doesn't matter which format is more prevalent - C2 will encode your audio to necessary formats on export.

Monday, July 18, 2011 at 8:21:46 PM
3
getter77 2,465 rep

Rather ridiculous that such a significant part of the "new web" going forward still hasn't been settled out by the main browsers. Well, at least having it down to OGG and AAC is better than trying to juggle more, but the whole situation on serves to hamstring rapid progress by all. Though I now wonder at a lark: What's the state of MIDI support among them? ;)

Monday, July 18, 2011 at 9:01:46 PM
2
TehLulzinator 4,214 rep

Never realized there would be licensing over audio codecs. Why is everything always about money! Another day, another lesson.

Naturally the open sourced OGG would be the obvious choice if it'd be supported on all browsers. Guess you'll have to do with 2 for the time being.

@Getter77, Sadly enough MIDI isn't really being supported by browsers (I believe not even by Windows). A quick search on Google gave me this: (http://www.ralphart.com/midi/juke_resources.html)

"The era of browser MIDI support appears to be largely over. Most of the plugins I once listed below are no longer available. The Quicktime plugin will work but not as smoothly as the Beatnik or Cresendo"

Oh well, what would you expect.

Monday, July 18, 2011 at 10:00:10 PM
1
Kyatric 71.3k rep

Candid theorical question but just to make sure :
.wav files setted into the project will be exported as compressed outputs files.
Will there be a way to set directly compressed files (.aac I presume) directly into the project ? (no conversion required on export)

Also I quite agree with bigcatrik as some short sound fx will tend to be lighter as .wav than as any other compressed format, the choice should be given to the user on export (a list of the sound files of the project each with a checkbox for example) about wether he wants such or such file to be converted or not.
A 9Ko .wav file will never be ligther in .mp3 or .ogg (.aac I have few knowledge about this format yet, but I'll take a look to make sure).

Monday, July 18, 2011 at 10:59:54 PM
0
Ashley 196.1k rep

@Kyatric, you'll be able to import compressed files directly, but if they're being re-compressed to a different format (eg. AAC to OGG for browsers which don't support OGG) then the quality is degraded. Also, compression might make the file larger in some rare cases, but then you have to consider that not all browsers play WAV either.

Tuesday, July 19, 2011 at 12:55:10 AM
0
Ashley 196.1k rep

I made a couple of edits to the article - Opera doesn't support AAC here.

Wednesday, July 20, 2011 at 12:22:37 AM
2
JonTheNiceGuy 2,262 rep

The main reason that AAC isn't supported by Firefox is because it's Open Source. To permit anyone to recompile the code (part of the license they adhere to), they can't include codecs which need to be purchased.

Aside from that, it's a great summary.

Thanks!

Wednesday, July 20, 2011 at 1:57:41 PM
1
Ashley 196.1k rep

@JonTheNiceGuy, isn't Chrome open source too? How do they work out their AAC license?

Wednesday, July 20, 2011 at 3:29:31 PM
2
jwalden 2,267 rep

Chrome is not open source. Chromium is open source; I doubt Chromium includes AAC but don't know for sure.

Ashley, as far as Mozilla paying for a license goes, aside from the whole open-source thing we have (I'm employed by Mozilla, although I have no involvement with codec licensing or indeed much anything in video/audio support -- I work on the JavaScript engine and occasionally dabble elsewhere), ask yourself a question. Should Mozilla only be looking out for the needs of web developers when it chooses to support, or not support, a codec? Is it perfectly fine to support a codec that costs nothing to encode? Or is it perhaps bad to support a codec which is free to encode, but costs money and requires license agreements to decode?

The barriers to entry in the browser market should be ability to read the relevant public, royalty-free standards, and ability to write the code to support them. The barrier to entry of a possibly-required royalty payment would deter competition in the market, and I'm sure you remember the state of competition in the market when Firefox arrived on the scene.

Those points aside, putting whoever owns AAC (Apple?) in the position of charging rent to use a supposed-integral part of the web platform seems pretty wrong to me. The value of a standard should be to the community that agrees on it, not to the lucky author or authors who managed to get their horse declared the winner.

Wednesday, July 20, 2011 at 7:43:55 PM
2
Ashley 196.1k rep

@jwalden, sorry for tech issues, new site!

I actually totally agree Vorbis (in whatever container) should be "the" standard. It's free, open, and anyone can use it (pending something about "submarine patent risk" that I don't think I properly understand).

Really what this blog post is about is our frustration there's still no one format that works everywhere. If Mozilla supported AAC, us developers could finally have a near-enough single format to support. That doesn't mean we think AAC should be the standard or de-facto standard - Vorbis should be - but we sure would like something in the mean time.

Wednesday, July 20, 2011 at 8:32:42 PM

Leave a comment

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