A sound as a sequence of numbers

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

A sound as a sequence of numbers

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A digital sound is stored as 0, 40, 80, 40, 0. What kind of data is this?
A A picture of the wave saved as a drawing
B An ordered list of whole numbers (samples)
2. You plot the samples 0, 40, 80, 40, 0 in order and join the dots. What do you get?
A An approximation of the sound wave
B A perfect copy of the original wave
3. Which statement about the order of samples is true?
A Order matters, because each number is a measurement at a set time
B Order does not matter, because the numbers are the same
4. The samples 10, 50, 90, 50, 10 are shuffled to 90, 10, 50, 10, 50. What happens to the plotted wave?
A It has the same shape, because the numbers are the same
B It has a different shape, so the sound changes
5. In the list 0, 30, 60, 30, 0, which sample is the highest volume measurement?
A 60, the third sample
B 0, the first sample

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1samples = [0, 5, 9, 5, 0, -5] A[2, 8, 2] is not [8, 2, 2]
2samples[0] BA sample sequence of six whole numbers: the wave rises to a peak of 9, falls back to 0, then drops below the middle line.
3Plotting the samples in order and joining the dots redraws an approximation of the sound wave. Cplot(samples) # join the dots in order
4Order matters: the same numbers in a different order make a different wave. DThe first sample in the list. Counting starts at 0, so this is one volume measurement at the very start of the sound.
5plot([5, 0, 9, 0, 5]) EThe samples were recorded as 0, 5, 9, 5, 0 but plotted in a mixed-up order, so the wave shape is lost. Plot them in the recorded order.
6samples = [0, 4.5, 9, 4.5, 0] FSamples are whole numbers (integers), so 4.5 is not allowed. Each measurement is rounded to a whole number, such as 4 or 5.

Definitions

sample sequence

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
samples = [2, 6, 9, 6, 2] print(samples[_])
2.
samples = [4, 8, 4, 0, 4] count = ___(samples)
3.
samples = [1, 5, 9, 5, 1] for s __ samples: plot(s)
4.
for i in range(len(samples)): plot(i, samples[_])
5.
samples = [0, 4, 8, 4, 0] if samples[0] __ 0: print("starts silent")

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A samples = [0, 5, 9, 5, 0, -5]
B first = samples[1]
C print(first)
Question 2
A samples = [2, 6, 9, 6, 2]
B n = len(samples)
C last = samples[n]
Question 3
A samples = [0 4 8 4 0]
B for s in samples:
C print(s)
Question 4
A s = [1, 4, 9, 6, 2]
B t = [0, 1, 2, 3, 4]
C for i in range(5):
D print(t[i], s[4 - i])
Question 5
A s = [3, 7, 2, 8]
B points = []
C for i in range(len(s)):
D points.append((s[i], i))

Answer Key

A sound as a sequence of numbers
Section A: Quick Questions
Q1
B — An ordered list of whole numbers (samples)
Q2
A — An approximation of the sound wave
Q3
A — Order matters, because each number is a measurement at a set time
Q4
B — It has a different shape, so the sound changes
Q5
A — 60, the third sample
Section B: Match the Pairs
Q1
samples = [0, 5, 9, 5, 0, -5] → A sample sequence of six whole numbers: the wave rises to a peak of 9, falls back to 0, then drops below the middle line.
Q2
samples[0] → The first sample in the list. Counting starts at 0, so this is one volume measurement at the very start of the sound.
Q3
Plotting the samples in order and joining the dots redraws an approximation of the sound wave. → plot(samples) # join the dots in order
Q4
Order matters: the same numbers in a different order make a different wave. → [2, 8, 2] is not [8, 2, 2]
Q5
plot([5, 0, 9, 0, 5]) → The samples were recorded as 0, 5, 9, 5, 0 but plotted in a mixed-up order, so the wave shape is lost. Plot them in the recorded order.
Q6
samples = [0, 4.5, 9, 4.5, 0] → Samples are whole numbers (integers), so 4.5 is not allowed. Each measurement is rounded to a whole number, such as 4 or 5.
Section C: Definitions
Q1
sample sequence — An ordered list of whole numbers, each measuring a sound's volume at a regular time. Plot them in order and join the dots to redraw an approximation of the wave.
Section D: Fill in the Blanks
Q1
samples = [2, 6, 9, 6, 2] print(samples[0])
Q2
samples = [4, 8, 4, 0, 4] count = len(samples)
Q3
samples = [1, 5, 9, 5, 1] for s in samples: plot(s)
Q4
for i in range(len(samples)): plot(i, samples[i])
Q5
samples = [0, 4, 8, 4, 0] if samples[0] == 0: print("starts silent")
Section E: Spot the Error
Q1
B — Lists start counting at index 0, so the first sample is samples[0]. samples[1] is the second sample. It should be first = samples[0].
Q2
C — The list has 5 samples, so the indexes run from 0 to 4. samples[n] is index 5, which does not exist and causes an error. It should be samples[n - 1].
Q3
A — The sample values in a list must be separated by commas. Without commas the list is not valid. It should be samples = [0, 4, 8, 4, 0].
Q4
D — Each sample must be paired with its own time step, in order. s[4 - i] reads the samples backwards, so the wave would be drawn reversed. It should be print(t[i], s[i]).
Q5
D — When plotting a wave, time (the position in the sequence) goes on the x-axis and the sample value goes on the y-axis. The point has x and y swapped. It should be (i, s[i]).