Old 10-14-2019, 01:28 PM   #1
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 91
Default plugin request: midi program change converter

hi,

i would like to make a request for a plugin that will , on 16 channels, take incoming program change messages and convert them to other numbers

so like a table of the 127 program changes, defaulting to matching, where you can select different program change numbers to substitute

heres the setup i use live:

https://www.youtube.com/watch?v=l5ar_3nGx2w&t=34s

and the idea is that i would place this plugin after the midichords instances so that when i send a program change to the midichords it then goes to this plugin so i can select synth sounds more freely.

right now i just have the synth sound programmed on the same program change number as midichords and its very redundant and not very fun.nwith the plugin it would be lots of fun.


thanks!!
Tony Ostinato is offline   Reply With Quote
Old 10-15-2019, 08:10 AM   #2
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

Sounds useful, I'll rustle something up for later!
snooks is offline   Reply With Quote
Old 10-15-2019, 11:33 AM   #3
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

Quote:
Originally Posted by Tony Ostinato View Post
and the idea is that i would place this plugin after the midichords instances so that when i send a program change to the midichords it then goes to this plugin so i can select synth sounds more freely.

right now i just have the synth sound programmed on the same program change number as midichords and its very redundant and not very fun.nwith the plugin it would be lots of fun.


thanks!!
Using different midi channels does not help? And did you check midiConverter3 by pizmidi, setting there, input type: program change, output type: program change, and it should work? Just an idea, had only a quick look, without big testing, worth trying at least. Then assigning Low Output and High Output to same hardware knob should allow you setting any program change output value for selecting your dream sound.

Also disable audio output by clicking on 2 in 2 out, then unchecking the output pins, if you do not want increase of 6dB for audio.

Last edited by TonE; 10-15-2019 at 12:09 PM.
TonE is offline   Reply With Quote
Old 10-15-2019, 12:58 PM   #4
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 91
Default

midiconverter3 is a great plug but that would only handle one number conversion, i need something that can do all 127
Tony Ostinato is offline   Reply With Quote
Old 10-15-2019, 12:59 PM   #5
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 91
Default

Quote:
Originally Posted by snooks View Post
Sounds useful, I'll rustle something up for later!
oh man thanks!!!
Tony Ostinato is offline   Reply With Quote
Old 10-15-2019, 02:11 PM   #6
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

Quote:
Originally Posted by Tony Ostinato View Post
midiconverter3 is a great plug but that would only handle one number conversion, i need something that can do all 127
Ok, sorry, I did not understand your request/need fully then, you could just add as many midiconverter3 as you need.

Did you explain anywhere what you need exactly as text?

x inputs
y outputs

are x constant?
are y constant?

midiconverter3 allows:
x=1, y=1

If you make life of forum readers easier by explaining the situation in clear form, using a few sentences, you might get more helping replies.
TonE is offline   Reply With Quote
Old 10-15-2019, 02:12 PM   #7
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

No worries, here you go. It's documented in the comments, let me know if anything is unclear or broken or anyfink...
Code:
/*
  PC Mapper 
  
  Uses mapping files placed in a new directory called "pc_mapper" that you should
  create in the Data directory in your REAPER resource path:
  
  eg
    Windows:
      %USERPROFILE%/AppData/Roaming/REAPER/Data/pc_mapper/
  
    Linux:
      ~/.config/REAPER/Data/pc_mapper/
   
  Entries in the files should take the following format...
  
     // MIDI armpit lever to Serum dubstep wobble
     1   // incoming channel (1 - 16)
     0   // incoming program change (0 - 127)
     5   // maps to this new channel...
     17  // ... and this new PC
     
  ... comments are optional, numbers in sets of four as the first character(s)
  on consecutive lines are required. The files should have a .txt extension.
  
  If the channel sliders are 0 and/or the PC sliders are -1 there was a problem
  with loading or reading the chosen file, otherwise they show the last PC mapping 
  from the MIDI stream.
  
*/

desc: PC Mapper

