looped audio skips when looping?

small nuisance thats bugging me, i attached a short music clip to my camera to test out some sound things, and its supposed to loop, and it does, but between loops theres a noticeable skip that really bugs me. Why would this be? (for the record yes its an ogg file not mp3, i remember that causing issues for me once)

Hi,
What do you mean with skip?
You can hear a noticeable click?

What import settings are you using on the file?
Is it loaded in memory or you read it from disk?

I hope you have the file in .wav format, try to export as mp3 or even better keep the wave file and loop it. Il the problem persists in any format, the file itself is not properly edited to loop.

oh, i should use wav? i will try that, though i could have sworn unity prefers ogg. By a “skip” i mean there is a short, but noticeably time between the end of the loop and the beginning where it goes silent, which should not be the case for a good audio loop

these would be the import settings: https://i.gyazo.com/a4ec47c8f18f434af2d26ed226349aec.png

Well that’s up to you. If your game is a pc game you could even think to use a wave file (especially if we’re talking of a single 1 minute music track for example…)

In many years i’ve never used .ogg files, to be honest, i’ve always used mp3.
Now, last time i had to work on a game audio have been many years ago but i can remember that even mp3 added a bit of “silence” in between the loops. It’s normal… after all it’s compressed data that must be decompressed.

Experiment with different formats. See if it goes better with mp3. Try even with .wav

Another thing you could try is to use this two delegates (but i don’t remember if they work with .ogg files):

AudioClip.PCMReaderCallback
AudioClip.PCMSetPositionCallback

The first should give you the position (in samples) of the audio being played.
The second should let you set a new position in the audio playback.

You could try to set the playback position at start just a few samples before reaching the end of file.

Just some ideas.

apologies, i solved the issue by going into audacity and seeing there was a split second of silence at the beginning of the audio file. Not something you notice normally unless youre looping it, thanks.

1 Like