I am trying to create an app with the electron-react boilerplate where i can create audio files.
I found Tone.js, which allows me to play sounds but loading the sample files seems close to impossible. Is there a way to give the audio data to Tone?
I am using Sampler but i dont know how to create the URLs to transmit the data
2
Answers
I ended up using a mix of the above answer and what i saw in the documentation:
This way, you only need to load 2 mp3 files, the sampler does the rest for you
Looking at the implementation of
Player.load
it can handle ArrayBuffers and luckily, using an<input type="file">
can be used to get an ArrayBuffer with a FileReaderHere is some sample code that assumes that there’s a file input with id "local-file" in your HTML and you have Tone.js loaded at this point: