I'm looping a wav file in my project and I notice that when the music file comes back around and restarts, there's a split second break between the end of the audio file and its loop — IE, it doesn't loop cleanly and sounds like a jerk/skip in the music file. I've tested this in both Safari, Chrome and the web2exe Chromium build just to rule out browser incompatibilities. Is there anything I can do about this?
Comments
Is there anything I can do to deal with the skipping where the loop comes around?
NOTE: Some audio libraries support both the HTML media elements and the Web Audio API—e.g. Howler.js. If using such a library, you must ensure that you configure it to use the Web Audio API—if allowed to use the media elements, you'll be in the same boat as you are now.
You don't say what the 'sound' is, but one very messy hack I discovered was to note the end time of the track, and then create a 'filler' of the same sound which is about 2 second long and triggered to play 1 second before the main track ends. This way it 'fills' the gap between loops, but as I say this only works on certain sounds. In my case the sound was a generic 'outside' nose (basically a soft wind) so the filler worked to an extent.
It's the backing music track, so I don't think that will work. I may have to get the musician to build the loop around that pause, so it cycles cleanly. A bit frustrating, but it is what it is I guess.