Study Guide

Representing Sound

How a computer turns a sound wave into binary by sampling it, what sample rate and sample resolution are, and how each changes the accuracy and the file size of a recording.

Lesson 1.7 Data Representation

For: Cambridge IGCSE Computer Science learners, or anyone who can already convert between binary and denary

Stage: Think

Recording a swing with a notebook

A fictional pupil, Kiran, sits by a playground swing. She wants to record how high the seat goes as it swings, using only a pen and a notebook, so that a friend could redraw the swing’s movement later. The seat moves smoothly: it is at a different height at every instant.

Think it through

Kiran cannot write down every instant. How could she record the movement so that her friend can redraw it? What would make the redrawing closer to the real swing?

Show a model answer

She could measure the height of the seat at regular times, for example once a second, and write each height in a table. Her friend plots the points and joins them up. The redrawing is closer to the real swing if she measures more often, and if she measures each height more precisely, for example to the nearest centimetre and not the nearest metre.

The swing’s height can be any value, with no gaps. Data that varies smoothly like this, so that it can take any value in a range, is analogue data. A sound is analogue too: the air vibrates in a smoothly changing wave, and a microphone turns it into a smoothly changing electrical signal.

A computer cannot store an unending number of values. It stores digital data: a set of separate values, kept as binary numbers. To store a sound, the smooth wave has to be turned into a list of separate numbers. Kiran’s table of heights is a small version of exactly that.

Stage: Discover

Turning a wave into numbers

Think it through

A microphone produces a smoothly changing signal. A computer stores only whole numbers in binary. Using Kiran’s idea, what two things would you do to the signal to turn it into whole numbers?

Show what happens

First, measure the height of the signal at regular moments. Second, round each measurement to the nearest whole-number level that can be stored. Each rounded measurement is then written in binary.

A measurement of the wave’s height at one moment is a sample, and taking measurements at regular intervals is sampling. The steps are:

From sound to binary

Follow one sound through the four stages that turn it into stored digital data.

  1. Microphone

    Step 1 of 4: Sound becomes a signal

    The air vibrates, and the microphone turns the vibration into a smoothly changing electrical signal. This is analogue data.

  2. Computer

    Step 2 of 4: Take samples

    At regular, very short intervals, the computer measures the height of the signal. Each measurement is one sample.

  3. Computer

    Step 3 of 4: Round each sample

    Each sample is rounded to the nearest of a fixed set of levels, because only a fixed number of levels can be stored.

  4. Computer

    Step 4 of 4: Store as binary

    The number of each level is written in binary, and the binary numbers are stored in order. This is the digital data.

    Technical detail: Played back, the numbers are turned into a signal again and sent to a speaker.

Stage: Discover

Encoding some samples

A fictional note is sampled six times. The recorder can store eight levels, numbered 0 to 7.

Think it through

If each sample is stored in 3 bits, how many different levels can the recorder store? How many bits will six samples take in total?

Show what happens

3 bits make 2³ = 8 levels (0 to 7), and six samples take 6 × 3 = 18 bits.

The six samples, after rounding, are at levels 2, 5, 7, 5, 2 and 0: the note rises to a peak, then falls to silence.