slider1:/pc_mapper:none:Current map file
slider2:0<0,16,1>Channel In
slider3:0<-1,127,1>PC In
slider4:0<0,16,1>Channel Out
slider5:0<-1,127,1>PC Out
slider6:0<0,1,1{- - -,Reload}>Reload file

in_pin:none
out_pin:none


@init

  //
  function resetMap()
    local ( chan  pc )
  (
    chan = 0;
    pc = 0;
    loop(16,
      loop (128,
        map[chan * chan_sz + pc * sz] = chan;
        map[chan * chan_sz + pc * sz + 1] = pc;
        pc += 1;
      );
      pc = 0;
      chan += 1;
    );
  );
  
  //
  function setSlider(slider_num, val)
    local ()
  (
    slider(slider_num) = val;
    sliderchange(slider_num);
  );

  map = 0; // mem pos of our array
  sz = 2;  // size of map entry (channel and PC)
  chan_sz = 128 * sz; // size of block of memory per channel
  
  resetMap();
  
  sFILE = 1; sIN_CHAN = 2; sIN_PC = 3;
  sOUT_CHAN = 4; sOUT_PC = 5; sRELOAD = 6;
  
  !has_init ? (
    map_file_num = -1;
    has_init = 1;
  );
  PC = $xC0;


@slider

  slider(sRELOAD) == 1 ?
  (
    reload = 1;
    slider(sRELOAD) = 0;
  );
  
  map_file_num != slider(sFILE) || reload ?
  (
    map_file_num = slider(sFILE);
    reload = 0;
    file = file_open(slider(sFILE));
    
    // default error values
    in_chan = out_chan = 0;
    in_pc = out_pc = -1;
    
    file ? (
      file_text(file) ? (
        resetMap();
        while (file_avail(file)) (
          file_var(file, in_chan);
          file_avail(file) ? file_var(file, in_pc);
          file_avail(file) ? file_var(file, out_chan);
          file_avail(file) ? file_var(file, out_pc);
          in_pc > -1 && in_pc <= 127 && out_chan && out_chan <= 16 
          && out_pc > -1 && out_pc <= 127 ? (
            map[(in_chan - 1) * chan_sz + in_pc * sz] = out_chan - 1;
            map[(in_chan - 1) * chan_sz + in_pc * sz + 1] = out_pc;
          )
          : (
            // set sliders to error values
            slider(sIN_CHAN) = slider(sOUT_CHAN) = 0;
            slider(sIN_PC) = slider(sOUT_PC) = -1;
          );
        );
      );
      file_close(file);
    );
  );


@block

  while (midirecv(offset, m1, m2, m3)) (
    m1 & $xF0 == PC ? (
      chan = m1 & $x0F;
      entry_pos = chan * chan_sz + m2 * sz;
      remap_chan = map[entry_pos];
      remap_pc = map[entry_pos + 1];
      setSlider(sIN_CHAN, chan + 1);
      setSlider(sIN_PC, m2);
      setSlider(sOUT_CHAN, remap_chan + 1);
      setSlider(sOUT_PC, remap_pc); 
      midisend(offset, PC | remap_chan, remap_pc, 127);
    )
    : (
      midisend(offset, m1, m2, m3);
    );
  );
snooks is offline   Reply With Quote
Old 10-15-2019, 02:21 PM   #8
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

Not a good file format, why not using csv, 4 numbers per line, space as delimiter for example. Much easier to handle. But your format is ok, if empty lines are allowed.
TonE is offline   Reply With Quote
Old 10-15-2019, 02:56 PM   #9
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

That's just what the file_var JS function works with when using text files, one number per line. C'est la vie.
snooks is offline   Reply With Quote
Old 10-15-2019, 03:15 PM   #10
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

I see that some good news is that we can use variables in the txt files and that we can do arithmetic on them:

Code:
armpit_lever_chan=1  // no spaces around '='
armpit_lever_pc=0
serum_chan=5
serum_dubstep=serum_chan+13

