Download

When playing audio at a desired start time, it sometimes seems to be off by a fraction of a second

Im working on a game sort of like Rock Band or Guitar hero, there are 4 instruments that can be played assigned to different audio cues. The Cue stops when the player stops holding down the correct button, then should resume at the correct time when they start pressing again.

I have a float variable being updated in Event Tick,

All of the Sound Cues are being played and stopped in the same blueprint, and sharing the same float variable. they are all exactly 16 seconds long.

the issue i am having is that sometimes when the sound is stopped and then played again, sometimes the cue is a fraction of a second off, not by alot, but enough where its definitely noticable in a game where the 4 sound cues need to sync correctly.

is this a bug in the engine? Are audio components just unreliable? Is there a better way i should be going about this? Any suggestions would be greatly appreciated.

If they need to be in sync, I would try two things:

  1. Start them all at the same time, and “stop” them by muting the volume, rather than actually stopping them.

  2. Write my own mixer that loads raw wave files and mixes together the appropriate files at the appropriate offsets. You can easily make sure everything is always in sync this way by mixing only on full beat offsets, for example. If your full sample is 16 seconds for 32 quarter notes at 120 bpm, you simply offset the position you play at so it’s the same as the master track, modulo (length / 32)

Ypu should also check out ue5 meta sounds

couldnt for the life of me figure out how the quartz mixer works but simply muting them instead of starting and stopping them was the solution, thanks!