Bipolar knob or multislider sending MSB/LSB

Discuss problems and solutions.
Post Reply
johnocan
Newbie
Posts: 1
Joined: 12 Nov 2013 13:31

Bipolar knob or multislider sending MSB/LSB

Post by johnocan »

Hi Folks,

I have been searching around for a while and can't seem to find an answer to this.... I want to create a knob or slider that will send NRPN values from -63 to 64. I have tried everything I can think of and so far can only make it work from -63 to 0 or from 0 to 64. The messages I am sending to address the parameter are

ctlout(0,99,0,1)
ctlout(0,98,34,1)
ctlout(0,6,128,1)
ctlout(0,38,x*128,1)

I know that the parts marked in red are where the issue is but I don't know how to make it work. Can anyone please help? I am trying to make a new template for the Shruthi and want to include the modulation matrix (hence the need for NRPN).

This is what the manual says about negative numbers in NRPN

When the maximum value of the parameter exceeds 127, or when it accepts negative values, a data entry MSB will have to be sent. Negative values are represented using 2’s complement. For example, the MIDI messages to send to set the Oscillator 1 range to -12:

176 99 0 (NRPN MSB set to 0)
176 98 2 (NRPN LSB set to 2, from the table below: Oscillator 1 range)
176 6 1 (Data Entry MSB set to 1 -- value above 127 or negative)
176 38 116 (Data Entry LSB set to 116, because 116 - 128 = -12)


Thanks,
John
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: Bipolar knob or multislider sending MSB/LSB

Post by Macciza »

Hi

On the right path but not quite there hey?? Always good to review the maths and logic, compare it to what it should be . . .

OK Maths first, lets get -63 to 64 . .. x*127-63 should do nicely … Try that in the value field of the Knob and check it to make sure . . . good . . .

Some Logic is needed to deal with the 'whether it is positive or not' question to decide what the Data MSB will be . . .
If the value is equal or greater than 0, send out Ctl 6 0 - if less then 0 send Ctl 6 1 == if(value>=0)ctlout(0,6,0,1);else clout(0,6,1,1);
And then the value to send if positive or negative - positive value or 128 minus the value == if(value >=0)ctlout(0,38,value,1);else clout(0,38,128+value,1); //value is negative so adding becomes subtracting

You can also reconfigure this to something like
if(value>=0){ctlout(0,6,0,1);ctlout(0,38,value,1);}
else {ctlout(0,6,1,1);ctlout(0,38,128+value,1);}

Remember to put the Ctl 99,98 stuff in before all of that as well - thats the bit that tells it to read the next bit as NRPN data . . .
Also if you do a search of the forum I think this has been covered a number of times - though the discussions have been confused at times . . .
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Post Reply