Quick answer: MP3 streaming is heavier to decode and seeks imprecisely (so loops have gaps). Convert music to OGG Vorbis — lighter, gapless-loopable, license-clean.

A game streams a background MP3. It occasionally stutters, and the loop has an audible gap. OGG Vorbis solves both.

Why MP3 Struggles

Convert to OGG

ffmpeg -i music.mp3 -c:a libvorbis -q:a 5 music.ogg

Quality 5 is a good music default. Then:

pygame.mixer.music.load("music.ogg")
pygame.mixer.music.play(-1)   # gapless loop

Buffer Size

If you still hear stutter with OGG on weak hardware, raise the mixer buffer at init:

pygame.mixer.pre_init(44100, -16, 2, 4096)
pygame.init()

A bigger buffer (4096) trades a little latency for streaming stability.

Author Loop Points

For truly seamless music loops, make the OGG start and end on the same waveform value (or use a loop region). Vorbis’s accurate seeking then loops cleanly.

Verifying

Music streams without stutter on your minimum-spec target. The loop is seamless — no gap, no click.

“OGG Vorbis is the Pygame music format: lighter to decode, sample-accurate loops, license-clean.”

Keep short SFX as uncompressed WAV (Sound objects) and long music as OGG (music streamer) — the right format per use.