plicatibu

Should I stick to wav file format?

Recommended Posts

I see people talking about problem to play audio. More specifically, each platform supports some audio formats but doesn't support others. 

 

I suppose that wav file format is supported in the majority of the platforms. Is there any problem to stick with wav file format and forget about the others? 

Share this post


Link to post
Share on other sites

The closest thing to a "universal", multi-purpose format across browsers seems to be mp3.  Even Firefox supports it now (unless you have an Enterprise version at work, which is about a year behind the latest).  File size on mp3 is smaller than wave, but sound quality may not be as good.  For just plain old sounds, I find mp3 to be a good choice.

 

The biggest "knock" on mp3 is that there are still some live patents on it and at least one company is trying to enforce them.  However, the last of these patents is due to run out shortly... something like 2015.  Unless you are selling very high volumes of games I doubt there is much to worry about now - and fairly soon, there should not be an issue at all.  Patent extensions are possible but I believe the ones still active have already been extended once.  My take is that mp3 will become the defacto standard.  Ogg seems to be a good technical solution, but does not enjoy as wide a support as mp3.

 

If anyone's views conflict with my statements I'd love to hear about it - if a correction is in order I need to hear it.

Share this post


Link to post
Share on other sites

One possible issue with mp3 is that it adds a tiny bit of silence to the start of your files. If you are using individual files for each sound and you want any of them to loop seamlessly then this will be a problem. Other formats like ogg and m4a don't suffer from this glitch. I guess really you should use one big audio sprite for all your sounds though, in which case this is a non-issue.

Share this post


Link to post
Share on other sites

Both WAV and MP3 formats are really just umbrellas, there are masses of different codecs that can exist within them, each with their own quirks and issues. Not all MP3s are created equal :)

 

I agree with plicatibu though, I always thought that WAV was the most universally adopted format too. It also has next to zero latency, so is perfect for sound effects that you need to fire quickly.

Share this post


Link to post
Share on other sites

Appreciate the feed back.  I kind of bungled what I was trying to say about the mp3 being the most "universal".  I was intending to mean universal in two senses:

1. Works in many places.

2. Best general applicability of a format that works in many places.

 

My understanding was that wav files are just two big for general usage.  However, maybe I'll take another look if mp3 usage results in an extra small gap in time before the sound is heard - that is very important to me.

 

I should say also that for my own purposes, the freedom from worrying about multiple files for each sound was an extravagance I could readily afford and my advice was coming from that frame of mind.  However, as has been pointed out, if you are willing to deliver multiple formats then you will have a more capable solution for your extra trouble.

Share this post


Link to post
Share on other sites

I'm surprised to see latency come up as an issue in the discussion. Surely the latency incurred with a compressed format is simply the time it takes to decompress the audio data before using it. But once it has been decompressed into RAM there is no further difference between using that or wav format audio is there? Its all just audio sample data from that point on so neither should have more latency than the other. Same as loading a compressed image format, the data in the jpg or png file on disk is compressed but in order to use it you decompress it in RAM into uncompressed bitmap data format, from which point there is no further difference in usage between one format and another.

 

Or maybe I am just plain wrong? (wouldn't be the first time! ;) )

Share this post


Link to post
Share on other sites

When I use that word I mean it in both the sense of the initial decompression hit, but also the start-up time involved in playing the sound.

 

This is why it's such a pain in the butt to loop mp3s seamlessly:

 

http://www.compuphase.com/mp3/mp3loops.htm

 

and

 

http://gamua.com/blog/2012/05/gapless-mp3-audio-on-ios/

 

do a great job of explaining it well.

Share this post


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

  • Recently Browsing   0 members

    No registered users viewing this page.