djipco / webmidi

Tame the Web MIDI API. Send and receive MIDI messages with ease. Control instruments with user-friendly functions (playNote, sendPitchBend, etc.). React to MIDI input with simple event listeners (noteon, pitchbend, controlchange, etc.).
Apache License 2.0
1.54k stars 116 forks source link

playNote does not sendNoteOff when passed an array of notes. #344

Closed tobyhede closed 1 year ago

tobyhede commented 1 year ago

Description When using playNote with an array of notes, duration is not handled correctly.

Code currently assumes a single note, and does not check for or iterate through an array.

Details The check for duration uses this line:

 if (parseInt(note.duration) > 0) {
djipco commented 1 year ago

Wow, it seems you are the first to realize this... Thanks for reporting and for the PR. I'll check it out as soon as I can.

djipco commented 1 year ago

Your PR, which fixes this issue, has been merged in. Release 3.1.5 includes the fix. Thank you so much for contributing!