
Here is an image of you compose a nice looping sound, see how I cut the sound when the amplitude is near "0". "As a general rule of thumb, Compressed audio (or modules) are best for long files like background music or dialog, while Native is better for short sound effects"Īnd regarding "have a nice gapless bgm" you need to use a good tool for that, one that allows you to cut, trim, stretch and test the audio loop before you export it to a wav file. But still I strongly suggest that you go with the WAV format for better results, this is what Unity states for short sounds: So if you increase the kbps (less compression) you will have far better results. See that the compressed waves don't start smooth, they start with a straight line which will render as noise.

See how smooth is the "sin" wave on the WAV format compared to the other formats? The reason is that compressed format like MP3 loss quality and information, deteriorating the quality. Think of audio clips as repeatable textures or seamless patterns, the start and end needs to match, and the easiest way to achieve this is by cutting the clip when the amplitude of the wave is 0. I don't need to play those clips to listen to the clic and the pop you mention, it is pretty obvious from the waveform you posted. It is easy to see that the clips are not well suited for gapless looping. Original Wave: Loops nicely, because it is WAV.Ĭompressed as MPEG (Non gapless looping selected), "pop" sound is super obvious while listeninig it.Ĭompressed as MPEG (Gapless looping selected), "pop" sound is still obvious, just a bit better than setting. These are the pictures of various settings I've tried, including the original wave file If the file given is wrong or not best for this situation, what conditions should the file fullfill in order to have a nice gapless looping bgm? However the "pop" sound is terribly obvious.Ĭhecking "gapless looping" is just a bit better but it does not avoid the "pop" sound 100%. In fact, that button was completely broken and did nothing.Īnd make it loop: var gameObject2 = new GameObject("MyObject") ĪudioSource2 = gameObject2.AddComponent() ĪudioClip2 = Resources.Load (filename) as AudioClip In very old versions of Unity, there was a "gapless looping" button (removed since about 2014). I am doing as instructed: Import WAV files, select MPEG encoding, check the "gapless looping" box

I've read these threads: Gapless-MP3-playback, Gapless looping on iOS, Gapless looping on iOS Producing seamless looping mp3s.

I've been struggling with this for some days already now.
