tttapa / Control-Surface

Arduino library for creating MIDI controllers and other MIDI devices.
GNU General Public License v3.0
1.22k stars 137 forks source link

Sysex message sender #1064

Open Vahen1981 opened 3 weeks ago

Vahen1981 commented 3 weeks ago

Hello! Actually I don't know if this is a bug or it is something that I ignore about sysex messages, but my problem is when I try to send a sysex message using the sender of the library it works very good until I send a sysex message that contains a byte like 0x90 or 0x80... In that point the sysex broke and disappear... and many time when this happen I receive a note on or note off message in the midi receptor...

I know 0x90 or 0x80 are notes on and notes off messages, so that's the reason because I don't know if this is a bug or is just forbidden to send this values inside a sysex message. What do you know about this?

tttapa commented 3 weeks ago

SysEx data can be 7 bits at most, the most significant bit should always be zero, as per the MIDI specification. Values of 0x80 and higher are reserved to encode the message types.

If you have to send values over 0x7F, you'll need to use a 7-bit encoding scheme. Depending on the type of data you want to send, you could use some kind of escape sequence to identify 8-bit values (e.g. 0x7F 0x12 means 0x92, but you'll need some additional tricks to represent 0x7F itself), or you could use a standard ASCII encoding scheme like Base64 or Base85.