Getting Started With FMOD Banks | Part 3

We're back today talking more about FMOD Soundbanks!

I think in this one we’ll finally start talking about loading them into Unity. But first a recap:

In Part 1 We Learnt That:

  • SoundBanks are files created by FMOD. They contain our audio and events for Unity to read and playback in our game.
  • Gaming systems that run our game need to load our audio from their storage system to their RAM before they can play it whilst the game is running.
  • RAM/Memory is extremely limited so we can’t load our SoundBank with all of our audio inside it into the game at the start (which is what Unity & FMOD will do automatically).
  • We can instead create multiple SoundBanks that we can load and unload as the audio contained within them is needed.

And In Part 2 We Learnt That:

  • Mobile Devices have even less RAM than other systems, so we need to be extra careful with how much we use up at once.
  • FMOD’s Master Bank holds information about buses, routing, snapshots, VCA’s and must be loaded for any of our audio to be heard.
  • The 3 main types of data that SoundBanks hold are Sample, Meta and Streaming Data.
  • We can create single files holding all of this data for each bank, or create multiple files for each data type of each bank.

I hope you’re taking notes!

Loading Banks into Unity

Okay, so let’s say that we have an FMOD project similar to this:

We have 6 music events, one for each scene/level of our game. 

We then create 6 additional banks (Bank tab -> right click -> ‘New Bank’) for each level’s music.

We want to load each bank at the beginning of it’s scene/level, and then unload it once the scene/level ends.

We also want to make sure that the Master Bank is loaded as soon as the game first starts running and never unloads.

Simple.

Finally, we’ll be telling FMOD to build our banks, and the data they contain, into a single file each.

Now that that’s all sorted, the first thing we need to do is open up our Unity project and take a look at our FMOD Settings.

FMOD Settings In Unity

nside your Unity project, you can edit the settings for your specific FMOD project that you’re implementing into it. Simply click on the FMOD tab at the top of your project and select ‘Edit Settings’.

You should then see a menu appear in the Inspector tab that looks like this…

(Note: I’m using FMOD 2.0 and your Settings will look different if you’re using an older version).

Here you can make tweaks that will affect your entire FMOD project and how the audio within it is played back in Unity.

The section we’re interested in is the ‘Initialization‘ section.

To put it briefly, Initialization is the process that FMOD’s API goes through when your game first boots up in order to prepare itself to play your audio during the game.

But you can see that we have options for deciding which banks load into our systems RAM during this process.

This is typically when you’re going to want to load your Master Bank, so that’s it’s ready before you tell any of your events to begin to play.

So change the ‘Load Banks‘ option from ‘All‘ to ‘Specified‘.

We now get the option to select which banks we’d like to load during initialization.

Select ‘Add Bank‘, and then click ‘Browse‘ to find your banks.

As well as all of your banks that we’ve built, you’ll notice that we have an extra Master Bank to select.

This is the Master.strings.bank file, which is an extra file that FMOD creates alongside the Main Master.bank file.

Master.strings.bank simply holds text and character data associated with all of your events, parameters, track names, snapshots, VCA’s, Buses, etc.

For the code that we write and FMOD’s API to be able to find these tools by their names, it has to check the Master.strings.bank file for them, so we need to make sure that both Master.bank and Master.strings.bank are loaded in for us to playback our audio.

Select ‘Master.bank‘. Then add another bank, browse, and then select ‘Master.bank.strings‘.

Finally, we’re asked whether or not we want to ‘Load Bank Sample Data’ for these banks during initialization.

Well because we don’t have any events (and therefore no sample data) assigned to the Master Bank in this example, it makes no difference. We may as well leave it blank.

But why is this even an option?

Pre-Loading Sample Data

Whenever we tell a bank to load, we need to consider whether or not we want the sample data within it loaded in with the rest of the banks data (such as meta data) or if we want to leave it in the systems storage device until it’s needed.

It’s up to you which one you choose, and will depend heavily on the context of the game, how much audio you have, how long it is, how much RAM space you have to work with and how essential it is for your audio to be heard as soon as it’s played.

AND WE’RE STILL NOT DONE!

But that will have to wait until next time. We’re nearly finished I promise! Now that we know how and when to load our Master Bank, all we have to do now is tell the rest of our banks to load for each level they’re needed.

Leave a Comment

Your email address will not be published. Required fields are marked *