Sound & Digital Audio: Sampling, Nyquist Theorem & MIDI
Idea in plain words
Sound Waves: Analog continuous longitudinal pressure waves characterized by Frequency (pitch in Hz) and Amplitude (loudness in dB).
Exam tip
High-yield exam topic (Very High).
Explanation
Digitizing sound involves two steps: Sampling (discretizing continuous time) and Quantization (discretizing continuous amplitude into discrete binary levels). Undersampling results in aliasing, where high-frequency sounds fold into false low-frequency distortion (prevented using analog anti-aliasing low-pass filters). MIDI represents music as compact performance instructions (typically 1-3 bytes per event), requiring minuscule storage compared to raw digital audio waveforms.
Key points
- Nyquist-Shannon Sampling Theorem: An analog signal can be perfectly reconstructed from digital samples if the sampling rate f_s is strictly greater than twice the highest frequency f_max: f_s > 2 * f_max.
- CD Quality Audio Standard: 44.1 kHz sampling rate (covers human audible range 20 Hz - 20 kHz), 16-bit linear quantization, 2 channels (stereo).
- Bitrate Formula: Bitrate (bps) = Sampling Rate (Hz) * Bit Depth (bits) * Number of Channels.
- Quantization Error & Signal-to-Noise Ratio (SNR): SNR approx 6.02 * n + 1.76 dB (where n is the number of quantization bits).
- Musical Instrument Digital Interface (MIDI): Symbolic control protocol transmitting musical events (Note On, Note Off, Pitch, Velocity) rather than sampled waveforms.
Example
Example
Telephone audio uses 8 kHz sampling rate and 8-bit companding (u-law or A-law), sufficient for capturing human speech up to 3.4 kHz with a bitrate of 64 kbps.
Code examples
/*
Digital Audio Bitrate Calculation:
For CD-Audio:
Sampling Rate = 44,100 Hz
Bit Depth = 16 bits per sample
Channels = 2 (Stereo)
Bitrate = 44,100 * 16 * 2 = 1,411,200 bits/sec (1.411 Mbps)
Data size for 1 minute:
Size = (1,411,200 bps * 60 sec) / (8 * 1024 * 1024) approx 10.09 MB
*/
Exam questions
- [8 Marks] State and explain the Nyquist-Shannon Sampling Theorem. Calculate the bitrate and file size of a 3-minute stereo CD audio recording.
- [6 Marks] Compare digitized digital audio (e.g., PCM WAV) with Musical Instrument Digital Interface (MIDI) across file size, editability, and hardware dependence.