Course contentsShow
← Machine Learning and Deep Learning
Lesson 2437 of 3,53853. Speech and Audio ProcessingFree lesson

Short-Time Fourier Transform (STFT)

Converting audio from time domain to time-frequency representation using windowed FFT for spectral analysis.

Short-Time Fourier Transform (STFT)

What you'll learn: How to convert audio signals from pure time-domain waveforms into time-frequency representations that reveal how spectral content evolves over time.

The Core Problem

You've learned about time-domain waveforms—they show amplitude over time. But audio signals aren't static; musical notes change, speech phonemes transition, and instruments produce different frequencies at different moments. A single Fourier transform of an entire audio file would tell you what frequencies exist, but not when they occur.

What STFT Does

The Short-Time Fourier Transform solves this by applying the FFT (Fast Fourier Transform) to small, overlapping windows of your audio signal. Think of it like analyzing a movie: instead of blending all frames together (standard FFT), you watch short clips in sequence to understand how the scene evolves.

Here's the process:

  1. Window the signal: Extract a small segment (e.g., 25ms of audio)
  2. Apply FFT: Get frequency content for that window
  3. Slide forward: Move the window slightly (with overlap, like 10ms)
  4. Repeat: Continue until you've covered the entire signal

The result is a spectrogram—a 2D representation where:

  • X-axis = time
  • Y-axis = frequency
  • Color/intensity = magnitude (energy at that frequency and time)

Why This Matters for ML

Spectrograms become image-like inputs for deep learning models in speech recognition, music classification, and audio event detection. They capture both harmonic structure and temporal evolution—critical for understanding "what's happening when" in audio.

Key Takeaway: STFT bridges time and frequency domains by applying windowed FFT, creating spectrograms that show how frequency content changes throughout an audio signal—essential for modern audio ML pipelines.