MIDI - Computing at Northumbria

Download Report

Transcript MIDI - Computing at Northumbria

School of Informatics
CG087 Time-based Multimedia Assets
MIDI
Introduction to the Musical Instrument
Digital Interface
MIDI
Dr Paul Vickers
1
School of Informatics
CG087 Time-based Multimedia Assets
Happy birthday!
• Well, it’s 20 years old this year
• Sigh. And I can remember the feature on Tomorrow’s World
when I first heard about it…
• Vince Clarke (Depeche Mode, Yazoo, Erasure)
used to have 8 Casio CZ-101s and 1 BBC Model B
Microcomputer connected by UMI-2B MIDI
audio stolen from Mad Jack’s page http://website.lineone.net/~mad.jack/
MIDI
Dr Paul Vickers
2
School of Informatics
CG087 Time-based Multimedia Assets
Myself?
• I had a BBC B and an Acorn Music 500 synth
• It had no keyboard and was programmed using its
own programming language Ample
Music on this page stolen from Colin Fraser’s 500 page
http://www.colinfraser.com/m5000/m5000.htm
MIDI
Dr Paul Vickers
3
School of Informatics
CG087 Time-based Multimedia Assets
Today?
• Roland D-20 (1990) Boss DS-330 (1993)
• Oberheim MC-3000 (2000)
MIDI
Dr Paul Vickers
4
School of Informatics
CG087 Time-based Multimedia Assets
So what is it?
• It’s a communications protocol
• A music description language in binary form.
• Each word describing an action of musical performance is
assigned a specific binary code.
• MIDI was designed for keyboards, so many of the actions
are percussion oriented.
• To sound a note in MIDI language you send a "Note On"
message, and then assign that note a "velocity", which
determines how loud it plays.
• Other MIDI messages include selecting which instrument
to play, mixing and panning sounds, and controlling various
aspects of electronic musical instruments.
MIDI
Dr Paul Vickers
5
School of Informatics
CG087 Time-based Multimedia Assets
History
• Early synths (1970s) were not designed with
interconnectivity in mind.
• Connected via two control ports, one for pitch and
note on/off events, and the other to provide a
timing reference.
– The first consisted of two signals: a variable DC control
voltage (CV), proportional to pitch; and a trigger pulse,
or gate.
– The second port consisted of a pulse train synchronized
with an external clock
MIDI
Dr Paul Vickers
6
School of Informatics
CG087 Time-based Multimedia Assets
Drawbacks of CV
• Only one note at a time could be controlled
– Newer polyphonic instruments suffered
• No agreement over external clock rate
– Special conversion boxes were needed to over- or
under-sample the clock
– Connecting multiple instruments, especially from
different manufacturers was complex and troublesome
MIDI
Dr Paul Vickers
7
School of Informatics
CG087 Time-based Multimedia Assets
Advent of MIDI
• In 1983 Sequential Circuits, Roland Corporation,
and Oberheim Electronics released MIDI 1.0
• MIDI spec. controlled by
– MIDI Manufacturer's Association (MMA)
– Japan MIDI Standards Committee
MIDI
Dr Paul Vickers
8
School of Informatics
CG087 Time-based Multimedia Assets
The specification
• MIDI specifies
– Hardware interface
– Binary control language
– MIDI file format
MIDI
Dr Paul Vickers
9
School of Informatics
CG087 Time-based Multimedia Assets
MIDI hardware
• Bi-directional serial asynchronous link with data
rate of 31,250 bits per second
– 320s to transmit 10 bits (MIDI byte is 8 data bits plus
a start bit and a stop bit = 10 bits)
– In 1s can transmit >3000 bytes
• Requires a 5-pin 180 DIN connector
– Pins 1 & 3 not used
– Pins 4 & 5 carry 5mA current loop
– +5v = binary 0, 0v = binary 1
• Ports have opto-isolation to prevent interference
MIDI
Dr Paul Vickers
10
School of Informatics
CG087 Time-based Multimedia Assets
Electrical specification
• Data converted by
UART
(universal asynchronous
receiver transmitter)
• UART and
microprocessor
communicate
via interrupts and
buffers
MIDI
Dr Paul Vickers
11
School of Informatics
CG087 Time-based Multimedia Assets
Port requirements
• A MIDI device must have
– MIDI-IN and MIDI-OUT
– Optionally MIDI-THRU
• Thru port transmits a copy of data received on the IN port
MIDI
Dr Paul Vickers
12
School of Informatics
CG087 Time-based Multimedia Assets
Connections 1 - synth to computer
From http://www.midipage.nl/uk_midi_aansl_1.html
MIDI
Dr Paul Vickers
13
School of Informatics
CG087 Time-based Multimedia Assets
Connections 2 - more complex
• Daisy chain links shouldn’t exceed 3 devices due
to transmission delays
MIDI
Dr Paul Vickers
14
School of Informatics
CG087 Time-based Multimedia Assets
Connections 3 – star network
MIDI
Dr Paul Vickers
15
School of Informatics
CG087 Time-based Multimedia Assets
MIDI bytes
• Two types of information
– Status
– Data
• Status messages generally indicate actions (e.g.
pressing a key on the synth)
• Data bytes supply the information for the status
byte (e.g. velocity of key press)
MIDI
Dr Paul Vickers
16
School of Informatics
CG087 Time-based Multimedia Assets
MIDI message
• A MIDI message has one status byte followed by
0..n data bytes
• Status and data bytes are differentiated by bit 7
Status
Data
1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0
0/1
0/1
0/1
0/1
0/1
0/1
0/1
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
• Thus MIDI values go from 0..127 (27)
MIDI
Dr Paul Vickers
17
School of Informatics
CG087 Time-based Multimedia Assets
Channels
• If > 1 device connected, which one should
respond to the messages?
• Messages are assigned to channels (16)
• Devices set to respond to particular channels
• Every message (except system messages) have a
channel number which is stored in bits 0..3 of the
Channel (11)
status byte Status Message type
1
Bit 7
MIDI
x
x
x
1
0
1
1
Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Dr Paul Vickers
18
School of Informatics
CG087 Time-based Multimedia Assets
7 status messages
•
•
•
•
•
•
•
•
MIDI
000 – Note off
001 – Note on
010 – Polyphonic key pressure
011 – Control change
100 – Program change
101 – Channel pressure (aftertouch)
110 – Pitch bend
Note on for channel 3 = 1 001 0010
Dr Paul Vickers
19
School of Informatics
CG087 Time-based Multimedia Assets
Example message
• Note on uses 3 bytes
– Status byte
– Data byte for note number
– Data byte for velocity
• So, middle C (midi note no. 60) at medium volume
(velocity 64) on channel 3 would be:
– 10010011 (note on, channel 3)
– 00111100 (data byte, value 60)
– 01000000 (data byte, value 64)
MIDI
Dr Paul Vickers
20
School of Informatics
CG087 Time-based Multimedia Assets
Other messages
• Other messages allow you
– to select another timbre on the synthesiser (program
change)
– Add pitch bend
– Add sustain
– Change volume
– Etc.
MIDI
Dr Paul Vickers
21
School of Informatics
CG087 Time-based Multimedia Assets
Not a sound format
• As it’s only a control language, it’s not a sound
format
• MIDI merely allows devices to speak the same
language
• A MIDI file is a sequence of note-on note-off
messages to instruct a tone generator to play
music
• The sound quality is totally depended on the
quality of the synthesiser playing the file
MIDI
Dr Paul Vickers
22
School of Informatics
CG087 Time-based Multimedia Assets
MIDI files
• Standard MIDI files (SMF) is a specification for
storing MIDI data
• 3 types: 0, 1, and 2 which just differ in the way
the data are stored
• MIDI files can be played by Windows Media Player
(and others) and can be loaded and edited by
MIDI sequencing software (word processors for
MIDI!), e.g. Digital Orchestrator Pro
• MIDI files don’t contain sound
MIDI
Dr Paul Vickers
23
School of Informatics
CG087 Time-based Multimedia Assets
Input & control
• MIDI input normally comes from a MIDI-equipped
instrument
–
–
–
–
–
Synthesiser/digital piano, etc.
Guitar with MIDI converter
Wind instrument converters (yes)
CV-MIDI boxes for old synths
Even voice-MIDI converters
• Or from MIDI files
• Or you create MIDI data using special sequencer
programs
MIDI
Dr Paul Vickers
24
School of Informatics
CG087 Time-based Multimedia Assets
MIDI sequencing
• Sequencers originally were hardware devices that
allowed you to store sequences of control voltages
to control CV synthesisers
• Sequences were normally notes, but could be filter
settings, gate controls, etc
• Then MIDI hardware sequencers were developed
• At the same time, people wrote software
sequencers for Atari ST, Sinclair Spectrum, BBC
Micro, Commodore Amiga
MIDI
Dr Paul Vickers
25
School of Informatics
CG087 Time-based Multimedia Assets
MIDI sequencers
• Cubase and Cakewalk are the two most wellknown and long serving programs
• Professional studios now use
–
–
–
–
MIDI
ProTools (www.digidesign.com)
Cubase (www.steinberg.net)
Logic (www.emagic.de)
Reason (www.propellerhead.se)
Dr Paul Vickers
26
School of Informatics
CG087 Time-based Multimedia Assets
Sequencers
• A sequencer
– Allows you to compose and store sequences of MIDI
data to create songs
– Organises the data in tracks (like on a multi-track tape
recorder)
– Has rich editing facilities (like a word processor)
– Often prints music scores too
• Current sequencers now let you mix audio with
the MIDI data (see next week)
MIDI
Dr Paul Vickers
27
School of Informatics
CG087 Time-based Multimedia Assets
Limitations of MIDI
• Not sufficient for music scoring
• Assumes a 12-tone chromatic framework
– What about just intonation?
– Micro tuning?
– Enharmonic distinctions (e.g. F sharp vs. G flat)
• No way to represent performance dynamics
– E.g. crescendo, diminuendo, etc.
• Slow serial ports
• 16 channel limit
MIDI
Dr Paul Vickers
28
School of Informatics
CG087 Time-based Multimedia Assets
Things to do with MIDI
•
•
•
•
Control one synth from another
Write and store music (sequencing)
Write your own MIDI programs
Sonify your own web pages (really!)
– See www.beatnik.com
• Combine MIDI with audio
• Control effects boxes and light shows
– Yes, you can do this. My reverb unit accepts MIDI
controls so my synth can turn on the unit’s echo
MIDI
Dr Paul Vickers
29
School of Informatics
CG087 Time-based Multimedia Assets
Web sites
•
•
•
•
www.midi.org (MIDI manufacturers’ association)
www.midi.com
www.beatnik.com
Do some programming in CSound
– Boulanger, R., Ed. (2000). The CSound Book:
Perspectives in Software Synthesis, Sound Design,
Signal Processing, and Programming. London: The MIT
Press
• http://www.csounds.com/
• http://music.dartmouth.edu/~dupras/wCsound/csoundpage.html
MIDI
Dr Paul Vickers
30
School of Informatics
CG087 Time-based Multimedia Assets
More reading
• Braut, C. (1994). The Musician's Guide to MIDI Sybex.
ISBN 0-7821-1285-4.
• Roads, C., Ed. (1998). The Computer Music Tutorial.
Cambridge, Massachusetts: MIT Press. ISBN 0-26268082-3.
• Kientzle, T. (1997). A Programmer's Guide to Sound.
Reading, Massachusetts: Addison-Wesley. ISBN 0-20141972-6.
• Selfridge-Field, E., Ed. (1997). Beyond MIDI: The
Handbook of Musical Codes. Cambridge, Massachusetts:
MIT Press. ISBN 0-262-19394-9.
MIDI
Dr Paul Vickers
31