Open apiel opened 3 years ago
I actually wonder if the sync is not better like this:
const audioContext = new AudioContext();
const timingOffset = (performance.now()/1000) - audioContext.currentTime;
https://cartoonbeats.com/how-to-sync-web-audio-api-and-web-midi/
The feature you'd like Would be great to have an example combining midi output and Tone.Sampler or Tone.Synth.
Additional context From my understanding, Tone.Transport.scheduleRepeat callback trigger a little bit before the moment we want to play a note with Sampler or Synth, so the AudioContext can ajust the timing. Or when if we include the code to send a midi message to an output device, the note we will be played directly. I think this issue show the problem: https://github.com/Tonejs/Tone.js/issues/196 tambien proposed a solution but when I try to implement it, the result are not accurate.
Here would be a start of example:
Using midi devices is a very common thing in electronic music and such example would be really great.