Jump to content

which audio format do you use for mobile?


Mike018
 Share

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?

Link to comment
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.

Link to comment
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.

Link to comment
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.

Link to comment
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?

Link to comment
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.

Link to comment
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?

Link to comment
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.

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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