We had a feature in our previous in house audio engine that would play out a specified audio track in a sfx event when receiving a stop event before killing the sound. This was used for pretty much every looping event that plays a tail sound on stop (ie. guns, engines, water , fire, etc). Currently in FMOD you would have to trigger this as a separate event. Would be great if it could all be contained within one event, would simplify and clean things up nicely.


  • You must to post comments
Best Answer

new method. cross posting from other thread

Here’s a new method I just came up with that only requires a stop call.

enter image description here

  1. If your sound is on the timeline put a loop region around it
  2. put a transition region on the same range
  3. add a parameter
  4. modulate the parameter with an AHDSR. ADHDSR has a special feature that when you call stop, the release phase plays out even after you call stop (as long as its not stop immediate).
  5. Add a parameter condition to your transition region, so that the condition triggers as soon as the release part of the AHDSR starts releasing. So if you have the condition 0-.99 and your AHDSR is set to 100% for everything except the release part, it should trigger the condition as soon as the release starts.
  6. add a destination marker, set it to be the transition regions target.
  7. place your tail sound at the new target marker.
  8. make sure the release in the AHDSR is long enough to handle the length of the tail sound.

To test it, you hold down the stop button, dont just click it. The stop button will start flashing and execute the release stage in the envelope, it flashes for as long as the release stage is active.

  • brett

    The whole point of the new method was to play out the loop. I see I misinterpreted your original issue, where you said ‘it only loops until the AHDSR executes’ which isn’t true. The AHDSR jumps straight to the Sustain point and stays there until stop is called by the game. This means the parameter value should be staying at 1.0 until stop is called.

    Both methods above do NOT require sending a parameter from the game. The whole point is you call stop, and the R part of the envelope triggers, which makes it automatically exit the loop. There is no game code required.

    I thought originally you didn’t want it prematurely leaving the loop, so the new method lets the loop play out, which is perfect for something like gunfire.
    If you want it *breaking out* in the middle of a loop, because your loop has multiple sounds in it, then that’s what the original method is for.

    If you need to to break out of a loop at a specific point because you’re not looping a single bang noise, but say 4 bang noises per loop, that’s what quantization is for, you can set it in milliseconds, inside a transition region.

    edit: better than a region in this case, is 4 transition markers instead of a region, then it will break out wherever you want it to.

  • Jesse Lyon

    When I remove the ADSR it loops fine. When I add the ADSR and push every point to the top, it starts playing from the tail marker every time, no matter what the parameter is set to, even if I remove the parameter condition.

  • Jesse Lyon

    Bah, I rebuilt it from scratch and now its working fine!

    Thanks for your help Brett, sorry for the run around.

    Edit: I figured out why it wasent working before, I had the parameter condition setup opposite from yours, with the condition valid at the high end (0.99-1) rather then the low end. Now its looping fine when set to 1, and then transitions and plays out the release when it gets the stop and parameter is set to 0. Thanks!!!

  • Steve

    @ guys : Thanks for the interesting thread and methods there is just something I am confused about as I reread your thread a couple of times on this part : “Push every envelope point to the top, like in the picture, and set the initial value of your parameter to 1.0, then it should work.”

    Why do we need to set the initial value to 1, what value does the one represent against the ADSR? I set the initial value to 0 and the tails play correctly when stoping (long click on stop) via Fmod. I did exactly the same as Brett : setting a condition from 0-0.99 on my loop, except having initial value at 0 and it does the same thing.

    Although I noticed that If during playing I move the condition range to 1 (double end cursor on the transition region) then it plays automatically the tail…

    If you set the condition from 0 to 0.99 on the loop does this mean o from 99 % of the ADSR, 100 % being the initial parameter so 1?

    Just need to understand clearly, thanks!!

  • brett

    the condition to jump to the marker is “parameter is between 0 and 0.99”. If it starts off at 0, it will trigger immediately. This is why it is set to 1.0 to start with.

    The AHDSR multiplies that parameter value with the envelope. It is param * 1.0 during the AHDS stage, and when stop is call, it has a downward slope which makes the release go from 1 to 0 quickly. ie when that ADSR hits .99 or .9 or .8 or whatever, now the parameter will be .99 or .9 or .8 or whatever it happens to hit, making the transition region condition trigger, and it will jump to the marker.

