Transcript midix
MIDI
One choice for adding sounds to multimedia
applications is the use of digital audio soundfiles
This can become very memory intensive, however, for large soundfiles
For example, a stereo 16 bit/sample 22 kHz soundfile requires > 5
mbytes per minute of audio
May be too much (e.g. for ringtones on a cellphone)
As an alternative to the use of soundfiles, MIDI
files have been considered
MIDI
MIDI (Musical Instrument Digital Interface) is a
standardized control language and hardware
specification
allows suitably equipped electronic musical instruments and devices to
communicate real-time and nonreal-time performance and control data
MIDI data is communicated digitally through a
production system as a string of MIDI messages
Each message describes an event which occurs
during a musical performance
MIDI
The messages are transformed into the sound
described by the message/event by a synthesizer.
MIDI can be created using a MIDI-editing
program or they can be recorded from a
performance on a MIDI-capable device (a MIDI
controller) and subsequently edited using the
same program.
MIDI data can easily be converted into sample
data, but the reverse is not true.
MIDI
MIDI messages are transmitted (in a serial
fashion) through a single MIDI line at 31.25 K
bits/second
MIDI communication is unidirectional
No error detection/correction (so max cable length of 50 meters)
Usually, MIDI instruments and devices are linked
together in a daisy-chain fashion
The following slide shows an example
MIDI Ports
MIDI devices may have up to 3 ports
MIDI IN port to receive data (to be played
back/synthesized by the device, for example)
MIDI OUT port for MIDI controllers which generate
their own MIDI data
MIDI thru to pass the input data to the next MIDI
device in the daisy chain arrangement
MIDI Devices
MIDI controllers generate performance data in
MIDI format
MIDI synthesizers generate audio output based
on MIDI data
A single keyboard might act as both MIDI controller
and MIDI synthesizer
A synthesizer can be some hardware (instrument) or
a program (soft synth)
MIDI sequencers can be used to receive, store
and edit MIDI data
Either hardware device or an application program
MIDI Sequencers
The sequencer software will typically run on a
Digital Audio Workstation (DAW)
Originally, special purpose microprocessor-based
hardware for capturing, editing, creating music
Today, a computer running special-purpose
software with audio hardware interfaces
Example sequencing software – Cubase
Examples of hardware-based sequencers are
MIDI keyboards and drum machines
These also may contain a synthesizer component
MIDI Sequencers
MIDI data can be used to produce musical scores
corresponding to the data, so sequencing software
is often tightly coupled to musical notation
software
Musical Acoustics and Notation
Musical sounds are characterized by pitch
(frequency), timbre, loudness
A note also carries start and duration info
Two notes which differ in pitch by 2^n, sound alike
to the human ear (except for the higher pitch)
An octave is the interval between one musical pitch
and another with half or double its frequency
The division into notes of an octave differs from
culture to culture
In Western culture, 440 Hz is a reference point and
is called note A
The octave between one note A and another (440880 Hz, e.g.) is divided into 12 notes
Musical Acoustics and Notation
On a keyboard, 8 white notes and 4 black notes
Musical notation is written on a musical staff,
with a key signature
The timbre of a musical sound is a function of its
overtones
The perceived loudness of a musical sound is a
function of the air pressure amplitude
The amplitude envelope covers the period of a
single musical note
Musical Acoustics and Notation
Musical Acoustics and Notation
MIDI Messages
MIDI messages are bytes that are interpreted by
the MIDI devices
The messages can be divided into two types:
The messages are used to convey a series of instructions to one or all of
the MIDI devices within the system.
Channel messages are messages assigned to a specific MIDI channel
System messages address all devices in a system, without regard to
channel assignment
Messages are transmitted in 10-bit bytes
Each begins with start bit of 0 and ends with a stop bit of 1
The start and stop bits are “stripped out” at the serial port, so we are left
with 8-bit bytes of data
MIDI Messages
The following is a typical 3 byte MIDI Note On message:
(10010101) (01000000) (01011010)
This message is interpreted as follows.
The first byte is the status byte while the second and third are data bytes
The most significant bit of the byte determines which type of byte it is
The next three bits of the status byte code the Note On message
The four least significant bits give the channel to which this message is
directed
In the case, channel #5. (Note that we can have up to 16 channels
addressed through a single MIDI cable)
MIDI Channels
MIDI Channel Messages
Whenever a MIDI device is instructed to respond to a
specific channel number, it will ignore any message not
directed to that channel
On the other hand, if a message is transmitted to that channel, the device will
respond to the message (within the device’s capability limits).
The 7 bits (not including the MSB) of the first data byte
code the note # that should be turned on - here, it is 64
The 7 bits of the second data byte indicate the attack
velocity (volume level of the note) - here, it is 90
MIDI Channel Voice Messages
Channel voice messages are used to transmit real-time
performance data throughout a connected MIDI system
There are seven channel voice messages:
Note On
Note Off
Polyphonic Key Pressure
Channel Pressure
Program Change
Control Change
Pitch Bend Change
MIDI Channel Voice Messages
A Note On message indicates the beginnning of a MIDI
note
The message consists of three bytes of information: MIDI
channel number; MIDI note number; Attack velocity
value
In general, MIDI note 60 is assigned to middle C key, and notes 21-108
correspond to the 88 keys of an extended keyboard controller
The final byte indicates the velocity at which the key was
pressed
Higher velocities lead to louder notes
Not all instruments interpret all attack velocities, and some do not respond
dynamically at all
MIDI Channel Voice Messages
A Note Off message indicates the end of a MIDI
note
If the instrument being played has a release (or decay) phase, it will
begin that phase when the message is received
The release velocity byte indicates the speed at which the key was
released
Few instruments generate or respond to release velocity
MIDI Channel Voice Messages
Polyphonic Key Pressure messages are transmitted by
instruments that are capable of playing more than one
sound at a time (e.g. a chord on a keyboard instrument)
The message indicates a pressure message for each key that is depressed
Pressure values can commonly be assigned to such parameters as vibrato,
loudness, and pitch
Channel Pressure messages are commonly transmitted by
polyphonic instruments that will only respond to a single
overall pressure applied to their controllers, regardless of
the number of keys being played at any one time
MIDI Channel Voice Messages
The Program Change message changes the
program or preset number that is active in a
device or instrument
Up to 128 presets can be selected by using this message
This can be used, for example, to switch between the different sounds
of a synthesizer or to change the rhythm patterns of a drum machine
MIDI Channel Voice Messages
The Control Change message transmits information that
relates to real-time control over the performance
parameters of a MIDI instrument
Control change messages correspond to changes in controllers such as foot
pedals, relative balance of a stereo sound field, etc.
Pitch Bend Change messages are transmitted by an
instrument whenever its pitch bend wheel is moved either
in the positive (raise pitch) or negative (lower pitch)
position from its central (no pitch bend) point
Pitch and Mod. Wheels
MIDI Channel Mode Messages
Controller numbers 121-127 are reserved for Channel
Mode messages. These include:
Reset all controllers
Local control
All Notes Off
MIDI Mode messages
General MIDI
The basic instrument sounds that are reproduced by
almost any electronic music setup will invariably change
from one setup to the next
This lack of conformity has brought about a single set of
standardized MIDI patch settings that have come to be
known as General MIDI (1991)
This standardized series of sound settings has been defined so that common and
popular instrument sounds are mapped to various program change numbers
General MIDI
Other standards followed
General MIDI Level 2 (GM2) released in 1999
increases polyphony to 32 voices, standardizes
controller numbers and system messages, etc.
while maintaining backwards compatibility with GM
GM2 also incorporates MIDI Tuning Standard (MTS)
from 1992 which allows for alternate (non-Western)
tunings to be specified
MIDI Time Code (MTC) embeds SMPTE timecode
timing information in a sequence of MIDI messages
General MIDI
Program #
1-8
9-16
17-24
25-32
33-40
41-48
49-56
57-64
65-72
Instrument Group
Piano
Chromatic Percussion
Organ
Guitar
Bass
Strings
Ensemble
Brass
Reed
General MIDI
Program #
73-80
81-88
89-96
97-104
105-112
113-120
121-128
Instrument Group
Pipe
Synth Lead
Synth Pad
Synth Effects
Ethnic
Percussive
Sound Effects
Playback of MIDI
Sampled sounds are played back by converting
the samples to an analog voltage which can be
used to drive speakers
Done in CD players, MP3 players and sound cards
Playback of MIDI
For MIDI files, the sound must be built up or
synthesized
Two methods for synthesizing sounds are frequency
modulation (FM) synthesis and wavetable synthesis
FM synthesis modulates sinusoidal frequencies
An amplitude envelope function is used
Fairly inexpensive
Wavetable synthesis makes use of stored sound
samples of real instruments
More realistic, but more expensive due to the need
for memory to store the samples
Alternative MIDI Uses
Besides being used for musical performance,
MIDI messages can also be used for non-musical
apps, as long as sender and receiver agree on the
meaning of MIDI messages
Some of the alternative uses of MIDI include
(note that timing is important in each)
Show control
Theatre lighting
Special effects
Etc.
MIDI Future
Alternative transportation mechanisms for MIDI
are being explored
MIDI on ethernet
MIDI over RTP/IP
MIDI over wireless
HD Protocol under discussion allows
Higher speed transport
Device discovery and enumeration
Increased numbers of channels and controllers
New kinds of events
Etc.