[sdiy] MIDI Sys Ex packet length

rsdio at audiobanshee.com rsdio at audiobanshee.com
Sun May 24 21:06:28 CEST 2015

On May 24, 2015, at 11:24 AM, Gordonjcp <gordonjcp at gjcp.net> wrote:
> On Sun, May 24, 2015 at 07:21:19PM +0100, Richie Burnett wrote:
>> If doing a flash update of firmware over conventional MIDI via
>> System Exclusive is it wise to break the download into many smaller
>> packets of say 128 or 256 bytes in length?
> Bear in mind that USB MIDI interfaces send sysex in 3-byte chunks, unless you terminate with 0xf7 - this buggers up sending sysex to Casio CZ synths :-)

USB-MIDI sends messages in 4-byte chunks between the computer and the interface. At most, 3 bytes are passed on to the actual MIDI port. The 1st byte of every 4-byte group is non-MIDI data giving a 4-bit code and a 4-bit "cable" number. This allows one USB cable to carry 16 MIDI ports worth of traffic per USB Device.

The 4-bit code, with 16 values, includes 1 code to begin or continue a SysEx message, where all 3 remaining bytes are sent on the Classic MIDI port. There are 3 other codes that specifically End a SysEx message, 1 code for each of the possible number of bytes remaining: 1, 2, or 3. These 3 codes do not require any specific values in the MIDI payload.

So, it's entirely possible with USB-MIDI to end a SysEx message without sending 0xF7. No need to confuse the Casio CZ family. I'm fairly certain that Apple's CoreMIDI properly supports this, including the built-in USB-MIDI driver for CoreMIDI. I'm not familiar with Windows support, although considering that Microsoft created the horrible USB-MIDI spec, you'd think that they implemented it correctly. Wait, I already know that they have never fully implemented the USB-MIDI spec (with regard to non-port entities), so I wouldn't be surprised.

Brian Willoughby
Sound Consulting

More information about the Synth-diy mailing list