Skip to content
ML to LLMs
Learning path

Module 29

Speech and audio

Turn sound into model input and text: spectrograms, mel filterbanks, MFCCs, CTC, transducers, attention decoders, and word error rate.

  1. 1. Spectrograms and mel featuresTurn a waveform into the log-mel spectrogram that speech models consume (framing, windowing, FFT, mel filterbank, log, MFCC) and get the shapes and parameters right.40 min
  2. 2. Speech recognition: CTC, transducers, and attentionExplain how speech recognizers align audio frames to text (CTC, RNN-T, attention encoder-decoder), decode CTC output greedily and with prefix beam search, compute the CTC loss with the forward algorithm, and measure word error rate.45 min

Audio arrives as tens of thousands of samples per second. Speech models first turn it into a log-mel spectrogram, a compact time-by-frequency image, then align those frames to a much shorter sequence of text tokens. This module builds both halves from scratch in NumPy and connects them to the libraries and pretrained models you would use in practice.

StageWhat happensFailure mode
Resamplebring audio to the model's rate (often 16 kHz)wrong rate, aliasing
Frame and window25 ms slices every 10 ms, taperedleakage, wrong framing
FFT and melpower per frequency, pooled into mel bandsmismatched filterbank or log
Encodeconvolution and transformer layerstoo much downsampling for CTC
Align and decodeCTC, transducer, or attention decoderdropped double letters, hallucination
Evaluateword error rate after normalizationincomparable numbers
#LessonYou will be able to
1Spectrograms and mel featurescompute frames, STFT, mel filterbank, log-mel, and MFCC with correct shapes, and avoid front-end mismatches
2Speech recognition: CTC, transducers, and attentiondecode CTC output, compute CTC loss with the forward algorithm, measure WER, and choose an ASR architecture