A Brief Overview of the MIDI Output Port



Courtesy of the Digital Theremin Design Group: Chris Manners
                                                                                  Richard Miranda
                                                                                  Allen Chung



Summary

A Musical Instrument Digital Interface port, also referred to as MIDI port, is a simple interface used to connect up to 16 music devices to a PC.  MIDI consists of two main components, a hardware interface, and the transmission protocol.

 Overview

The MIDI hardware is fundamentally a simple serial port.  This port sends 10 data bits in one byte, which consist of eight data bits one start bit and one stop bit transmitted at a rate of 31.25 Kbaud.  The midi connector has 5 pins in total.  On the MIDI out port pin 4 is connected to a pull up resistor of 220 ohms, and 5V.  Pin 2 is connected to the grounded cable shielding.  Pin 5 is connected to a 220 ohm resistor, a buffer and then the UART.  The maximum cable length, for twisted pair cables is 50 feet.

2
3
1
 

 

 

 

 

 

 

 

 


The MIDI protocol consists of a specific list of messages, which devices must acknowledge.  Messages can vary in length from one byte up to an unlimited size.  The first byte of a MIDI message is special, it is called the status byte.  Status bytes are discerned from data bytes by bit #7.  All status bytes have bit #7 set, all data bytes have bit #7 cleared.  Therefore, status bytes can posses values from 0x80 up to 0xFF, and data bytes can posses values of 0x00 up to 0x7D.  Status bytes 0x80 to 0xEF are used to transmit messages to a specific MIDI device.  These types of messages are called voice messages.  Messages broadcased with status bytes 0xF0 to 0xFF are not designed for a specific MIDI device in mind, so they are heard by all MIDI devices.

 

 

Message Value Range

Description

0x00

0x7D

Data bytes

0x80

0xEF

Device specific messages

0xF0

0xFF

Broadcast messages

 

Basic Commands

 

The two fundamental MIDI commands are the simple Note On and Note Off commands.  Note On can have values 0x80 through 0x8F and Note Off can have values 0x90 through 0x9F.  The lower nibble of these commands represents the MIDI channel the command is issued on. 

 

Each of these commands have two data bytes which follow them, the first data byte is the note number and the second is velocity. 

 

The following example illustrates how these two commands are issued.

 

0x90 0x3C 0x20          Note On, channel 0, Middle C

0x80 0x3C 0x20          Note Off, channel 0, Middle C

 


Information and diagram on the MIDI port hardware and protocol specification was obtained from:

www.borg.com/~jglatt/