Pilcrow Records

Scripter Javascript Tutorial

javascriptmusiclogicscripterbookexcerpttutorial

58 Native Scripter Event Objects

In addition to the common Event properties and methods, different types of events have properties which are specific to them as listed in Table 2 for NoteOn, 3 for NoteOff, 4 for PolyPressure, 5 for ControlChange, 6 for ProgramChange, 7 for ChannelPressure (Aftertouch), and 8 for TargetEvent.

NoteOn Event Properties
Property Value Notes
pitch Integer within 0–127 The pitch for the Event.
velocity Integer within 0–127 The velocity for the Event.
detune Integer For Apple-sourced synths only, detunes the pitch by Ticks, with 127 Ticks per half step, and usually detunes up to one semitone (half step). No other event type allows for detuning. See the detune property chapter for more information.
NoteOff Event Properties
Property Value Notes
pitch Integer within 0–127 The pitch for the Event.
velocity Integer within 0–127 The velocity for the Event.

NoteOff events can be created with their corresponding NoteOn events as a convenience:

var note_off = new NoteOff(note_on);

Doing this duplicates the properties contained in the NoteOn event into the NoteOff event, including the beatPos property.

PolyPressure Event Properties
Property Value Notes
pitch Integer within 0–127 The pitch for the Event.
value Integer within 0–127 The value for the Event.
ControlChange Event Properties
Property Value Notes
number Integer within 0–127 The controller number for the Event.
value Integer within 0–127 The value for the Event.
The tutorial scripts say to use the MIDI.controllerName() function to get the name of the controller, but that function is undefined at the time of publication.
ProgramChange Event Properties
Property Value Notes
value Integer within 0–127 The value for the Event.
ChannelPressure (Aftertouch) Event Properties
Property Value Notes
value Integer within 0–127 The value for the Event.
TargetEvent Event Properties
Property Value Notes
target String of menu entry The name of the target menu entry.
value Integer within 0–127 The value for the Event.

The tutorial scripts say to use the MIDI.controllerName() function to get the name of the controller, but that function is undefined at the time of publication.