Save memory... by streaming from disk?


I noticed most of my memory is consumed by the FMOD Audio Bank, as opposed to the textures (which I suspected initially). It seems as if FMOD loads the compressed *.bank file into memory, and then decompresses on-the-fly.

A google search learned me that I can also stream from disk with FMOD Ex. Is this also possible with FMOD Studio? I know the risk of a buffer underrun, I’d just like to try to see how it performs. (A buffer underrun might actually be preferred over a out-of-memory crash on some low-memory devices such as the iPod Touch)

Studio allow you to specify streaming behavior on a per-track basis. In the Event Editor, click on the ‘Banks’ tab to view the Banks Browser, then select an event. In the Event Editor, you’ll observe that each audio track has a ‘STREAM’ toggle button.

Unfortunately, we don’t currently have any way to bulk edit streaming settings, so you’ll need to set the behavior of each track in your project individually.

(I hope you don’t mind that I deleted your duplicate post. I’m guessing it was an accidental addition?)


Do you have any recommendations when to stream?

The max tracks you can stream from disks depends on other File IO activity and the iOS device. If there is no other File IO, can you haphazard a guess how many files can be streamed simultaneously?

I presume that larger compression allows for less File IO bandwith, but increases CPU cost? (Or does iOS have a chip dedicated to MP3 decompression - and is the CPU spared?)

What will happen when a buffer underruns? Will audio go:
a) out of sync (i.e. pause playback of track, while other tracks continue playing)
b) stutter (i.e. pause/play)
c) drop (i.e. silent)

Thanks for your insight!

(and the double post was by accident. didn’t even notice it! so thanks for deleting!)

Generally people will only stream long music pieces as there is often only 1 at a time and they are quite large. I don’t have any specific statistics for you regarding the number of streams possible but I would recommend keeping it to just music.

Using different compression algorithms will give different CPU costs, PCM and ADPCM are ideal for SFX, they are very low CPU but have none or low compression respectively. For music Vorbis, MP2 or MP3 are options, all relatively high CPU cost but with good compression, I would recommend Vorbis for these.

iOS devices do have access to a single hardware codec for decoding MP3 or AAC audio, this will not work with FSBs produced by Designer so if you use this you must have a loose .mp3 or .m4a. All other audio decoding will be performed on the CPU.

If you encounter an under-run either from streaming bandwidth problems or CPU saturation the result is stuttering, moments of repeated audio as playback reuses portions of the buffer which have already played.