PPT Format - java.cms.livjm.ac.uk

Download Report

Transcript PPT Format - java.cms.livjm.ac.uk

CMSCDHN1114/CMSCD1011
Introduction to Computer
Audio
Lecture 6: The MIDI standard
(Part I - Protocols)
Dr David England
School of Computing and Mathematical Sciences
http://java.cms.livjm.ac.uk/homepage/staff/cmsdengl/
Teaching/cmscd1011.htm
Email: [email protected]
Introduction to Computer Audio
1
In this session...
• What is MIDI?
• The MIDI standard
– channels, events and messages
• General MIDI
• Note about Tutorials
– You must attempt the built-in tutorials for Cakewalk as
advised by email (1st March)
Introduction to Computer Audio
2
What is MIDI?
• MIDI is an acronym for Musical Instrument Digital
Interface
– It was created in 1983 as a means for the real-time
control of music devices
• MIDI is used to capture the performance aspects
of music as opposed the actual digital audio
• MIDI does not explicitly encode the sound timbre
• The MIDI standard specifies a set of performance
commands that can be sent to MIDI devices which
then synthesise the original performance
– The receiving device decides how to reproduce it
Introduction to Computer Audio
3
Uses for MIDI
• The use of MIDI to supplement digital audio is now
widespread in multimedia applications and
computer games
– Most games use MIDI for background music
– The Sony PlayStation™ also uses MIDI for some music
• This is thanks in part to affordable, good quality
wavetable synthesisers in modern soundcards
• MIDI files are extremely small (compared to raw
digital audio) and therefore offer the multimedia
developer additional benefits
– Savings in storage space, network transmission time, etc.
Introduction to Computer Audio
4
The MIDI interface
• MIDI devices generally include three connectors
– IN, OUT and THRU
• To control one device (the SLAVE) from another
(the MASTER) you would connect the OUT from
the MASTER to the IN of the SLAVE
OUT
MASTER controller
Introduction to Computer Audio
IN
SLAVE
5
MIDI channels
• Although there is only one physical OUT connector,
MIDI information can be transmitted on any of 16
logical channels
• The master can usually transmit (TX) on any of the
16 channels while slaves are set to receive (RX) on
one or more of these channels
– A device that can receive and play on more than one
channel is known as a multitimbral device
– In the previous slide, if the keyboard is set to transmit on
channel 10 and the drum machine is set to receive on
channel 10, the keyboard can be used to control the
drum machine
Introduction to Computer Audio
6
Connecting MIDI devices
THRU
IN
OUT
MASTER controller
IN
THRU
IN
The THRU port can be used to pass all messages through the device. Any
devices later in the chain will then also pick up those messages.
Introduction to Computer Audio
7
MIDI transmission
• MIDI is a serial protocol (its messages are sent
as a series of individual bits)
• Information is sent in 10-bit packets (words) made
up of:
– A start bit (whose value is always zero)
– 8 bits of data (the contents)
– A stop bit (whose value is always one)
• One or more words comprise a MIDI message
• The start and stop bits are only needed for
communication purposes and are stripped off by
the actual device
Introduction to Computer Audio
8
MIDI messages
• At the highest level, MIDI messages are classified
as being either:
– Channel Messages (they apply to a specific channel)
– System Messages (they apply to the system as a
whole and not to a channel)
– Channel messages can be further split into:
• Channel Voice Messages (these carry musical performance
data)
• Channel Mode Messages (these affect the way a receiving
instrument will respond to the channel voice messages)
• Every MIDI message is preceded by a status
byte to show what type it is
Introduction to Computer Audio
9
Channel voice messages
• The channel voice messages are:
– Note Events (Note On, Note Off)
– Program Changes (changing the sound used to play a
particular piece)
– Controller Changes (various controllers such as
Volume, Pan, Foot controller, Modulation, etc)
– Pitch Bend (bending notes up or down)
– Channel and Polyphonic Aftertouch (pressing further
down on a key after it has been pressed)
Introduction to Computer Audio
10
Channel mode messages
• Channel mode messages are used to tell an
instrument how to respond to voice messages
• These messages are:
–
–
–
–
–
Turn all sound off
Turn all notes off
Reset all controllers (sliders, etc)
Local control on and off
Omni modes:
• This controls how the device responds to multichannel data
Introduction to Computer Audio
11
System messages
• System messages allow you send system specific
messages to connected devices
• These include:
– System Exclusive data (this allows you to send nonMIDI information to a device)
– Sequencer commands
• Song Select, Song Start, Song Stop, Song Continue
– Active sensing
– System reset
Introduction to Computer Audio
12
Note events
• Every note event (both Note On and Note Off)
specifies what note was played and what
velocity it was played at
• Note pitch values are stored in 7 bits, therefore
there are 27 = 128 possible notes
– C0 is note 0 (8.17 Hz)
– C5 (known as middle C) is note 60 (261.63 Hz)
• The velocity is how hard you hit the key and again
is a 7-bit value (i.e. it has the range 0 - 127)
• Every note on should have a corresponding note
off event
13
Introduction to Computer Audio
Status and data bytes
• The stream of MIDI data is divided into two types
of bytes: status bytes and data bytes
– A status byte has a 1 in the leftmost bit
– A data byte has a 0 in the leftmost bit
• The status byte can be split into two nibbles
– A nibble is four bits
Status byte
Data byte
Data byte
10010000 01000000 01010000
Note On Event
Channel 1
(0 - 15 = 1 - 16)
Key value
64
Introduction to Computer Audio
Velocity value
80
14
Running status
• Having to send 3 bytes for every note event can
consume a lot of the MIDI bandwidth in very dense
musical passages (more on this next week)
• Running status is a technique that can be used to
reduce this overhead
– Under running status, if the next event is the same type
as the previous event, it will not send the status byte
again
• This causes problems since every note on has a note off event
which has a different status byte
• This can be overcome by sending a note on with a velocity of
zero (silence) instead of a note off thereby ensuring that the
running status value is maintained
Introduction to Computer Audio
15
General MIDI
• The General MIDI Specification (which was
created well after the birth of MIDI) specifies the
relationship between program numbers and
actual sound timbres
– A program change message can be sent on any channel
to tell the MIDI device which instrument to use
• It specifies:
– Sound timbre groups, names and number
– Channel allocations
• Channels 1 - 9 and 11 - 16 are for chromatic sounds
• Channel 10 is for drum and percussion sounds
Introduction to Computer Audio
16
Summary
• MIDI is used to capture musical performances
• MIDI devices are responsible for generating the
actual sound based on the MIDI instructions
– This can lead to wide variations in the actual
performance not unlike real musicians interpreting a
musical score
• The MIDI protocol specifies what messages are to
be understood by MIDI devices and what form
these messages should take
• The handouts for this lecture contain much more
information which you should read for next time!
Introduction to Computer Audio
17
Next lecture...
• We will continue looking at the MIDI standard by
discussing the various types of MIDI hardware that
is available and seeing how to set up MIDI
equipment and instruments
Introduction to Computer Audio
18