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:
Start them all at the same time, and “stop” them by muting the volume, rather than actually stopping them.
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)
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!
Likely what was causing the slight latency issue was the latency induced on loading the asset. If you’re using stream caching, the assets are likely slightly latent when loading the asset into the cache. By playing and stopping the sound, you’re essentially priming it. Then once the asset is loaded and you play it, it’ll play immediately. In general, the latency on first load/playback is a complexity of streaming systems and there are a number of methods to reduce it with stream caching.