'Play mp3s for certain duration and in sequence

I have some mp3s: C.mp3, Csharp.mp3, D.mp3 etc etc. Based on what a user specifies, I want to play C.mp3 for 1 second (user specified time), Csharp.mp3 for 2 seconds, and D.mp3 for 3 seconds. Each of the mp3s is a piano note sample lasting for 10 seconds. How can I chain the playing of these mp3s with the specified playing durations? I understand there will be some audio distortion (a loud tick) at the end when you stop the playing sound abruptly, but that is another issue. I tried settimeout but howlerjs stops playing sound after about 10 or so settimeout function calls. Also, settimeout and playing the same note more than once in sequence ignores all subsequent plays.



Solution 1:[1]

It looks like this isn't possible using Howler.js. Which is strange since web audio supports scheduling robustly. Tone.js also supports playback scheduling robustly but I can't find this functionality in Howler.js.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alex Ch