Midi CC Mapper

Post your Lemur Projects.
Post Reply
alexbausw
Newbie
Posts: 5
Joined: 11 Feb 2013 14:51

Midi CC Mapper

Post by alexbausw »

Hi All,

I made a little Midi ControlChange Mapper with some calculation problems. In general it works fine but sometimes I don't get the expected output-values.
Some times I don't reach 127 and sometimes i don't reach zero.
How can I improve my calculation algorithm (I have also used the algorithm from this forum as an alternative with the same problems)?
Here is the code for my output-calculation "calcR(v, il, iu, ol, ou, s, c)":

Code: Select all

decl i, o, p;
decl curve = {1,2,3,0.5,0.33};

//v = values, il = input lower limit, iu = input upper limit
//ol = output lower limit, ou = output upper limit, s = pos/neg slope
//c = selected response curve

p = curve[c];

//set lowest value to zero and scale input between 0 and 1 
i = (v - il) / (iu - il);

//set responsecurve
i = i^p;

//set range for i to the desired limits
o = i * (ou + 1/127 - ol);

//alternative calculation in one formula
//o = ((((v - il) * (ou - ol)) / (iu - il)) ^ p) + ol;

//change increment to decrement if Button is checked and set startpoint
if (s)	o = 1 + 1/127 - (1 - ou) - o;  
else 	o += ol;			

return o;


I attached the complete CC-Mapper-Modul for testing. It includes a fader to simulate midi-input, so you don't need a midi-controller.
Thanks in advance for many replies. :-)

vg

Alex
Attachments
SingleMidiCCMapper.jzml
MidiCCMapper
(32.44 KiB) Downloaded 130 times
Post Reply