I have an Fmod project in Unity and a heirarchy set up using studio event emitters. It’s a 2D game and I’m using custom perameters to simulate distance and direction.
Each scene has a large number of emitters to handle various complex audio systems, which started to create lag spikes so I began setting max instance limits on the “problem children” that had the most instances at once. Everything worked out smooth and I got audio for the entire project implemented with no performance issues, however when I created the first playtest build for test audiances it had horrible audio issues, including pops and clicks and certain emitters abruptly stopping.
I began troubleshooting and determined that further reducing max instances made this issue stop happening however I had to limit them so drastically that it started to effect the gameplay and even then there would still be issues of music tracks randomly stopping if there was a lot going on audio wise.
I’m kind of lost on what to do at this point and I still don’t understand why there would be audio issues in the build that aren’t at all present when testing the game in the editor. I’m working on really tight deadlines for this project and will continue troubleshooting on my own but if anyone can offer any advice I’d greatly appreciate it.
It’s worth noting that I have tested the build on multiple machines so that’s not the issue. Also since this game is going to be a full release I can’t share it here but I can email it to an official Fmod representative if need be.
Edit: after a lot of tinkering it seems that the issue is not enough real and virtual channels causing fmod to cut certain emitters, I increased the max values in Unity and it helped a little but I’m still having issues of pops and clicks in the audio mix and certain sounds failing to play, the ones failing to play are often the loudest and most recent one which as I understand goes against the behavior Fmod is supposed to have when you exceed max channels (and I definitely shouldn’t be exceeding 256) I can’t find any fix for this and I’d greatly appreciate some assistance
It’s difficult to troubleshoot your performance issues exactly, but I can provide some general tips for optimizing your project:
If you upload a profiler session from FMOD Studio to your FMOD profile that has recorded the issues in question, I may be able to diagnose your issues more accurately.
Thank you for the reply! I suspected the number of voices could be an issue given that I had a large number of layers as separate multi instruments for the sake of more variation. I am however wondering if you’re aware of any reason why it would all sound fine within the Unity editor and have problems as soon as it’s in a build? I find the performance difference baffling given that running games within the Unity editor generally requires more CPU and memory than running a built game. I have never overridden the default file systems so that may be an effective route as well, I’m just very confused as to why it would have issues in the build when it functions perfectly in the editor
The difference in editor vs build performance could be a number of things on Unity’s end that are impacting CPU performance (e.g. difference in quality level between editor and build, for one). On FMOD’s end, the editor’s platform-specific settings and/or Studio build target settings may be different from the platform you’re building for, causing a discrepancy in audio encoding settings, max instances/voices, channel counts, etc. between build and editor.
With that said, it’ll be difficult to help you much further without a profiler session. You can connect FMOD Studio to your Unity project using Live Update, and then use the profiler to record the FMOD processes and output of your project while it is running. Once a profiler session has been recorded, it’s possible to package and export the session by right clicking on a recorded session and choosing “Package Selection”. You can connect FMOD Studio to a build (as opposed to just the editor) by enabling Live Update for your build platform under FMOD Settings → Platform Specific in Unity.
I looked into the file system issue and over the course of experimenting I discovered the issue was actually related to the decompression of audio samples in realtime. Because so many events were being triggered for short sounds so frequently it was putting too much strain on the processor and causing voices to vertualize that weren’t supposed to. I set the most common assets as decompressed and checked the preload sample data box on my bank loader and everything is now playing exactly as intended in the build. In case anyone with a similar issue reads this in the future it bears noting that this method caused a massive spike in memory, in this particular project memory usage wasn’t a concern because the rest of the game is minimal but in other use cases it would be important to balance memory use with consolidating voices for your own overall goals.