Why do I have a noticable gap in my audio when it loops?

Was experiencing this exact thing, found a fix. When I played the loop in my audio editor (Ableton) it would sound perfect but the problem was when exporting the sound Ableton automatically adds the tiniest margin of empty space to the beginning of the file. There’s a setting in Ableton (and I’m sure most audio software) when exporting that said “Render as loop” once I checked that box and exported the audio now perfectly loops for me in Unreal. Hope this helps some people

3 Likes

No, this is neither a solution nor a fix. Read the thread above.

The problem isn’t the loop itself but when you want to use the loop node and set it to x repeats. The issue doesn’t appear if you just set the wave to “loop infinitely”.

1 Like

So I managed to sort this out, using C++. I had the same problem with looping - there was always a small gap between the loops, even though I was 100% sure that my loop mp3 file was fine.

In the end, I ended up using a recursive function, with a timer that’s set to the duration of the sound.


void USLSound::ExecuteLoop(UWorld* World) {
  UGameplayStatics::PlaySound2D(World, CurrentSound, CurrentVolume);
  float NextLoopTime = CurrentSound->GetDuration();
  World->GetTimerManager().SetTimer(
         LoopTimerHandle,
         [World]()
         {
             ExecuteLoop(World);
         },
         NextLoopTime,
         false // Don't repeat - we handle repetition manually
     );
}

This worked perfectly, confirming that my loop file was fine.

If you have a small gap at the end of your sound file, you could even set NextLoopTime to a slightly smaller number (say CurrentSound->GetDuration() - 0.05 for 50ms)