HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
Text, Sound and Images in Binary
  1. 1Text and character sets
  2. 2Sound: sample rate and sample resolution
  3. 3Images: resolution and colour depth
  1. Computer Science
  2. /Text, Sound and Images in Binary
  3. /Sound: sample rate and sample resolution

Course 1.2·Lesson 2 of 3

Sound: sample rate and sample resolution

Sound is a smooth wave, but a computer can only store numbers. It measures the wave many times a second and stores each measurement in binary. You learn what the sample rate and the sample resolution are, and how they change the accuracy and the size of a recording.

about 25 min1 simulation1 practice question
Lesson 2 of 3Show all lessonsHide
Text, Sound and Images in Binary
  1. 1Text and character sets
  2. 2Sound: sample rate and sample resolution
  3. 3Images: resolution and colour depth

Try the code and the simulations beside the lesson.

From a wave to numbers

When you speak, the air vibrates. A microphone turns the vibration into a smoothly changing signal: a sound wave. The height of the wave at any moment is its amplitude.

A computer cannot store a smooth curve. To convert sound into binary, the computer samples the wave. It measures the amplitude at regular moments, and stores each measurement as a binary number. The computer then processes these numbers.

A grey sound wave, one full cycle of a sine curve, drawn against time. Eight equally spaced dots mark the samples. Horizontal grid lines mark the 8 levels of a 3-bit sample, numbered 0 to 7 on the left. Each dot is rounded to the nearest level, and the levels of the samples are 4, 6, 7, 6, 4, 1, 0 and 1, with the 3-bit code of each written under it.

In the picture, the grey curve is the wave. The dots are the samples. Each sample is rounded to the nearest level, and the level is stored in binary. With 3 bits there are 23=82^3 = 823=8 levels, numbered 0 to 7.

Sample rate

The sample rate is the number of samples taken in one second. It is measured in hertz (Hz), where 1 hertz is one sample a second.

  • A higher sample rate measures the wave more often. The stored sound follows the real wave more closely, so the recording is more accurate.
  • But there are more samples to store, so the file is larger.
Two panels showing the same sound wave, two cycles of a wave whose height changes quickly. In the left panel the wave is sampled 6 times and the blue steps through the samples miss most of the shape. In the right panel it is sampled 40 times and the blue steps follow the wave closely. The labels say low sample rate and high sample rate.

The picture shows the same wave sampled at a low rate and at a high rate. At the low rate, quick changes in the wave fall between the samples and are lost.

Sample resolution

The sample resolution is the number of bits used for each sample. It is sometimes called the bit depth.

  • With bbb bits a sample can take 2b2^b2b different levels. 8 bits give 256 levels, and 16 bits give 65536 levels.
  • A higher resolution means each sample is rounded less, so the recording is more accurate.
  • But each sample needs more bits, so the file is larger.

Both settings work the same way: as the sample rate and the resolution increase, the accuracy of the recording and the file size both increase.

The size of a sound file

Every second there are (sample rate) samples, and each one needs (resolution) bits.

bits=sample rate×sample resolution×length in seconds\displaystyle \text{bits} = \text{sample rate} \times \text{sample resolution} \times \text{length in seconds}bits=sample rate×sample resolution×length in seconds

A recording sampled 8000 times a second at 8 bits for 10 seconds needs 8000×8×10=6400008000 \times 8 \times 10 = 6400008000×8×10=640000 bits. Divide by 8 for bytes: 80000 bytes. The next course turns sizes like this into kibibytes and mebibytes.

Practise with new numbers

Try it in Python

The program samples one wave at a chosen rate and resolution. It prints each sample as a level and as binary, and then the number of bits stored.

Read it first. Then run it. How many different levels appear?

1. Change bits = 3 to bits = 1. How many levels are left, and what has happened to the shape of the wave?

2. Double samples. What happens to the number of bits?

Common mistakes

  • Mixing up the two settings. The sample rate is how often you measure. The sample resolution is how many bits each measurement has.
  • Forgetting the time. The size depends on the length of the recording too.
  • Thinking only one thing increases. Higher settings give better accuracy and a larger file.
  • Levels and bits. 4 bits give 24=162^4 = 1624=16 levels, not 4 levels.

Remember these

  • Sound is sampled: the amplitude is measured at regular moments and each value is stored in binary.
  • Sample rate: the number of samples taken in a second.
  • Sample resolution: the number of bits per sample. bbb bits give 2b2^b2b levels.
  • Higher rate or resolution: a more accurate recording and a larger file.
  • Bits === sample rate ×\times× resolution ×\times× seconds.

Check yourself

Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.

  1. What is meant by the sample rate of a recording?
  1. How many different levels can a sample take with a resolution of 5 bits?
  1. A sound is sampled 4000 times a second at 16 bits for 3 seconds. How many bits does it need?
  1. A recording is made again with double the sample rate. Everything else is the same. What happens to the file size?
  1. Give one reason to choose a higher sample resolution, and one reason not to.

Enroll free in Text, Sound and Images in Binary

Every lesson is open to read. Enrolling also lets you:

  • Mark lessons done and carry on where you stopped.
  • Take the tests of this lesson and its course.
  • Count the course towards the certificate for its chapter.
No payment. You can leave at any time.

Problems (3)

A doorbell stores its chime as a sound sampled 8000 times a second, with a sample resolution of 8…Easy · High School (9–10) · by StemPy Lab
A podcast clip is recorded at 16000 samples a second with a resolution of 16 bits…Medium · High School (9–10) · by StemPy Lab
A cheap voice recorder takes a sample every 0.25 milliseconds…Hard · High School (9–10) · by StemPy Lab
Next: lesson 3Images: resolution and colour depth
← Text, Sound and Images in Binary
← Text and character setsImages: resolution and colour depth →

Discussion (0)

Log in to join the discussion.

Loading…

1 Python program
5 questions to check yourself

This lesson is free to read. Enroll free to keep your place and take the tests.