Jump to content

audio performance on android


Recommended Posts

using the fantastic howler.js - all works dandy on desktop and iOS 6 but plays like a dog on android (tab 2 android 4.1.1 chrome)


using the sound sprite approach, performance is woeful - it's seemingly random if it will even play a sound and there is a noticeable lag when a sound is triggered regardless of whether it plays it or not!


looks like there are plenty of reported issues with android and html5 audio around - but wondered if any of you had found a better solution/library/approach to playing sounds on android specifically when making a game.

Link to comment
Share on other sites

There were similar discussion at createjs/soundjs group:



Basically Mobile Chrome on Android does not support WebAudio yet. Only HTMLAudio. The latter is not able to cache the sounds on Android (thus the delay), cannot play sounds in parallel and overall not very good :)


WebAudio API works great for me on Android Chrome version M28 beta (behind a flag). So we are several months it seems from getting it working in the wild on user devices.


So I decided not to hack it, as it is going to be fixed properly relatively "soon". For now, I am disabling sound on Android if only HTMLAudio support is detected. Or playing just a music loop (but no sound effects). This should work mostly ok (apart from the fact that we cannot make it looping well :) ).

Link to comment
Share on other sites

thanks for that link - it's nice to know I'm not alone!


Howler.js does fall back to html5 audio - but as you mention, it's performance is very limited.


My conclusion was to skip any audio if on an Android device until the situation improves - so I'm glad to hear someone else is doing the same!


It's such a shame really as iOS6 web audio works so well! - it's sad to see such a massive difference between the two platforms when it comes to audio at the moment 

Link to comment
Share on other sites

Are you referring to Android 2.3+ or Android 4.+? If you are targeting the newer Androids, there are no issues with sounds so far - if implemented the right way with having an Audio context for each sound and music file.


It somehow works a bit laggy on both Firefox and Chrome, but parallel sounds work. Problem here is that I'm currently using ogg and mp3 files which require both an asynchronous parser/decoder. Latency is a bit bad inside a shooter, but here's the proof: http://www.youtube.com/watch?v=PojeyUiFLi4


Well, to fix that issue, I thought about implementing the sound correction loop as I did with the Zynga Jukebox. Problem here is that it's wasted performance for audio and it doesn't make sense for me to deliver crappy environments as I have my own V8GL runtime for that which handles everything correctly directly on the sound chip or the GPU via OpenAL and OpenGL.


If you want to give it a try, the Zynga Jukebox's support was dropped by Zynga, but it's still available here: http://martens.ms/#!development-jukebox



EDIT:// I just realized that the latency is exactly the length of the sound file. Maybe there's an issue that they try to optimize sounds "per source identifier" and allocate only one sound buffer for each unique Audio context, gotta dig into that.




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...