MP3 format doesn't loop gaplessly

Hi, a game composer learning Unity here!

I just watched the lesson on Block Breaker about using background music and it talks about using mp3 files as source for the bg loop music.

I just want to point out that mp3 won’t loop seamlessly because by default the compressed audio is padded with silence at the end. In order to loop without “gaps” the file must have a multiple of 1024 samples before it gets compressed.

To avoid that either use wav or ogg files :wink:

Cheers!

2 Likes

Hello @Xetrovoid

I just saw your post and I was wondering if maybe you could help me. I have an mp3 music that I have in my game. It doesn’t seem to have any noticeable gap that you mentioned but after a few times looping (I believe twice) it just stops. The game music doesn’t play anymore and I was wondering if you know why this might happen? I have no experience with music and I am new to coding. Any ideas or advice would be super appreciated! Thanks!

Privacy & Terms