# MSC, Hex and Grandma2

Hey there,

I'm trying to convert midi notes to MSC in order to control a grandma2, speicifically to trigger cues within an executor.

This is the raw midi to trigger cue 4, exectuor 1, page 1

F0 7F 7F 02 7F 01 34 2E 30 30 30 00 31 20 31 F7

where 34 2E 30 30 30 00 31 20 31 is 4.000 NUL 1 1

(This triggers correctly)

From the Grandma2 manual:

"Decimal numbers in hex is some of the easiest to convert. It needs a "3" in front. This means that decimal 4 becomes 34 in hex. The complete cue number including the dot is then: 34 2E 30 30 30."

However, if i set midi note to variable nn incoming, then send midi note 4 and set the midi outgoing as

F0 7F 7F 02 7F 01 nn 2E 30 30 30 00 31 20 31 F7

then the variable gets substituted to 04, not 34 - how would I convert to this 3 prepended hex format?

Another example - the number 62 would become the octets 36 32

Sorry if this is a simple question or has been answered before, it's really got me stumped :)

H

It looks like you are talking about ASCII coding. For instance you would want the decimal number 52 on incoming covert to 35 32 hex on outgoing, correct?

This can be done, however I have to tell you a caveat. It is easier to set this up if you set up the outgoing Sysex to be a fixed amount of digits with largest number of digits available to reduce the number of translators, so say the largest number of characters is 5 digits plus a decimal point plus two digits after the decimal point. (Say 99999.99). This of course would be represented by 39 39 39 39 39 2E 39 39. Can you get a way with a number of 1.00 looking like 30 30 30 30 31 2E 30 30 ? If so, we can do it in a single translator. If not, we will need a different translator for every number of digits you expect. Each translator would then need to determine if the incoming value is for them and if not exit leaving it for another translator, so in the above example we would need 8 translators, one for 1 digit, one for 2 digits, etc.

I’m pretty sure I’ve done this before but will need to see if I can dig up the example. Before I do, could you see if leading or trailing zero’s will be a problem for GrandMA?

Another thing to consider is how to handle decimal points within MT Pro. Of course, if you are never using decimal points internally, there is nothing to worry about, other than that, we will need to figure how to represent a decimal value within an integer variable.

Now for the basic question. If you want say 25 decimal to convert to 32 35 hex (a two position value) and the incoming value is in pp

//get tens value

qq=pp/10

// get ones value

rr=pp%10

// convert tens

tt=qq+0x30

// convert ones

uu=rr+0x30

output would be tt uu

If you want 5 digits plus decimal plus 2 its output would be

30 30 30 tt uu 2E 30 30 ( 00025.00)

Doing all of this off top of my head so I might have missed something but hopefully you get the gest of what I’m doing.

Steve Caldwell

Bome Q&A Moderator and

Independent Bome Programming Consultant/Specialist

bome@sniz.biz