Closed weiwei-ww closed 6 years ago
Hi @weiwei-ww,
Duration values are not explicitly specified within Note On
event objects. To know when a note should be turned off you should use the matching Note Off
event, or in the case of some MIDI files, a corresponding Note On
event with a velocity of 0. Let me know if you have any questions on that,
-Garrett
Hi @grimmdude ,
Thanks for your help. Does this player contain a parser so that I can first go through all the events and match every 'Note on' event with a 'Note off' event?
@weiwei-ww yes, use Player.dryRun()
, and then all the events are ready in Player.events
Thanks @ledlamp.
That's correct, Player.dryRun()
will parse and populate events in Player.events
. Though, this is called automatically when loading a file so in most cases you can just access Player.events
from the start.
-Garrett
I am building a midi player using MidiPlayerJS. The player will play a note when a 'Note On' event is fired. Is it possible to get the duration (length) of the notes?