Changing between sounds at specific percentage of file length

Hello,
I’m still very new to using FMOD, so this might be a pretty basic question.
We have a door that opens when you pull a lever, and if you pull it again it can start closing mid-animation.
What we want to do, is make it so that if the door changes which direction it’s moving in, the sound plays from a position based on how far the animation has gone.
For example, if it opens 75%, and you pull the lever to close it, the closing sound plays the last 75%, skipping the first 25% of the sound. Or if you close the door 30% and then start opening it again, the opening sound plays the last 30%, starting at 70% of the whole sound.
Is there a way to do this using the parameters in FMOD, or do we have to do this through code?

Hope someone can help!

The Start Offset property of an instrument allows you to start a certain percentage of the way through an audio file. To find the start offset property, select the instrument in the editor, then expand its trigger behavior drawer. This property can be automated on a parameter if you wish.

However, if your event uses only synchronous instruments, it may be easier to simply set the event instance’s timeline position such that the instrument starts playing from part-way through. Information on how to set the timeline position is described here: https://www.fmod.com/resources/documentation-api?page=content/generated/FMOD_Studio_EventInstance_SetTimelinePosition.html#/

1 Like

Great, thank you so much!

1 Like