6/28/2026 at 11:03:19 AM
The Web MIDI API[0] used by the author has a built-in precise scheduler, that has higher precision and works better than the unreliable setTimeout approach used by OP when coupled with the Performance API[1].Pass a timestamp as the second argument to midiOutput.send(data, timestamp), calculated with performance.now. Something like midiOutput.send(data, performance.now() + offset)
0: https://developer.mozilla.org/en-US/docs/Web/API/MIDIOutput/...
1: https://developer.mozilla.org/en-US/docs/Web/API/Performance...
by omneity
6/28/2026 at 6:50:22 PM
Brilliant suggestion. I'll test scheduling directly on the Web MIDI API thread to keep JS main thread timers out of the equation.by halfradaition