Compressing wave files

Started by
15 comments, last by ageny6 20 years, 6 months ago
quote:Original post by dede
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.


If you have a, for example, for minute song, and that it is about 40 someodd number of megabytes, does that mean that you get to load 40 megabytes worth of wav in memory?



My signature used to suck. But it''s much better now.
My signature used to suck. But it's much better and more accurate now.
Advertisement
quote:If you have a, for example, for minute song, and that it is about 40 someodd number of megabytes, does that mean that you get to load 40 megabytes worth of wav in memory?


yes that is correct. Usually most game music is a loop of a short tune. Think back to those old nes games with the short midi loops. Great, now that Mario Bros music is stuck in my head again!!! I haven''t really looked into using midi for background music mainly because it is easier for me to plug my guitar or keyboard into my sound cards audio in and record as a wav, but I know midi files are really small and I think they use very little processing time, but that may be an option you might want to look into.


Evillive2
E-Mail
Evillive2
quote:Original post by ageny6
quote:Original post by dede
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.

If you have a, for example, for minute song, and that it is about 40 someodd number of megabytes, does that mean that you get to load 40 megabytes worth of wav in memory?
Depends. You can get away with double buffering your music.

Here''s are blocks of music
ABCDEF...

Load AB, play A, get B ready. When the A stops, start B. Erase A and load C. Repeat til end, and restart. That is a way you can get around 40 megs. zlib allows you to load things in blocks, you''ll just have to generate header information, which would be faster than decompressing a mp3.

If you do it in another thread(i.e. a mult-threaded application), it probably wouldn''t be too much of a preformance hit. You''ll have to play with how big your block size is too, you want it to be long enough to have enough time to get the next one, but not too big.


You can also just not care, since Windows has 2 gigs of virtual memory to play with. You''ll just have a very long loading time!


If you talking about 40 megs, I''d just use either .mp3 or .ogg. DirectShow has mp3 decompression, and .ogg has its own decompression for free. I''d go with mp3, since it is slightly more mature at this time, so it decompresses a bit faster.

~~~~~
"the best thing about betting on apathy is that even when you lose, you dont care." - nethead.
Download and play Slime King I.
~~~~~Screaming Statue Software. | OpenGL FontLibWhy does Data talk to the computer? Surely he's Wi-Fi enabled... - phaseburn
quote:Original post by evillive2


...Think back to those old nes games with the short midi loops...


Evillive2
<a href="mailto:jessechoward@netscape.net"><img border="0" src="http:\\users.rcn.com/jhoward5/char1.gif" width="64" height="64">E-Mail</a>

I had no Idea NES uses MIDI.
quote:I had no Idea NES uses MIDI.


sure, its not like the game cartriges could hold data the size of a wave file!

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

My signature used to suck. But it's much better and more accurate now.
http://www.vgmuseum.com/systems/nes/

That page doesn''t mention anything about MIDI.
So its like pre midi technology. Pretty neat

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

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

This topic is closed to new replies.

Advertisement