// MIDI armpit lever to Serum dubstep wobble
armpit_lever_chan   // incoming channel (1 - 16)
armpit_lever_pc     // incoming program change (0 - 127)
serum_chan+1        // maps to this new channel...
serum_dubstep-1     // ... and this new PC
snooks is offline   Reply With Quote
Old 10-15-2019, 04:51 PM   #11
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 91
Default

super thanks times double trillion

i need to tutorial on how to install this as a plugin tho, i am still an idiot
Tony Ostinato is offline   Reply With Quote
Old 10-16-2019, 02:57 AM   #12
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

No worries, I've attached a zip file that contains the file.

Open REAPER and go to the Actions window. Run the Action:
Show REAPER resource path in Explorer
Then download the zip file, double click to open and drag and drop the file it contains into the "Effects" subdirectory in the folder that Reaper opened.

In the Data subdirectory at that location create another folder called "pc_mapper" and create a .txt file in there with some entries and the script should pick it up automagically when you put it on a track.
Attached Files
File Type: zip PC_mapper.zip (1.5 KB, 119 views)

Last edited by snooks; 10-16-2019 at 05:22 AM. Reason: actually attach file
snooks is offline   Reply With Quote
Old 10-16-2019, 03:30 AM   #13
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 91
Default

got it runnin, right now its on my test pc and i'm testing it and i think i got it.

very very nice. makes total sense and its working perfectly.

i am supremely grateful, this will open up some flexibility in my setup.
Tony Ostinato is offline   Reply With Quote
Old 10-16-2019, 03:50 AM   #14
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

Cool, so we can see a new video after 1 year of well testing.
TonE is offline   Reply With Quote
Old 10-16-2019, 05:24 AM   #15
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

Good stuff, I just saw that I didn't attach the file so I've edited the post for anyone else!
snooks is offline   Reply With Quote
Old 10-16-2019, 04:19 PM   #16
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 91
Default

Quote:
Originally Posted by TonE View Post
Cool, so we can see a new video after 1 year of well testing.
i really should do a new one, i've added a bunch of things. nvme ssd really helps. also i run 4 project tabs now (only one active at a time) so i can switch to one for the horn section and then instantly switch to another for a solo and then back. they all have some similar and some unique instruments so i can bounce around things real fast.

i did this one using the windsynth in vocoder mode:

https://www.youtube.com/watch?v=i2-Sw_sITDU
Tony Ostinato is offline   Reply With Quote
Old 10-18-2019, 01:25 AM   #17
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 91
Default

argh, sadly it didnt work in reaper 4.31 which is what i use onstage

newer versions have a weird bug in routing and don't work with my configuration of sends and routing

