Answered
1
1

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.

JL

  • You must to post comments
Best Answer
4
2

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 Paterson

    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

    Well I must be either missing something or Im misunderstanding your first method, as I cant seem to get it to loop indefinitely until receiving the stop command. It will only loop for the attack/hold time set in the envelope. Hopefully I can make it to GDC this year and we can look at this together in person!

  • Brett Paterson

    that’s because the condition in the loop conditions is not met, so it leaves the loop.
    This means you should be looking at your ADSR. You could delete your ADSR and modify the parameter by hand to test it.

    Then the adsr is added to your parameter. 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.

  • 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!!!

Great Answer
1
1

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 Paterson

    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
0
1

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 Paterson

    ‘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
0
1

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.