10.6

Table Of Contents
217Logic Pro Effects
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 11: Slider Creation
In Logic Pro, type the following in the Script Editor window to create a slider named
“Parameter x” with a default range of 0 to 1. It is set to the mid-point value of 0.5.
var PluginParameters = [{name:"Parameter x", defaultValue:0.5}];
Tutorial script 12: Slider Ranges
In Logic Pro, type the following in the Script Editor window to create a linear slider type,
with five possible positions (steps), and a range from 0 to 5.
var PluginParameters = [{name:"Octaves", defaultValue:3, minValue:0,
maxValue:5,
numberOfSteps:5, unit:"octaves", type:"lin"}];
Tutorial script 13: Menu Creation
In Logic Pro, type the following in the Script Editor window to create a menu named
“Range” with the options “Low”, “Mid”, and “High”.
var PluginParameters = [{name:"Range", type:"menu", valueStrings:["Low",
"Mid", "High"]}];
Dynamically hide or show MIDI plug-in controls
In complex Logic Pro scripts, it may be helpful to hide or show parameter controls
dynamically, such as for a menu item that lets you choose a group of controls to display.
Type the following in the Script Editor window to create these controller types.
var PluginParameters = [{name:'uno'}, {name:'dos', hidden:true}];
Call UpdatePluginParameters() to change this dynamically.
Retrieve plug-in parameter values
Call GetParameter() with the parameter name to return a value (number object) with the
current value of the parameter. GetParameter() is typically used inside the Logic Pro
Scripter MIDI plug-in HandleMIDI function or Logic Pro Scripter MIDI plug-in
ProcessMIDI function.
In Logic Pro, this code example converts modulation events into note events and provides
a slider to determine note lengths.
Text following /* shows comments that explain the JavaScript code.
var PluginParameters = [{name:"Note Length", minValue:0, maxValue: 100, unit:"%"}]; /*
create a slider (default range 0 - 100) */
function HandleMIDI(event) {
if(event instanceof ControlChange && event.number == 1) { /* if event is MIDI cc1
(modwheel) */
var note = new NoteOn; /* create a NoteOn object */
if(event.value == 0)