AUDIO • ARTIFACTS & PLAYBACK

AUDIO NOT LOOPING SEAMLESSLY / AUDIO STUTTER

Background music or engine audio has a noticeable micro-gap, crackle, or loud popping click every time it loops.

Primary Causes of Audio Loop Glitches

  • 1. Streaming from Disk on Looping Clips: If an Audio Clip's Load Type is set to Streaming, disk I/O bottlenecks can cause micro-buffer underruns right at the loop point, creating a split-second pause.
  • 2. MP3 Padding Silence: The MP3 format inherently adds a tiny buffer of silence (20-50ms) to the beginning and end of encoded files. MP3 files can never loop seamlessly!
  • 3. Non-Zero Crossing Waveforms: If the audio file waveform ends at a non-zero amplitude before jumping back to the start, the speaker cone pops.

Step-by-Step Fix

  1. Use WAV or OGG Formats (Never MP3 for Loops):

    Re-export your audio tracks from your DAW in uncompressed .WAV or raw .OGG format.

  2. Adjust Audio Clip Import Settings in Unity:

    Select the Audio Clip in your Project Assets view and set:
    • Load Type: Decompress On Load (for short loops under 15 seconds) or Compressed In Memory (for longer background music).
    • Preload Audio Data: Checked.
    • Compression Format: Vorbis (Quality 70-80%).

  3. Ensure AudioSource.loop is Enabled in C#:
    audioSource.loop = true;
    audioSource.clip = seamlessEngineClip;
    audioSource.Play();

Related Audio Guides & Errors

Frequently Asked Questions

Go to Project Settings > Audio. The DSP Buffer Size determines the audio mixing buffer latency. Setting it to Best Latency reduces audio trigger delay but can cause audio crackling on weak mobile CPUs; setting it to Good Latency or Best Performance eliminates crackling at the cost of slight audio delay.