Hi guys, i have a question, how make this sound action:
–>button pressed
Start audio effect part
Middle audio effect part is looping (only in pressed button)
–>button released
Play end audio effect
I could easily do the first two actions, but how to make the third audio part play is correctly.
When I release the button, I need to break the loop and play the ending?
You can do it using Key_off functionality. Just place sustain point at the end of you loop ( it should be async and looped on item by the way, cut activated too) and your ending sound right after the sustain point. Your loop area should be short enough for cases when player will press and release button very quick.
Thank you, but it doesn’t work quite correctly, I need the sound to break off and go to the final part, and the method you showed makes an event when the region is finished playing.
That is, I need to break the loop at any time when I release the key and play final audio…
I’m afraid I don’t understand what you mean by “the method you showed makes an event when the region is finished playing.” As far as I can tell, FoxyMusic’s method does not create new events or event instances at any point. Do you mean it triggers an instrument when the playback position leaves the loop region? If so, how does that differ from what you wanted?
Also, have you looked at the “Music/Level 03” event in the “examples.fspro” project that comes with FMOD Studio? It contains transition regions and loop regions designed to cause the playback position to jump from one part of an audio file to another when a parameter value changes. I believe these features could be used to get the behavior you want.
@black_racer (and also @joseph) I made an example project on how you can make an event which plays a OneShot as LeadIn → Loops → Plays another OneShot on LeadOut:
When Play() is called, it starts playing a LeadIn Sound + starts playing a loop
When Stop() is called, it transitions and plays a LeadOut Sound.
Here’s a Dropbox-link to the project if you want to try it out (it’s got a README and all )
Parameter Value Modulation (the magic that makes it work)
Here’s how it works:
SUMMARY
The Main Event will play the tail/oneshot when the event is stopped, ie. avoid writing special code for that to happen, or playing the oneshot as a separate event.
HOW IT WORKS
The “TailOnStop”-parameter is modulated through an AHDSR-modulator on the parameter-value-knob (in the parameter view).
Assuming the parameter’s initial value is “0”, this AHDSR-modulator will make the parameter set itself to “1” while the event is playing (ie. it is on)
When the event is stopped, the modulation will jump down the value to “0”, which triggers the transition to the “Tail”.
FADE OUT MODULATIONS
The “loop”-sub event has an AHDSR-modulator to allow the loop to fade out (ie. crossfade with the Tail), if you so wish.
Additionally there’s an AHDSR-modulator on the Master-track of the main event, which makes the event play out the tail (make it audible) when it is stopped.
You just made it too comlecated. It works just the same way in one event. With all the same functionality. you can adjust fade time as you like, and even stop it as it made in your event with parameter on stop and transition region. But there’s defenetly no need for bunch of sub events. Just use async and loop functionality on your files directly.
I would love any of you guys to explain this to me again, but as if I was the 5-years old child. I´ve been tring to make “on-stop” event for two days and I am dead. Nothing from these tutorials work for me.
EDIT: I figured where was my problem. When I set everything up (ADHSR envelope on parameter skipping to end), nothing was happening - everything was stopping immediatelly. BUT - I tried setting AHDSR modulator on the master volume of the whole event and that was what was causing the problem. I set AHDSR envelope for parameter “to tail” a little shorter than master volume envelope so that it had an actual time to go to the end and that solved it. If anyone is reading this post in the future - maybe this will help : )