Spectral Analysis

Fourier transform and the frequency domain

Lorenz Schwarz
Karlsruhe University of Arts and Design (HfG)

Winter Semester 2024/25
Course info

← Chapters · Download PDF ↓

For iPhone/iPad users, the PDF download is recommended.

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.

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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.)

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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.

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025

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

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
Spectral Analysis

Comparing clarinet and trumpet at 260 Hz

center

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
Spectral Analysis

Pure tone (sine wave)

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

center

View sine wave on Desmos

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
Spectral Analysis

Complex tones (example: sawtooth)

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

center

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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.

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025

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.

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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.

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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
Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
Spectral Analysis

Discrete Fourier transform (DFT)

For digital audio, the DFT is used, which operates on discrete, finite-duration signals by replacing the continuous integral with a finite sum. The Fast Fourier Transform (FFT) is an efficient algorithm for computing the DFT.

inverse DFT:

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
Spectral Analysis

Discrete Fourier transform (DFT)

  • No calculus needed — uses finite sums, avoids infinities.
  • Assumes finite, sampled signals: Digital processing uses sampled signals.

DFT is simpler and more computationally relevant than FT.

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
Spectral Analysis

Quantities of the DFT formula:

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
Spectral Analysis

Fast Fourier Transform (FFT)

The FFT is an efficient algorithm for computing the DFT, reducing computational complexity from to operations.

This allows efficient computation for:

  • Real-time spectrum analysis
  • Frequency-domain filtering and equalization
  • Convolution-based processing (reverberation, time-stretching)

The FFT is an algorithmic optimization of the DFT computation.

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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)

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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
Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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.

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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
Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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.

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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)

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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.

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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)
Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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.
Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
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
Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
Spectral Analysis

Spectrogram, sonogram

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

  • X-axis: Time
  • Y-axis: Frequency
  • Color/brightness: Amplitude
Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025
Spectral Analysis

Spectrogram

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

center

Fundamentals of Sound | Lorenz Schwarz | WS 2024/2025

Original content: © 2025 Lorenz Schwarz
Licensed under CC BY 4.0. Attribution required for all reuse.

Includes: text, diagrams, illustrations, photos, videos, and audio.

Third-party materials: Copyright respective owners, educational use.

Contact: lschwarz@hfg-karlsruhe.de

← Chapters

The FFT of a real signal produces mirrored results above the Nyquist frequency