No sound played when lots of calls to FMOD event

I’m having an issue where in the game, an event happens a lot of times. Maybe 10 per second or more. We attached a FMOD sound event to that call. I wanted to limit the amount of sounds by using Max Instances and Cooldown.

But it seems it doesn’t work. Because it is triggered so often, it seems the event is not triggered at all. No matter what I enter into the Max Instances or Cooldown, I cannot hear the sound.

The only thing that works is implementing a “cooldown” in the code, so the event to FMOD only fires every 100ms for example. Then I hear the sound and can manipulate it and everything seems to work fine. But it’s strange that the built-in Max Instances and Cooldown doesn’t work? I thought it’s exactly for these kinds of purposes? What are we doing wrong?

Chris

1 Like

I’m afraid I don’t have enough information to identify the cause of the problem you’re having. Have you tried using live update and recording a session in FMOD Studio’s profiler window? Profiler sessions record how often event instances and voices are created, stopped, and virtualized, and so are a useful tool for diagnosing this type of issue.

For example, you may find that the event is being triggered so often that it is stealing every instance of itself before it can begin; if so, you could solve the problem by using cooldown without instance limiting, or by changing the stealing behavior.

I should probably mention that max Instances and Cooldown don’t directly interact and are designed for different purposes, so using both in the same event may be overkill.

Cooldown determines the minimum amount of time that must pass after an event begins playing before an new instance of that event can begin playing. Thus, if an event’s cooldown is set to 100 ms, and it has been only 40 ms since an an instance of the event was last started, it is not possible to play a new instance of the event. Cooldown is primarily used to prevent “spamming” of notifications or incidental dialogue.

Max Instances defines the number of concurrently-playing instances at which creating a new event instance causes the stealing behavior to come into play. It is primarily intended for limiting resource use, though it may also sometimes be used to prevent “spamming” of notifications and dialog.

When an event has both a finite max instances value and a cooldown, and your game’s code attempts to create a new instance of the event, the cooldown value is checked first, and only if the cooldown duration has been exceeded is the max instances value checked.

Hi Joseph

Thanks for the answer so far. I’m glad I understood the usage of cooldown and max instances correctly. Also stealing behaviour. I’ll try recording a profiling session to see if the flurry of events gets registered or what is happening.

I understand that stealing behaviour might make the sound start over and over, but the last call to the sound should play it through, correct?

For testing I tried different settings and also INF max instances and NO cooldown. There was no sound played. So I need to dig deeper to see what’s going on. And make a porfiler session. Let’s see when I can do this, but I will get back as soon as I can.

Thanks
Chris

Hey Joseph

Here’s a video of the profiling session.

  • First I play the sound, I added a nasty alarm to it so it’s really clear when it plays.
  • Then I switch to the profiler session where you can see the voices, instances and lifespan.
  • I play a recorded session with “simulate” on. And you can hear the sound from time to time. But even after longer pauses (longer than 1s) it sometimes does not trigger.
  • Then I reduce the cooldown to 0ms. No Max Instances. It should play whenever it’s called.
  • Strangely it doesn’t seem to really play simultaneously. You can also hear how the event is being wildly called in the second half of the profiling session, where there is actually almost no voices or instances. Why is it called so often there and not shown? And why is it stopping?

Is it further possible that the cooldown counter is reset if a call to that event is coming even though it’s still in the cooldown phase, so that if lots of calls are coming in, it’s constantly resetting the cooldown without playing the sound once?

Thanks for any help.
Chris

Hey @joseph Do you have any insights I might try to find out what’s going wrong? I uploaded a video to YouTube that shows the setup and what’s happening.

Looking at your YouTube video, I notice that your voice count is often hovering around the 32 mark. That might mean you’re exceeding the system voice limit, resulting in certain voices being virtualised.

Try adjusting your game’s maximum number of software channels, as per the FMOD API User Guide, and see if it affects your game’s behavior. This won’t alter the behavior of the recorded profiler session in FMOD Studio (Studio uses the default value), but if it changes the behavior in your game, it’ll be a clear indication that exceeding the voice limit in your game is the cause.