Getting Started With FMOD Banks | Part 2

We're back for part 2! Explaining to you who, what, when, where, how and why we use SoundBanks to load our audio from FMOD into our Unity game.

First let’s quickly sum up what we learnt about in this last email.

  • 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.

Now let’s return back to our story with Cai…

(If you’re reading this Cai, hi!)

Cai’s Puzzle Game
So last time we left off, we had just discovered that Cai had assigned all of his FMOD audio events to a single Bank. I knew this wasn’t ideal, but before I told him to do anything specific, I first wanted to learn a little bit more about the game he was working on.

The game was a puzzle game. From the start menu, the player could select 1 out of 5 “Worlds” to enter and in each was a small collection of puzzles to complete (about 2 to 4). Cai wanted to set the game up to play 1 of 5 music pieces depending on which “World” the player was currently in.

As we learnt last time, Cai had all 5 music events assigned to a single bank. This would mean that as soon as the game started, all of his music would be loaded into the games RAM and would have remained there so long as the game was running. 

The reason why this was particularly bad for Cai’s game is because it was a MOBILE game being developed for IOS and ANDROID.

Heed my warning young one, MOBILE PHONES HAVE EXTREMELY SMALL RAM SPACE. 

 

You cannot afford to waste RAM space for mobile devices. If you do, you may notice a lot of ‘slow-down’ or ‘frame drops’ from your game. Because the game is trying to load assets into it’s RAM where there isn’t enough space, the games performance starts to slow down as it tries to make room for the new asset, deciding what it can afford to unload.

So obviously this needs fixing, but before we can fix it, we need to understand a few more concepts that we’ll need to consider when loading our banks in and out of Cai’s game. Let’s start by talking about the special bank that FMOD provides for us automatically that Cai is using to load his audio with.

The Master Bank

The Master Bank is the one and only Bank that FMOD will automatically create for you. As well as being able to hold our audio events, it holds info about our entire FMOD project and how our audio is to be played back in Unity. It holds info about things such as our Buses, Snapshots, VCA’s and more.

If the Master Bank is not loaded into our game, then we won’t be able to hear our audio play at all, even if the audio events are assigned to another bank that is loaded. This is because the Master Bank holds information that all events need to use to be played, despite which bank they’ve been assigned to.

By default, Unity will load ALL Banks including the Master Bank. This is why when implementing audio, we can just assign our events to the Master Bank and hear them play back in Unity by just telling them to start.

Data Types

Another concept we need to wrap our heads around is the different Types Of Data inside of a Bank file.

We know that an FMOD Bank will contain data about any event we assign to it. But it’s important to understand how that data is separated when inside the bank.

Sample Data

Sample Data refers to data that represents our audio files themselves, whether they're .WAV. AIFF .MP3 or any other format. Sample data is also referred to as 'assets' in FMOD.

Meta Data

Meta Data refers to data that represents information about how the event itself will play. This includes parameters, modulators, automation, DSP's, loops, sends, transition regions, sustain points and any other detail you can think of that affects how the audio will be heard by our player once the event is triggered.

Streaming Data

Inside the Audio Bin Menu (Ctrl+3 or Cmd+3) you can set audio files to 'Stream'. Whenever a 'Streaming Audio File' is told to play, it will be loaded in from the storage device bypassing the RAM. This is used on large files such as music that would take up a lot of space in the RAM. This does however cause a slight delay between when the audio is told to play in-game and when the player hears it.

The reason why it’s important to understand all of this is because you have the power to separate your banks into multiple files depending on their type.

If you go into your FMOD project and go:

PC: Edit -> Preferences -> Build
Mac: File -> Preferences -> Build

…you’ll be brought to a menu similar to this:

Here, you’re given a few different options as to how you’d like to organize your banks inside your games folders, set compression settings for audio depending on different platforms and more.

The section labelled ‘Built banks file separation’ is what we’re interested in as it will affect how many files we’ll have to load into Unity.

Option 1 will turn each bank into 1 single file containing all of the data for the events assigned to it.

Option 2 will turn each bank into 2 separate files. One containing all our events Meta Data and another containing all of our events Sample Data.

Option 3 will turn each bank into 3 separate files. One containing all of our Meta Data. One containing all of our regular Sample Data and one final file containing all of our Streaming Data

I’d normally recommend you stick to Option 1 to make things easier for yourself. The other options might be preferred if you’re working on a game that you KNOW FOR SURE will be followed up by patches containing new audio.

Having your banks separate into files based on data allows you to replaces files with new ones containing new audio (sample data) for players to download and install as a patch.

We’re Nearly Ready To Start Loading Banks…

But for now, we’re going to take a break and save that for the next post. I didn’t realize how long these posts would be when I first started writing them, whoops!

Leave a Comment

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