Skip to content

Instantly share code, notes, and snippets.

@cgimenes
Last active February 1, 2022 20:05
Show Gist options
  • Save cgimenes/a84957f5874689fe3406e2e8272ea834 to your computer and use it in GitHub Desktop.
Save cgimenes/a84957f5874689fe3406e2e8272ea834 to your computer and use it in GitHub Desktop.
Mainstage Scripter's Drone Pad Script
var PluginParameters = [
{
name: "Key",
type: "menu",
valueStrings: ["A", "Bb", "B", "C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab"],
minValue: 0,
maxValue: 11,
defaultValue: 0,
numberOfSteps: 11
}, {
name: "On",
type: "menu",
valueStrings: ["False", "True"],
minValue: 0,
maxValue: 1,
defaultValue: 0,
numberOfSteps: 1
}, {
name: "Previous Key",
type: "momentary"
}, {
name: "Next Key",
type: "momentary"
}
]
var A4 = 57;
function Stop() {
var noteOff = new NoteOff();
noteOff.pitch = A4;
noteOff.send();
noteOff.pitch = A4 + 1;
noteOff.send();
noteOff.pitch = A4 + 2;
noteOff.send();
noteOff.pitch = A4 + 3;
noteOff.send();
noteOff.pitch = A4 + 4;
noteOff.send();
noteOff.pitch = A4 + 5;
noteOff.send();
noteOff.pitch = A4 + 6;
noteOff.send();
noteOff.pitch = A4 + 7;
noteOff.send();
noteOff.pitch = A4 + 8;
noteOff.send();
noteOff.pitch = A4 + 9;
noteOff.send();
noteOff.pitch = A4 + 10;
noteOff.send();
noteOff.pitch = A4 + 11;
noteOff.send();
}
function Play() {
var noteOn = new NoteOn();
noteOn.pitch = A4 + GetParameter("Key");
noteOn.velocity = 127;
noteOn.send();
}
function ParameterChanged(param, value) {
if (param == 0 && GetParameter("On") == 1) {
Stop();
Play();
}
if (param == 1 && value == 0) {
Stop();
}
if (param == 1 && value == 1) {
Play();
}
if (param == 2 && value == 1) {
var key = GetParameter("Key");
if (key == 0) {
SetParameter("Key", 11);
} else {
SetParameter("Key", key - 1);
}
}
if (param == 3 && value == 1) {
var key = GetParameter("Key");
if (key == 11) {
SetParameter("Key", 0);
} else {
SetParameter("Key", key + 1);
}
}
}
@Stefan7kk
Copy link

Thanks for the pad!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment