Mike018

which audio format do you use for mobile?

Recommended Posts

Originally I used all mp3s around 180 kbps, but I often get feedback from users that some audio doesn't play, or gets cut off. For audio less than 1 second, I want to switch to an uncompressed file, but which one to use? Audacity has a giant list of stuff.

For audio 1-3 seconds long, is mp3 the most efficient and quality format to use?

Share this post


Link to post
Share on other sites

I can't really answer your question specifically, but, for small audio snippets I've generally aggregated small clips into one larger file, the same as a spritesheet but for audio instead. That's not exactly an answer but maybe it totally avoids whether mp3 is efficient for small audio clips by aggregating all your small ones into one call.

Due to the way things are loaded you might want to ensure small clips you want straight away are at the start of the file, that way you can possibly start using them immediately and not block your app from starting until the larger audio file is totally downloaded, of course, depending on your use-case you might not get away with this but you'll probably find you can at least join all your small snippets into a couple of files, likely still better than loading lots of small audio files.

Share this post


Link to post
Share on other sites
On 1/22/2018 at 5:37 PM, mattstyles said:

I can't really answer your question specifically, but, for small audio snippets I've generally aggregated small clips into one larger file, the same as a spritesheet but for audio instead. That's not exactly an answer but maybe it totally avoids whether mp3 is efficient for small audio clips by aggregating all your small ones into one call.

Due to the way things are loaded you might want to ensure small clips you want straight away are at the start of the file, that way you can possibly start using them immediately and not block your app from starting until the larger audio file is totally downloaded, of course, depending on your use-case you might not get away with this but you'll probably find you can at least join all your small snippets into a couple of files, likely still better than loading lots of small audio files.

Do you use audio sprites for mobile? Back in the days when I used phaser audio for everything, I tried audio sprites and a pretty good chunk of android users couldn't get anything to play, which was the same result I had for using individual audio files. Now I'm using the cordova media plugin to play audio now for android, and last I checked it doesn't support audio sprites but significantly reduced the amount of feedback I got about audio issues.

Share this post


Link to post
Share on other sites

Not being able to play is more likely to be a result of the audio format than from using audio sprites. Also on Android there is the stock browser which didn't used to support web audio, which will have a big impact on audio experience for your users. I've always taken the approach of generating audio in two formats, .ogg and .m4a. Then load .ogg when its supported as the file size is smaller, otherwise use the .m4a. I put all the audio into as few audio sprites as possible, and never have had any complaints about it not working on Android, except for those cases where web audio was not supported by the browser, in which case I normally prepare a slimmed down audio sprite that will work better for HTML5 audio. Still the same two formats though.

Share this post


Link to post
Share on other sites
2 hours ago, alex_h said:

Not being able to play is more likely to be a result of the audio format than from using audio sprites. Also on Android there is the stock browser which didn't used to support web audio, which will have a big impact on audio experience for your users. I've always taken the approach of generating audio in two formats, .ogg and .m4a. Then load .ogg when its supported as the file size is smaller, otherwise use the .m4a. I put all the audio into as few audio sprites as possible, and never have had any complaints about it not working on Android, except for those cases where web audio was not supported by the browser, in which case I normally prepare a slimmed down audio sprite that will work better for HTML5 audio. Still the same two formats though.

Do you use uncompressed audio files at all for SFX? I've heard for short files, uncompressed audio is more suitable, but in the context of native apps, not sure about web.

Also, for mobile, what's the limit for audio sprites?

Share this post


Link to post
Share on other sites

I can't think of a case where uncompressed audio would be required for web.

7 hours ago, Mike018 said:

Also, for mobile, what's the limit for audio sprites?

If you mean in terms of memory it would depend on what devices you want to support. It usually ends up being a bit of trial and error, but I normally start to worry if my audio sprites get longer than a minute and a half or so. You'll know when its too long because the page will keep reloading automatically on iOS.

Handy tip is to keep your files mono because that takes half as much memory as stereo once loaded.

Share this post


Link to post
Share on other sites
9 hours ago, alex_h said:

I can't think of a case where uncompressed audio would be required for web.

If you mean in terms of memory it would depend on what devices you want to support. It usually ends up being a bit of trial and error, but I normally start to worry if my audio sprites get longer than a minute and a half or so. You'll know when its too long because the page will keep reloading automatically on iOS.

Handy tip is to keep your files mono because that takes half as much memory as stereo once loaded.

Great, thanks for the advice. One last question, what do you use to play audio sprites, howler?

Share this post


Link to post
Share on other sites

Just to second using Howler... it's the best audio lib out there IMO.

Also second using m4a and ogg. mp3's have some issues in browsers with seeking and looping nicely, in my experience.

I'd also recommend having different compression settings, which are selected based on the device. Mono 96kbps might be good enough for mobile devices, but maybe supply Stereo 128kbps (or above) for PC players where memory is unlikely to be an issue, and better speakers almost certainly going to be used.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.