Closed MoyuScript closed 4 years ago
When i use player.play() and handle midi event. I need to handle 'Note on' and 'Note off' event only, and send them to Jazz-midi to play.
if (event.name === 'Note on') { doSomething(); }
But it can't be played fluently if i use a complex MIDI file. So i add 'rawEventCode' to 'eventJson', it's now can be played fluently.
if (0x80 <= ev.rawEventCode && ev.rawEventCode <= 0x9f) { // Note on and Note off port.send(ev.rawEventCode, ev.noteNumber, ev.velocity); } else if (0xc0 <= ev.rawEventCode && ev.rawEventCode <= 0xcf) { // Program Change port.send(ev.rawEventCode, ev.value); }
When i use player.play() and handle midi event. I need to handle 'Note on' and 'Note off' event only, and send them to Jazz-midi to play.
But it can't be played fluently if i use a complex MIDI file. So i add 'rawEventCode' to 'eventJson', it's now can be played fluently.