Tone.js
Tone.js copied to clipboard
please endcode fetch uris of sound samples
I just spent several hours debugging this
window.playPianoSeq = (notes, interval) => {
console.log("piano");
const sampler = new Tone.Sampler({
urls: {
"C4": "assets/C4.mp3",
"D#4": "assets/D#4.mp3",
"F#4": "assets/F#4.mp3",
"A4": "assets/A4.mp3",
},
release: 1
}).toDestination();
Tone.loaded().then(() => {
sampler.triggerAttackRelease(["Eb4", "G4", "Bb4"], 4);
})
}
Finally it is obvious of course. The fetch url is sliced off at the # character. Whats needed is to do a encodeURIComponent the urls before sending