|
|
|
10-14-2019, 01:28 PM
|
#1
|
Human being with feelings
Join Date: Apr 2012
Posts: 91
|
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!!
|
|
|
10-15-2019, 08:10 AM
|
#2
|
Banned
Join Date: Sep 2015
Posts: 1,650
|
Sounds useful, I'll rustle something up for later!
|
|
|
10-15-2019, 12:59 PM
|
#3
|
Human being with feelings
Join Date: Apr 2012
Posts: 91
|
Quote:
Originally Posted by snooks
Sounds useful, I'll rustle something up for later!
|
oh man thanks!!!
|
|
|
10-15-2019, 02:12 PM
|
#4
|
Banned
Join Date: Sep 2015
Posts: 1,650
|
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);
);
);
|
|
|
10-15-2019, 02:21 PM
|
#5
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
|
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.
|
|
|
10-15-2019, 02:56 PM
|
#6
|
Banned
Join Date: Sep 2015
Posts: 1,650
|
That's just what the file_var JS function works with when using text files, one number per line. C'est la vie.
|
|
|
10-15-2019, 11:33 AM
|
#7
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
|
Quote:
Originally Posted by Tony Ostinato
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.
|
|
|
10-15-2019, 12:58 PM
|
#8
|
Human being with feelings
Join Date: Apr 2012
Posts: 91
|
midiconverter3 is a great plug but that would only handle one number conversion, i need something that can do all 127
|
|
|
10-15-2019, 02:11 PM
|
#9
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
|
Quote:
Originally Posted by Tony Ostinato
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.
|
|
|
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 03:34 PM.
|