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.52k stars 115 forks source link

Note duration ignored in channel.playNote #337

Closed tobyhede closed 1 year ago

tobyhede commented 1 year ago

When using playNote with a note containing a duration value, the duration is not used.

const note = new Note(value, { attack, duration })
channel.playNote(note);

I think I've tracked the issue to a Line 724 OutputChannel.js

The implementation of playNote accepts an options object and uses a duration value in this object: https://github.com/djipco/webmidi/blob/fe5adbaed0e73025a8733e249ea059a02f371a08/src/OutputChannel.js#L724

djipco commented 1 year ago

This has been fixed in release 3.1.4. Thank you so much for reporting the problem.