Audio on Android not stopping when the audio cue is done playing

Unreal Engine 4.13.0.

Android 7.1.1 (API 25) and Android 5.0.1 (API 21)

In our game we have a number of .wav assets that when played have a significant amount of silence at the end when played on Android. When played on PC (both in and out of the editor) everything is fine.

Here’s what happens:

  1. Start audio asset playing.
  2. Audio plays as expected. In editor, the audio cue has a listed duration of 3.9 seconds.
  3. OnFinishedAudio event is not triggered until a significant amount (3 - 4 seconds) of time after the audio plays. So, it triggers approx. 7-8 seconds after starting the audio.

In the 3-4 seconds of silence after our audio, the Unreal Engine thinks that the audio cue is still active and playing. I have verified this by playing music and setting up the cue to auto duck the music. I also confirmed it by attaching print statements when audio playback starts and to the OnFinishedAudio event.

Not all of our audio assets have this problem, but a significant number do.

I have reproduced this bug in the FirstPersonExample template.

In my example template, I have set up some music and two audio assets. The first one works as intended, the second one does not. The only different between the two assets is the actual audio data in the .wav files.

If you would like a copy of my FirstPersonExample template, please let me know and I can supply a download link via private message.

Thank you,

Hey .Hpe,

So we are making big changes to our Audio engine, and this issue sounds very similar to others that were reported in 4.13 and 4.14 which should be resolved in the 4.15 engine release. Would you mind testing your issue in 4.15 to see if it still occurs there as well?

The new audio engine is coming to 4.16 so a lot of the old issues will no longer occur and the quality will improve. Let me know if you have further questions.

Cheers,

I have confirmed that my issue does not occur when using the 4.15 engine release.

We’re currently on 4.13 and are not sure if we’re going/able to move to 4.15. Do you happen have github commits or dates for the changes that might have fixed this issue? I did a cursory search in the UE4 GitHub repository, but wasn’t able to locate the specific set of changes.

We’re using a slightly modified version of the engine and may just integrate the fixes ourself, assuming the changes are straight forward.

Thanks,

I cannot think of a specific set of Cl’s that would address your particular issue and I would have to give you a CL that makes things worse. I would check the format of your sound files you are experiencing this issue with, and make sure they are identical to the ones that play correctly.

There is also a bug that still has yet to be fixed which could be related to the android audio playback issue you are experiencing.

UE-38753

This issue has yet to be fixed, but as I mentioned we are bringing a completely new audio engine with 4.16 and these issues will more than likely be fixed indirectly.

Thanks,

I spent a lot of time checking the sound files before posting the bug. The header data in the WAV is exactly the same (except for fields that contain the size of the audio data itself) for the WAV files that work and the ones that don’t.

The only difference in our sound files is the actual wave content. I tried manipulating the content directly and in some cases could make a problematic WAV work again, but I was never able to narrow down the exact sequence of data that caused the problem in the first place.

Perhaps it is a specific duration that is causing the issue. It is interesting how it only occurs on some sounds though, so your best bet is to try an workaround the issue for now and/or move to an engine version that does not have the issue if it is blocking your development.