Game Development Community

Stuttering, and in dealing with a lot of audio

by BeyondtheTech · in iTorque 2D · 06/01/2009 (9:43 am) · 1 replies

As I can't stand games that obviously have the room for audio (read: Wii and their 8.5GB capacities), and yet impose the player to read everything, I was planning to have a lot of audio files full of speech.

However, when I started playing them from my game, I noticed a small stutter of the engine as it's probably access, loading, buffering, and/or queueing, the WAV file. It's not bad if the game is slow, but if I'm creating an action game, that could be a problem, especially when it's all different audio at different times.

I opened up a previous thread about caching (that didn't get any replies yet), but I was hoping someone has a workaround or fix. I did that to an animation with a really low alpha so it couldn't be seen on screen, and subsequent calls to the animation seem to not stutter.

Is that what I'll have to do for all my animations and audio files? Is there a better method to the madness? How do I know that one "cached" animation isn't going to push other animation out of memory, causing another stutter later on in the game?

In regarding audio, does it have to be 44.1KHz, 16-bit mono WAV files, or can I use 22.05KHz, less, or even 8-bit (yuck) to lessen the amount of stuttering by loading a smaller file? Also, it will improve the entire size of the application I'm trying to distribute.


#1
06/01/2009 (4:00 pm)
It should be 16-bit, but you can lower the frequency, particularly for speech. There have been reports of issues with 8-bit sound, although you could try 8-bit 11025Hz and hope you don't get any pops.

You might find IMA4 decoding source out there, if you can't find a way to get sounds decoded to WAV buffers on the iPhone. That would be a better solution. You can only decode one IMA4 stream with the hardware, but if there is a decoder in a kit on the device, decode to RAM and keep a few sounds there.

If you only need to play one at a time, it's easier. Streaming is much faster than the preloading I guess Torque does.

(Right now I'm not sure if iTGB even knows about other things than WAV and MP3!)