Jump to content

Looping without using tempo


remvst
 Share

Recommended Posts

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 :)

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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 :(

Link to comment
Share on other sites

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 :P

Link to comment
Share on other sites

  • 2 months later...

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...