Signals to learning / 3. From time to samples

Lesson 12 of 40 · Beginner · About 25 minutes

Resampling safely

Why is keeping every other sample sometimes wrong?

You will be able to

  • Predict the new Nyquist limit after downsampling.
  • Describe interpolation, filtering and decimation in a resampling pipeline.

A lower-rate view

Downsampling by integer M retains one sample in every M. The new rate is fₛ/M and the new Nyquist frequency is fₛ/(2M). Components above that limit need filtering before the reduction; otherwise they fold. A moving average is a filter, but not generally a sufficiently selective anti-alias filter.

A rational rate change

A conceptual rational conversion by U/D inserts zeros to increase the rate, applies a suitable low-pass interpolation/anti-alias filter with the appropriate gain, then keeps every Dth sample. Polyphase implementations avoid calculating unused intermediate values. Choose filter design and edge handling deliberately; sample count rounding alone is not resampling.

fₛ,new = fₛ,old × U/D; filter before decimation

Worked example

48 ksample/s downsampled by 3 becomes 16 ksample/s, with Nyquist 8 kHz. A 10 kHz component folds to 6 kHz if it survives the prefilter. The reduced fraction for 48→44.1 ksample/s is 147/160.

A common trap

Interpolating a curve through samples does not create missing high-frequency information, and downsampling without a prefilter is not safe just because the result sounds plausible.

Predict, then experiment

What happens to a 9 Hz component when the rate falls from 32 to 16 samples/s? Before touching the controls, say or write your prediction.

Interactive experiment

Frequency folding

When does a sampled sinusoid become indistinguishable from a slower one?

Blue is the source, dashed amber is the apparent sinusoid, and circles are samples shared by both. The display covers two seconds.

Your experiment

Set source 9 Hz. Compare rates 32 and 16 Hz. Use the apparent-frequency readout to explain what a prefilter would need to suppress before the rate reduction.

Change one parameter at a time. Compare what you observed with your prediction and record an explanation in your notes.

Check your understanding

Try from memory first. Hints and feedback are part of learning, not a penalty. These checks are for self-study, not a graded qualification.

1. The prefilter for downsampling should be designed against…
Give me a hint

Which clock receives the output?

2. What is the new rate when 48,000 samples/s is decimated by 3?

Accepted absolute tolerance: ±0.001 samples/s.

Give me a hint

Divide the old rate by the decimation factor.

Reference answers (after your attempt)
  1. the new lower Nyquist limit with a transition margin — Correct: protect the bandwidth of the output clock.
  2. 16000samples/s — 48,000/3=16,000.

Apply it: Specify a rational converter

Use paper, your notes, or a local notebook/editor. Code examples are Python 3 starting points to run yourself; this page does not execute code or automatically assess the practical task.

  1. Reduce 44,100/48,000 to U/D.
  2. State the required filtering and boundary policy.
  3. Explain what a polyphase implementation saves.
Reference solution & review criteria

Use U=147, D=160. A suitable low-pass filter limits imaging and aliasing; disclose padding and delay. Polyphase calculation evaluates useful phases rather than building the full zero-inserted array.

Your notebook

Notes and progress stay in this browser. They are not sent to the server; ordinary web-server request logs still operate. Export a backup from the course page.

Review list

Completion requires both correct checks and your practical-task acknowledgement.

Go deeper

Sources support further study; the worked examples and questions here are original. Browser experiments are small, disclosed models—not evidence of production-model quality or hardware performance.