Old 02-04-2018, 09:30 PM   #1
pipelineaudio
Mortal
 
pipelineaudio's Avatar
 
Join Date: Jan 2006
Location: Wickenburg, Arizona
Posts: 12,504
Default JSFX for auto engaging fx

I'd like to create something to automatically engage an effect when a pedal is moved a certain way. For instance, I would like moving a pedal past 10 to unbypass a wah. Once it is on, the same pedal should control the wah's position

Going under 11 would turn the wah back off (idealy there would be a bit more to it than this,but

Can anyone make something like this based on the psudocode below?


Sliders:
inCC // the cc# you want as a control
outCC // the cc# you want to send the output date to
threshold //checks the level of inCC. If inCC <=10 then outCC sends 0 to the cc# specified in outCC.
//IF inCC > 10 then outCC sends 127 to the cc# specified in outCC.
__________________
REAPER Shirts are Back! - https://shop.spreadshirt.com/pipelineaudio/
pipelineaudio is offline   Reply With Quote
Old 02-04-2018, 10:56 PM   #2
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 5,922
Default

Easy to do such a switcher JSFX, if you do the pin routing correctly.

e.g. (for a stereo effect):
- set the track to four channels
- use any effect "above" your effect
- do the pin routing for same: output 1 to channel 1+3, output 2 to channel 2+4
- standard pin routing for your effect effect: channel 1+2 to input 1+2, output 1+2 to channel 1+2
- do the pin routing for the switcher JSFX: input 1,2,3,4 to channels 1,2,3,4, output 1+2 to channel 1+2

Now the switcher JSFX can simply switch (or pan if you like that better) between it's effect (channels 1+2) and clean (=sidechain = channels 3+4) inputs.

Is that what you have in mind ?

A "naive" switcher JSFX would be just some five lines of code. But hard switching might create a harsh noise when switching. Hence it might be appropriate do do a cross-fading.

My "Midi Volume control" (available in ReaPack, including Documentation) provides all the basics for this.


Quote:
//IF inCC > 10 then outCC sends 127 to the cc# specified in outCC.
Or do you want just a midi filter and some other functionality is supposed to do the actual audio switching ?

I suppose there are JSFXes in Reaper's stock effects that can do such a CC function.

OTOH, if you want to use some VST (automation) parameter of some effect, Reaper provides imposing a function between the CC input and the parameter output that can be set to be very steep and hence do an on/off switching.

-Michael
__________________
www.boa-sorte.de

Last edited by mschnell; 02-04-2018 at 11:06 PM.
mschnell is online now   Reply With Quote
Old 02-04-2018, 11:26 PM   #3
pipelineaudio
Mortal
 
pipelineaudio's Avatar
 
Join Date: Jan 2006
Location: Wickenburg, Arizona
Posts: 12,504
Default

***edit***

Thinking about it more, it seems it would be most handy to just have this over MIDI, though I'd like to learn how to use it to switch pins.

It should send the new CC while passing the old CC through unmolested, and passing thru any other cc's on the new cc's number unmolested as well (or perhaps have an option to block any original data that came in over the new cc's number)
__________________
REAPER Shirts are Back! - https://shop.spreadshirt.com/pipelineaudio/

Last edited by pipelineaudio; 02-04-2018 at 11:41 PM.
pipelineaudio is offline   Reply With Quote
Old 02-05-2018, 01:29 AM   #4
pipelineaudio
Mortal
 
pipelineaudio's Avatar
 
Join Date: Jan 2006
Location: Wickenburg, Arizona
Posts: 12,504
Default

I am able to get this working sort of by using parameter modulation, scale and offset, though it doesnt work so well for sliders
__________________
REAPER Shirts are Back! - https://shop.spreadshirt.com/pipelineaudio/
pipelineaudio is offline   Reply With Quote
Old 02-05-2018, 08:34 AM   #5
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 5,922
Default

Quote:
Originally Posted by pipelineaudio View Post
I am able to get this working sort of ...
What final goal do you have in mind ?

-MJichael
__________________
www.boa-sorte.de
mschnell is online now   Reply With Quote
Old 02-05-2018, 04:15 PM   #6
pipelineaudio
Mortal
 
pipelineaudio's Avatar
 
Join Date: Jan 2006
Location: Wickenburg, Arizona
Posts: 12,504
Default

I think it will be easier if every time I ask about things, you don't assume I mean something other than what I am saying. I may have reasons for wanting certain things to happen, that don't necessarily mean something other than what I mean.

I like that you are helping to find alternate suggestions because that is making things far easier than doing it exactly my way would have, but sometimes its as simple as it sounds.

1. take a value from a MIDI CC#x
2. if that value is say 10 or less, send value 0 to CC#y
3. if that value is say 11 or more, send value 128 to CC#y

there could be a lot of cool options to make this work better, but this is the basics.

I'm able to do this somewhat with parameter modulation/midi link, but its a bit sketchy
__________________
REAPER Shirts are Back! - https://shop.spreadshirt.com/pipelineaudio/
pipelineaudio is offline   Reply With Quote
Old 02-06-2018, 07:18 PM   #7
Time Waster
Human being with feelings
 
Time Waster's Avatar
 
Join Date: Aug 2013
Location: Bowral, Australia
Posts: 731
Default

Quote:
Originally Posted by pipelineaudio View Post
Can anyone make something like this based on the psudocode below?


Sliders:
inCC // the cc# you want as a control
outCC // the cc# you want to send the output date to
threshold //checks the level of inCC. If inCC <=10 then outCC sends 0 to the cc# specified in outCC.
//IF inCC > 10 then outCC sends 127 to the cc# specified in outCC.
As it happens, I'm currently working on an FX which will be able to do this (as well as some other stuff). I should have something ready to post in a few days if you can wait.
__________________
ReaRack JSFX Modular Synth - Mostly harmless: https://stash.reaper.fm/v/28403/ReaR...dularSynth.zip
The Wasters of Time: https://soundcloud.com/thewastersoftime
Time Waster is offline   Reply With Quote
Old 02-07-2018, 02:03 AM   #8
pipelineaudio
Mortal
 
pipelineaudio's Avatar
 
Join Date: Jan 2006
Location: Wickenburg, Arizona
Posts: 12,504
Default

Awesome! I waited 46 years, what's another few days?
__________________
REAPER Shirts are Back! - https://shop.spreadshirt.com/pipelineaudio/
pipelineaudio is offline   Reply With Quote
Old 02-07-2018, 12:00 PM   #9
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 5,922
Default

Quote:
Originally Posted by pipelineaudio View Post
Awesome! I waited 46 years, what's another few days?
If I would have been able to understand what exactly you want I maybe would already have done this some days ago

-Michael
__________________
www.boa-sorte.de
mschnell is online now   Reply With Quote
Old 02-07-2018, 02:35 PM   #10
pipelineaudio
Mortal
 
pipelineaudio's Avatar
 
Join Date: Jan 2006
Location: Wickenburg, Arizona
Posts: 12,504
Default

I think the simplest form would be

Slider 1=MIDI CC#x for input

Slider 2=MIDI CC#y for output

Slider 3="Threshold" Takes the value from CC#x. values above this slider setting send value 127 of CC#y to output. Values below this slider send value 0 of CC#y to output.

cc#X should pass to the output unaffected

---------------------------------------------------------------------------------

More ideal version:

Same as above but, Slider 3="On Threshold" Takes the value from CC#x. values above this slider setting send value 127 of CC#y to output.

Slider 4="Off Threshold" Takes the value from CC#x. IF current state of cc#y is 127, then values below this slider setting send value 0 of CC#y to output.

This way can create an overlap or dead zone. So that it could require a lower value to turn the effect on than off, especially for a wah wah or divemomber, this would let you rock the pedal pretty hard without worrying about turning the effect off accidentally.

Slider 5="dwell time" this sets the minimum time in msec that CC#x has to be below the value set in slider 4 before a value of 0 is sent by CC#y to the output. This will further reduce the chances of accidentally turning the effect off

Slider 6=Inverts CC#y's output
__________________
REAPER Shirts are Back! - https://shop.spreadshirt.com/pipelineaudio/
pipelineaudio is offline   Reply With Quote
Old 02-07-2018, 03:01 PM   #11
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 5,922
Default

I suppose a midi channel slider should be provided.

I'll take a look.

-Michael
__________________
www.boa-sorte.de
mschnell is online now   Reply With Quote
Old 02-08-2018, 09:36 AM   #12
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 5,922
Default

Quote:
Originally Posted by pipelineaudio View Post
More ideal version...
Here you are... Please test.
-Michael

Code:
desc:Pipe Midi Filter
author: Michael Schnell (mschnell@bschnell.de)
version: 1.0
changelog: initial release
donation: United Nations Foundation http://www.unfoundation.org/
about:
  ## Description
   Pipe
  

  ## Limitations
   P?ipe
  





// Author: Michael Schnell, based on a work of Time Waster (M. Smith)
// License: LGPL - http://www.gnu.org/licenses/lgpl.html
//



slider1:0<0,15,1{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}>MIDI Channel
slider2:1<0,127,1{0 Bank Sel M,1 Mod Wheel M,2 Breath M,3,4 Foot P M,5 Porta M,6 Data Entry M,7 Vol M,8 Balance M,9,10 Pan M,11 Expression M,12 Ctrl 1 M,13 Ctrl 2 M,14,15,16 GP Slider 1,17 GP Slider 2,18 GP Slider 3,19 GP Slider 4,20,21,22,23,24,25,26,27,28,29,30,31,32 Bank Sel L,33 Mod Wheel L,34 Breath L,35,36 Foot P L,37 Porta L,38 Data Entry L,39 Vol L,40 Balance L,41,42 Pan L,43 Expression L,44 Ctrl 1 L,45 Ctrl 2 L,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64 Hold P sw,65 Porta sw,66 Sustenuto sw,67 Soft P sw,68 Legato P sw,69 Hold 2 P sw,70 S.Variation,71 S.Timbre,72 S.Release,73 S.Attack,74 S.Brightness,75 S.Ctrl 6,76 S.Ctrl 7,77 S.Ctrl 8,78 S.Ctrl 9,79 S.Ctrl 10,80 GP B.1 sw,81 GP B.2 sw,82 GP B.3 sw,83 GP B.4 sw,84,85,86,87,88,89,90,91 Effects Lv,92 Trem Lv,93 Chorus Lv,94 Celeste Lv,95 Phaser Lv,96 Data B. Inc,97 Data B. Dec,98 NRP L,99 NRP M,100 RP L,101 RP M,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127}>CC Input
slider3:2<1,127,1{0 Bank Sel M,1 Mod Wheel M,2 Breath M,3,4 Foot P M,5 Porta M,6 Data Entry M,7 Vol M,8 Balance M,9,10 Pan M,11 Expression M,12 Ctrl 1 M,13 Ctrl 2 M,14,15,16 GP Slider 1,17 GP Slider 2,18 GP Slider 3,19 GP Slider 4,20,21,22,23,24,25,26,27,28,29,30,31,32 Bank Sel L,33 Mod Wheel L,34 Breath L,35,36 Foot P L,37 Porta L,38 Data Entry L,39 Vol L,40 Balance L,41,42 Pan L,43 Expression L,44 Ctrl 1 L,45 Ctrl 2 L,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64 Hold P sw,65 Porta sw,66 Sustenuto sw,67 Soft P sw,68 Legato P sw,69 Hold 2 P sw,70 S.Variation,71 S.Timbre,72 S.Release,73 S.Attack,74 S.Brightness,75 S.Ctrl 6,76 S.Ctrl 7,77 S.Ctrl 8,78 S.Ctrl 9,79 S.Ctrl 10,80 GP B.1 sw,81 GP B.2 sw,82 GP B.3 sw,83 GP B.4 sw,84,85,86,87,88,89,90,91 Effects Lv,92 Trem Lv,93 Chorus Lv,94 Celeste Lv,95 Phaser Lv,96 Data B. Inc,97 Data B. Dec,98 NRP L,99 NRP M,100 RP L,101 RP M,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127}>CC Output
slider4:10<0,127,1>Threshold
slider5:5<0,64,1>Hysteresis
slider6:0<0,500,10>dwell time (msek)
slider7:0<0,1,1{straight,invert}>Output

@init
  out  = 0;
  outo = 0;
  in   = 0;
  delay = 0;
  
@slider
  inChannel   = slider1;
  inCC        = slider2; 
  outCC       = slider3;
  thh         = slider4;
  thl         = thh - slider5;
  dt          = slider6;         
  invert      = slider7;
  thl < 1 ? thl = 1;
  invert ? (
    outh        = 0;
    outl        = 127;
   ) : ( 
    outh        = 127;
    outl        = 0;
  )  
  
@block
  while (midirecv(offset, msg1, msg2, msg3)) (
    status = msg1 & $xF0;      // Extract message type
    channel = msg1 & $x0F;
    channel == inChannel ? (   // Is it on our channel?
      status == $xB0 ? (       // Is it a controller event?
        msg2 == inCC ? (       // Is it the right CC?
          in = msg3;
          in > thh ? (
            out = outh;
           ) :  msg3 < thl ? (
            out = outl; 
          );  
          out != outo ? (
            outo = out;            
            f = srate / samplesblock;   // calls per second
            f = f * dt / 1000;          // minimum calls        
            f = 0 | f;
            delay = f+1;
          );
        );
      );
    );
    midisend(offset, msg1, msg2, msg3); // pass through
  );    
  delay ? (
    delay -= 1;
    !delay ? (
      outv !=  outo ? (
        outv = outo;
        midisend(offset, msg1, outCC, outo); // pass through            
      );  
    );   
  );
  
  
@gfx 640 400

gfx_r=gfx_g=gfx_b=0; gfx_a=1;
gfx_x=gfx_y=0;
gfx_rectto(gfx_w,gfx_h);

q1 = gfx_w / 128;

outv>64 ? (
  gfx_r = 1; gfx_g = 1; gfx_b = 0;
  gfx_x = 0;
  gfx_y = 0;
  gfx_rectto(gfx_w, gfx_h/2);
);  

gfx_r=gfx_g=gfx_b=1;

gfx_r = 0; gfx_g = 0; gfx_b = 1;
gfx_x = thh*q1;
gfx_y = 0;
gfx_lineto(gfx_x, gfx_h);

gfx_x = thl*q1;
gfx_y = 0;
gfx_lineto(gfx_x, gfx_h);

gfx_r = 1; gfx_g = 0; gfx_b = 0;
gfx_y = 0;
gfx_x = 1+in*q1;
gfx_lineto(gfx_x, gfx_h);
__________________
www.boa-sorte.de
mschnell is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:45 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.