MIDI sysex out: platform compatibility?

Does MIDIOut.sysex behave compatibly across Mac, Windows and Linux?

I’ve tried Linux – no problem if the Int8Array begins with 0xF0 and ends with 0xF7.

I’m not able to try Mac or Windows at the moment.

The help file says “On Windows, the function call must contain a full sysex message. In other words, it must start with 0xF0 (240 or -16) and end with 0xF7 (247 or -9)” – same as Linux. But the note’s specificity (“on Windows”) suggests that Mac may be different… without actually confirming :laughing: … which… well, I guess I’ll update that after getting an answer.

Could someone confirm?

This is for a quark I’m preparing. I would like the user not to have to worry about this detail – just provide the data between the bookends and let the system format it properly for the OS.

hjh

Hm, then I realized that sysex is hard to test without a specific test case (you would need a device with a known sysex protocol).

So it might help if I share my test case.

Copy/paste this into e.g. sysex.pd.

#N canvas 727 52 450 300 12;
#X obj 105 48 sysexin;
#X obj 105 73 t b f, f 11;
#X obj 179 172 list store;
#X msg 179 98 append \$1;
#X obj 105 98 delay 10;
#X obj 105 123 t b b;
#X listbox 179 197 20 0 0 0 - - - 0;
#X connect 0 0 1 0;
#X connect 1 0 4 0;
#X connect 1 1 3 0;
#X connect 2 0 6 0;
#X connect 3 0 2 0;
#X connect 4 0 5 0;
#X connect 5 0 2 1;
#X connect 5 1 2 0;

Launch recent Pd (that listbox is in Pd 0.52 – maybe not in 0.51 – don’t use an older version for this).

Open the pd file.

Since this is Mac, turn on IAC MIDI (Audio MIDI Setup).

Pd > Media > MIDI Settings and receive from IAC.

In SC:

MIDIClient.init;

// I think...? Not on Mac, I can't test
m = MIDIOut(MIDIClient.destinations.detectIndex { |endpt| endpt.device.containsi("IAC") });

// if this worked, you would see the message in the Pd list box
m.sysex(Int8Array[1, 2, 3]);

// or here
m.sysex(Int8Array[0xF0, 1, 2, 3, 0xF7]);

In Linux, the first sysex output (without delimiters) displays nothing, but the second shows 240 1 2 3 247 (ok!).

Would really appreciate it if someone could try on a Mac.

hjh

I just tested this, and it produces the same behavior for me. m.sysex(Int8Array[1, 2, 3]); doesn’t display anything, but the second causes 240 1 2 3 247 to pop up in the message box.

1/ Thanks! 2/ That’s good news – it means the format of a sysex array is the same for all three OSes. (So I won’t have to write a platform switch.)

I’ll update the help.

hjh