Great Answer

You don’t need a separate event, you can break out of a loop with a parameter, and play the tail pretty easily.
ie, i just made a parameter called playtail from 0-1 and it only loops if playtail < 0.5, and setting it to 1.0 makes it break out.
loop with breakout/tail
If you dont like the parameter idea, you can do it by putting loop with its timeline, inside another event as a reference event. Just drag that loop event into a new event as an eventsound, and put a sustain point in the parent event, in that timeline, in the middle of the loop event’s box. Then all the programmer has to do is execute a keyoff command instead of stop to play a tail sound which can be just to the right of the loop sound.
This is done with getCue, and Cue::trigger(), instead of stop.

ie enter image description here

  • brett

    for the 2nd method, you can just use a sound with its loop button ticked on (top right of instrument panel down in the deck), rather than using an event with a loop region. It just depends how complex your loop is.

  • You must to post comments

Both great workarounds, thanks Brett! The first method is probably best, as I dont currently have a programmer available. However, adding a simple “play on stop” feature (such as a tickbox on the track) would be even better, as it would all be handled with the one stop command, and I wouldnt have to deal with additional in game parameters or programmers!

  • brett

    ‘play’ what though? There is a timeline there, and the idea is that you want it to play forward after pausing in the timeline.
    Another idea is to use a transition point that only leaves on a certain event (like a stop). You need some transition logic in your event, not just ‘play x or y’ , thats not a concept that is part of the studio interface, and sounds a bit hard-coded.

    The keyoff method lets you do what you need, but the issue is the programmer has to trigger a cue instead of calling stop. Do you mean, if you use a stop command, it should not stop but automatically trigger a sustain point, or maybe my other idea, a transition that kicks in if stop is called?

  • Jesse Lyon

    Exactly, when receiving a stop command from the game (UE4 in my case), it should not stop the looping event immediately, but play out a sustain point before killing the sound. I’ll play around with the transitions a bit more, I’m sure I can get it working that way with the suggestion you provided.

  • You must to post comments

I have similar problem. I designed a sound like this:

It’s sound of a bow shot. First sound is an oneshot, later under loop region there’s scattered sound that keeps playing unless I set the parameter “arrow_release” to 0.5 – 1. Then cursor jumps to Marker A and simultaneously arrow release oneshot sound is played. The problem is whatever I do my event is not released. Usually when there’s nothing to play my events stop automatically without problem but not this time. Do you know what should I do? I suspect loop region to prevent the event from being released. I also tried adding ADSR to arrow_release parameter to no avail.

  • Jesse Lyon

    See Brett’s solution above, its working perfectly for me. If not, then you likely have your ADSR and condition setup wrong. Also dont forget you have to hold the stop button to audition it properly in FMOD (sending the stop event from the game will set the ADSR to release and jump to the marker automatically during runtime).

  • Vojta Nedved

    Thanks for your answer. Brett’s solution works for me but it’s not perfect. When I set parameter “arrow_release” to 0.50 weak shot sound can be played, when I set it to 1.00 perfectly strong shot sound can be played. You can’t do this with simple sound on timeline. But that’s not the problem – my problem is that whenever there’s loop region or scattered sound with infinite total sounds, my event doesn’t get released. When I don’t use scattered sound or region loop it gets released normally so I’m a bit confused. Is it some kind of issue of FMOD? Do I have to tell the programmer to stop the event every time after he sets my parameter?

  • Vojta Nedved

    Or maybe it’s a problem of FMOD studio implementation made by our programmers… I need to evaluate this.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.