it says "effect has code error in slider around line 111"fileavail{file}?file_var)(file_out_chan
Tony Ostinato is offline   Reply With Quote
Old 10-18-2019, 02:42 AM   #18
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

I think I know what that is (syntax of "while loops" changed). My very near future self has almost certainly attached a replacement that might work...
Attached Files
File Type: zip PC_mapper.zip (1.5 KB, 119 views)
snooks is offline   Reply With Quote
Old 10-18-2019, 05:00 AM   #19
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by Tony Ostinato View Post
newer versions have a weird bug in routing and don't work with my configuration of sends and routing
That is really sad

Can you elaborate what exactly is the problem ?

I very happily use the current Reaper version "on stage". (AFAIU they did a lot of performance enhancements since that time.)

-Michael

Last edited by mschnell; 10-19-2019 at 04:12 AM.
mschnell is offline   Reply With Quote
Old 10-18-2019, 02:21 PM   #20
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 91
Default

Effect has code error in onblock 'Around line 137'chan = m1 & $x0F

got a lot further it looks like, cool!

if nothing else it will be useful down the road

the bug i ran into while setting up this laptop and reaper is that on my live setup projects i have a bizarre setup of muted tracks and tracks that are both muted and solo'd

this is so some tracks are always running, where the vsti's are, and then you can use a macro to go from track to track selecting the track and muting all others

on the newer reaper the tracks that send directly to the vsti tracks werent working, but tracks that route to another track and then to the vsti instrument track did work

so like track routed to vsti didnt play, track routed to midichords track and then that routed to vsti track did.

but that was a year ago things may have changed. i have another older laptop with this setup and i'll try it out again on that and see whats up.
Tony Ostinato is offline   Reply With Quote
Old 10-18-2019, 05:19 PM   #21
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 91
Default

tested latest version and its still not working in the same weird way

the presets that route straight to the kontakts work but not the 3 synths and the wivi's

all presets that route to a midichorder and then the vstis play everything.

switch back to 4.31 and they all work

seems like midi itself isnt sending straight to those channels and i cant figure out why

heres my project files:

https://drive.google.com/drive/folde...y0tS3IxV1A5SVk
Tony Ostinato is offline   Reply With Quote
Old 10-19-2019, 04:21 AM   #22
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by Tony Ostinato View Post
the bug i ran into while setting up this laptop and reaper is that on my live setup projects i have a bizarre setup of muted tracks and tracks that are both muted and solo'd
This might be too unusual to not trigger some weird behavior.

I suppose simply muting tracks (like LiveConfigs does), will not fit your requirements, as you need "spill over" or other situations with two tracks being active at the same time.

You might want to take a look at ReaPack -> Midi Fade X. This plugin will auto-fade a track (due to a Midi CC sent to it) and mute the track once the volume is faded out. Pipelineaudio used this successfully for a Guitar setup.
I am planning to do an upgraded replacement for LiveConfigs. See this thread -> https://forum.cockos.com/showthread.php?t=223949. But I am just collecting ideas and trying to manage the necessary tools to do the work. I do hope you will be able to provide suggestions and test the stuff once it's going to start working.

-Michael
mschnell is offline   Reply With Quote
Old 10-19-2019, 04:26 AM   #23
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by Tony Ostinato View Post
heres my project files:...
If you can provide a minimal project just using Kontakt (with factory libararies) and free plugings I might be able to tak a look.

-Michael
mschnell is offline   Reply With Quote
Old 10-19-2019, 07:51 AM   #24
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

Quote:
Originally Posted by Tony Ostinato View Post
argh, sadly it didnt work in reaper 4.31 which is what i use onstage

newer versions have a weird bug in routing and don't work with my configuration of sends and routing
Just keep this old version then, until the 'bugs' of newer version are fixed.
TonE is offline   Reply With Quote
Old 10-19-2019, 08:30 AM   #25
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

Quote:
Originally Posted by Tony Ostinato View Post
Effect has code error in onblock 'Around line 137'chan = m1 & $x0F
Oh crap, I forgot they'd changed the midirecv/send too, here's that changed to the old skool codology:

Code:
/*
  PC Mapper 
  
  Uses mapping files placed in a new directory called "pc_mapper" that you should
  create in the Data directory in your REAPER resource path:
  
  eg
    Windows:
      %USERPROFILE%/AppData/Roaming/REAPER/Data/pc_mapper/
  
    Linux:
      ~/.config/REAPER/Data/pc_mapper/
   
  Entries in the files should take the following format...
  
     // MIDI armpit lever to Serum dubstep wobble
     1   // incoming channel (1 - 16)
     0   // incoming program change (0 - 127)
     5   // maps to this new channel...
     17  // ... and this new PC
     
  ... comments are optional, numbers in sets of four as the first character(s)
  on consecutive lines are required. The files should have a .txt extension.
  
  If the channel sliders are 0 and/or the PC sliders are -1 there was a problem
  with loading or reading the chosen file, otherwise they show the last PC mapping 
  from the MIDI stream.
  
*/

desc: PC Mapper

slider1:/pc_mapper:none:Current map file
slider2:0<0,16,1>Channel In
slider3:0<-1,127,1>PC In
slider4:0<0,16,1>Channel Out
slider5:0<-1,127,1>PC Out
slider6:0<0,1,1{- - -,Reload}>Reload file

in_pin:none
out_pin:none


@init

  //
  function resetMap()
    local ( chan  pc )
  (
    chan = 0;
    pc = 0;
    loop(16,
      loop (128,
        map[chan * chan_sz + pc * sz] = chan;
        map[chan * chan_sz + pc * sz + 1] = pc;
        pc += 1;
      );
      pc = 0;
      chan += 1;
    );
  );
  
  //
  function setSlider(slider_num, val)
    local ()
  (
    slider(slider_num) = val;
    sliderchange(slider_num);
  );

  map = 0; // mem pos of our array
  sz = 2;  // size of map entry (channel and PC)
  chan_sz = 128 * sz; // size of block of memory per channel
  
  resetMap();
  
  sFILE = 1; sIN_CHAN = 2; sIN_PC = 3;
  sOUT_CHAN = 4; sOUT_PC = 5; sRELOAD = 6;
  
  !has_init ? (
    map_file_num = -1;
    has_init = 1;
  );
  PC = 0xc0;


@slider

  slider(sRELOAD) == 1 ?
  (
    reload = 1;
    slider(sRELOAD) = 0;
  );
  
  map_file_num != slider(sFILE) || reload ?
  (
    map_file_num = slider(sFILE);
    reload = 0;
    file = file_open(slider(sFILE));
    
    // default error values
    in_chan = out_chan = 0;
    in_pc = out_pc = -1;
    
    file ? (
      file_text(file) ? (
        resetMap();
        while(
          file_avail(file) ? (
            file_var(file, in_chan);
            file_avail(file) ? file_var(file, in_pc);
            file_avail(file) ? file_var(file, out_chan);
            file_avail(file) ? file_var(file, out_pc);
            in_pc > -1 && in_pc <= 127 && out_chan && out_chan <= 16 
            && out_pc > -1 && out_pc <= 127 ? (
              map[(in_chan - 1) * chan_sz + in_pc * sz] = out_chan - 1;
              map[(in_chan - 1) * chan_sz + in_pc * sz + 1] = out_pc;
            )
            : (
              // set sliders to error values
              slider(sIN_CHAN) = slider(sOUT_CHAN) = 0;
              slider(sIN_PC) = slider(sOUT_PC) = -1;
            );
          );
        );
      );
      file_close(file);
    );
  );


@block

  while(
    midirecv(offset, m1, m23) ? (
      m1 & 0xf0 == PC ? (
        chan = m1 & 0xf;
        this_pc = m23 & 0xff;
        entry_pos = chan * chan_sz + this_pc * sz;
        remap_chan = map[entry_pos];
        remap_pc = map[entry_pos + 1];
        setSlider(sIN_CHAN, chan + 1);
        setSlider(sIN_PC, this_pc);
        setSlider(sOUT_CHAN, remap_chan + 1);
        setSlider(sOUT_PC, remap_pc); 
        midisend(offset, PC + remap_chan, remap_pc);
      )
      : (
        midisend(offset, m1, m23);
      );
    );
  );
snooks is offline   Reply With Quote
Old 10-20-2019, 03:45 AM   #26
Tony Ostinato
Human being with feelings
 
Join Date: Apr 2012
Posts: 91
Default

thar she blows!! fully functional it seems, will test more tomorrow but it looks perfect!!

i wanna reward you, probably the thing of some value that i can toss out is all the charts i've done:

https://drive.google.com/drive/folde...kJ6VFY3YTlSWVU

if you know a sax or trumpet etc player they might dig that. dont use the midisax charts because theres all sorts of notes that wont work without the setup

but like all the horn section charts are good to go

i don't program. i did in the apple //e days and some on the atari st. made a sesex util for the digitech ips-33b and that nearly drove me mad. for every month of programming there were 4 of debugging and in the end when i coded it the way it should work it didnt and when i did it the way that really should not have worked it did and i couldnt ever figure out why.

so i have big respect for programmers. thanks so much!!
Tony Ostinato is offline   Reply With Quote
Old 10-20-2019, 07:39 AM   #27
snooks
Banned
 
Join Date: Sep 2015
Posts: 1,650
Default

Ooh ar me 'arty, that's good news and thanks very much for sharing the scores!
snooks is offline   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 11:28 AM.


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