Avoid Clicks when Stopping All Bus/Events

How can I avoid clicks when stopping all events from a bus ?
Is there some sort of “automatic short fadeout” option available in the API ?

Here is the - certainly incorrect and simplified - method that I use at the moment (generates clicks):

            FMOD.Studio.Bus playerBus = FMODUnity.RuntimeManager.GetBus("bus:/amb");
            playerBus.stopAllEvents(FMOD.Studio.STOP_MODE.IMMEDIATE);

FMOD Studio csharp Unity

You can use the other stop mode, FMOD.Studio.STOP_MODE.ALLOWFADEOUT, which will allow AHDSR modulators to complete their release, and DSP effect tails to play out. If this is insufficient, or isn’t the exact behavior you’re looking for, can you provide some more info on your specific use-case so I can help find an alternative?

Thank you for your response.
Your suggestion worked for me.

I’m currently working on designing the sound and music for a story mode in a Unity game. This mode consists of a sequence of cutscenes, and I’m using three buses: Ambiance, SFX, and Music, to emit sound events accordingly.

During the transitions between cutscenes, there are instances where I need to stop all sounds from one or more buses. Thanks to your solution, I can now achieve the fade-out effect I desire by applying AHDSR settings individually to each sound event and setting the appropriate release time on the master track.

However, I’m now contemplating whether it is possible to implement a more streamlined approach. Specifically, I am wondering if I can trigger a common AHDSR envelope for all the events within a bus. My idea is to set up this AHDSR on the bus track itself and then use code to activate this common modulator when I need to stop all events within that bus. In doing so, I would be able to efficiently terminate all these events with the desired fade-out effect.

If you have experience or insights into this approach, I would greatly appreciate your guidance.
Thank you again for your assistance.

1 Like

Unfortunately, there’s no way to accomplish this with a “common” AHDSR modulator on the Bus, as Bus::stopAllEvents simply retrieves the events assigned to the Bus and individually stops them all, so the AHDSR behavior is still tied to each event. Alternatives would be:

  • Batch add an AHDSR modulator to all events in the Bus by selecting them all in the Event Editor, and adding the modulator to the event’s master fader
  • Create a preset Gain effect, add an AHDSR to the Gain, and then add the preset to all events you want the behavior on (batch adding can be used here as well)
  • Create a blending Snapshot with the Bus fader set to -∞ dB, modulate the intensity with an AHDSR, and then play the snapshot from code alongside stopping the event to manually apply release behavior to the Bus volume.
  • Create a global parameter which you use to automate the bus’ fader, and ramp it down or (set it once and use seek speed in Studio to ramp it down) from code at the same time you stop your events, similar to the snapshot option.

That said, I’ve added a common AHDSR modulator for Buses to our internal feature/improvement tracker.

Thank you for the additional information.

I wasn’t aware that it was possible to batch add effects to several events!
This is incredibly useful.

Wishing you all the best,

1 Like