10.6

Table Of Contents
216Logic Pro Effects
normalizeChannel(number channel): Normalizes a value to the safe range of MIDI
channels (1–16).
normalizeData(number data): Normalizes a value to the safe range of MIDI data bytes
(0–127).
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 10: Event Detection
In Logic Pro, this script passes all events through and sends an “all notes off” message
when receiving a MIDI continuous controller 20 event.
Text following /* shows comments that explain the JavaScript code.
function HandleMIDI(event) {
event.send(); /* pass through the event if the event is MIDI CC 20 */
if (event instanceof ControlChange && event.number == 20)
MIDI.allNotesOff(); /* send an all notes off message */
}
Create Logic Pro Scripter MIDI plug-in controls
This section describes use of the Script Editor to create standard interface controllers such
as sliders and menus for your Scripter plug-ins. The only mandatory property you need to
define for a new parameter is “name”. This defaults to a basic slider. In addition, you can
use further properties to change the type and behavior of controls.
Optional properties
type: Type one of the following strings as the value:
“lin: Creates a linear fader.
“log”: Creates a logarithmic fader.
“momentary”: Creates a momentary button.
“menu”: Creates a menu.
The menu type requires an additional valueStrings property that is an array of strings
to show in the menu. See Tutorial script 13.
defaultValue: Type an integer or floating point number to set a default value. If no value
is typed, the default is 0.0.
minValue: Type an integer or floating point number to set a minimum value. If no value is
typed, the default is 0.0.
maxValue: Type an integer or floating point number to set a maximum value. If no value
is typed, the default is 1.0.
numberOfSteps: Type an integer number to define the number of steps.
unit: Type a string to present a unit description in the plug-in controls. If no value is
typed, the default behavior is to display no unit.
text: Type text to create a divider/header in the plug-in UI.