Speech & Audio AI / Representing Sound
Why almost every speech model sees a picture of sound.
Reviewed by Yuvaraj
A raw waveform is an honest representation of sound, but a punishing one to learn from: at 16 kHz, one second is 16,000 numbers whose meaning lives in patterns spread across thousands of samples. Almost every speech system therefore transforms the waveform into a spectrogram, a picture of how the signal's frequency content changes over time, before any learning happens. This lesson explains the transform that produces it, how to read the resulting image, the fundamental tradeoff it forces, and the mel scale that reshapes it to match human hearing.
You can feed raw samples to a neural network, and some modern models do. But the waveform hides the structure that matters:
The fix is to move from the time domain (amplitude vs. time) to the time–frequency domain (which frequencies are present, and when).
A Fourier transform decomposes a signal into the frequencies that make it up. Applied to a whole clip it tells you which frequencies are present but not when, useless for speech, where timing is everything. The short-time Fourier transform (STFT) fixes this by chopping the signal into short, overlapping windows and running a Fourier transform on each:
Ask about this lesson, or about anything in AI. Answers cite the lessons they draw on.
Finished this lesson?
Mark it complete to earn XP, keep your streak, and schedule a review.
The result is a matrix: one axis is time (one column per frame), the other is frequency (one row per frequency bin), and each cell's value is how much of that frequency was present in that frame.
A spectrogram is displayed as an image, and once you can read it, speech becomes legible at a glance:
Vowels appear as stacked horizontal bands (the resonant frequencies, or formants, of the vocal tract); the hiss of an "s" or "f" shows as a broad smear of high-frequency energy; silence is a dark column. This is exactly why turning audio into an image is so powerful: it lets the same convolutional and transformer architectures that conquered vision do the heavy lifting on sound.
The one dial you cannot escape is window length, and it forces a genuine tradeoff rooted in the physics of waves:
You cannot make both arbitrarily precise at once, sharpening time necessarily blurs frequency and vice versa. Speech pipelines typically settle near a 25 ms window with a 10 ms hop as a well-tested compromise for the timescale of phonemes.
Humans do not hear pitch linearly. The gap between 200 Hz and 400 Hz sounds like a large jump, while 5,000 Hz to 5,200 Hz, the same 200 Hz, is barely noticeable. Our perception of pitch is roughly logarithmic. The mel scale warps frequency to match, spacing perceived-equal pitches equally:
A mel spectrogram applies a bank of triangular filters spaced on this scale, collapsing the hundreds of linear frequency bins into ~80 perceptually meaningful ones. This throws away detail the ear ignores and keeps what it cares about, which is why the mel spectrogram, not the raw STFT, is the standard input to speech-recognition and text-to-speech models. Taking a further step (a discrete cosine transform of the log-mel energies) yields the classic MFCC features that dominated speech systems before deep learning.
Common mistakes