I'm trying to sync abcjs with ToneJS. abcjs plays a melody (via notation) and ToneJS plays a loop. I would like to sync these two audio sources.
As I understand I need to create a shared AudioContext in which they both can play, but I'm not sure how to do it.
As far as I understand I need to create a shared audio context. From the ToneJS docs I can use Tone.setContext(ac)
. I also need a onClick (or similar) callback to run await Tone.play()
before playback works. But setting audio context before Tone.play() I get the error "AudioContext is suspended ...".
Can someone please lead me in the right direction...?