Six samples written in 3-bit binary
SampleLevel3-bit binary
12010
2
37
45
52
60

    Show the completed table
    SampleLevel3-bit binary
    12010
    25101
    37111
    45101
    52010
    60000

    The recording is stored as 010101111101010000: 18 bits, in order. Each sample is a whole number of levels, so the stored wave is a set of separate steps, not a smooth curve.

    Check your understanding

    A recorder stores every sample in 4 bits. It takes 10 samples. How many bits does the recording take?
    Show the answer

    Answer: B. 40 bits, because 10 samples × 4 bits = 40.

    10 × 4 = 40 bits. The levels (16 of them) say how finely each sample can be measured; the bits per sample say how much is stored for each.

    Stage: Predict

    How often to measure

    Kiran’s two friends measure the same swing for 4 seconds. Mo measures its height 2 times a second, and Zara measures it 10 times a second.

    Think it through

    Whose table will let you redraw the swing’s movement more closely, and whose table is longer? How many heights is each table likely to hold?

    Show what happens

    Zara’s table is closer to the real swing, because there are more points and so less is guessed between them. It is also longer: Mo has 2 × 4 = 8 heights and Zara has 10 × 4 = 40 heights.

    The number of samples taken in each second is the sample rate. It is measured in hertz (Hz): one hertz is one sample per second. Mo used 2 Hz and Zara used 10 Hz. Real recordings use thousands: a recording of speech on a phone line may use 8000 Hz, and a music CD uses 44 100 Hz.

    The number of samples in a recording is the sample rate multiplied by the length in seconds.

    Counting samples
    Sample rateLengthNumber of samples
    10 Hz4 seconds40
    100 Hz5 seconds
    1000 Hz30 seconds
    8000 Hz2 seconds

      Show the completed table
      Sample rateLengthNumber of samples
      10 Hz4 seconds40
      100 Hz5 seconds500
      1000 Hz30 seconds30 000
      8000 Hz2 seconds16 000

      Check your understanding

      A recording is made again at a higher sample rate, with everything else the same. What happens to it?
      Show the answer

      Answer: A. It follows the original sound more closely, and the file is bigger.

      A higher sample rate gives a more accurate recording because there are more samples, and a bigger file for the same reason.

      Stage: Predict

      How carefully to measure

      Now look at how carefully each height is measured. Kiran can record a swing height to the nearest metre, or to the nearest centimetre.

      Think it through

      Which measurement needs a bigger number to write down? If a computer used only 2 bits for each sample, how many different heights could it store?

      Show what happens

      Centimetres need a bigger number: there are more possible values. 2 bits make 2² = 4 patterns, so only four different heights could be stored. Every measurement would be rounded to one of four steps, and the redrawn swing would look stepped and rough.

      The number of bits used for each sample is the sample resolution. With n bits for each sample, there are 2ⁿ levels to round to. More bits give more levels, with smaller steps between them, so each sample is closer to the true height of the wave.

      Sample resolution and levels
      Sample resolutionNumber of levels
      1 bit2
      2 bits
      4 bits
      8 bits
      16 bits

        Show the completed table
        Sample resolutionNumber of levels
        1 bit2
        2 bits4
        4 bits16
        8 bits256
        16 bits65 536

        Check your understanding

        A recorder changes from 8 bits to 4 bits for each sample, with the same sample rate. What changes?
        Show the answer

        Answer: C. There are only 16 levels, so samples are rounded more roughly, and the file is smaller.

        With 4 bits there are 2⁴ = 16 levels, against 2⁸ = 256. Samples are rounded to a coarser set of steps, so the recording is less accurate, but each sample needs fewer bits, so the file is smaller.

        Stage: Explain

        Two settings, two jobs

        Think it through

        In your own words, how do sample rate and sample resolution differ? Use the swing to explain each, and say which of them is a count of bits.

        Show a model answer

        Sample rate is how often the height is measured (samples per second, in hertz). Sample resolution is how carefully each height is measured, and is the number of bits for each sample.

        Do not confuse: Sample rate and sample resolution

        How often?Sample rate
        The number of samples taken each second, in hertz (Hz).44 100 Hz means 44 100 samples every second.
        How precisely?Sample resolution
        The number of bits used for each sample, which sets how many levels there are.16 bits means 65 536 levels for each sample.

        Raising either one makes the recording more accurate and the file bigger.

        Sample rate does not change how loud or how high a sound is. It changes how closely the recording follows the original: a higher rate has more samples, so there is less guessing between them. In the same way, a higher resolution does not make the sound louder: it makes each sample closer to the true height of the wave.

        A fictional recorder stores 4000 samples every second, each in 8 bits, for 10 seconds.

        1. Find the number of samples. 4000 × 10 = 40 000 samples.
        2. Find the bits. Each sample takes 8 bits, so 40 000 × 8 = 320 000 bits.
        3. Now change one setting. If the sample rate is doubled to 8000 samples a second, there are 80 000 samples and 640 000 bits: twice the size.
        4. Change the other. If the resolution is doubled instead, to 16 bits each, there are 40 000 × 16 = 640 000 bits: also twice the size.

        Doubling either setting doubles the file size, and makes the recording more accurate. A later lesson turns this working into a formula.

        Go deeper Beyond the specification: why a music CD uses 44 100 Hz

        Humans can hear sounds up to about 20 000 Hz. A wave can only be followed properly if it is sampled at least twice as fast as its highest frequency. Twice 20 000 is 40 000, and 44 100 Hz is a little above that. Telephone calls need much less: speech is understandable using about 8000 Hz, which is why a phone call can sound dull next to a music recording.

        Stage: Apply

        Choose settings for a job

        A fictional app offers two ways to record. “Voice memo” uses 8000 Hz and 8 bits. “Studio music” uses 44 100 Hz and 16 bits.

        Apply it

        A pupil records a spoken reminder to herself and wants the file to be as small as is sensible. Which setting should she choose, and why?
        Show the answer

        Answer: B. Voice memo, because speech stays clear at lower settings and the file is smaller.

        For speech, the lower settings give a recording that is still clear and a much smaller file, so voice memo is the sensible choice. For music, where more of the detail of the sound matters, the higher settings are worth the extra size.

        Apply it

        A recording uses 16 000 samples a second at 8 bits each for 30 seconds. It is recorded again at 8000 samples a second, with everything else the same. What happens to the file size?
        Show the answer

        Answer: C. It is half the size, because there are half as many samples at the same bits each.

        Halving the sample rate halves the number of samples, so the file is half the size. The recording is less accurate, because less of the wave is measured.

        Apply it

        Tariq says: “If I raise the sample rate from 8000 Hz to 16 000 Hz, each sample gets 16 bits.” What is wrong with this?
        Show the answer

        Answer: A. The rate counts samples each second; the bits in each sample come from the resolution.

        The sample rate and sample resolution are separate settings. 16 000 Hz means twice as many samples each second; 16 bits would be a change of sample resolution.

        Stage: Consolidate

        Bring it together

        Think it through

        Without looking back, explain to a friend how a computer stores a sound, and why a recording sampled 10 times a second at 2 bits sounds rougher than one sampled 10 000 times a second at 16 bits.

        Show a model answer

        The sound wave is analogue. The computer measures its height at regular moments (samples), rounds each to one of a set of levels, and stores each level as a binary number. At 10 samples a second and 2 bits (4 levels), there are very few points and each is rounded coarsely, so the stored wave is a poor copy. At 10 000 samples a second and 16 bits (65 536 levels), there are many points and each is very close to the true height.

        Check your understanding

        Which of these is digital data?
        Show the answer

        Answer: C. The list of binary numbers that a recorder stores for a sound.

        A list of binary numbers is digital: each sample is one of a fixed set of levels. The air pressure and the microphone’s signal are analogue, because they vary smoothly.

        • Analogue data varies smoothly and can take any value in a range, like a sound wave. Digital data is made of separate values, stored in binary.
        • To store a sound, the wave is sampled: its height is measured at regular intervals, each sample is rounded to a level, and the level is stored as a binary number.
        • The sample rate is the number of samples each second, in hertz (Hz). The sample resolution is the number of bits for each sample, and n bits give 2ⁿ levels.
        • A higher sample rate or a higher sample resolution makes a recording more accurate, and makes the file bigger. A lower one makes it less accurate and smaller.
        • The two settings are separate: one is how often, the other is how precisely. Neither changes how loud a sound is.

        Sources and scope

        • What this lesson is. The seventh lesson of the Data Representation module, written for this site. It teaches point 2 of Cambridge IGCSE Computer Science 1.2 (sound: sample rate and sample resolution) against the 2026 to 2028 syllabus (version 6). Its curriculum links are provisional: no link has been verified by the site owner. They show where the lesson may help with a course and imply no review or endorsement by any examination board.
        • Original material. Kiran and the swing, Mo and Zara, the six samples, the two recording settings and Tariq’s claim are fictional examples written for this lesson. The numbers are chosen to divide cleanly: real recordings use many more samples. The phone and CD values are the usual ones.
        • Simplified on purpose. Samples are shown as whole-number levels rounded to the nearest one. How a recording is turned back into sound, the maths of sampling, and stereo (more than one channel) are not taught. Calculating a file size is in Measuring Storage and File Sizes.