draft
note

Notes about the MIDI protocol format

MIDI (Musical Instrument Digital Interface) is a protocol designed for musical devices, using simple byte-level communication.

MIDI Message Structure

See the midi/messages page for a detailed description of MIDI messages.

Polarity on the Wire

MIDI via DIN (traditional 5-pin connector)

Ref : page 6 of the The Complete MIDI 1.0 Detailed Specification (version 96.1 third edition) (complete_midi_96-1-3.pdf) :

The MIDI data stream is a unidirectional asynchronous bit stream at 31.25 Kbits/sec. with 10 bits transmitted per byte (a start bit, 8 data bits, and one stop bit).

(CA-033) MIDI 1.0 Electrical Specification Update [2014] (ca33 5 PIn DIN Electrical Spec.pdf) :

The hardware MIDI interface operates at 31.25 (+/- 1%) Kbaud, asynchronous, with a start bit, 8 data bits (D0 to D7), and a stop bit. This makes a total of 10 bits for a period of 320 microseconds per serial byte. The start bit is a logical 0 (current ON) and the stop bit is a logical 1 (current OFF). Bytes are sent LSB first.

see https://learn.sparkfun.com/tutorials/midi-tutorial/hardware—electronic-implementation

MIDI via USB

Data Rates and Bandwidth Comparison

Connection TypeData RateMax Bandwidthmsg/s (1)time per msg (1)
DIN MIDI31,250 bits per second (bps)31.25 kbps10’4160.1 ms
USB MIDI12 Mbps (Full Speed USB)12’000 kbps4’000’0000.25 us

(1) : for typical 3 bytes messages (status byte + 2 data bytes)

In practice, you cannot know what hardware sits behind some generic MIDI port. You should use the 3125 bytes/s limit unless you have special knowledge about the device.