Lots of sounds makes the game go mute? (Unity)

Hello! I’m new to FMOD, just integrated it into a Unity project where I have lots of short sounds playing (think machine guns and stuff like that). I play the sounds via script using FMODUnity.RuntimeManager.PlayOneShot(eventname, transform.position);

When I play it in the unity editor, some sounds are intermittently missing, as if there isn’t enough sound channels. (The debug window says it uses 20-40 channels.)
When I run the game as an executable, the sounds play for a couple of seconds, then go completely mute for several seconds, then really struggle, playing just one or two sounds every now and then.

I’m not sure what’s going on. Am I running out of sound channels, or is something else happening? If it’s the lack of channels, how do I increase them? I’ve found some commands like
FMODUnity.RuntimeManager.CoreSystem.setSoftwareChannels(128);
…but I don’t know how to use them. If I try adding them in just somewhere in my scripts, nothing seems to change.

Could someone tell me how to increase sound channels in FMOD/Unity? I mean in a very practical way, which line of code to add, or which settings to tweak?

The sound works fine without FMOD. (I’d like to add FMOD for some added features though.)

I can’t really answer for the max channel and Unity part, but for the FMOD Studio part, did you work a bit on limiting the number of instances? You can limit on a per event basis, per bus basis, or even on the master, with the most appropriate stealing mode. For lots of short sounds spamming in a row, maybe think of setting a short cooldown in the macros. And I hope you didn’t set your assets as “streaming”.

Heya, thanks for replying!

The number of instances is already limited in my game itself (and the sound works fine without FMOD), and the assets are not set as streaming.

I’ve tried adding these lines to a script:
FMODUnity.RuntimeManager.CoreSystem.setSoftwareChannels(128);
FMOD.ADVANCEDSETTINGS advset = new FMOD.ADVANCEDSETTINGS();
advset.maxVorbisCodecs = 128;
advset.maxMPEGCodecs = 128;
advset.maxPCMCodecs = 128;
advset.ASIONumChannels = 128;

…but I’m not sure if that’s the right way at all. It doesn’t seem to help. What else could I try?

I’ve also tried switching between WASAPI and ASIO, tried lowering the game’s CPU usage, and tried lowering the rate at which sounds are played - sounds still get muted a lot. It shouldn’t be this bad, so it feels like the number of channels is very low or some other setting is very wrong by default. Or I’m doing something completely wrong.

Did you try using the profiler and live update, to get more detailed informations?

Well, I’m just bad at browsing menus it seems! Finally found the solution: two sliders labeled real and virtual channel count.

FMOD top menu → edit settings → “Platform Specific” → “Default” and there they are, four menus deep. The issue was that they default to (only) 32, and the script commands did nothing, but these sliders do the job.

1 Like