MiBAC Color Staff picture

MIDI Reference

MIDI

MIDI is an acronym for Musical Instrument Digital Interface. MIDI was developed in the early 1980s as a hardware and software specification that would enable computers and synthesizers to communicate with each other.

Hardware Setup

The required items are:

  • Computer,
  • MIDI interface
  • MIDI Cables
  • Synthesizer
  • Sound source (Speakers or Headphones)

This is how it’s wired.

The MIDI interface is essentially a 31.25K Baud modem transmitting serial data between the synthesizer and computer. The MIDI interface is connected to the modem port of the computer with a standard Mac printer cable. Two MIDI cables connect the MIDI Interface and synthesizer, one cable for send and one for receive. The MIDI Ports are labeled MIDI IN and MIDI OUT. They connect to opposite names between the MIDI interface and synthesizer.

The computer can MIDI messages to the the synthesizer.
Computer > MIDI Interface > MIDI Out > MIDI cable > MIDI In > Synthesizer.
The synthesizer can send MIDI messages to the computer.
Synthesizer > MIDI Out > MIDI cable > MIDI In > MIDI Interface > Computer

Decimal, Binary and Hexadecimal Number Systems

Computers and synthesizers communicate in the binary number system. Binary numbers consists of ones and zeros. A single zero or one is called a bit. Computer CPU chips are optimized to process data in 8 bit units (bytes), 16 bit units (words), and 32 bit units (longs). Normal people use the decimal system (base 10) to relate to numbers. Computer programmers use the hexadecimal system (base 16) to relate to numbers. Base sixteen was chosed because it represents multiples of 8 bits that the computer uses to process data.

A comparison of the decimal, binary and hexadecimal systems is shown in the following table.

Binary Decimal Hexadecimal
0000 0 $0
0001 1 $1
0010 2 $2
0011 3 $3
0100 4 $4
0101 5 $5
0110 6 $6
0111 7 $7
1000 8 $8
1001 9 $9
1010 10 $A
1011 11 $B
1100 12 $C
1101 13 $D
1110 14 $E
1111 15 $F

Min Max Range

Number bits Max Binary Max Decimal Max Hex
8 11111111 255 $FF
16 1111111111111111 65,535 $FFFF
32 11111111111111111111111111111111 4,294,967,295 $FFFFFFFF

Understanding Decimal, Binary, Hexadecimal

MIDI Data Format

MIDI communication is achieved through "messages" consisting of one or more bytes. The MIDI protocol is very specific about how many bytes are in a "message." The most common number is three. The first byte in the message is called the status byte. The remaining bytes are called data bytes.

Status Bytes

A byte is a status byte if the most significant bit is set. In english this means that the left most bit of the byte (eight zeros or ones) is a 1.

1bbbbbbb (b = 0 or 1)

Data Bytes

A byte is a data byte if the most significant bit is not set. In english this means that the left most bit of the byte (eight zeros or ones) is a 0.

0bbbbbbb (b = 0 or 1)

Hex Binary Decimal
Data Byte Min $0 00000000 0
Data Byte Max $7F 01111111 127
Status Byte Min $80 10000000 128
Status Byte Max $FF 11111111 255

MIDI Messages

There are 8 categories of status messages. Status messages are sent by playing keys, pushing buttons, or moving wheels on the synthesizer. They can also be sent by the computer. The MIDI specification defines eight major types of MIDI messages. The left four bits indicates the type of message, the right four bits indicate the MIDI channel.

Status Messages ($80-$FF)

Left Right Effect
$80-$8F $8 = Note Off $0-$F = MIDI channel Turns off the note on the specified channel
$90-$9F $9 = Note On $0-$F = MIDI channel Turns on the note on the specified channel
$A0-$AF $A = Key Pressure/ Aftertouch $0-$F = MIDI channel Hold a key down to apply vibrato to a single note
$B0-$BF $B = Control Change $0-$F = MIDI channel e.g. stereo pan, volume control, plus many more
$C0-$CF $C = Program Change $0-$F = MIDI channel change to flute , change to piano
$D0-$DF $D = Channel Pressure $0-$F = MIDI channel apply "aftertouch" to all notes on the channel
$E0-$EF $E = Pitch Bend $0-$F = MIDI channel moving the pitch bend wheel
$F0-$FF $F = System Messages $0-$F = MIDI channel Timing, system exclusive commands

To send a note on message to channel 1 the message would be $90, to send a note on message to channel 7 the message would be $96, and to send a note on message to channel 15 the message would be $9F.

Data Messages ($00-$7F)

One or two data bytes follow every status message. They’re used to indicate which key was pressed down, how loud the note is, what instrument button was pushed, etc.

Status Name # Data Data 1 Data 2
$8c Note Off 2 Note Number Velocity
$9c Note On 2 Note Number > 0: Velocity

= 0: Note Off

$Ac Note Aftertouch 2 Note Number pressure value
$Bc Control Change 2 Control # Control Value
$Cc Program Change 1 Patch # not used
$Dc Channel Aftertouch 1 Pressure value not used
$Ec Pitch Bend 2 Pitch Bend LSB Pitch Bend MSB
$Fx System Messages 0 - many later

c = channel ($0-$F)

Types of Data Transmitted through MIDI

Examples

This is a MIDI message to turn on Middle C on MIDI channel 1

903C6B

$90 = Turn note on channel 1 (0 is MIDI channel 1)
$3C (60 is Middle C) = note number
$6B (107) = velocity

Once turned on, some MIDI notes will stay on forever. When its time to end, send a note off message

803C6B or 903C00

$80 = Turn note off on channel 1 (0 is MIDI channel 1
$3C (60 is Middle C) = note number
$6B (107) = velocity (ignored)
or
$90 = Turn note on channel 1 (channels based 0 -15)
$3C (60 is Middle C) = note number
$00 (0) = Note On with velocity of 0 means turn note off

MIDI Note Numbers and Music

Middle C is MIDI note number 60. The black and white keys are numbered consecutively from that point. As you move to the right numbers get higher. As you move to the left numbers get lower. Because there are 12 half steps in an octave, the C's on the piano have MIDI note numbers 24, 36, 48, 60, 72, 84, 96, 108. The lowest key on the piano is note number 21. The highest note is note number 108.

Other Links

Harmony Central MIDI Tools and Resources

MIDI Note Numbers and Names

Tutorial on MIDI and Music Synthesis

MIDI Specification

 

 


web: http://www.mibac.com
email: sales@mibac.com

MiBAC Music Software
P.O. Box 468
Northfield MN 55057

phone: (800) 645-3945
phone: (507) 645-5851
fax: (507) 645-2377