Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ageny6

Compressing wave files

This topic is 5453 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a file format out there that can compress a .wav file but retain the .wav extension. In other words, I am not looking for who to convert to .mp3 or .ogg, what I am looking for is almost like a codec, but for audio .wav files. Any ideas? Thanks My signature used to suck. But it''s much better now.

Share this post


Link to post
Share on other sites
Advertisement
The ACM (Audio Compression Manager) of Windows will automatically use the appropriate codec for a .WAV file, so you can actually rename a .MP3 or .WMA to .WAV and it''ll play as a .WAV and the decompresion will be handled for you!

.WAV is really just a wrapper - most "plain" WAVs you''ll find aren''t "raw" sample data anyway.

Share this post


Link to post
Share on other sites
quote:
Original post by S1CA
.WAV is really just a wrapper - most "plain" WAVs you'll find aren't "raw" sample data anyway.


So how come, then, does a .wav takes up soo much hard drive space if it is not raw data?



My signature used to suck. But it's much better now.

[edited by - ageny6 on October 11, 2003 10:05:45 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by ageny6
So how come, then, does a .wav takes up soo much hard drive space if it is not raw data?


Lossy versus lossless compression and different levels of "lossiness" as well as different levels of CPU overhead to decompress/decode.

MP3, WMA, OGG etc are [typically] more lossy and use more CPU time to decode.

PCM, ADPCM etc are [typically] less lossy and use less CPU time, but have larger file sizes for the equivilent file.

The type of samples being compressed matters too - for example TrueSpeech WAVs are more applicable for spoken word audio.

Share this post


Link to post
Share on other sites
quote:
Original post by cowsarenotevil
When you compress a WAV file using an MP3 codec, will it be larger or smaller than the equivalent MP3?

Note sure what you mean? If you are asking about whether an mp3 is larger than a wav, the answer is not, because there is some data loss during the conversion.


My signature used to suck. But it''s much better now.

Share this post


Link to post
Share on other sites
Wait a minute!

That means that using uncompressed raw data for, say, background music would take less processing speed than playing a mp3? Did I get that straight? If so, is there a big difference, or is it barely noticable by today's standards?



My signature used to suck. But it's much better now.

[edited by - ageny6 on October 12, 2003 6:27:32 PM]

Share this post


Link to post
Share on other sites
quote:
Did I get that straight?


Yep, MP3/WMA/OGG etc take more CPU time to decode/decompress than simpler compression formats such as ADPCM.


quote:
If so, is there a big difference, or is it barely noticable by today''s standards?


It depends how scarce your CPU resources are - if you''re making a game for P200''s *AND* everything else in your game is using a lot of CPU power (physics/dynamics simulation for example), then yes, the difference can be important (big-ish).

On a "current" machine however, the audio decode time is a tiny percentage of the available CPU power - and there are usually much larger CPU hogs than audio decompression. Games commonly are CPU bound in some way though - so its something to look at _if_ the performance of your game on your target is below par.

Share this post


Link to post
Share on other sites
quote:
Yep, MP3/WMA/OGG etc take more CPU time to decode/decompress than simpler compression formats such as ADPCM.

It does take more time, however, it depends on how you load your audio files as well. If you have a small mp3 that gets played continuously as background music, with some (most?) audio libraries like fmod you can have it uncompress the file at loadup into memory so it only uncompresses once and continuously plays it from memory. I do that with most of my game sounds since a raw wav file is about 10mb per minute of audio (I think), and a 1 minute mp3 can be less than 1 mb. It takes a lot less disk space but more time when the game/level is loading. You will probably see the biggest performance hit when you try to play files directly from disk at runtime. Depending on the complexity of your game, you may have the extra time per frame to read from the disk and decompress on the fly. For example that worked fine for a simple galaga type game I made, but probably wouldn''t work well for a first person shooter where frames per second seem to be bragging rights for people.

Evillive2
E-Mail

Share this post


Link to post
Share on other sites
Since this is in ''game programming'', I''ll assume you''re using it for a game.

You can use zlib to compress your wav in a zip, then zlib again to decompress and load during game play. It will still be a wav file, but it will be smaller.

~~~~~
"the best thing about betting on apathy is that even when you lose, you dont care." - nethead.
Download and play Slime King I.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!