Year 9 · Spring 2

Representations: going audio-visual · Lesson 3 of 5

Sampling, sample rate and bit depth

PracticalTopic 6 Representing sound

Year 9 · Representations: going audio-visual · Lesson 3 of 5

You will learn to

  • Explain how sampling turns a smooth sound wave into a list of numbers.
  • Calculate a sound file's size: sample rate × bit depth × seconds × channels.
  • Use the Nyquist rule: sample at least twice as often as the highest frequency.
  • Explain how the Arduino's ADC turns a knob's voltage into a number from 0 to 1023.

Year 9 · Representations: going audio-visual · Lesson 3 of 5

Success criteria

You have got it when you can say:

  • I can sample a wave on squared paper and draw the stepped copy.
  • I can calculate the size of a short mono recording, with units.
  • I can say why music is sampled 44,100 times a second.
  • I can turn the knob and say what a reading of 512 means in volts.

Year 9 · Representations: going audio-visual · Lesson 3 of 5

Retrieval starter

Questions from before. Write your answers, then show them.

  1. Last lesson

    Which is metadata?

    A The image's widthB The colour of pixel 7C A pixel's red value

    A. The image's width

  2. Last unit

    SELECT FirstName FROM Students WHERE Year = 8; returns…

    A Only the first names of Year 8 studentsB Every field of every studentC The number of Year 8 students

    A. Only the first names of Year 8 students

  3. Earlier this year

    A variable made inside a function is…

    A Global: usable anywhereB Local: only exists inside it while it runsC Saved to a file

    B. Local: only exists inside it while it runs

Year 9 · Representations: going audio-visual · Lesson 3 of 5

Key words (1 of 2)

Sample rate
Sound samples taken per second, in hertz.
Bit depth
Bits per sound sample. Sets how precisely each is measured.
Analogue
Smooth and continuous, with any value possible.
Digital
Made of separate, countable steps.

Year 9 · Representations: going audio-visual · Lesson 3 of 5

Key words (2 of 2)

ADC / DAC
Analogue-to-digital converter: turns a smooth signal into numbers.

The explanation · step 1 of 3

Sampling, step by step

  1. Pick regular moments in time.
  2. At each moment, measure how high the wave is.
  3. Round it to the nearest level you're allowed to store.
  4. Save the level as a binary number.
  5. Repeat for the whole recording.
e.g.Example

With 3 bits (levels 0–7), 8 samples might be 4, 6, 7, 6, 4, 2, 1, 2 → stored as 100 110 111 110 100 010 001 010.

The explanation · step 2 of 3

Sample rate: how often

Sample rate = samples per second, in hertz (Hz). More samples = closer to the real curve.

?Why?

Why do CDs use 44,100 Hz? People hear up to about 20,000 vibrations a second. You must measure each vibration at least twice (top and bottom). So you need over 40,000 samples a second.

The explanation · step 2 of 3

The maths: How fast must you sample?

The explanation · step 3 of 3

Bit depth: how precisely

Bit depth = bits per sample. n bits give 2ⁿ levels.

  • 3 bits → 8 levels (very rough).
  • 8 bits → 256 levels (phone calls).
  • 16 bits → 65,536 levels (CD quality).

Year 9 · Representations: going audio-visual · Lesson 3 of 5

Try it: Sample a sound wave

Year 9 · Representations: going audio-visual · Lesson 3 of 5

The maths: Sound file size

Symbols first, then the words, then the equation. Change the numbers.

Year 9 · Representations: going audio-visual · Lesson 3 of 5

The maths: From ADC reading to volts and brightness

Symbols first, then the words, then the equation. Change the numbers.

Year 9 · Representations: going audio-visual · Lesson 3 of 5

Quick quiz · 1 of 3

Sample rate means…

  1. A How many bits per sample
  2. B How loud it is
  3. C How many samples per second

C. How many samples per second

Measured in hertz: samples per second.

Year 9 · Representations: going audio-visual · Lesson 3 of 5

Quick quiz · 2 of 3

A bit depth of 4 gives how many levels?

  1. A 4
  2. B 8
  3. C 16

C. 16

2⁴ = 16.

Year 9 · Representations: going audio-visual · Lesson 3 of 5

Quick quiz · 3 of 3

Turning a microphone's voltage into numbers is done by…

  1. A An ADC
  2. B A DAC

A. An ADC

Analogue to Digital Converter.

Year 9 · Representations: going audio-visual · Lesson 3 of 5

Exit ticket

Answer on paper before you go. Then check.

  1. The highest pitch you want to record is 10,000 Hz. The smallest sample rate that works is…

    A 10,000 HzB 5,000 HzC 20,000 Hz

    C. 20,000 Hz Nyquist: at least 2 × 10,000 = 20,000 Hz.

  2. Mono → stereo, everything else the same. The file…

    A stays the sameB halvesC doubles

    C. doubles Two channels = two full lists of samples.