GCSE Link: 3.07 (Sound)
We have already learned about how sound waves can be sampled at regular intervals and stored in binary at GCSE, but now we will extend that knowledge on this page.
The Nyquist-Shannon theorem states that the sample rate of an audio file must be at least twice the maximum frequency of the original sound wave to accurately reproduce it.
Human hearing is limited to around 20kHz, so most audio files use a sampling rate of 44.1kHz, which is slightly higher than the minimum sample rate of 40kHz required by the Nyquist-Shannon theorem.
Everything you have learned about audio so far relates to digital audio, where sound is sampled
and not stored accurately. However, there is an alternative form of audio representation that we
will now learn about.
A Musical Instrument Digital Interface (MIDI) file stores instructions for how to play a piece of music instead of sampling the audio.
Think of a MIDI file like sheet music: it can tell the computer how to play a piece of music instead of actually playing the piece of music.
MIDI files contain event messages, which control the synthesiser that produces the sound. These event messages include information such as which instrument should play a note, when the note should be played, the pitch, volume, and duration of a note, and control data like the BPM of the song.
What are the advantages and disadvantages of using MIDI files over digital audio files?
MIDI files are easily editable: if you want to change just one note in the song you can just change
a single instruction; whereas with a digital audio file you would need to re-record the whole piece.
Also, the file sizes of MIDI files can be a lot smaller than their equivalents in digital audio.
However, with a MIDI file, the output audio depends entirely on the synthesiser being used to play
the music, so the song could sound vastly different on a different setup; whereas with a digital
audio file it will sound almost exactly the same on any setup.