Sign in to follow this  
gurkesaft

Howler.js dynamic music has gaps

Recommended Posts

Hi all,

My goal is to create dynamic music that responds to what is happening in game. I am using Howler.js, but am happy to try other libraries. (Howler is pretty awesome, though!)

The way I'm approaching this is to chop up my music into loopable blocks, and then "queue up" the next block at the end of the current block. For this, I am currently using Howler's once('end', ...) functionality, with a structure similar to:

my_current_howl.once('end', function() { 

   my_next_howl.play();

});

It works. It's fun. The only problem is, depending on the cpu load, there is a variable gap in the music (always at least SOME gap, which precludes continuous waveforms).

It seems to me that looping does not suffer from this issue, but if I loop, then I'm stuck with one block looping over and over. I would imagine it should be possible to somehow modify the loop data while keeping the loop running but I cannot see how to do this in Hower.

Does anyone have any ideas or library suggestions? Is this a fundamental limitation? 

Cheers,
Jack

Share this post


Link to post
Share on other sites

Timing is never a browsers strong point 😕

One option is to have, say, 3 pieces of music, all the same length, all set to loop, all set to start playing at the same time. But you change the volume of them to say, bring one bit of music whilst another fades out. Think of it like layering instruments in an orchestra.

Share this post


Link to post
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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.