Making sounds perfectly looped

From Verge3D Wiki
Jump to navigationJump to search

To use audio assets for the web, the MP3 format is recommended as it provides high data compression and is supported in all modern browsers. However, creating looped sounds without glitches is not trivial when dealing with MP3. First, it uses lossy compression and second, it might insert delay headers (padding) at the start of tracks that cause audible, glitchy pops on loop repeats.

For seamless audio looping, use CBR (Constant Bit Rate) encoding with maximum bit rate available for MP3 — 320K. Avoid encoding assets with VBR (Variable Bit Rate).

For example, when using FFmpeg, encode your assets as follows:

ffmpeg -i input.wav -codec:a libmp3lame -b:a 320k output.mp3