I have been working on a project where I am required to send several floating point numbers via MIDI over BLE. I decided to use real-time sysex messages as no other message within in the MIDI v1.0 spec would contain the 7 plus floating point numbers I need to receive from the feather.
However, I am finding that when sending them as raw bytes, I am only receiving a four byte message consisting of the sysex start byte (0xF0), two bytes of the data, then the sysex end byte (0xF7). The rest of the data is then interpreted as whatever either the MIDI.h or BLEMidi.h libraries interpret the rest of the bytes of data to be.
I have tried to use both versions of the MIDI.sendSysEx() function but whether I provide the start and end bytes or not, the message data is still reduced to two bytes with the start/end bytes on either side. Digging through the source code of both FourtySevenEffects MIDI and the Adafruit BLE MIDI libraries has me wondering if there is something I am not setting up properly in MIDI.h or a problem with how the BLEMidi.h send functions detect sysex messages and tries to terminate them properly. Either way, my eyeballs are bleeding and I am frustrated.
For simplicity, I reduced my code and placed it in the blemidi example for testing. I removed the scale playback and inserted this:
Code: Select all
union DataArray {
float values[2];
uint8_t bytes[8];
} data;
data.bytes[0] = 0x7f; // id = real-time message
data.bytes[1] = 0x00; // dev id
data.bytes[2] = 0x01; // sub id #1
data.bytes[3] = 0x02; // sub id #2
data.values[1] = 22.7;
uint8_t test[10] = {0xf0, 0x7f, 0x00, 0x01, 0x02, 0xff, 0xff, 0xff, 0xff, 0xf7};
//MIDI.sendSysEx(10, data.bytes);
MIDI.sendSysEx(10, test, true);
Code: Select all
21:16:49.944 From Feather nRF52840 Express Bluetooth SysEx Universal Real Time 4 bytes F0 7F 00 F7
21:16:50.002 From Feather nRF52840 Express Bluetooth Reset
21:16:50.002 From Feather nRF52840 Express Bluetooth Reset
21:16:50.004 From Feather nRF52840 Express Bluetooth Reset
... [repeats indefinitely]