How can I convert Wav files to take up less memory
Miscellaneous Forums/General Discussion/How can I convert Wav files to take up less memory
I've noticed lately that all the games I have been making are
taking up more and more memory because of the .Wav music
files that I have included with them.
How can I fix this?
.Wav files are so expensive that they are not practical for me to
continue using in my games.
Is there any way to reduce their memory cost?
like converting them to a different format that can still be used
in Blitz?(Such as mod, or midi)
Thanks,
The Mighty WERDNA(Lord Of Darkness)
Mod and Midi are completely different formats. They're composed of multiple sounds, they're not a single sampled sound. There are two supported formats which are still a single sampled sound like a WAV, but with compression, and those would be OGG and MP3. For licensing reasons, you're best off avoiding MP3, so that leaves us with OGG.
Now, Ogg will save you a lot of hard drive space, but when you load it into memory, it has to be uncompressed to play it with the standard sound commands. In order to play it compressed, either from memory or disk, you need to stream it, and I think the MaxMod is probably your best option for that. There's a BASS module from Brucey, and that can stream OGG's too. One of those two libraries ought to suffice anyway.
You can also reduce the quality of the WAVs, e.g. mono sound, or a lower sampling rate. Obviously that also makes them sound worse.
Streaming OGG/MP3 means you use less memory, but it's also much more CPU intensive than playing a plain WAV file, so on low-end machines it may still be problematic.
Windows XP has included a saveable mp3 wav codec so you can convert your files to .wav but internally stored as .mp3. I've had no problems with files encoded this way in distribution - apart from some people emailing me to suggest I use mp3.
Open Windows sound recorder, drag a file in, and goto save as and select the codec. I'm on a Vista machine atm has some new fangled rather limited version of Sound Recorder so I cant guide you directly to it, but it's there.
Saving your .wav files this way allows you to continue using them as a Blitz sound file rather than a music file, and gives you the full benefit of mp3's file sizes.
Also, I think though am not sure, they actually decompress on loading, so there's no CPU hit. I'm not 100% sure on this though so please forgive any innacuracy, i've not played with sound in some time.
2 problems with MP3.
1)
You have to pay for it.
More reading.
2) The WindowsXP MP3 codec is capped at 56kB/s, so isn't going to sound all that great. You'd be better off using an encoder like LAME, but then there's still the whole licensing thing.
Ogg for teh win.
That, and mp3s add a lil header at the start so they don't loop well.
<3 OGG
Start AND end.
The WindowsXP MP3 codec is capped at 56kB/s, so isn't going to sound all that great.
Actually, it depends on the version of Mediaplayer that you have installed -- Mediaplayer 11 replaces the crappy 56K version with the Frauenhofer MP3 codec, which can encode in high bitrates as well. (up to 320kbps)
(Even without the full MP11 installed you can install just the codec:
http://www.looprecorder.de/tut_l3codec.php )
Start AND end.
Well, consider me just a lil bit more educated. Thankyou. :o)
Can Blitz even play .ogg files?
And thanks for the tip about sound recorder.
LOL I completly forgot it could do that.
Major Thanks everyone!
Why I want to reduce the file size, is because most of the games
that I upload to file front are fairly small in memory, except for the
music that goes with them. I want to make it as easy, and quick, as
possible to download my games.(And upload them for that matter.
I'm on dial up and have an average upload\download speed of 5 kb.)
The Mighty WERDNA(Lord Of Darkness)
Can Blitz even play .ogg files?
It can, but it is very slow to load. I use BASS to stream.
Yay it worked!
Sound Recorder works just fine, without the lesser quality of the
sound being to noticeable.
I managed to turn a music file that is 242.16 seconds long, and cost
20.3 MB into a music file of the same length, that only cost 709 Kb.
Now I realize that that may be pushing it a bit far, but this will
definetly work! So Thanks Again Everyone!
I would be lost without this site ^_^
The Mighty WERDNA(Lord Of Darkness)
But you said memory... Mp3 and Ogg are expanded in memory before/during playback. The only way to reduce memory consumption is to either stream from disk or to encode at a lower bandwidth - ie. 16Khz file is 50% less than a 32Khz file and 16Khz Mono is 25% size of a 32Khz Stereo file. Remember disk space used does not equal memory used.
Mp3 and Ogg are expanded in memory before/during playback.
Not really. There's nothing stopping you streaming from memory.
Why I want to reduce the file size, is because most of the games that I upload to file front are fairly small in memory, except for the music that goes with them. I want to make it as easy, and quick, as possible to download my games.(And upload them for that matter. I'm on dial up and have an average upload\download speed of 5 kb.)
i think he was on about file size to begin with but the whole using memory just confuses the issue
like most of us know a png or jpg on disc is less than the same bmp but as far as video memory goes they are the same
its just using the wrong terminology
You have to pay for [mp3].
Mp3 does incur royalties, but in terms of the Blitz programmer just getting a reasonable-selling shareware title out, it's not so bad:
http://mp3licensing.com/royalty/games.html
No license fees are due if less than 5 000 copies of a particular game title are distributed.
Not that I agree with file formats or algorithms being 'protected' in this way, but by the usual Corporate Evil standards, that's pretty decent, and how many Blitzers have sold more than 5000 copies of a single game? For over 5000 copies you're talking $0.50 per copy.
(At that point, you just switch to .ogg, which you should have done from the start.)
and how many Blitzers have sold more than 5000 copies of a single game? For over 5000 copies you're talking $0.50 per copy.
Counting demos as 'distributed copies', at a conversion rate of 1% you'd only actually be able to sell 50 copies before you needed to pay.
But yeah, OGG is a much better format. Especially VBR-OGG which are amazingly small.
OGGY OGGY OGGY
OGG OGG OGG!
IPete2
There's nothing stopping you streaming from memory.
Except the command set?
how many Blitzers have sold more than 5000 copies of a single game?
Yeah. There's a reason they say "distributed" and not "sold".
you'd only actually be able to sell 50 copies before you needed to pay.
So it's more like $50 a copy. Let's say your game brings in about $4 a sale in revenue, and you had no other expenses at all. You'd have to sell more than 600 copies just to break even.
Except the command set?
Which command set is that?