Natural Language Processing · Advanced level

Advanced level · Module 8: Automatic Speech Recognition · Lesson 1 of 3

Audio Basics for Speech Recognition

Learners load audio, resample it to 16 kHz, visualise waveforms and spectrograms and understand what an ASR model receives as input.

In this lesson you will

  • Load, resample and visualise audio
  • Explain spectrograms and why ASR uses them

Key concepts

waveformsampling rate (16 kHz)mono audiospectrogram / log-Mel featuresaudio file formats

The lesson

Audio is a sequence of air-pressure measurements. Most speech models expect mono audio sampled at 16,000 samples per second, so recordings must be converted. Phone recordings are often at other rates and in compressed formats.

A spectrogram shows how much energy each frequency has over time. Speech models such as Whisper convert audio into log-Mel spectrogram features internally, which is why background noise and poor microphones affect results.

Record your own short clips with consent (a sentence of English and, if you speak one, a sentence in a local language) to use as test material in this module.

Step by step

  1. Load a short recording and print its sampling rate and duration.
  2. Resample to 16 kHz mono.
  3. Plot the waveform and a spectrogram with Matplotlib.
  4. Compare a quiet and a noisy recording visually.

Practice activity

Prepare and visualise five consented test recordings.

Expected result: Five 16 kHz mono clips with waveform and spectrogram plots and notes on noise.

Check your understanding

  1. What sampling rate do many speech models expect?

    Show answer

    16,000 samples per second (16 kHz).

  2. What does a spectrogram show?

    Show answer

    The energy of different frequencies over time.

Further learning

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.