We are contemplating using ogg for our sound files to get our download size down. I found though, that the ogg files use substantially more RAM than wavs. For instance, here are the memory stats reported by FMOD_memory_getstats:
Memory stats for wav:
current: 3577063, max: 3922006
Memory stats for ogg:
current: 9690638, max: 9936923
So thats almost 6MB more of memory vs wavs. Is that normal? I think my oggs are encoded ok (vbr <64kbps, single channel, 22khz)
- banana asked 10 years ago
Yeah the ogg reference decoder allocates some insane amount of memory for each time you create a sound for tables and the like (i’ve seen 200k to 600k before).
We’re working on a system that will be only available via FSB encoding, where certain things are hard coded (ie which mapping/floor method it uses) so that we can throw out a bunch of stuff, and switching to tremor lowmem/lowaccuracy (lowaccuracy sounds the same to me, theres probably 1 or 2 bits of error introduced which is ok for games) we can get the memory overhead down to 40kb from what i’ve seen.
When it is added as FMOD_CREATECOMPRESSEDSAMPLE this 40k (probably lower I havent looked at chopping it down more to say 10-20kb) will 1 constant overhead at init time (so hopefully 320kb to 640kb for 32 voices) and it doesnt matter how many more oggs you have it will just be the raw compressed data that is allocating memory.
Thanks for the help guys
For ogg, could decompressing the stream once be an option? Then you can throw away the decoder memory, and you are just left with the memory necessary to store the decoded data. Obviously this introduces overhead when a sound is created, but we preload most of the game sounds only once.
I did mess around with mp2 a bit, although the freeware encoder I found on the internet (twolame) introduced some artifacts in the file – sound dips near the end – which mess up looping sound playback.
- banana answered 10 years ago
Please login first to submit.