
The HandleMIDI() function lets you process MIDI events that the plug-in receives. HandleMIDI is called each time a MIDI event is received by the plug-in and is required in order to process incoming MIDI events. If you don’t implement the HandleMIDI function, events pass through the plug-in unaffected.
HandleMIDI is called with one argument, which is a JavaScript object that represents the incoming MIDI event. HandleMIDI and JavaScript Event object use is shown in the examples.
Load the corresponding Tutorial setting to view the script in the Script Editor. This will help you to understand the syntax structure and layout of code and comments. See Use the Script Editor.
Pass MIDI events through the plug-in.
function HandleMIDI(event) {event.send();}Log events to the plug-in console and don’t send them anywhere.
function HandleMIDI(event) {event.trace();}Repeat notes up one octave with 100ms delay and pass all other events through.
Text following /* shows comments that explain the JavaScript code.
function HandleMIDI(event) {event.send(); /* send original event */if (event instanceof Note) { /* if it is a note */event.pitch += 12; /* transpose up one octave */event.sendAfterMilliseconds(100); /* send after delay */ }}