Why this matters
Sound, photos, and video all start as smooth analog signals, yet they end up as files made of 0s and 1s. The same three-step idea turns each of them digital, and the same simple multiplication tells you how big the file will be. Compression is then what makes those files small enough to stream and share.
The idea
Digitizing follows three steps: sampling (read the value at regular intervals), quantization (round each value to the nearest level on a scale), and encoding (write the levels in binary). For sound this whole process is called PCM. Higher sampling frequency and more quantization levels give quality closer to the original, but more data too.
Data sizes come from simple formulas:
- Sound (bits per second) = sampling frequency × quantization bit depth × number of channels.
- Image (bits) = number of pixels (width × height) × bits of color per pixel.
- Video (bytes) = image data per frame × frame rate × seconds.
Images are built from pixels; resolution is how finely they are divided. A 24-bit full color pixel uses 8 bits each for red, green, and blue. Video is just many still frames shown fast; the frame rate (fps) controls smoothness and size.
Compression shrinks files. Lossless compression can be reversed perfectly (good for text and programs). For example, run-length encoding rewrites "AAAAA" as "A5". Lossy compression drops detail humans barely notice and cannot be undone (good for audio, images, video). The compression ratio = compressed size ÷ original size × 100%.
Picture it
flowchart LR An[Analog signal] --> S[1. Sampling] S --> Q[2. Quantization] Q --> E[3. Encoding to binary] E --> F[Digital file] F --> C[Compression: lossless or lossy]
Worked example
Find the size of 1 second of CD-quality stereo audio: sampling frequency 44,100 Hz, 16-bit depth, 2 channels. Bits per second = 44,100 × 16 × 2 = 1,411,200 bits. Divide by 8 to get bytes: 176,400 B, which is about 176 KB (using 1 KB = 1,000 B).
Now compression. A 90 MB video is compressed to 30 MB. Compression ratio = 30 ÷ 90 × 100 ≈ 33%. And run-length encoding "AAAAABBAAAABBBBBBBBAAAAAA" (25 characters) becomes "A5B2A4B8A6" (10 characters), a ratio of 10 ÷ 25 × 100 = 40%.
Your turn
Try the practice: put the digitizing steps in the right order, sort examples as lossless vs lossy compression, and match each term (pixel, frame rate, sampling) to its meaning.
Recap
- Digitize anything with sampling → quantization → encoding (sound = PCM).
- Sizes: sound = freq × depth × channels; image = pixels × color bits; video = frame × fps × time.
- Lossless reverses perfectly (text); lossy drops unnoticed detail (media). Ratio = after ÷ before.