Download

Playing an audio clip in-time with music

I’m pretty new to Unreal Engine and am looking to make a game with some rhythm game elements. For example, at the start of the level, start playing a BGM and whenever the player presses a key, on the next beat or bar, a music clip will play along with the music.

  1. Is there a way to keep track of the number of samples played of an audio clip similar to this function in Unity? https://docs.unity3d.com/ScriptRefer…s-dspTime.html
    Here’s an example of an implementation for a rhythm game using dsptime in Unity: http://ludumdare.com/compo/2014/09/0…m-game-part-2/

  2. Is there a way to schedule audio clips to play at a certain beat or after a certain amount of time? This should not be reliant on framerate since frame rate might be out of sync with audio.

Hey Joanna,
Check the Time Synth component. It’s made just for that. It works well too.

There is a new Subsystem out in 4.26, in Early Acess/Beta, called Quartz. It allows you to establish metronomes called Clocks on the Audio Renderer and allows you to schedule synchronous audio playback. It also supports delegates for event queue status as well as ticks for gameplay to receive beat data. I do not have any videos or docs on it yet, but we do have docs pending release.