Auto-engage expression pedal for PC-based modellers: a solution!

adamquek

Member
Messages
866
Hey folks,

I've been throwing this idea around for weeks in my head and finally sat down and put in the elbow (brain?) grease to make it work.

I've always loved the auto-engage function of the Bad Horsie wah, which is also available in the Axe FX. Since selling off the Axe-FX and moving over the Helix Native, I basically haven't used my expression pedal for anything as I don't like tap dancing to change scene/patch, then move over the the wah etc.

I noticed that Reaper has a programmable FX plugin called JSFX, and it was capable of receiving/sending MIDI, so I wrote a short script to turn my expression pedal into an auto-engage pedal.

Basically it functions like a noise gate, that sends a 127 value when the pedal is moving and a 0 value when the pedal is above a threshold for a specific duration in ms.

I'm not a programmer so apologies if there are more elegant ways to get this done. For everyone else, feel free to make use the code, pretty please with what it does for 45 lines (although... it took many hours to get that far).

desc:MIDI auto engage

slider1:7<0,127,1>MIDI CC# in
slider2:1000<500,2000,20>Gate (ms)
slider3:110<0,127,1>Threshold
slider4:4<0,127,1>MIDI CC# out

in_pin:none
out_pin:none

@slider
cc_in = slider1;
gate_ms = slider2;
threshold = slider3;
cc_out = slider4;

@init
auto_engage = 0;
time_precise(last_move);
counter = 0;

@block

//time of last move
while(midirecv(offset,msg1,msg2,msg3)) (
counter = counter + 1;
msg1==$xB0 && msg2==cc_in && msg3 < threshold ? (
time_precise(last_move);
);
);

//time since last move
time_since = min(time_precise() - last_move,gate_ms/1000);

//open gate check
time_since < gate_ms/1000 && auto_engage == 0 ? (
auto_engage = 1;
midisend(0,$xB0,cc_out,127);
);

//close gate check
time_since == gate_ms/1000 && auto_engage == 1 && msg3 > threshold ? (
auto_engage = 0;
midisend(0,$xB0,cc_out,0);
);
 


Trending Topics

Top