Spectral Analysis

Fourier transform and the frequency domain

Lorenz Schwarz
Karlsruhe University of Arts and Design (HfG)
Winter Semester 2024/25
Course info

← Overview

SPECTRAL ANALYSIS

Fourier transform and frequency domain

Spectral Analysis

Sound in different domains

An audio signal can be described from different perspectives, depending on which aspect of sound is being analyzed.

  • Time-based descriptions reveal changes over time
  • Frequency-based descriptions reveal spectral content

→ Both views describe the same signal, but reveal different information.

Spectral Analysis

Time domain vs. frequency domain

Audio signals are commonly represented in two domains:

  • Time domain:

    • Amplitude as a function of time
  • Frequency domain:

    • Distribution of energy across frequencies (magnitude and phase)

(Analog signals are continuous; digital signals are discrete.)

Spectral Analysis

Time domain

The time domain shows how a signal’s amplitude changes over time.

  • Analog signals: continuous in time and amplitude
  • Digital signals: discrete samples in time and amplitude

→ The time domain reveals transients, timing, and amplitude changes.

center

Spectral Analysis

Frequency domain

The frequency domain describes a signal in terms of its frequency components rather than time.

  • shows how much energy each frequency contributes

center

Spectral Analysis

Spectrum

The spectrum shows a moment of a signal’s frequency content.

  • Amplitude (or magnitude) as a function of frequency
  • Optionally includes phase information

→ The spectrum is the primary tool for analyzing timbre and harmonic structure.

Which signal contains a 400 Hz sine?

center

The second spectrum shows a spike at 400Hz

center

Spectral Analysis

Timbre and spectrum

Timbre (perceptual):
The sonic quality that distinguishes instruments playing the same pitch

Spectrum (technical):
The distribution of frequency components and their amplitudes

Listen to the same pitch (C4 ≈ 261.6 Hz):

Trumpet:     Clarinet:

→ Same pitch, different timbre

Spectral Analysis

Comparing clarinet and trumpet at 260 Hz

center

Spectral Analysis

Understanding spectra with a sawtooth wave

center

  • Each peak in the spectrum represents one sine wave (partial or harmonics)
  • Harmonic series 260, 520, 780, 1040... Hz

Spectral Analysis

Pure tone (sine wave)

A is a single frequency component, the fundamental building block of all sounds

center

View sine wave on Desmos

Spectral Analysis

Complex tones (example: sawtooth)

Musical instrument sounds and basic waveforms (except sine) contain many sine waves (click for graphing calculator)

center

Spectral Analysis

Fourier transform

Decomposes a signal from the time domain (waveform) into the frequency domain (spectrum):

  • Reveals the individual sine wave components and their amplitudes (and phases)
  • Shows which frequencies are present and how strong they are

→ Any complex sound can be represented as a sum of sine waves.

Fourier series of a saw tooth wave (approximation)

center


Fourier transform of a sawtooth wave

center

Spectral Analysis

Time-domain signals and spectral analysis

A time-domain signal represents amplitude values over time, either continuous or discrete . The spectrum is a weighting function that describes how harmonic components are combined to reconstruct the time-domain signal as a sum.

  • Input: time-domain signal
  • Output: frequency-domain spectrum

→ The spectrum represents the amplitude and phase of each frequency component.

Spectral Analysis

Fourier Transform

Fourier transform (analysis formula):

  • Break the signal into its frequency components

Inverse transform (synthesis formula):

  • Rebuild the signal from its frequency components.

Spectral Analysis

Euler's formula and complex numbers

A complex exponential combines cosine and sine into a single expression representing sinusoidal components:

where is the imaginary unit.

  • Real part: — cosine component
  • Imaginary part: — sine component

→ This representation is fundamental to the Fourier transform, allowing efficient encoding of both amplitude and phase.

Complex exponential on unit circle
Spectral Analysis

Discrete Fourier transform (DFT)

For digital audio, the DFT represents a finite block of samples as a finite set of frequency components:

: sample index · : frequency-bin index · : number of samples

The frequency represented by bin is:

Spectral Analysis

Inverse DFT and finite computation

The inverse DFT reconstructs the samples from their frequency components:

  • continuous integration is replaced by finite summation
  • infinite limits are avoided: input and output each contain values
  • the resulting representation is directly suitable for digital computation

Detailed derivation: Julius O. Smith, Mathematics of the DFT ↗

Spectral Analysis

Fast Fourier Transform (FFT)

The FFT computes the DFT efficiently, reducing computational complexity from to .

