remvst Posted March 17, 2013 Share Posted March 17, 2013 Hey guys, I'm using a music for my new game which is supposed to loop, but there's a short delay between two loops, which is really annoying. Do you know any solution do fix this?I'd rather not edit the music to make it fade in and out... I'm using buzz for the sounds, so I guess it's the same as using a native <audio> element. Thanks in advance Quote Link to comment Share on other sites More sharing options...
evolvingpoet Posted March 18, 2013 Share Posted March 18, 2013 I had the same problem when using buzzjs. The solution I used was to make the audio that needed looped smaller in file size, either by shortening the audio or by reducing its quality, etc (since the gap is most likely from the split second it takes to load the file again). If you can't do either of those, I would attempt to make use of buzzjs's events, and have the audio preload when the first gets near finishing, and then play the new sound when it finishes (instead of using the built in loop function). Quote Link to comment Share on other sites More sharing options...
remvst Posted March 18, 2013 Author Share Posted March 18, 2013 If you can't do either of those, I would attempt to make use of buzzjs's events, and have the audio preload when the first gets near finishing, and then play the new sound when it finishes (instead of using the built in loop function).Well that sounds a bit sketchy. I guess I'll just edit the music to make it fade in and out Quote Link to comment Share on other sites More sharing options...
Ezelia Posted March 18, 2013 Share Posted March 18, 2013 @remvst I'm maintaining a fork of buzzjs, if you can give me a test case with a music file available online, I'll try to fix that Quote Link to comment Share on other sites More sharing options...
remvst Posted March 18, 2013 Author Share Posted March 18, 2013 Here is the music I'm using: http://www.dreade.org/nosoap/radio/tracks/DST-AngryMod.mp3 As it's a browser bug, you shouldn't be able to fix it, but maybe you can add a method which would call a function before the sound ends, like mySound.beforeEnd(time,callback) I know I could do it using a tick function, or something like that, but I just don't want to Quote Link to comment Share on other sites More sharing options...
vacum Posted June 4, 2013 Share Posted June 4, 2013 It's pretty complicated to achieve perfect loops when working with compressed audio. mp3 and aac files introduces a few frames of silence in the beginning which renders a popping/cracking sound when the sound starts over. The easiest way is to create an audio file with a short fade-out in the end (the fade should start exactly where the sound is supposed to loop) and start the same sound exactly when the loop point is reached. This can be done with the web audio api. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.