Get Instance/Timeline Position of a referenced event

,

Hi,

We’re trying to sync a music instrument to an animation by getting the timeline position of the instrument’s event.

The instrument event is a referenced event, referenced by a global music event (with other instruments).

When searching instances of the instrument’s event with the “Find Events Instances” function, it returns 0 even though we can clearly hear the instrument playing in game.

Is there a way to get the instrument’s event instances (to get the timeline position after that) ?

FMOD version : 2.02.18
Unreal 5.2

Thanks

Hi,

Yes, FMOD_STUDIO_TIMELINE_BEAT_PROPERTIES (FMOD Engine | Studio API Reference - Event Instance) contains the current position of the nested event. To get these properties you will want to assign the FMOD_STUDIO_EVENT_CALLBACK_NESTED_TIMELINE_BEAT event callback (FMOD Engine | Studio API Reference - Event Instance) to the parent event which will have to be done via code.

It would be more straightforward to get the position of an unreferenced event. Could you elaborate on the behavior you are looking for?

I’m not sure we can use this because we need more accurate time than beats and because the music event has multiple child and grandchild events (so I wonder how I would get the timeline beat of the grandchild event I’m trying to aim and not another one).

We first (in blueprint) tried to get the instrument event by the "Find Events Instances” function as I said, but as it was a nested event we couldn’t choose it as the event variable. So we decided to get the instrument event out of the music event by referencing it instead, but the function didn’t return anything (via blueprint or code this time).

What we are looking for : a way to synchronise the instrument event position to an animation. We have a ambient music system in which the instrument event is played synchronously with the rest of the instruments. It plays silently (it is send by a transceiver effect to an another event that manage the spatialization and volume of the instrument) because it must play only when a particular character play the intended instrument in game. So the instrument event has to be synchronized with the global music and the animation at the same time. The idea was to drive the animation position with the music (as the music can’t be stopped or changed) when it begins to play.

We managed to get it work for now by setting a global parameter on the guitar event through timeline (set to 0 at 0s and set to 1 at 0.05s) with a seek speed which matches the event length. We then get the parameter value in Unreal to know at which position the animation has to start. It’s a bit ugly but it works.

Hi,

Thank you for the explanation.

Unfortunately, this may be your best option for getting the timeline position of the child and grandchild. Beyond getting the beat properties you won’t be able to access more information about the events.

Stumbling on this trying to do something similar. Would you mind sharing how to start implementing this? I’m not sure how to set a parameter to automatically update as a track progresses.


Sure !
First, you will need a continuous global parameter that will be your timeline parameter. Min= 0 and Max= 1 to have a normalized parameter (usier for programmers).
In the screenshot, I set the parameter to 0 at 0s via a command instrument. Then, I set it to 1 at 0.05s. You need to calculate the duration between when you set the parameter to 1 (here 0.05s) and the end of your sound to determine the ascending seek speed of the parameter. Let’s say it lasts 5s, you do 5 - 0.05 = 4.95 and then speed = 1/4.95 ~= 0.2. The longer the sound, the harder it is to have a corresponding seek speed because it needs to be very small and we can’t have that precision.
Finally, you only need to get the parameter value from your game engine.

1 Like