MP3 vs. WAV
Firms like ID or Valve uses both sound files for their games, generally music is kept in MP3/OGG and all other sound files are WAVs. Does anybody knows why. I mean, MP3 is smaller and have a better quality. So I think of using only wav files in my game. Or is it better to use WAVs for all sound files and MP3 only for the music files.
Thx,
Pityworm2
The only reason I can think of now, is that for small file size (such as sound fx like gunshots) the (disk space) difference between mp3/ogg and raw wav is not great.
And why use compression if wav is better suited.
Of course this changes for large sound tracks, hence, the sound tracks are compressed.
And why use compression if wav is better suited.
Of course this changes for large sound tracks, hence, the sound tracks are compressed.
A vid of my Pengo adv. remake in beta stage_____________
Music is usually done with ogg vorbis files if youre an idependent developer because you dont have to pay royalties to use them. If youre actually going to sell a game you have to pay the owner of the mp3 patent some money. The reason music arent wav files is because wav files are generally about 10x larger for the same audio length as an mp3. Put a song or two on a CD and youve already filled 20% of the CDs space.
wav files are more easily loaded because they are windows native format. You can read the data chunk directly and fill a sound buffer with them. This makes them better to use for short sounds.
Note, the sound quality of wav's are generally better than mp3, not vice versa.
wav files are more easily loaded because they are windows native format. You can read the data chunk directly and fill a sound buffer with them. This makes them better to use for short sounds.
Note, the sound quality of wav's are generally better than mp3, not vice versa.
Thanks for the great input
That's right...but I mean in general I can do all with MP3/OGG what I wanted and have the advantage to keep them small...or is there something on wavs that I can't do with mp3/ogg? I mean, I surely will have to play some files at the same time, like environment sounds and action sounds (birds in the background and the shotgun in front, or something like this)
That's right...but I mean in general I can do all with MP3/OGG what I wanted and have the advantage to keep them small...or is there something on wavs that I can't do with mp3/ogg? I mean, I surely will have to play some files at the same time, like environment sounds and action sounds (birds in the background and the shotgun in front, or something like this)
There is some overhead when playing an mp3. Generally a sound buffer is small, which can only fit about a second or two of sound. When you play an mp3, you read the first second of data, decompress it into a wav format, and play it. When the first second is done playing, you read some more data, decompress it, and write it to the begining of the buffer again. THe buffer is played over and over, but with newly updated data every time. That way you dont load megabytes of data into memory, and the size of the music file doesnt matter. It could be 100mb and the performance would be the same as if it were 5mb.
Most short wav files dont have to be decompressed at all, and they already fully fit into a buffer. This eliminates the decompression and disk access bottlenecks.
Buffers can always be played simutaneously, streaming and non streaming. The only difference between the two is how its managed, but the fact remains, its just a buffer. A sound card usually plays 64-256 simutaneously.
I'd advise you to get a copy of "Game Audio Programming" used from amazon ($60 book new, i got for $12 used). Its an awesome explanation of game audio and audio management in general.
Most short wav files dont have to be decompressed at all, and they already fully fit into a buffer. This eliminates the decompression and disk access bottlenecks.
Buffers can always be played simutaneously, streaming and non streaming. The only difference between the two is how its managed, but the fact remains, its just a buffer. A sound card usually plays 64-256 simutaneously.
I'd advise you to get a copy of "Game Audio Programming" used from amazon ($60 book new, i got for $12 used). Its an awesome explanation of game audio and audio management in general.
So Mulligan you recommend me to use wav files for all the small files and just use mp3/ogg for the sound files such as the background music, if I understand you right.
If the sound clip is going to last for more then 2 seconds or so, you probably want to go for MP3/OGG. Unless it's a sound effect that's only just over 2 seconds, then it's up to you to decide.
Most games implement sound effects as one-shot buffers, where the entire WAV is loaded into the buffer and played, and they play music as streaming buffers where a buffer of only 1 or 2 seconds is created, but filled over and over (Think of it like a treadmill at the gym - the treadmill is only 1 or 2 metres long, but you're actually walking for hundreds of metres on it)
Most games implement sound effects as one-shot buffers, where the entire WAV is loaded into the buffer and played, and they play music as streaming buffers where a buffer of only 1 or 2 seconds is created, but filled over and over (Think of it like a treadmill at the gym - the treadmill is only 1 or 2 metres long, but you're actually walking for hundreds of metres on it)
Again thx for the input...
So if I understand you all right, I should use wavs for sounds that are being just played (under 2 secs or so) and for music I should use mp3...
So I can say, as an example, I play the level music as mp3 'cos it's a bigger file and much longer and the sounds, such as the player's footstep, the sound of the weapons and the environment are wavs 'cos they are normally under two seconds...
So if I understand you all right, I should use wavs for sounds that are being just played (under 2 secs or so) and for music I should use mp3...
So I can say, as an example, I play the level music as mp3 'cos it's a bigger file and much longer and the sounds, such as the player's footstep, the sound of the weapons and the environment are wavs 'cos they are normally under two seconds...
The only reason that I know of to use MP3/OGG instead of WAV is for size purposes, WAV will be better due to quality, but you have to be realistic about what you want to do. I agree with Steve. Use WAV for your sound effects, but use MP3/OGG for background music. I'd say OGG because it is free, and most of us on this website are hobby developers or lone wolves, who maybe get paid to develop, but don't have million dollar budjets behind them to pay for MP3 usage.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement