Delay between SoundBase finishes playing and the event "OnAudioFinished" fires

I’m writing a simple dynamic music system that switches music tracks on the fly according to gameplay condition. Each track is a SoundBase list containing a song cut by measure. Every time OnAudioFinished fires, we play the next SoundBase. The whole functionality is done in blueprint with UE 4.14.3.

However, with the current implementation, it seems that there is a noticeable delay between the end of the previous measure ends and the starting of the next. Is there a way to solve the problem or reduce the delay?

Related question: Noticeable gap in sequence node on sound cue and OnAudioFinished

unfortunately, doing OnAudioFinished delegate triggers for interactive music isn’t going to work for a number of reasons. Blueprint runs on a game thread tick while audio runs in a separate thread. To do this we’d have to write a scheduler that introduces latency so that audio events could be scheduled according to a “sample accurate” clock. This is actually something that I’d like to implement in the near feature but doesn’t exist now.

People have been able to make interactive/dynamic music systems by doing their musical timing entirely on the game thread vs depending on delegate callbacks. Then, author your music pieces as one-shots with a bit of tail so that when a new piece plays (or if the same piece is retriggered), the tail will prevent an instantaneous stop (and thus sound like a discontinuity). You can also mask transitions via one-shot “stinger” sounds (like cymbal swells, orchestral hits, or some other musical one-shot).

I’d recommend checking out the BP Timeline component to build a BPM counter that counts beats and measures and broadcasts musical structural events which you can use to trigger pieces of music.

Thank you for answering. I changed the transition to cross-fading for the current project due to time constrain. I will take your suggestions for the future implementation.