AQA 7517, section 4.5.6.8
MIDI (Musical Instrument Digital Interface) is a standard that lets electronic musical instruments, computers and other devices communicate. A MIDI file doesn't contain any sound. It contains instructions about how the music should be played, a bit like sheet music for a machine.
The purpose of MIDI
MIDI was created so that devices such as a keyboard, a synthesiser, a drum machine and a computer can be connected and work together. A key pressed on a MIDI keyboard can make a sound on a different synthesiser, or be recorded on a computer.
Event messages
MIDI sends a stream of event messages. Each message describes something that happens, such as a key being pressed, with a few numbers.
| Message | What it says |
|---|---|
| Note on | A note starts playing |
| Note off | A note stops playing |
| Velocity | How hard a key was pressed, which affects the volume |
| Pitch | Which note, as a number (for example 60 is middle C) |
| Program change | Which instrument sound to use (piano, violin, ...) |
| Channel | Which of 16 instruments or parts the message is for |
| Tempo | How fast the music is |
| Pitch bend, modulation | Changes to the sound while it plays |
Example message: Note on, channel 1, note 60, velocity 100 means "on channel 1, start playing middle C, fairly loud". Later, Note off, channel 1, note 60 ends it.
Each message is just a few bytes, so a whole piece of music takes very little storage.
How MIDI playback works
- The MIDI file (or the live keyboard) sends the event messages.
- A synthesiser (hardware, or software on a computer) receives them.
- The synthesiser generates the sounds from its own instrument sounds.
The sound is created at playback, and not stored in the file.
Advantages of MIDI files
- Very small files. The file stores events, not sound samples. A few minutes of music might be a few kilobytes, compared with several megabytes for sampled audio.
- Easy to edit. You can change individual notes, the tempo, the key, or the instrument without re-recording, and without any loss of quality.
- Changing instrument. The same piece can be played by a piano, then by an orchestra, just by changing the program message.
- Works in both directions. It's easy to connect keyboards and computers, so a performance can be recorded and then displayed as music notation.
- No loss in quality when editing or copying, since only instructions are stored.
Disadvantages
- The sound depends on the synthesiser. The same file may sound different on different devices.
- It can't record real sounds, such as a human voice or natural sounds.
- It needs a synthesiser to play.
MIDI compared with sampled sound
| MIDI | Sampled audio (such as WAV or MP3) | |
|---|---|---|
| Stores | Instructions (events) | The sound wave as samples |
| File size | Tiny | Large |
| Editing notes | Easy | Very hard |
| Voice or real sounds | No | Yes |
| Sound is the same on any device | No | Yes |
Worked example
Task: a game developer wants background music that takes up very little space, and that can change its tempo as the game gets more intense. Why would MIDI be a good choice?
MIDI files are tiny, which matters for a game that has to be downloaded and stored. The music is made of events, so the tempo can be increased by changing one value, without the pitch changing. The developer can also change the instruments to suit different moments. A sampled recording would be much larger and couldn't easily change tempo while keeping the pitch.
Exam tip: state that MIDI stores event messages (such as note on, note off, pitch, velocity and instrument), not sound. For advantages, say that the files are small and that individual notes, tempo and instruments can be edited easily.
Check yourself
What is the purpose of MIDI?
To let electronic musical instruments and computers communicate by sending messages describing how music should be played.
Give two examples of information in a MIDI event message
Any two of: which note to play (pitch); when a note starts or stops; the velocity (how hard it was pressed); which instrument; which channel; the tempo.
Why is a MIDI file much smaller than a recording of the same music?
It stores instructions (events) as a few bytes each, and not the sound waveform as thousands of samples every second.
Give one disadvantage of MIDI
It can't store real recorded sounds such as speech, and the sound depends on the synthesiser used for playback.