Spectrograms: Visualizing Audio
You'll learn how spectrograms transform audio from a one-dimensional signal into a two-dimensional "picture" that reveals both frequency and time information.
What Is a Spectrogram?
A spectrogram is a visual representation of audio that shows how the frequency content of a signal changes over time. Think of it as a heat map: the x-axis represents time, the y-axis represents frequency (pitch), and the color intensity shows the amplitude (loudness) of each frequency at each moment.
From STFT to Spectrogram
Remember the Short-Time Fourier Transform (STFT) you learned earlier? It splits audio into overlapping windows and computes the frequency spectrum for each window. A spectrogram is simply a 2D visualization of all those STFT results stacked together:
- Each vertical slice represents one window's frequency spectrum
- Brighter/warmer colors indicate stronger frequency components
- Darker/cooler colors show weaker or absent frequencies
Why Spectrograms Matter
Unlike raw waveforms that only show amplitude over time, spectrograms reveal patterns in frequency space. This is crucial because:
- Human speech has distinctive frequency patterns (formants)
- Musical notes appear as horizontal bands at specific frequencies
- Noise, silence, and different sounds have visually distinct "signatures"
- Deep learning models (like CNNs) can process spectrograms as images
Think of it like this: a waveform is like reading sheet music as a single line of numbers, while a spectrogram is like seeing the full musical score with all instruments visible at once.
Key Takeaway: Spectrograms convert audio into 2D time-frequency representations by visualizing STFT outputs, making frequency patterns visible and enabling image-based deep learning approaches for audio tasks.