1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I -...

18
Introduction to Computer Introduction to Computer Audio Audio 1 1 CMSCDHN1114/CMSCD1011 CMSCDHN1114/CMSCD1011 Introduction to Computer Introduction to Computer Audio 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/staf f/cmsdengl/ Teaching/cmscd1011.htm Email: [email protected]

Transcript of 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I -...

Page 1: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

11

CMSCDHN1114/CMSCD1011 CMSCDHN1114/CMSCD1011 Introduction to Computer AudioIntroduction to Computer Audio

Lecture 6: The MIDI standard(Part I - Protocols)

Dr David EnglandSchool of Computing and Mathematical Sciences

http://java.cms.livjm.ac.uk/homepage/staff/cmsdengl/

Teaching/cmscd1011.htmEmail: [email protected]

Page 2: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

22

In this session...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)

Page 3: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

33

What is MIDI?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

Page 4: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

44

Uses for MIDIUses 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.

Page 5: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

55

The MIDI interfaceThe 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

MASTER controller SLAVE

OUT IN

Page 6: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

66

MIDI channelsMIDI 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

Page 7: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

77

Connecting MIDI devicesConnecting MIDI devices

OUTIN THRU

INTHRUIN

MASTER controller

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.

Page 8: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

88

MIDI transmissionMIDI 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

Page 9: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

99

MIDI messagesMIDI 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

Page 10: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

1010

Channel voice messagesChannel 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)

Page 11: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

1111

Channel mode messagesChannel 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

Page 12: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

1212

System messagesSystem messages

• System messages allow you send system specific messages to connected devices

• These include:– System Exclusive data (this allows you to send

non-MIDI information to a device)– Sequencer commands

• Song Select, Song Start, Song Stop, Song Continue

– Active sensing– System reset

Page 13: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

1313

Note eventsNote 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

Page 14: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

1414

Status and data bytesStatus 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

10010000 01000000 01010000

Status byte

Note On Event Channel 1(0 - 15 = 1 - 16)

Key value64

Velocity value80

Data byte Data byte

Page 15: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

1515

Running statusRunning 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

Page 16: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

1616

General MIDIGeneral 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

Page 17: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

1717

SummarySummary

• 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!

Page 18: 1 CMSCDHN1114/CMSCD1011 Introduction to Computer Audio Lecture 6: The MIDI standard (Part I - Protocols) Dr David England School of Computing and Mathematical.

Introduction to Computer Introduction to Computer AudioAudio

1818

Next lecture...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