Advertisement

MP3 vs. WAV

Started by May 10, 2005 07:34 AM
15 comments, last by CJM 19 years, 6 months ago
Okay that's clear to me. But what does me wonder is the fact that a wav file that is about ten seconds long is about 1.5 Megs and the same file encoded with mp3 is only a few bytes, so at what size I should use mp3/ogg and when wav.

The file I was talking about is a fan that turns...so I would say it's an simple effect but as Steve said the sound buffer is small, so would it be wiser (in my opinion) to convert this file to mp3/ogg.

So if anybody knows at which length of the sound file I should use mp3/ogg and when wav, please let me now.
Quote: Original post by Pityworm2
So if anybody knows at which length of the sound file I should use mp3/ogg and when wav, please let me now.


It all depends on situation. Consider this - you have that 10 second clip. In wav format let's say it's about 1.5MB. Let's say encoded its about 100kb. Now while the OGG is smaller, what happens behind the scenes is that the OGG file is decompressed into a wav file in memory then played (From my OpenAL experience at least). Now this is not a big deal really - until you need to play that sound a lot.

If you are always using that sound, why add all the overhead of using an encoded format, while you can save processing at the expense of size? That's the main basics of choosing what you need. For longer files, over 30 seconds, using Wav's is still possible, if you stream them, but at that size, the trade off is more in favor for compressing them.

So ideally, if you have a sound that will be played *a lot*, and it is failry short, let's say under 15 secs, then there is nothing wrong with using WAV. You will have to analyze the actual performances though. If you have a sound clip that's 10 seconds and is played only once or twice, then you can see why OGG is better, smaller size!

Wrapping up, as lemurion brings up a good point (others do as well, but his post is the cutoff to what I can see [wink]) imagine if you had a text file that was 5KB. Sure you could zip it up and save space, but then you have to go though the hassal of unzipping it, then having the original file + the zip file. In that case, having just used the orig text file would have been better - assuming you are not in despearye need to save space.

It's all an issue of HDD space (WAV) vs Memory + Processing (OGG/MP3)
Advertisement
Quote: Original post by Pityworm2
I mean, MP3 is smaller and have a better quality.


No. I'm sure you've already got this by now, but just to state it explicitly, mp3/ogg are of lower quality than wav. Both are what's known as a 'lossy format' - as part of thier compression algorithm, they discard some information from the file. The quality is still very good however.

- Jason Astle-Adams

Ok heres how it works:

.Wavs use a higher sample rate and less compression than MP3s. Most wavs in video games are 16bit 44.1khz or CD quality which is going to sound great if the person playing your game has a nice sound system. MP3 is a better option if you are worried about the overall size of your project, but they cut out alot extra harmonics and extreme frequencys in you music which makes them sound flat. MP3s are not going to serve you well if you want your music to be mixed in 5.1 surround or if you want your tracks to really pump out alot highs and bass. As far as sound FX I would definately recomend WAV because you want them to sound crisp and the sounds are not going to be long enough to take up alot of disk space.

Bottom Line: If you want to save disk space use MP3, if you want kick ass sound quality use WAV




Quote: Original post by Anonymous Poster
Ok heres how it works:

.Wavs use a higher sample rate and less compression than MP3s. Most wavs in video games are 16bit 44.1khz or CD quality which is going to sound great if the person playing your game has a nice sound system. MP3 is a better option if you are worried about the overall size of your project, but they cut out alot extra harmonics and extreme frequencys in you music which makes them sound flat. MP3s are not going to serve you well if you want your music to be mixed in 5.1 surround or if you want your tracks to really pump out alot highs and bass. As far as sound FX I would definately recomend WAV because you want them to sound crisp and the sounds are not going to be long enough to take up alot of disk space.

Bottom Line: If you want to save disk space use MP3, if you want kick ass sound quality use WAV


Sample rate has nothing to do with it. A 16bit 44.1khz WAV will not be compressed to 8bit/22khz in MP3, unless you have no idea what you're doing. When you're encoding into MP3/OGG, you're removing extra frequencies and harmonics that the ear supposedly doesn't need - nothing to do with the word length/samplerate. Now, a well-encoded MP3 or OGG is indistinguishable from a CD quality audio file to anyone but an audio pro, and sometimes, not even them. Generally, once you hit about 192kbps or 160-256kbps VBR (the best way to encode), people stop hearing the difference. Hell, many people don't even hear one at 128kbps. So, it's really not a big deal.
http://www.zirconstudios.com/ - original music for video games, film, and TV.
Quote: Original post by Anonymous Poster
Ok heres how it works:

.Wavs use a higher sample rate and less compression than MP3s. Most wavs in video games are 16bit 44.1khz or CD quality which is going to sound great if the person playing your game has a nice sound system. MP3 is a better option if you are worried about the overall size of your project, but they cut out alot extra harmonics and extreme frequencys in you music which makes them sound flat. MP3s are not going to serve you well if you want your music to be mixed in 5.1 surround or if you want your tracks to really pump out alot highs and bass. As far as sound FX I would definately recomend WAV because you want them to sound crisp and the sounds are not going to be long enough to take up alot of disk space.

Bottom Line: If you want to save disk space use MP3, if you want kick ass sound quality use WAV


Please ignore above post.
Advertisement
Hey,

My primary coding background isn't so much in sound, but I've dabbled in it a little bit in my time, and it's kind of a hobby.

First up - MP3 vs. OGG.
MP3 is proprietary, though as a developer you don't need to pay money to use it [ie, Microsoft's DirectX people / Windows Media team have already paid it]. OGG is free /opensource?. The quality is comparable, there is very little distinction between the formats [ie, quality, size and decompression/playback demands]. Many triple A titles use each, UT2K4 uses OGG, whilst [methinks] the Splinter Cell Series uses MP3. Aside from ideological ground, there's little between them [OGG may have a slight edge on MP3, but even that's open to interpretation, particularly on adoption rates].

Second - Compression
You can compress wav files to either [and usually end up with a smaller filesize...]. The quality loss can be minimal. Compression of MP3/OGG doesn't lose too much quality so long as you set it up right - most information lost is outside effective hearing / speaker ranges. So, this is also a moot point IMO.

Similarly, the MP3/OGG files mean less transfer from the hard drive, because they're smaller. Certainly at this point MP3/OGG seems like the way to go for all sounds.

Thirdly - Decompression
This is where the problems with using MP3/OGG/other formats come in. WAV is capable of storing more or less the same data that your sound card uses, so no/little decompression is required. Because MP3/OGG are compressed, they must be decoded before they can be played. This decompression doesn't take too long on modern hardware, so long as you only do it occasionally.

The operative word is occasionally. Decoding one audio stream isn't going to have too much of an impact, but if you're trying to decode 30 or so audio streams at a time it becomes more of an issue. Now, while it's possible [and usual practice] to decode the file into memory before you use it, many sound effects can be unloaded and loaded at arbitrary times [ie, when you pull out your machine gun in an FPS, it may load the machine gun sounds - and when you put it away the sounds may be unloaded]. If your files are OGG/MP3 then you'll need to decode them every time.

Music however, is usually streamed, which means that you've got constant disk access, and only one decode happening. This is generally faster because accessing lots of stuff from the disk is slow.

Anywho, my advice. Sound fx, use wav. Music or other single-shot sounds [ie dialogue] use some compressed format.

CJM

[Edited by - CJM on May 16, 2005 4:04:11 AM]

This topic is closed to new replies.

Advertisement