Questions about how to optimize memory with FMOD

Hello, I am a new user to fmod and I am currently working on my first project with it for a small game. As I’ve selected most of the sound samples I’m going to use and started to plan how to implement them this problem about optimization popped in my mind.
For instance, I am using a sample of a dog barking, and I will separate each bark. Would it be best to split each bark individually before applying them on fmod or is it fine to have a single audio file and split it within fmod?
Which also is related to my next questions: If using the single audio file, would the game instantiate the entire root sample or would the build only send to unity the used information? And If I were to split the sample into many clips, and happened to not use all of them, would the unused clips in the soundbank still be loaded into the game?

When an event is loaded and the sample for the instruments is not set to Streaming, it will load that entire sample into memory. In this situation, splitting the samples into individual barks will be preferable. If the sample is set to Streaming then it will load that sample in chunks, however it does introduce a little bit of buffering. Any gains for optimization you make using a single large asset instead of multiple smaller assets will be negligible and it would be better to structure the event in an easy-to-understand and easy-to-maintain manner instead.

Any asset used in an event in any capacity will be bundled into the event’s assigned bank or asset bank. If an asset is not used (eg. in the assets browser it is listed as #unused) then it will not be included.

1 Like

Hi! I think it’s a proper place to ask my question.
I’m trying to optimize the build size (for mobile) by shrinking the size of the audio assets. Wa got some gameplay music loops. I’m managed to break apart that loop to ouple of “samles” wich are used multiple times. For example one of the tracks after splitting it in to patterns A, B, C, D, E, F etc. after reassembling became like -
A-A-B-B-C-D-A-B-D-C-E-F-C-E-F an so on. Not to mention - i’ve now been able to reconfigure that loop as i please. It is dried the size of the music bank.
But after analyzing deeper that A,B,C,D… samples, it became clear that each that sample consists of a main theam and a couple of instruments in various configurations.
To be exact - A was split into A_1 and A_2. B was split into A_1 and B_2. And C is like
A_1 A_2
And D is
A_1 B_2
And E, F = A, B but with Instr_1 and Instr_2.
I hope that clear enough))))
That would give me even more dry music bank.
Now the question is:
While I’m shrinking the physical memory size, would it be some additional calculations during gameplay? Or only some additional time on loading the level assets?
Thanks in forward )

Yes: Playing multiple assets at the same time consumes more CPU cycles than playing one asset at a time. (More precisely, each simultaneously-playing asset consumes one of your project’s limited software channels, increasing the chances that some channels will be virtualized.)

On most platforms, CPU time is a more significant constraint on what you can do than random access memory, and random access memory is a more significant constraint than disk storage. Many of our users therefore prefer to optimize their game to require less CPU and memory, even if that means increasing bank size - but every game has different requirements.

So if i understood you correctly - an event that consists of composite events ain’t converting into one single sound track when loaded into runtime?

That’s right.

FMOD is a tool for creating adaptive audio, meaning that every part of it is designed to let you make your game’s sound react to the player’s actions in complex and interesting ways. For example, splitting your audio up into multiple sound files that play simultaneously (as you have done) means that your game’s code could potentially control the volume of each of those sound files independently in real time, dynamically adjusting which tracks are audible based on what the player is doing in the game.

However, for this to work, every part of an FMOD Studio event needs to be processed in real time while your game is being played. It’s not possible for the build process to convert all the assets in an event into a single asset ahead of time, because that would prevent FMOD from being able able to affect each of those assets individually when the game is played. Thus, events with a lot of complex content consume more resources when played than events with simple content.

Besides, if FMOD Studio did somehow convert each event’s content into a single large asset, that asset would be just as large as the large music tracks you started with - and so splitting your music tracks up into multiple smaller assets wouldn’t result in smaller bank sizes.

Thanks a lot.