Load times, sound banks and 3d sound areas.


(Nick Adamson) #1

Hi All.
I’m new to FMOD and have a couple of questions with regards to the time it takes to load sounds and the most efficient way to do things.
I’m developing a game where sound is fundamental, In fact is it’s the main UI driver as the game is designed to be played by people like me who are blind so the on screen graphics are minimal.
The sound engine I was using in my previous releases was OK but had some limitations. For my new project I’d like to start using FMOD as it looks like it should give me everything I need.
I’m developing in C++ on windows using the FMOD low level API. I’ve got sounds loading and playing and the sound environment I’m building is starting to sound how I expect.
However I’m finding the soundscape very slow to load, and I’m not even stressing it that much.
At the moment I’m loading around 10 individual .ogg files. I’m calling Create Sound once for each file and storing the sound structure. As a number of the sounds are repeated from different sound sources, maybe 10 or 15 times, in the soundscape I’m calling play sound per sound source but passing in the same Sound structure returned from Create Sound. This gives me any number of channels per sound structure. Is this the most efficient way to do this? In the end game there’s going to be far more sounds sources and from what I’ve read FMOD should be able to handle that well.
What I was expecting to happen is that the create sound calls would take a little time, disk IO being the main culprit, but the play sound calls to be very fast. This is not what I’m seeing, the play sounds seem to be taking quite a long time to run too. Is this expected? What can I do to decrease the load time and/or play time?
I’ve read that sound banks can be used to contain a number of files and that loading your sounds in to a sound bank during the build process and playing them from the bank during operation is the recommended approach. I’ve been playing with the sound bank generator and can see how that works to generate the SFBs files however what I’ve not worked out yet is how I tell FMOD to look in the SFB file when calling create sound. A couple of questions here:

  1. I’ve read that loading the sounds from sound banks is much quicker. Is this correct?
  2. How do I tell FMOD to load my sounds from a sound bank? I’m using the low level API.

Working with 3d sounds:
I’ve got the general idea of the 3d sounds in space, how to position the sound source, how to position the listener however one of the things I’ve not spotted how to do is have a sound take up an area rather than a single point in space. For example, say I’ve got a river running down the left hand side of my soundscape, as the user moves forward the sound of the river at the moment goes behind them. This is because the sound of the river is set to a point in space rather than an area of space. What it should do is continue on their left hand side as they move forward. I could get around this by moving the sound source point in space as the user moves but I wondered if this was the best way of doing it. I’m hoping I’ve missed something in the documentation with regards to setting an area for a sound source. Is there a way to do this or is it something I’m going to need to do manually?
Sorry for all the newbie questions and thanks for your time in reading and answering.
Nick.


(Cameron Baron) #2
As a number of the sounds are repeated from different sound sources, maybe 10 or 15 times, in the soundscape I’m calling play sound per sound source but passing in the same Sound structure returned from Create Sound. This gives me any number of channels per sound structure. Is this the most efficient way to do this? In the end game there’s going to be far more sounds sources and from what I’ve read FMOD should be able to handle that well.
That is the way we would recommend. By default, on Windows, FMOD can have up to 256 total voices (real and virtual) and of those, 64 audible voices at a time.
What I was expecting to happen is that the create sound calls would take a little time, disk IO being the main culprit, but the play sound calls to be very fast. This is not what I’m seeing, the play sounds seem to be taking quite a long time to run too. Is this expected? What can I do to decrease the load time and/or play time?

If you are using the default flags when creating the Sound, I would not expect the play calls to take very long.
Normally with larger Sounds/files we would recommend using FMOD_CREATESTREAM so that you aren’t loading a large amount into memory, but this can cause the play call to be take longer.
So anything that is really time sensitive is recommended to be created with FMOD_CREATESAMPLE, although it will increase memory usage.

1. I’ve read that loading the sounds from sound banks is much quicker. Is this correct?

That is correct, FSB is designed for loading and will be much faster than .wav or .ogg files.

2. How do I tell FMOD to load my sounds from a sound bank? I’m using the low level API.

The ‘play_stream’ Lowlevel API example uses an FSB. You create a sound from it as you would with a single file, then access the sounds in it with Sound::getNumSubSounds and Sound::getSubSound.
https://fmod.com/resources/documentation-api?page=content/generated/FMOD_Sound_GetSubSound.html#/

I’ve got the general idea of the 3d sounds in space, how to position the sound source, how to position the listener however one of the things I’ve not spotted how to do is have a sound take up an area rather than a single point in space. For example, say I’ve got a river running down the left hand side of my soundscape, as the user moves forward the sound of the river at the moment goes behind them.

There isn’t really a way to make an area sound as you have described.
I would have suggested exactly what you said, have the sound follow the player along the path of the river.