🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

WebAudio API in next release

posted in A Keyboard and the Truth for project 96 Mill
Published February 04, 2014
Advertisement
For those that don't know HTML5 has two audio specifications at the moment.

The poorly performing but widely implemented 'Audio Element'

And the high performance but spottily implemented 'WebAudio API'


When we launched Revel last April, the WebAudio API was in bad shape, and mostly implemented only in chrome and a few other webkit variants.

So we made due with with the Audio Element; which has very high latency, some platform specific bugs, and requires a bit of extra work for out needs.


In Revel we use 'Audio Sprites' which means all of our sound effects are merged together in a single sound with silence breaks (padding) between each one; and has a table of contents that maps sound effect id's to positions and durations.

This is because it reduces HTTP transfer overhead dramatically, and the audio element is very difficult to work with and can exhibit bugs if you use too many of them playing simultaniously.

This meant cueing up the audio element to the proper location to play a sound, and setting a timer to go off to stop the sound after the specified length of the sound.

As you can guess the precision was not great; and suffered under heavy system load; but it generally did the job.



Now thankfully we detect for, and will use the higher performance Web Audio API; so far in tests audio is much more responsive, it seems perhaps a bit clearer; and the API is designed specificaly to play segments from start positions and durations in a buffer; so overruns seem non-existant.
1 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement