Using the Web MIDI API, I can send some messages:
// Note on
output.send([0x90, 0x20, 0x50]);
I can also schedule some messages to be well-timed and sent in the future:
// Note off, 1 second later
output.send([0x80, 0x20, 0x40], performance.now() + 1000);
Now, suppose I've scheduled many messages to be sent in the future over several seconds, and now I want to cancel the sending of those messages. According to the spec, I should be able to call clear
on the output:
output.clear();
However, this is undefined on Chrome (at least as of v79).
Uncaught TypeError: output.clear is not a function
I assume this part just isn't implemented yet. Is that the case? And if so, is there some alternative I can use today?
It is indeed not yet available. You can follow this issue to get updated of any advancements.
Note that Firefox has a flag to allow the Web Midi API, might worth a try to see if they do handle it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With