Game and music sync

Here’s the general idea:

Each level/stage in my game would have a “song” that progresses with the player. Example, the song begins with a drum track, if all goes well after a while then the bass track adds up, then the guitar, etc… If something goes bad then you go back a section or even to the start of the song… You get the idea.

What I’ve tried so far:

  • I have imported each section of my song as separate wav files so that each section can loop perfectly.
  • I’ve created a blueprint with audio components for each song section.
  • It starts by playing the first section.
  • I’ve put a custom event call that triggers at the end of the section.
  • This custom event decides if it continues to the next section or if it replays the first section.

This works… Except that it introduces a slight delay between the sections even though they should loop/merge perfectly…

Another thing I want to do is perfectly sync some visual aspects of the game to the music. A light that flashes on each beat for example…

Any help/guidance on the best approach to achieve this would be much appreciated.

Thanks!

Hugo

I can also confirm that the delay is present when doing things this way. I followed the Twitch stream tutorial for this exact thing - having music progress with the player.

There is a delay when there shouldn’t be.

It’s actually quite hard to maintain everything in sync as the audio is not multithreaded at the moment - so sometimes you’ll get lucky and the sound will be played “close enough” on time, sometimes it won’t.

I don’t believe there is any easy fix for that, but an audio engine overhaul is on track.

I didn’t know there was a live stream about this.

Is this the one?: Audio & Blueprints | Live Training | Unreal Engine - YouTube

Thanks!