Command Instrument stoping an event doesn't propagate fadeout parameter

Hi, I’m not sure if this is a bug or not. This could be a case of RTFM that becomes a feature request…

There is an event “AmbianceOn” that plays a snapshot instrument + a loop region. Documentation says that a snapshot doesn’t need a loop region and is active until stopped, that’s the RTFM part :slight_smile:
There is another event “AmbianceOff” that stops the event “AmbianceOn” with a command instrument (stops the event, not the snapshot).

Doing that, the stop is propagated to the snapshot so that’s great, but the snapshot stops without the “fade out” parameter on, so it produces a click (I can replicate this click behavior in code by stopping the snapshot without fade out)

The fix is done by removing the loop region on the event “AmbianceOn” and using the command instrument from “AmbianceOff” to stop the snapshot, not the event. Doing that stops the snapshot with fade out and no click.

So bug, “as designed” or feature request?..


EDIT: ooops, it seems I mixed up things and the loop region is needed for the snapshot to be active. The documentation says that too.
So the fix is “AmbianceOff” event must contain a command instrument that stops the snapshot immediately and then stops the “AmbianceOn” event after 500ms or something so the fadeout can occur… This seems a little tedious: is there another way to do that?

This is both “as designed” and a feature request: There’s good reasons why instrument AHDSR modulators behave the way they do, but we can see why you might sometimes want them to behave differently.

When an AHDSR modulator is placed on one of the properties of an instrument, the release period of that AHDSR modulator starts when that instrument is untriggered. When an AHDSR modulator is placed on one of the properties of an event, the release period of that AHDSR modulator starts when that event is stopped with fadeout. Stopping an event does not untrigger any of the instruments in that event. (If it did, an event with an AHDSR modulator on its master bus volume would normally fall silent immediately when stopped, instead of fading out gradually, due to its instruments all being untriggered at the same time.) This allows you to produce events with much more complex behavior than could otherwise be achieved.

A snapshot instrument is an instrument; thus, its release period begins when the instrument is untriggered, not when the event is stopped. If you want your snapshot’s release period to play out when the event is stopped, you must ensure that the snapshot is untriggered when the event is stopped.

The simplest way to do this is to play and stop the snapshot as an event in your game’s code, instead of through a snapshot instrument. Under the hood, a snapshot is a kind of event, so you can start an instance of a snapshot with Studio::EventInstance::start and stop it with Studio::EventInstance::stop, just as you would with any other event.

Alternatively, if your project requires snapshot instruments, you can ensure that each snapshot instrument is untriggered when the event is stopped by giving the snapshot instrument a parameter trigger condition, and placing an AHDSR modulator on the value of that parameter. Parameter values are event properties, so an AHDSR modulator on a parameter value does enter its release period when the event is stopped with fadeout.

As I said at the top of this post, you’re not the first user to want certain instruments to be untriggered when their parent events are stopped. We don’t want to make that the default behavior, but we can see that it would be a useful option, so we’re currently planning to add it as an option in a future version of FMOD Studio.

Thanks for the detailed explanations!
We went for the code-called event solution and it works fine (didn’t know a snapshot can be started/stopped like an event, very convenient)