Jump to content

Custom Sustain Pedal


Unheardofski

Recommended Posts

Here's a little utility script I made for dive-bombing and generally sliding with the Scarbee Rickenbacker without a sustain pedal. I think this is probably doable in the built in Modifier too but I wanted to make a script to learn a little. Enjoy. It's pretty easy to remap any control to the notes menu. Just change the CC number in the script.

 

I am also working on a script for automating the Scarbee keyswitches post recording since I suck at playing them live. If anyone has the Rick I would be curious to know if yours accepts sending a new midi note on with pitch 33 from scripter. Mine does sorta but it instantly acts like it received a note off too.

 

Anyway: Paste this into your (edit: scripter not scripture) and SUSTAIN the crap out of anything.

 

//Custom Sustain Pedal
var NOTES = [];
for (var i = 0; i < MIDI._noteNames.length; i++) {
	NOTES.push(MIDI._noteNames[i]);
	}	
NOTES.push("--All enabled--");	
function HandleMIDI(event) {
var note = GetParameter("Replace Sustain Pedal With")
var all = GetParameter("Enable Any Note for Sustain")

 if(event instanceof NoteOn && all == 1 ||event instanceof NoteOn && event.pitch == note) {
 
   var cc = new ControlChange; //make a new control change message
   cc.number = 64; //set it to controller 64 (sustain)
   cc.value = 127; //set the value
   cc.send(); //send the event
   Trace("Sustain On"); //print the event to the console
}
else if (event instanceof NoteOff && all == 1 ||event instanceof NoteOff && event.pitch == note) {

   var cc = new ControlChange; //make a new control change message
   cc.number = 64; //set it to controller 64 (sustain)
   cc.value = 0; //set the value
   cc.send(); //send the event
   Trace("Sustain Off"); }

else {
event.send();
}
}
var PluginParameters = [
{
	name:"[Custom Sustain Pedal]",
	type:"text",
},
	{name:"Enable Any Note for Sustain",
	type:"menu",
	valueStrings: ["Off","On"],
	numberOfSteps:2,
	defaultValue:0,
},
{
	name:"Replace Sustain Pedal With",
	type:"menu",
	valueStrings:NOTES,
	numberOfSteps:127,
	defaultValue:0
}]

function ParameterChanged(param, value) {
switch(param){
case 0:
break;
case 1:
if (1 == value) {
SetParameter("Replace Sustain Pedal With", 128);
}
else if ( 0 == value) {
}
break;
case 2:
if (128 !== value) {
SetParameter("Enable Any Note for Sustain" , 0);
}
else {
}
break;
default:
break;
}
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...