Is gapless audio looping possible in Unity

I Know the option is there but it never works, its ether white noise ether a “tick” sound when the audio loop restarts.
We are about to make a musical game but without that simple option its just impossible (it shouldn’t even be an option, it should be done automatically).

so far nope, you can’t really mess with the audio itself, if you are trying to make a perfect loop get audacity which is a free sound application

I already have a .wav perfect loop, its just it doesnt loop in Unity without a "tick’’ or a white noise when it restarts, already tried all options.

I haven’t tried this, but I find it incredible that it doesn’t work.

I’m still not in the sound stage of my game, but if this is the case, I’ll be worried.

If you use a .wav file without “gapless looping”, you will hear a white noise when the loop restarts.
If you check “gapless looping” you will hear a small “tick noise” when the loop restarts.
If that’s a bug, than that’s a serious one.

Hi, did you ever reach a solution with this? I’m about to make a game that requires perfectly seamless audio loops. This worries me!

I’m having the same problem. Audio is ticking when loops restart and “gapless looping” is always grayed out as an option. I’ve heard that the solution is to set the audio format to mpeg, but that doesn’t seem to be one of my options right now with version 4.1.2f1.

I haven’t really worked with standard looping of clips, so I can’t comment on that, but you can loop seamlessly using playscheduled

After banging my head against the wall for a while I figured out that the reason -my- clips were popping had to do with the sample rate. Apparently 44.1 kHz good, 48kHz bad.

Yeah I’ve found that playing with sample rates and compression can have different effects on the tick noise that a ‘gapless’ loop track has. It also changes when it’s on iOS as opposed to the editor etc… it’s annoying and probably is a bug that needs fixing.

If you have an audio clip that on iOS is converted into an mp3, and the mp3 is a multiple of frame size, and it pops, then submit a small test app as a bug.

What do you mean by this?

This is hows its supposed to be done (apparently) though I think with 4.2 the looping is pretty good as standard, Im working on a project with similar problems. http://answers.unity3d.com/questions/516113/using-audioclipcreate-to-create-a-reference-track.html for my latest issue I could use some help with that if you have any ideas.

MP3 files break their audio up into frames, each of which is something like 1800 bytes long. (I forget the exact size, I know it’s not 1800). For a given sample rate, each frame has a certain size in seconds of audio. If your mp3 clips is not a multiple of this time, then you’ll have some empty space in the end of the last frame. This empty space will prevent your clip from looping seamlessly. (Now I come to think of it, I think they audio duration is fixed, and the frame size in bytes varies according to sample rate. A 128kbps clip has a frame size of 417bytes, the first 4 of which are header.)

1 Like

Sure, just use WAV or OGG.

You cannot loop an mp3 in Unity.

(I don’t know why Graham’s answer is so staggeringly complicated. It’s utterly trivial to loop an mp3 - any number of simple pieces of software does that, from other game engines to trivial audio players, etc. It’s “nothing.” It just happens that in Unity you can not loop mp3s. To loop audio in Unity just trivially convert first to OGG or WAV then drop that file in Unity. Nothing to it.)

(ALSO NOTE GRAHAM: what you say is quite incorrect dude: if you magically guess a “clean” frame size to import in to Unity, it does not help because Unity re-does the sizing itself, anyway, and it will again break and have a gap. You can see any number of posts about this online. Note that there are any number of trivial tools available to “fix” a “matching frame size” for you regarding mp3 files. This simply does not work with Unity. You simply, cannot, loop an mp3 in Unity. It’s no big deal and it’s that simple.)

3 Likes

Like @Fattie says, use wav or ogg instead of mp3. I ran into the same thing. Exporting to wav fixed it.

A perfect seamless sound with ogg has a hiccup when restarts loop. 2019.4.8.