Raw MIDI -


I hope this finds you well. I am trying become more efficient in my use of Bome. One of the things I am doing is trying to use a single translator to send data out on different channels based on an incoming CC. 

Here's a scenario:

-receive a CC

-based on the CC number, send out a raw message on a certain channel 

-the outgoing message would be a CC number with a variable representing the channel number

Example would be B1 28 7F (CC40 with a value of 127 sent on channel 2). But I want the channel number to be represented by a valid variable. I tried to use local and global variables but the input was invalid ex Bqq 28 7F.

Am I barking up the wrong tree here? 




The status byte of a MIDI message is composed of two four bit nibbles. For instance

B1 where B is the status byte and 1 is the channel. This is represented in binary as 1011 0001

Where 1011 is B and 0001 is 1

0000 - 0

0001 - 1

0010 - 2

0011 - 3

0100 - 4

0101 - 5

0110 - 6

0111 - 7

1000 - 8

1001 - 9

1010 - 10 (0x0a)

1011 - 11 (0x0b)

1100 - 12 (0x0c)

1101 - 13 (0x0d)

1110 - 14 (0x0e)

1111 - 15 (0x0f)


So to combine the status byte with the channel you need to use the OR operator. If pp is 0x0b and qq is 0x01 this is what you would do

// shift status byte into upper nibble (over write existing pp)


//  pp is now 0xb0.  Now OR with lower nibble to combine



Now pp will be 0xb1 (or 177 decimal as shown in the log window if rules is checked). You can now use pp as the outgoing variable in and it will be sent as 0xb1 as you requied.