Help sending different Command values with "Control Surface


I'm using an Arduino Leonardo and the Control Surface library.

I know how to send a typical 'Control Change' message (on byte 176), but I want to send a 'Control Change' message on bytes 177, 178, and 179.

Is this possible with the Control Surface library?


What is the syntax for sending a single byte ?

17610 == B016, where the high nibble B16 indicates that it is a Control Change message, and the low nibble indicates that it's addressed at MIDI Channel 1 (zero-based).

Similarly, 17710 == B116, which is Control Change (B16) on Channel 2 (116),
17810 == B216, you get the idea.

When dealing with MIDI, the decimal representation of the messages is completely meaningless, it's much more useful to use hexadecimal.

Now to answer your question:

Control_Surface.sendControlChange({0x12, CHANNEL_1}, 0x34);

will send a Control Change message addressed to Controller #1216 on Channel 1, with a value of 3416, which is encoded in Serial MIDI as hex B0 12 34 (where the first byte is 176 in decimal).

Control_Surface.sendControlChange({0x12, CHANNEL_2}, 0x34);

results in a message of hex B1 12 34 (where the first byte is 177 in decimal).

Similarly, CHANNEL_3 → 178, CHANNEL_4 → 179.

Thanks Pieter P!

If you want to go really low-level, you could do the following:

    177,  // status and channel
    0x12, // controller #
    0x34, // value

But, IMO, it's better to use

  Control_Surface.sendControlChange({0x12, CHANNEL_2}, 0x34);