10.6

Table Of Contents
211Logic Pro Effects
PitchBend.value(integer number): 14-bit pitch bend value from -8192–8191. A value
of 0 is center.
TargetEvent.target(string): Create user definable MIDI CC messages or control
plug-in parameters.
TargetEvent.value(float): Sets the target value.
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
Logic Pro Scripter MIDI plug-in Script Editor.
Tutorial script 7: Event Creation
In Logic Pro, this example replaces every received MIDI event with a modulation control
change message.
Text following /* shows comments that explain the JavaScript code.
Tip: You can use the JavaScript “new” keyword to generate a new instance of an
Event object of any type.
function HandleMIDI() {
var cc = new ControlChange; /* make a new control change message */
cc.number = 1; /* set it to controller 1 (modulation) */
cc.value = 100; /* set the value */
cc.send(); /* send the event */
cc.trace(); /* print the event to the console */
}
Tutorial script 8: Event Modification
In Logic Pro, 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.
Text following /* shows comments that explain the JavaScript code.
Tip: You can use the JavaScript “new” keyword to generate a new instance of an
Event object of any type.
var NeedsTimingInfo = true; /* needed for .sendAfterBeats() to work */
function HandleMIDI() {
var on = new NoteOn; /* make a new note on */
on.pitch = 60; /* set its pitch to C3 */
on.send(); /* send the note */
var off = new NoteOff(on); /* make a note off using the note on to initialize its pitch
value (to C3) */
off.sendAfterBeats(1); /* send a note off one beat later */
}