CoursesAIMathCodePhysicsAbout and FAQ

TwiddleLab / Code / How Computers Store Everything

Sound Is a List of Numbers

Lesson 5 of 11 · 7 min · Free, no account needed

What you will learn

  • A microphone turns sound into a wave; a computer samples it: measures its height again and again.
  • Sample rate: how many measurements per second. A CD takes 44 100.
  • Bit depth: how many levels one measurement can have. 16 bits give 65 536.
  • Size = samples per second x bytes per sample x channels x seconds.

Start the lesson

How the lesson goes

  1. A microphone hears a wave of air. A phone can only store numbers.

    One of these is the real sound, the other went through a cheap recorder. Play both. Which is the original?

  2. Be the recorder: measure the wave.

    Tap the wave in at least 8 places. Each stick turns its height into one number.

  3. How many measurements make it sound real?

    Turn up the samples per wave until the copy is at least 95% alike.

  4. Samples, rate and depth.

    A sample is one measurement of the wave's height: one number.

    The sample rate is how many samples per second. A CD uses 44 100. Too few and the sound turns robotic.

    The bit depth is how many levels one sample can choose from. A CD uses 16 bits: 65 536 levels.

  5. A cheap recorder has only 3 bits: 8 levels.

    Drag each stick top to the nearest level. The orange strip shows the error you are forced to add.

  6. A CD takes 44 100 samples every second. How many in one minute?

    Drag the marker on the scale. Each step of the scale is 10 times more.

  7. Tune the whistle: match each target pitch.

    A higher note is a wave that repeats more often. Lay your blue wave on the dashed one, then Lock in.

  8. Play back your own numbers.

    These are the measurements you took. A speaker turns them back into sound.

  9. One minute of CD music: 44 100 samples a second, 2 bytes each, 2 ears. About how many MB?

    1 MB = 1 000 000 bytes. Round to one decimal.

  10. Back to the two sounds. Now you can see them.

    Play them again and tap the robot.

Previous lesson: Pixels and Colors · Next lesson: Squeezing Without Losing · Part of the course: How Computers Store Everything

Lessons are interactive and need JavaScript. Turn it on to play them.

Loading TwiddleLab