How to tick independent of frame rate array

Im trying to make an array stay in sync with audio as its recording and playing back. This is a game that needs to be built with it always staying in sync and so I need to code to be fps independent. anyone know how to do it?

1 Like

It really depends on what you’re thinking of doing and how you’re going to do that.

Timelines, for instance, are frame rate independent.

Many ways of animating things on tick are framerate dependent, but not all.

Well what im trying to do is read off of an array but not have any frame drops stop it from reading and small freezes so it need to be frame independent

It’s a wee bit enigmatic, not too easy to advise without knowing what’s at stake.

A Timer is also framerate independent. Interestingly enough, it will fire multiple times between the frames if they’re delivered sluggishly. But the in-between distribution across a frame is not even, so to speak.

If we’re accessing / sampling audio data and update something else, you could set a timer to a low value and it will update an array at that interval.

ah ok how would I do that tho. Could you provide an example. Im trying to run it at a constant 30 fps. Grabbing the array.

at a constant 30 fps

You probably mean 30 times per second.

If you want to work in a frame-independent manner, forget about frames. Think of time instead - of how often.


Try it like this and see if you’re getting the expected results:

No matter how many frames are being spat out, you should get the same number of Timer updates.


Yet another way of handling it:

This way Tick no longer goes as fast as it can. Each actor can have its own interval.

3 Likes

I didn’t know timelines were frame rate independent. That’s awesome.

Watching how this develops. I have worked a lot with audiocomponents in an attempt to sync multiple audio tracks, think of Guitar Hero or anything like that. Was an unfixable nightmare in UE4-27-2 as the current playback position can not be retrieved accurately and will desync into invalid values whenever the app window loses focus. Gave up since the audio code is such a mess. Wonder if it got a proper rewrite in UE5 but UE5 comes with its own audio trouble right now.

1 Like

I actually figured it out

Thanks I got it working in my game im working on