How do I get the current playback position (secs or ms) of a playing sound cue?

Surely there must be a way.

1 Like

you need to use an audio component to play the sound then use the OnAudioPlaybackPercent delegate function to get the playing USoundWave and the playback percent.

Keep in mind since sound cues can play many sound waves, this will be called back for each playing sound and return their playback percent.

There isn’t a way to get the logical playback time of a sound cue (i.e. accumulating delay notes, etc) right now.

The “OnAudioPlaybackPercent” event that I create doesn’t seem to execute. I’m binding it to the Audio Component that I create with “CreateSound2D” but I can’t see it activating. My sound cue is non-looping.

That worked really well - thank you!
I can do beat-matching now.

You have to call Play function after binding event.

I’m having a similar issue that I’m hoping someone can help me with.

What I’m trying to do is be able to call a function/event that gets the current playback time in the currently playing audio and start playing a different audio at the same playback time.

Reason I’m trying to do this is because I have a BGM for my levels that has an Intro (introduction), and after that finishes playing, I immediately start playing the looping segment of music (the refrain/chorus). At the end of the level (when whatever objective is completed that would end the level and load the next level, for example: after beating the level boss), I need to get the current time in the looping refrain, stop playing that music file, and begin playing a different music file that contains the refrain + outro/conclusion, so that the music can smoothly transition from essentially looping to not looping.

I’ve got stored sound base variables for storing the 3 segments of audio, I’ve got my bind event to on audio playback percent, but I’ve no idea what to do with this to essentially go from the non-looping A to the looping B to the non-looping C.

I’m a programmer first and an artist second, and have basically no musical skill to save my life. But I’m making a side-scroller beat-em-up game and it just won’t feel right without background music to go along with each level/boss battle.

The problem I had was that when I used QueueAudio in USoundWaveProcedural to continuously add audio data and played it back with audiocomponent, OnAudioPlaybackPercentNative seems applies only to add data for the first time so I can’t get USoundWaveProcedural actually playing time, and OnAudioFinishedNative also does not work, I would appreciate it if anyone could solve my confusion.