10.6

Table Of Contents
210Logic Pro Effects
Use the JavaScript Event object
When the Logic Pro Scripter MIDI plug-in 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.send(): Send the event.
Event.sendAfterMilliseconds(number ms): Send the event after the specified value has
elapsed (can be an integer or a floating point number).
Event.sendAtBeat(number beat): Send the event at a specific beat (floating point
number) in the host timeline.
Event.sendAfterBeats(number beat): As above, but uses the beat value as a delay in
beats from the current position.
Event.trace(): Print the event to the plug-in console. See Use the Trace object.
Event.toString(): Returns a String representation of the event.
Event properties
Event.toarticulationID(integer number): Sets the articulation ID from 0–254.
Event.channel(number): Set MIDI channel 1 to 16.
Event.beatPos: Retrieves the event’s exact beat position.
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:
NoteOn.pitch(integer number): Pitch from 1–127.
NoteOn.velocity(integer number): Velocity from 0–127. A velocity value of 0 is
interpreted as a note off event, not a note on.
NoteOff.pitch(integer number): Pitch from 1–127.
NoteOff.velocity(integer number): Velocity from 0–127.
PolyPressure.pitch(integer number): Pitch from 1–127.
PolyPressure.value(integer number): Define a pressure value from 0–127.
ControlChange.number(integer number): Controller number from 0–127.
ControlChange.value(integer number): Controller value from 0–127.
ProgramChange.number(integer number): Program change number from 0–127.
ChannelPressure.value(integer number): Aftertouch value from 0–127.