AP® Computer Science Principles · Big Idea 2 · Topic 2.1
Analog Data, Sampling, and Digital Approximation
A computer can't store a smooth, continuous wave, so it measures the wave's height at regular time intervals and keeps only those numbers. That list of numbers is the digital approximation of the original signal.
The real world is analog: sound, light, and motion vary smoothly, with infinitely many values between any two points. A computer can only store a finite list of numbers, so it has to chop that smoothness into pieces. Sampling is the process of measuring the wave's value at evenly spaced moments in time and recording each measurement as a number. String those numbers together in order and you get a digital approximation of the original wave.
How closely the approximation matches reality depends on the sampling rate, how many samples get taken per second. Sample often and the recorded points trace the wave's shape closely, so rebuilding it produces something very close to the original. Sample rarely and the points miss the wave's fast wiggles entirely, so the rebuilt wave can look like a completely different, slower wave than the one that was actually recorded. Picture a wave sampled 8 times per cycle versus the same wave sampled only 2 times per cycle: the 8-sample version clearly traces the rise and fall, while the 2-sample version barely hints at a shape and could be mistaken for something else.
This same logic extends to images. A digital photo is really a grid of sampled light measurements, called pixels, taken at fixed spots across a scene. Zooming into the photo doesn't let you see finer real-world detail, because no measurement was ever taken there. It just enlarges the existing samples into bigger blocks. Sampling connects directly to compression and file size, later topics, since more samples per second or per inch means more accuracy but also more data to store.
Key terms
- Analog data
- Information that varies continuously, with no gaps, like a smooth sound wave or a ramp of light intensity.
- Sampling
- Measuring the value of an analog signal at regular intervals and recording each measurement as a number.
- Sampling rate
- The number of samples taken per second, usually measured in hertz.
- Digital approximation
- The finite list of sampled numbers that stands in for a continuous analog signal, close but never perfectly exact.
- Pixel
- One sampled measurement of light or color at a fixed point in a digital image.
Watch it explained
- How it worksHow does measuring a wave at regular intervals turn a continuous signal into a list of numbers?
- How it worksWalk me through rebuilding a sound wave from its samples and seeing exactly where it differs.
- Worked exampleShow me one wave sampled at 8 points per cycle and the same wave sampled at 2 points per cycle.
- Common mistakeWhy doesn't zooming into a digital photo reveal detail that its samples never actually captured?
- Going furtherWhat happens to a recording when the sampling rate is too low to follow the fastest wiggle?
Check yourself
End of topic.