Introduction: Sound in the Digital World

Have you ever wondered how your favorite song travels from a recording studio into your smartphone and then out through your headphones? Real-world sound is messy, curvy, and continuous, but computers can only understand 1s and 0s. In this chapter, we are going to learn how we "capture" the air vibrations of sound and turn them into data. Don't worry if this seems a bit technical at first—once you see the patterns, it becomes as simple as taking a series of snapshots!

1. Analogue vs. Digital Quantities

Before we look at the tech, we need to understand the difference between the "real world" and the "computer world."

Analogue Data: In the real world, sound is an analogue quantity. This means it is continuous. Imagine a slide at a playground—you can be at any height at any time. There are no "steps." Analogue sound waves vary continuously in frequency and amplitude.

Digital Data: Computers are digital. Digital data is discrete (it consists of separate, distinct values). Imagine a set of stairs. You are either on one step or the next; you can't really be "between" steps in a way the computer understands.

Analogy: Think of a dimmer switch for a light (analogue) vs. a standard On/Off switch (digital). The dimmer has infinite positions, while the digital switch has specific, set states.

2. The Conversion Process: ADC and DAC

To get sound into a computer and back out again, we need two very important "translators":

Recording Sound (Analogue to Digital):
1. A microphone captures sound waves and turns them into an analogue electrical signal.
2. This signal is sent to an Analogue-to-Digital Converter (ADC).
3. The ADC "samples" (measures) the voltage of the signal at regular intervals.
4. These measurements are converted into binary numbers and stored.

Playing Sound (Digital to Analogue):
1. The computer reads the binary data from the file.
2. The binary numbers are sent to a Digital-to-Analogue Converter (DAC).
3. The DAC converts these numbers back into an analogue electrical signal.
4. This signal is sent to a speaker, which vibrates the air to recreate the sound.

Key Takeaway: An ADC turns sound into numbers so the computer can store it; a DAC turns numbers back into sound so we can hear it.

3. Digital Representation: How we measure sound

When we convert sound, there are two main "settings" that determine the quality of the recording: Sampling Rate and Sample Resolution.

A. Sampling Rate

The Sampling Rate is the number of samples (measurements) taken per second. This is measured in Hertz (Hz).
1 Hertz = 1 sample per second.
If a song is recorded at 44,100 Hz (standard CD quality), it means the computer took 44,100 measurements every single second!

Did you know? A higher sampling rate means the digital wave looks more like the original analogue wave, making the sound clearer and more accurate.

B. Sample Resolution

The Sample Resolution (sometimes called bit depth) is the number of bits used to store each sample.
• If we use more bits, we can have a larger range of numbers to choose from.
• A larger range means we can record the "height" of the sound wave much more accurately.

Quick Review: The "Camera" Analogy
Think of recording sound like taking a video with a camera:
Sampling Rate is the frame rate (how many pictures per second).
Sample Resolution is the number of colors/pixels in each picture (how much detail in each measurement).

4. Calculating Sound File Size

Calculating the size of a sound file is a very common exam task. Here is the magic formula you need to remember:

\( \text{File size (bits)} = \text{Sampling Rate (Hz)} \times \text{Sample Resolution (bits)} \times \text{Duration (seconds)} \)

Step-by-Step Example:
Calculate the size of a 10-second recording with a sampling rate of 100 Hz and a resolution of 8 bits.
1. Rate: 100
2. Resolution: 8
3. Seconds: 10
4. Calculation: \( 100 \times 8 \times 10 = 8000 \text{ bits} \).
5. To get bytes: \( 8000 / 8 = 1000 \text{ bytes (or 1 KB)} \).

Common Mistake to Avoid: Always check your units! If the question asks for the answer in bytes, remember to divide your final answer (in bits) by 8.

5. Nyquist’s Theorem

You might think, "Why not just sample 1 million times a second?" While that would be high quality, it creates massive files. Nyquist’s Theorem gives us a rule for the perfect minimum sampling rate.

The theorem states: To represent a sound accurately, the sampling rate must be at least twice the highest frequency of the sound.

Example:
If the highest frequency in a sound is 15,000 Hz, what is the minimum sampling rate needed?
Calculation: \( 15,000 \times 2 = 30,000 \text{ Hz} \).

Why does this matter? If we don't sample at least twice the frequency, we might miss the peaks and troughs of the sound wave, causing the digital version to sound distorted or completely different from the original.

Summary Checklist

Analogue is continuous; Digital is discrete (1s and 0s).
ADC is used for recording; DAC is used for playback.
Sampling Rate is how many samples per second (Hz).
Sample Resolution is how many bits per sample.
Nyquist's Theorem: Sample at 2x the highest frequency!
Formula: \( \text{Size} = \text{Rate} \times \text{Res} \times \text{Secs} \).