translate midi CC -> sysex containing LS, MS nibbles

Hello, I've been using Midi Translator Pro for about a week - so I am relatively new to it. It's really added a lot to my setup already, but now have encountered my first programming issue (I'm not a programmer.) I am trying to send a midi CC (let's say CC19: B0 13 pp) (pp values 0-100) to a DSI Poly Evolver which is mainly controlled by sysex instructions which contain LS and MS nibbles (in that order), e.g.

Oscillator 1 Fine Tune: F0 01 20 01 01 01 LS MS F7

where LS cycles through 00 -> 0F and MS counts up from 00 -> 06 (once LS has cycled through 0F it returns to 00 and MS increments by 1.) Values range from 00 00 to 0A 06 (0-100) (I think this is correct)

The outgoing message will obviously have variables for LS & MS, but I don't know where to start with the rule function to convert a CC message with values 0-100 to 00 00 - 0A 06

Once I get the general idea, I think I will be able to apply the rule to all controls.

I know this can be done - Has anyone succeeded with this kind of translation?

Thanks for your time,

Tom

I will be able to help with this later today. Might have a few more questions for you though.
If I understand correctly you want the above Sysex translated to CC value of 0-100. So the main challenge will be to convert MS LS to proper value on output. Just want to verify that is what you are looking for.

Hi Steve,
Thanks for replying.
Other way round – so incoming message is CC (values 0-100)
Outgoing message is the sysex message from 00 00 – 0A 06

OK however 0A 06 would be 106. Is this what you want?

OK to convert CC value to LSB MSB as you describe

Input Controller XX set value to pp

Rules

// set LSB MOD operator

qq=pp%16

// Set HSB Divide operator since BMT uses integers, remainder gets dropped.

rr = pp/16

output message would then be raw midi

F0 01 20 01 01 01 qq rr F7

I only tested on paper. Let me know if it does the trick

 

This should handle value up to 127 incoming

 

The outgoing messages should go something like this:
0 = 00 00
1 = 01 00
(miss a few)
15 = 0F 00
16 = 00 01 etc…

I will double check – LSB definitely comes before MSB on the Evolver.

Thanks for this Steve. I will not be able to test until tomorrow – I will report back with results.
Tom

This is it. Thank you.
Of course I meant to put 04 06 instead of 0A 06.
It should now be possible to map all commands to available CC numbers – there is one more problem to overcome which is how to deal with messages which have values above 127 (CC values 0-127 but sysex message value 0-200 for example). I have seen the tutorials on the old forum which show how to scale a control down. I’m guessing the opposite would be true to scale up. Would an extra variable be needed to get to the desired decimal value, and then apply the two operators above?
Thanks again,
Tom

So you want to scale down 0-127 to be 0-100 on input to make it 00-00 to 04-06 on output?
You will not be able to get a single controller to output more than 127. You would have to manipulate sysex values above 127 with a separate controller.

If you want to scale down the input 0-127 to become 0-100 you would need to put the following rules before the rules I documented earlier.
// First multiply to get better precision
ss=pp1000
// target output range 0-100
ss=ss
101
// target input range 0-127
ss=ss/128
// divide it back to get to original decimal place (integer)
ss=ss/1000
// alter the input value for future processing (from original rules)
pp=ss

Note you can scale up or down for about anything with this method. Just remember if you scale up, you will lose precision.

If you want to scale down the input 0-127 to become 0-100 you would need to put the following rules before the rules I documented earlier.
// First multiply to get better precision
ss=pp*1000
// target output range 0-100
ss=ss*101
// target input range 0-127
ss=ss/128
// divide it back to get to original decimal place (integer)
ss=ss/1000
// alter the input value for future processing (from original rules)
pp=ss

 

Thanks for the explanation Steve.
I thought there might be a way to scale up a controller without losing precision. For now I am happy that it is possible to control a sysex parameter including output values above 127 using cc control input. The midi controller I use can restrict input from 0-100, so for a control parameter which has a range of 200 I just multiply the CC variable by 2 first to increment in steps of 2. This should be good enough.
Thanks again,
Tom

Good, deal. Glad I could help!