MIDI: General Description and Overview

This article contains a description of a Musical Instrument Digital Interface (MIDI), and how it is used on the Macintosh.
Introduction
MIDI is a communications protocol -- a standard way of exchanging information:

- between electronic musical instruments, and

- between computers and those instruments.

By connecting the Apple MIDI interface to your Macintosh or Apple IIGS, and using MIDI software and instruments designed for the purpose, you can use your computer to compose, edit, orchestrate, and control playback of music on MIDI instruments such as keyboard synthesizers, drum synthesizers, and tone generators. You can then use your computer and MIDI software to transcribe the music into musical notation that can be edited, saved on a disk, and printed.

The most common use of a computer/MIDI setup is to record songs which can be saved onto the computer's hard disk, much like using a tape recorder to record songs. Advantages of using a computer/MIDI setup are:


Recording music with MIDI instruments such as keyboards, drum machines, and sound modules is easy. MIDI translators are available for electric guitars, but they are an added expense. Although computers can make digital recordings of analog instruments such as voice and horns in addition to recording MIDI instruments, this requires expensive computer hardware and storage devices.

Typical MIDI Setup

------                  ----              -------------
|    |---serial cable---|  |--MIDI cable--|| ||| || |||              
------                  ----              -------------    
Macintosh                MIDI               Instrument      
                      Interface    

Serial Cable

Every desktop Macintosh starting with the Mac Plus in 1986 until 1998 (when Apple switched to USB input ports starting with the iMac), came with two standard DIN-8 serial ports. . You connect the Macintosh to a MIDI interface (a small box) with a standard serial cable--the same kind used to connect the Macintosh to a StyleWriter printer. It does not matter which end of the cable is used in either device.

MIDI Interface
Most MIDI-equipped instruments contain both a receiver and transmitter. However, some instruments may have only a receiver or transmitter. The receiver accepts messages in a MIDI data format and executes the MIDI commands. The transmitter originates messages in MIDI data format, and transmits them by way of a line driver and UART. The MIDI interface consists of an optoisolator, UART (Universal Asynchronous Receiver-Transmitter), and other interface function hardware. The MIDI interface has at least one MIDI IN jack and MIDI OUT socket.

A MIDI interface operates at 31.25 Kbaud (+/- 1%) asynchronously, using a data format of one start bit, eight data bits, and one stop bit. This makes a total of 10 bits for each 320 microsecond period per serial byte.

The MIDI circuit is designed to accommodate a 1.5 mA current loop with a logical 0 as current ON. Also, one Output can drive one Input, and ONLY one, with a rise and fall time of less than 2 microseconds.

As specified by the IMA (International MIDI Association), MIDI connectors are DIN 5 (180 degree) sockets. The MIDI connectors are labelled MIDI IN and MIDI OUT, with pins 1 and 3 left disconnected in both the transmitter and receiver.

MIDI cables may be a maximum of fifty feet (15 meters,) with shielding connected to pin 2 at both ends.

MIDI Setup
The MIDI OUT of the interface is connected to the MIDI IN of an instrument, and the MIDI OUT of the instrument is connected to the MIDI IN of the interface. These connections are made with standard MIDI cables.

TO RECORD MUSIC FROM A MIDI INSTRUMENT

------                  -----               (OUT)-------------
|    |---serial cable---|   |(IN)---MIDI cable---|| ||| || |||          
------                  -----                    -------------    
Macintosh                MIDI                      Instrument      
                      Interface    
      <-  <-  <-  <-             <-  <-  <-  <-
         INFORMATION TRAVELS IN THIS DIRECTION


TO PLAY BACK MUSIC THAT IS STORED IN THE COMPUTER

------                  -----(OUT)                -------------
|    |---serial cable---|   |----MIDI cable---(IN)|| ||| || |||          
------                  -----                     -------------    
Macintosh                MIDI                       Instrument      
                      Interface    
      ->  ->  ->  ->             ->  ->  ->  ->
         INFORMATION TRAVELS IN THIS DIRECTION


MIDI Instruments
A MIDI instrument is an electronic instrument which can send and receive MIDI information. Common MIDI instruments include keyboards, drum machines, and sound modules (also called tone generators). A MIDI instrument can be connected to a MIDI interface, which is in turn connected to a computer. Some MIDI instruments have a built-in MIDI interface.

A sound module, also called a tone generator, is like an electronic keyboard without the keyboard keys. It is a device containing all the sounds a keyboard would contain, and these sounds can be triggered by another MIDI keyboard, or by a computer using sequencing software.

MIDI Data Format
Except for the "Real-Time" and "Exclusive" messages, all MIDI communications are transacted through multi-byte "messages" of one Status byte followed by one or two Data bytes. The messages are divided into two main categories:

1. Channel
- Voice
- Mode
2. System
- Common
- Real-Time
- Exclusive

[Status] ----- + ----- [Channel] ------- or ------- [System]
                          +                            +
                   [Voice or Mode]     [Common, Real-Time, or Exclusive]

Status Byte
The Status byte is an eight-bit binary number with the most significant bit set (1). The purpose of the Status byte is to identify the message type for the Data bytes.

Except for Real-Time messages, a new Status byte always commands the receiver to adopt the new status, even if the receiver has not yet completed the previous message.

Channel Messages
The Channel message is identified by a four-bit number in the Status byte which address the message to one of the sixteen channels. In this way, messages are sent to any units in the system whose channel number matches the channel number encoded in the Status byte.

- Voice: A type of Channel message used for controlling an instrument's voice.

- Mode: A type of Channel message used for controlling an instrument response to a voice message.

System Messages
The System message does NOT have a channel number encoded and the message is intended for all units on the system.

- Common The Common message is intended for all units in the system.

- Real-Time: The Real-Time message is intended for all units in the system and may be sent at any time, even between messages of a different status type. A Real-Time message is either acted upon or ignored by the unit, after which the receiving unit will resume process under its previous status.

- Exclusive: The Exclusive message may contain any number of Data bytes and will include a Manufacturer's Identification (ID) code. All but the unit whose receiver recognizes the ID code should ignore the Data bytes.

Computer

You need "music processing software" to enter and edit music, just like you need word processing software to enter and edit text. Music processing software is commonly referred to as "sequencing software".

If you would like to know more about MIDI, a number of helpful books are available from bookstores.
Published Date: Feb 18, 2012