Hello! There is an event that is supposed to fade out at a forced stop. But if there is no forced stop, then the event should stop exactly when the audio track inside the event ended. ADHSR works fine, but if you let it play to the end, the release time is added to the duration of the audio track inside and the event plays longer, i.e. there is a fading of silence, because the audio track has finished. It turns out that using ADHSR is not suitable in our case, because we need an immediately stop if forced one is not used. Is it possible to solve such a problem? Or maybe the possibility to sometimes ignore AHDSR or something else, any ideas?
I’m not clear on the content of your event. Is the AHDSR modulator on an event property or an instrument property? When the event is sent a stop command, do you want the whole event to fade to silence, or just one instrument? And when the playback position reaches the end of the instrument, what audio is still playing that causes the fade to silence to be obvious?
Hello, Joseph! The event is a phrase, a modulator on the volume. I have attached a video to make it clear. At a forced stop everything is fine, we are satisfied, the video is the first 2 runs. And the next 2 runs show that when the end of the audio file is reached, the event does not stop instantly, but also fade in. And it turns out that it becomes longer in time by the duration of fading. This is critical for us, because we check from the code whether the event was played, and only after its stopping we start the next event, and so it turns out that we have pauses in the duration of fading.
Thanks, that video really clarified how your event is structured.
Here’s how to get the behavior you want: Remove the AHDSR modulator from the track volume, re-add it to the instrument’s volume, and give the instrument an “event state: not stopping” trigger condition. This will ensure that the instrument fades out when the event is sent a stop command, but that the event stops instantly when the instrument finishes playing out its content.
Hello! This did not quite help to solve the problem. For some reason in this version AHDSR works differently, i.e. I had to adjust Release settings to achieve the desired attenuation. To be more accurate, the curve begins to depend on the length of the audio. So, if you set a short release, fade is possible by forced stopping only in the beginning of the track, if you stop it later, after the middle for example, it won’t fade, and it becomes a problem with long tracks… So, again, I don’t understand how it works. If you set the release to 3 seconds, the event will fade out only in the interval of 0 to 3 seconds, if you stop it later, it will turn off without fading. I attached a link to the video. Where you can see that the fade is set to 1.2 seconds. And if you stop the event in this interval, it fades, and if later than 1.2 seconds, it abruptly cuts off without fading
This is a bug! Thanks for bringing it to our attention. I’ve added it to our bug tracker, so it will be fixed in an upcoming version of FMOD Studio.
As an alternative to moving the AHDSR modulator to the instrument’s volume property and using event state conditions (and thus having to deal with the bug), I suggest putting a command instrument at the end of the single instrument, setting its command type to “Stop Event - Immediate” and its target to the event containing the instrument. This will cause all instances of the event to immediately stop as soon as the command instrument is triggered. You mentioned above that you only intend there to be one instance of the event playing at a time, so this should work for your purposes.
Thanks for your help! This solution, using the command instrument, works for us at the moment. Too bad there is a bug with AHDSR, we will wait for it to be fixed! Thanks again!