Alternating sounds based on length?


#1

Is there a way to alternate between two random variation sets of sounds (let’s say “inhale” and “exhale”) so that the next sound plays immediately after the previous sound ends, even if the variations have different lengths?

I thought it could be done by nesting an Inhale and an Exhale event in a looping, sequential playlist, and have the Inhale and Exhale random variations inside those nested events. But the nested events’ length doesn’t seem to depend on the content length, whether you use timeline sync or Async to play them.

Is there any technically feasible way to queue multiple sets of random variations of different lengths one after another, so that the length of the asset determines when the next sound gets triggered? The only way I could think of was “an ugly and complicated timeline transitions hack” but surely there should be a better way?


#2

Unfortunately, the only ways to achieve the behavior you describe at present are the “ugly and complicated timeline transitions hack” you mentioned, and an imperfect workaround that uses an AHDSR and sidechain modulator on a parameter in conjunction with a loop region that has a parameter trigger condition to detect when a track is no longer producing audio.

The behavior where multi instruments use the timeline length of nested events to determine when a nested event has finished playing rather than the output of the nested event is a known bug. It will be fixed in an upcoming major version of FMOD Studio. (Because it represents a significant behavior change, we are unable to fix it in a patch version.)


#3

Thank you for the response. At this point maybe the timeline hack is then the way to go.

It’s possible to make random variations on a timeline by adding a self randomized parameter to the event, having a set of Transitions at the beginning of the event, with Conditions that apply to a range within that random parameter. So if you have 6 random variations, transition 1’s condition is 0-1, transition 2 is 2-3, etc. This gives a better distribution than just giving every transition a Probability of 100% divided by number of variations.

You’ll still need destination markers for each wav variation, an End destination marker at the end of the timeline, and a transition to end at the end of each variation. Assuming the variations are lined up one after another on the timeline.

Maybe a script could be authored to automate the creation of the transitions, their conditions, and the destination markers?


#4

So if you have 6 random variations, transition 1’s condition is 0-1, transition 2 is 2-3, etc. This gives a better distribution than just giving every transition a Probability of 100% divided by number of variations.

That’s a good method, but I should mention that randomization modulators on event properties (such as parameter values) only select new random values when the event instance starts. This means that if the playpack position encounters your logic point repeatedly within a single event instance, the same transition marker will activate each time.

If you want your event to be able to trigger a different transition marker each time the playback position reaches the logic point, there’s a way to do that. When multiple transition markers share the same timeline position, they’re evaluated from top to bottom. You can therefore get similar behavior by assigning each transition marker a probability equal to 1/n, where n is one plus the number of transition markers lower than that transition marker in the logic point. For example, if you have a logic point consisting of four transition markers, you can ensure each transition marker has an equal chance of being triggered by assigning them probabilities of 25%, 33%, 50% and 100%, from top to bottom.

Maybe a script could be authored to automate the creation of the transitions, their conditions, and the destination markers?

Such a script could definitely be made! Our scripting system fully supports it.