The Scripter Script Editor lets you use a simple shorthand to add standard controllers such as sliders and menus for automated or real-time control of your plug-ins. The only mandatory property to define a new parameter is a name, which defaults to a basic slider. In addition, you can use further properties to change the type and behavior of controls.
unit: Type a string to present a unit description in the plugin controls. If no value is typed, the default behavior is to display no unit.
Optional properties
type: Type one of the following strings as the value:
“lin”: Creates a linear fader.
“log”: Creates a logarithmic fader.
“menu”: Creates a menu.
“valueStrings”: The menu type requires an additional property that is an array of strings to show in the menu.
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.
Type the following in the Script Editor window to create these controller types:
Slider 1: var PluginParameters = [{name:"Parameter x", defaultValue:0.5}];
The code example results in a slider named “Parameter x” with a default range of 0 to 1. It is set to the mid-point of 0.5.
Slider 2: var PluginParameters = [{name:"Octaves", defaultValue:3, minValue:0, maxValue:5, numberOfSteps:5, unit:"octaves", type:"lin"}];
This code example results in a linear slider type, with five possible positions (steps), and a range from 0 to 5.
Menu: var PluginParameters = [{name:"Range", type:"menu", valueStrings:["Low", "Mid", "High"]}];
This code example creates a menu named “Range” with the options “Low”, “Mid”, and “High”.
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 HandleMIDI function or ProcessMIDI function.
This code example converts modulation events into note events and provides a slider to determine note lengths.
Type the following in the Script Editor window. Text following “//” describes the argument function.
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) //because modwheel range is 0-127 and pitch range is 1-127, convert a modwheel value of 0 to 1 event.value = 1;note.pitch = event.value; //use cc value as note pitchnote.velocity = 100; //use velocity 100note.send(); //send note on var off = new NoteOff(note); //create a NoteOff object that inherits the NoteOn pitch and velocity values var delayInBeats = GetParameter("Note Length")/100 + 0.1; //retrieve the parameter value of the slider you created (add 0.1 to guarantee note on and off are not simultaneous off.sendAfterBeats(delayInBeats); //send note off after the length in beats is set via the slider }}