Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Scripter Plugin - Ignore accidental repeated note within specified timeframe

Hi,


I am trying to write a script for Mainstage Scripter plugin that ignores a duplicate note message within the range of say 100 milliseconds. ie., if a C-2 note on event is received, pass it through to the instrument, and then if any more C-2 note on events are received within 100 milliseconds of the first event, do not pass them through. Kind of like a Midi time gate or something...


The problem I'm trying to solve is that I use my sustain pedal to trigger kick drum samples by converting the CC64 to a Note C-2 using Midipipe (I know I can do this directly with Scripter now but its working) and send it to the Mainstage instrument. But because the sustain pedal is just a physical switch, any slight contact of the switch sends a 127/0 value of CC64, which isn't a problem with sustain, but when it's converted to C-2, it triggers a kick drum sample. This means that sometimes I get double or triple notes when hitting the pedal. As long as I hit the pedal cleanly it doesn't usually happen, but in a live scenario it often happens at the worst times haha...


I am great at stealing scripts from other people and messing around with them to get them to solve my problems, but I actually have no idea what I'm doing, so I have hit a wall, and I can't find anyone else who has tried to solve a similar problem.


Hope that makes sense, any help would be appreciated


Cheers


Jeremy

MacBook Pro (13-inch Early 2011)

Posted on Jun 23, 2015 8:43 AM

Reply
4 replies

Jun 25, 2015 1:48 AM in response to jeremypeterallen

I think, this can be done with scripter, however, I'd take a look at the switch of your sustain pedal first. Maybe you need a unit, that has a microswitch with a bit of hysteresis to avoid the contact bounce. Maybe cleaning it with DeOxit might help.

Another idea: Use something like the Shadow Stompin'Bass. Here's a video using a headphone for that:

https://youtu.be/cmuTJp8JiZA

This seems to me much better, since it offers some dynamic playing as well.


Hope this helps,


DaCaptain

Jun 25, 2015 2:15 PM in response to DaCaptain

No that doesn't really help...


I'm well aware of other foot pedals and switches, but I have a thousand reasons not worth going into as to why I want mine to work...


That's why I didn't say, "hey this is what I've been doing, but is there another option to do this rather than my sustain pedal?"


I clean out the pedal regularly and it does help for a period of time, but I don't want to keep doing this...

Jun 26, 2015 2:12 AM in response to jeremypeterallen

That's OK. Try this script:


>>>>>

// Contact DeBouncer


var myTimestamp = 0;


function HandleMIDI(event)

{

if(event instanceof ControlChange)

{

switch(event.number)

{

default: event.send(); break;

case 64:

{

if(event.value > 64) // sustain On

{

var currentTime = Date.now();

var delta = currentTime - myTimestamp;

// Trace(delta);

if(delta > 2000) // this is 2000 ms. Change as needed

{

myTimestamp = currentTime;

event.send();

}

}

else

event.send();

} break;

}

}

else

event.send();

}


<<<<<<<

Best,


DaCaptain

Scripter Plugin - Ignore accidental repeated note within specified timeframe

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.