Applications include:

  • real-time spectrum analysis
  • frequency-domain filtering and equalization
  • fast convolution, such as convolution reverb
  • phase-vocoder processing, such as time stretching
Spectral Analysis

Frequency bins

The FFT produces discrete frequency values called bins, each representing a specific frequency component. Each bin contains amplitude and phase information for its frequency component.

Frequency of bin :

where is the bin index, is the sampling rate, and is the FFT size.

For real signals: Number of bins = (due to symmetry)

Spectral Analysis

Frequency resolution

Frequency resolution (bin spacing) determines how finely the spectrum is divided:

where is the sampling rate and is the FFT size.

  • Larger FFT size → smaller → better frequency resolution
  • Frequencies separated by less than cannot be distinguished
Spectral Analysis

Example

Sampling rate: 44.1 kHz
FFT 1024-sample

This means frequencies within a frequency band 43 Hz fall in the same bin and cannot be distinguished.

Spectral Analysis

Window function

Tapering function that smoothly reduces signal amplitude to zero at analysis window boundaries, minimizing discontinuities and spectral leakage.

  • Applied when signals contain non-integer periods within the FFT window
  • Typically symmetrical, bell-shaped functions
  • Common types: Hann, Hamming, Blackman-Harris

→ Trade-off: Reduced leakage vs. reduced frequency resolution.

Hann window
Hann window
Spectral Analysis

Spectral leakage and windowing

Spectral leakage occurs when the analysis window doesn't contain an exact integer number of wave cycles.

  • The signal appears discontinuous at window edges
  • This discontinuity creates artificial frequency components
  • Energy 'leaks' from the true frequency into neighboring bins

→ A window function tapers the signal smoothly to zero at the edges.

Spectral Analysis

Window characteristics in frequency domain

Each window function has a characteristic frequency response with a main lobe and side lobes:

  • Main Lobe:

    • Central peak determining frequency resolution. Width measured between first zeros (null points).
  • Side Lobes:

    • Secondary peaks flanking the main lobe. Height (in dB) indicates leakage suppression quality.
  • Trade-off:

    • Lower side lobes require wider main lobes, reducing frequency resolution.
Rectangular and Hann window frequency response

Rectangular (-13 dB side lobes)
vs. Hann (-31 dB side lobes)

Spectral Analysis

Selecting a window function

Window Main lobe width Side lobe level Use case
Rectangular
(no window)
Narrowest
(2 bins)
Highest
(-13 dB)
Maximum frequency resolution,
integer number of periods
Hann Medium
(4 bins)
-31 dB General purpose,
good balance of resolution and leakage
Hamming Medium
(4 bins)
-42 dB Better side lobe suppression,
8-bit systems, telephony
Blackman-Harris Widest
(6 bins)
-92 dB
(4-term)
High dynamic range,
very low leakage critical applications

Trade-off: Better side lobe suppression = wider main lobe = reduced frequency resolution.

Spectral Analysis

FFT size (window size)

Number of samples per FFT computation. Determines the time-frequency resolution trade-off:

  • Larger size: Better frequency resolution, worse time resolution
  • Smaller size: Better time resolution, worse frequency resolution

Common sizes: 256, 512, 1024, 2048, 4096 (powers of 2)

FFT Size Frequency Resolution Time Resolution
Small (256) Poor (coarse bins) Good (fast response)
Large (4096) Good (fine bins) Poor (slow response)
Spectral Analysis

Applications of the Fourier transform

Theoretical approaches:

  • Organs: Additive synthesis for sound creation.
  • Tone Wheels: Used in the Telharmonium by Thaddeus Cahill (1898).

Spectral audio signal processing:

  • Additive synthesis
  • Digital filter design
  • Vocoder: Manipulation of speech and audio signals.
Spectral Analysis

Applications of spectral analysis

  • Analysis: spectrum analyzers in DAWs
  • Processing: convolution reverb, spectral effects, noise reduction, time stretching
  • Synthesis: additive synthesis, spectral resynthesis
Spectral Analysis

Spectrogram, sonogram

A time-varying visual representation of a signal's frequency content:

  • X-axis: Time
  • Y-axis: Frequency
  • Color/brightness: Amplitude
Spectral Analysis

Spectrogram

Spectrograms reveal temporal evolution of spectral content. Helpful for analyzing speech, music, and environmental sounds.

center

© 2025 Lorenz Schwarz

Original text, diagrams, illustrations, photographs, audio, and video are licensed under CC BY 4.0, except where otherwise noted.

Instrument samples (trumpet and clarinet):
University of Iowa Electronic Music Studios, Musical Instrument Samples · Lawrence Fritts

← Overview Next chapter →