Title: MIDI
1MIDI
- Musical Instrument Digital Interface
A digital communication protocol allowing devices
to send and/or respond to instructions
2Function of MIDI
- The MIDI protocol allows devices to exchange
various types of instructions - MIDI data is not an audio signal
- As a comparison
- a tape or CD contains a description of an audio
signal - a printed page of music contains instructions
that a (human) instrumentalist is trained to
carry out - a MIDI file contains instructions that a
(computer) instrumentalist is trained to carry out
3Function of MIDI
- Thus, a MIDI file is small and easily transmitted
- It contains instructions only, leaving the
creation of the actual audio signal to the
receiving device - Instruction messages are transmitted in the form
of binary numbers - Binary numbers may be transmitted by alternating
voltage between set high and low levels - high 1
- low 0
4Connecting MIDI Instruments
- Typically, a MIDI instrument has three MIDI ports
IN, OUT and THRU
- In a simple configuration, one main instrument
will act as the master to a number of slave
instruments.
5Connecting MIDI Instruments
- The sound of the master may be enhanced by
doubling its sound with a slave instrument that
is set to play a different type of sound.
master
slave
- This is accomplished by connecting the MIDI OUT
Of the master to the MIDI IN of the slave.
6Connecting MIDI Instruments
- To enhance the sound still further, more slave
devices may be added by daisy chaining more
instruments together via the MIDI THRU port.
master
. . .
slave 1
slave 2
slave n
- The MIDI THRU port simply passes on what comes to
the instrument via the IN port.
7Connecting MIDI Instruments
- In some situations, daisy chains can lead to
delays at the end of the chain. - A tidier configuration is to use a MIDI Thru Box
master
8Connecting MIDI Instruments
- To play an arrangement, a sequencer can send MIDI
to a group of instruments.
sequencer
. . .
Channel 1
Channel 2
Channel 16
- MIDI has 16 channels
- Each instrument can be set to play a different
sound and base channel, with each part
corresponding to a different channel.
9Configuring MIDI Instruments
- MIDI came into being at the same time as the
personal computer. Soon, programmers began
writing MIDI software.
A MIDI interface translates computer code to MIDI
code
10MIDI Software
- A software sequencer could have more features
than a dedicated hardware sequencer, and have
more memory. - Editor/Librarian software could allow complex
synthesizer patches to be created more
intuitively. - Patches could be arranged and stored in banks
- Groups of banks could be stored in a computer and
transferred to the instrument - Notation software could translate MIDI
information into notated music, as well as
transpose, create parts, allow easy creation of
alternate arrangements, etc.
11Configuring MIDI Instruments
- The most flexible configuration makes use of a
MIDI patchbay
With successive IN/OUT port pairs, each device
connected to the patchbay can send and receive
information
Many devices can play on more than one MIDI
channel
MIDI patchbay
A patchbay allows a software synthesizer to
address both port and channel number
Tone modules are synthesizers without keyboards
A master controller keyboard produces no sound,
but only sends MIDI information
Thus, the number of available channels becomes
lt portsgt 16
12Computer as Sound Generator
- It is also possible to use the computer as a
sound generating instrument - A MIDI interface is often combined with a sound
card that has banks of wavetable sounds - Apples QuickTime, a free download, comes bundled
with a set of instrument sounds, which are used
by the computer to play MIDI files
J.S. Bach, Trio Sonata BWV.525
- The QuickTime instruments also function as an
internet browser plug-in, allowing web pages to
play MIDI files on a computer that has the
plug-in installed.
13The MIDI Language
- MIDI messages fall into two main categories
- Channel (pertaining to information on a
particular channel) - Voice
- Mode
- System (pertaining to the system as a whole)
- Real time
- Common
- System Exclusive (SysEx)
14Channel Voice Messages
- MIDI is transmitted in 10-bit bytes
1
0
start
stop
- The first and last bits are start and stop bits,
used to identify the beginnings and ends of bytes
- The actual MIDI information is in the middle
eight bits
15Channel Voice Messages
- There are two types of MIDI Channel Voice bytes
status bytes and data bytes - A status byte determines the type of message and
the channel (what? and where?) - The MSB of a status byte is 1
1nnnnnnn
- A data byte gives a value (how much?)
- The MSB of a data byte is 0
0nnnnnnn
- With seven bits following the MSB, a data bytes
range of expressible values is 0-127
16Channel Voice Messages
- A Channel Voice message consists of one status
byte and at least one data byte - The status byte is divided into nibbles
1nnn nnnn
message type
channel no. (0-15)
- With three bits to define message types, there
are eight possible types of messages. Seven are
implemented.
17Channel Voice Messages
Note Off
1000nnnn 0nnnnnnn 0nnnnnnn
status
two data bytes
note number
velocity
Middle C MIDI note number 60
- Velocity how quickly a note is released
- A higher number is a quicker release,
corresponding to a note fading quickly - A lower number is a slower release, corresponding
to a note fading slowly
18Channel Voice Messages
Note On
1001nnnn 0nnnnnnn 0nnnnnnn
status
two data bytes
note number
velocity
- Velocity how quickly a note is depressed
- A higher number results in a louder tone
- A velocity value of 0 is the same as a Note Off.
19Channel Voice Messages
Polyphonic Key Pressure (Poly Aftertouch)
1010nnnn 0nnnnnnn 0nnnnnnn
status
two data bytes
note number
pressure
- Pressure applied to the keys is mapped to some
modulation parameter (within the particular
instrument) - Thus, each key can generate its own degree of
modulation - This is a feature found mainly in higher-end
instruments (separate sensors must be installed
for each key)
20Channel Voice Messages
Channel Key Pressure (Channel Aftertouch)
1101nnnn 0nnnnnnn
status
one data byte
pressure
- Poor persons aftertouch less costly to
implement, and thus found on more instruments
than poly aftertouch - One pressure value is applied to all notes on a
given channel - The value is read from the key that is being
pressed hardest
21Channel Voice Messages
Program Change
1100nnnn 0nnnnnnn
status
one data byte
program number
- Change to a specified patch number on an
instrument - With one data byte, up to 128 patch numbers may
be specified - A separate message type (that we will see
shortly) can allow specification of more than 128
patches
22Channel Voice Messages
Pitch Bend
1110nnnn 0nnnnnnn 0nnnnnnn
two data bytes
status
pitch bend value, LSB
pitch bend value, MSB
- Pitch bend has 14 bits of resolution, a value
range of 0 to 16,383. - The range of pitch shift is programmable within
an instrument, typically from one semitone to an
octave above and below the note being bent. - 64 values within the range of a semitone would be
acceptable, but within the range of an octave
there would be audible discontinuities (zipper
noise). Hence, two data bytes for better
resolution. - Pitch bend is a special class of controller (the
next message type). It is its own message type
so that the two data bytes may be combined into
one value.
23Channel Voice Messages
Control change
1011nnnn 0nnnnnnn 0nnnnnnn
two data bytes
status
Controller number
Controller value
Controllers modify the sound of a sounding note
The controller number specifies a stream of
information.
Controller information is commonly described
either in terms of what type of device is
producing the stream (pedal, wheel, slider, etc.)
or what type of sound parameter is being
controlled (volume, tremolo, pan position, etc.)
The first data byte defines the control stream
being addressed, the second data byte determines
its value (or position).
24Channel Voice Messages
Control change
The implementation of controller messages was
meant to be open-ended, to allow the creation of
new types of modulation. Many controller numbers
remain undefined. Controller numbers 120-127 are
reserved for another MIDI message type (our next
topic), leaving 120 definable controllers. The
sound parameter affected by a physical controller
may vary from instrument to instrument, or may be
mappable within a particular instrument.
25Channel Voice Messages
Control change
Controllers 64-69 are typically ON/OFF
controllers. Value of 0 OFF Value of 127 ON
Controller Number
Sostenuto (damper) pedal 66 Soft pedal 67
26Channel Voice Messages
Control change
Sometimes more resolution than 0-127 is needed.
27Channel Voice Messages
Control change
Another example addresses the problem of
instruments that have more than 128 patches. Such
an instrument will have a number of banks, with
each bank containing 128 patches. Controller 0
typically defines bank number. A bank select
message (controller 0) followed by a program
change message allows selection of this many
patches ltnumber of banksgt 128