I need to play some sounds in howler.js the thing is that I don't know how to chain it.
For example, at string BCG
would need to play b.ogg then c.ogg and finally g.ogg
If I just use (after loading):
sound.play('b');
sound.play('c');
sound.play('g');
All of them start and overlap which isn't what I need.
I see there's a onend property, however can't figure out how to use it properly.
Regards.
You could create a function
playString(yourString)
that will read each character and dynamically set theonend
property of your sound. The following example should play B C G A C:Note that you could also tweak this function to work when a character is not in the sprite, or to use an array of names instead of a string.
Here is my simple solution, I am using tiny files so download delay is not an issue. sound is global in this case
You could use this code whic doesn't require sprites (jsfiddle, Github issue) :
Please share back your variation if you do one.