Use the JavaScript Event object

When the HandleMIDI function is called, an Event object represents one MIDI event and implements several methods you can call in your script.

The Event object is not instantiated directly, but is a prototype for the following event-specific methods, properties, and types.

Tip: You can use the JavaScript “new” keyword to generate a new instance of an Event object of any type.

Event methods

Event properties

Event types

The Event object is a prototype for the following event types. All event types inherit the methods and channel properties described above.

The event types and their properties are passed to HandleMIDI as follows:

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.

Tutorial script 7: Event Creation

This example replaces every received MIDI event with a modulation control change message.

Tutorial script 8: Event Modification

This example replaces every received MIDI event with a C3 note on/off. The example also uses the NeedsTimingInfo variable. See Use the JavaScript TimingInfo object.

Tutorial script 15: Control Plug-ins

You can create user-definable MIDI CC messages, or you can control plug-in parameters. TargetEvent reads the parameter to be modified from a menu where the user can select a destination MIDI CC. Alternately, you can use the Learn Plug-In Parameter feature to assign any plug-in parameter inserted after (below) Scripter in the same channel strip. The chosen destination is saved with the plug-in setting.