Hi there!
I have started using FMOD Studio along with Unity for our game project. One of the exciting features of FMOD for us is the support of localized dialogue using Localized Audio Tables and Programmer Instruments. I have used the example FMOD project along with the source code example for Unity (https://www.fmod.com/resources/documentation-unity?version=2.02&page=examples-programmer-sounds.html) and managed to get it to work just fine but I have run into a couple of things that might create issues for us in the long run. I will try to explain my thought process of trying to fix these, so please correct me on anything I might be doing wrong.
After setting everything up and testing that the localized dialogues work, I have noticed that every time I played one of the dialogues FMOD would log the following warning:
[FMOD] SoundSourceInstrumentInstance::startChannelIfReady : Loading delay exceeded, sound may play at incorrect time
Investigating this, I found out that the source of this warning is the fact that the desired sound is not yet loaded into memory so FMOD needs to do that first, which might introduce slight delay. For small enough sounds this delay should not be noticeable (I believe our dialogue lines should fit into this area) and can generally be ignored. The only way of fixing this would be to preload the sample data which not only doesn’t work for audio tables but would load all the dialogue lines in the bank into memory. Considering we could have thousands of dialogue sounds, I can see that being an issue. So loading the needed dialogue line right when it needs to be spoken using the createSound
method should be the desired way of doing things.
I investigated a bit further just in case and set the logging level to “Log” in the FMOD settings. In the extra logging information I found out that the bahavior is different from what I expected. Instead of the individual line being loaded in, played and then unloaded, it creates sounds for all the dialogue lines in the bank through the SystemI::createSoundInternal
method. It also does this every time I play any of the dialogues.
Looking into the createSound
method it seems to load things based on the data gained by the getSoundInfo
method, so I cannot really alter its behaviour. Also the only thing passed into the getSoundInfo
method is a string containing the key identifying the dialogue line, so I don’t see myself fixing the issue here either.
What I would like to ask is if it is possible to change the behaviour of the createSound
method to only load the individual sound for the given dialogue line instead of loading all of them contained in the same bank? Am I somehow using the entire concept of localized audio tables and programmer instruments incorrectly?
If this is the expected behaviour, is there a way I should be working around this? Creating all the sounds beforehand and storing them would be overly demanding on memory as mentioned before. Another way I could maybe see helping would be to structure the dialogue sounds into multiple banks instead of a singular one. Although this might make the process of creating, loading and unloading them more complex that what we would like. Any tips are greatly appreciated.
Version of Unity and FMOD I am using in case this info is relevant to my issue:
Unity version: 2021.2.0f1
FMOD for Unity package version: 2.02.04
FMOD Studio version: 2.02.04
Thanks in advance.