Audio signals contain information in both time and frequency. Understanding how this information is represented is fundamental to modern audio engineering, from MEMS microphone systems and speech enhancement to noise reduction, beamforming, and AI-based audio processing.
Two of the most important tools for analyzing audio signals are the Fast Fourier Transform (FFT) and the Short-Time Fourier Transform (STFT).
FFT provides an efficient way to analyze the frequency content of a digital signal, while STFT extends this concept to show how the frequency content changes over time.
This guide explains the difference between DFT, FFT, and STFT, how they work, and why they are widely used in practical audio signal processing systems.
What Is the Fourier Transform in Audio Processing?
An audio waveform in the time domain shows how sound pressure or microphone output changes over time.
For example, a microphone recording can be represented as:
x(t)
where t represents time.
However, a time-domain waveform does not directly tell us which frequencies are present.
The Fourier Transform provides another representation:
time domain → frequency domain
Instead of asking:
How does the signal change over time?
we can ask:
What frequency components are contained in the signal?
This is particularly useful because many characteristics of speech, music, mechanical noise, and environmental noise are easier to identify in the frequency domain.
For example:
- low-frequency noise may appear as strong energy below a certain frequency;
- fan noise may contain relatively stable spectral components;
- speech contains characteristic harmonic and formant structures;
- tonal interference can appear as narrow peaks in the spectrum.
This frequency-domain information forms the foundation for many audio processing algorithms.
DFT: The Foundation of Frequency Analysis
The Discrete Fourier Transform (DFT) converts a finite sequence of discrete samples into a representation of its frequency components.
For a sequence of N samples, the DFT is:
X[k] = Σ x[n]e^(-j2πkn/N)
where:
- x[n] is the input signal
- X[k] is the complex frequency-domain representation
- N is the number of samples
- n is the time-domain sample index
- k is the frequency-bin index
The output contains both magnitude and phase information.
The magnitude can be calculated as:
|X[k]|
and the phase as:
∠X[k]
In practical audio systems, engineers frequently analyze the magnitude spectrum because it provides an intuitive view of where signal energy is concentrated.
What Is FFT?
The Fast Fourier Transform (FFT) is not a different mathematical transform from the DFT.
Instead, FFT refers to a family of algorithms that calculate the DFT much more efficiently.
A direct DFT implementation has computational complexity approximately proportional to:
O(N²)
An FFT algorithm can reduce this to approximately:
O(N log N)
for common FFT structures.
This difference becomes significant when processing large numbers of audio samples or when FFT calculations must be repeated continuously in real time.
For example, an audio DSP may calculate an FFT for every incoming frame.
Using an efficient FFT implementation makes it practical to perform operations such as:
- spectral analysis
- noise estimation
- equalization
- filtering
- speech enhancement
- acoustic measurement
- feature extraction
- beamforming-related processing
- AI preprocessing
Why Is FFT Important in Audio Processing?
The FFT is widely used because many audio-processing problems are easier to solve or understand in the frequency domain.
A simplified processing chain can be:
Microphone → ADC → Audio Frame → FFT → Frequency Analysis → Processing → IFFT → Output
Depending on the application, the frequency-domain processing stage may perform:
- noise suppression
- spectral filtering
- gain adjustment
- frequency-domain masking
- signal measurement
- feature extraction
For example, a simple noise reduction system can estimate the background-noise spectrum and reduce the gain of frequency components dominated by noise.
This concept is used in classical algorithms such as spectral subtraction and Wiener filtering.
FFT Frequency Resolution
One of the most important concepts when using an FFT is frequency resolution.
For a sampling rate of Fs and an FFT size of N, the frequency-bin spacing is:
Δf = Fs / N
For example, suppose:
- sampling rate = 16 kHz
- FFT size = 512
Then:
Δf = 16000 / 512 = 31.25 Hz
Each FFT bin therefore represents approximately 31.25 Hz of frequency spacing.
Increasing the FFT size improves frequency resolution.
For example:
| Sampling Rate | FFT Size | Frequency Resolution |
|---|---|---|
| 16 kHz | 256 | 62.5 Hz |
| 16 kHz | 512 | 31.25 Hz |
| 16 kHz | 1024 | 15.625 Hz |
| 48 kHz | 1024 | 46.875 Hz |
| 48 kHz | 2048 | 23.4375 Hz |
However, a larger FFT is not automatically better.
A larger FFT also means a longer analysis window, which affects temporal resolution and processing latency.
This creates an important engineering trade-off:
Frequency resolution vs. time resolution vs. latency
FFT Size and Audio Processing Latency
In real-time audio systems, the choice of FFT size affects more than frequency resolution.
For a sampling rate Fs and frame length N, the duration represented by one frame is approximately:
T = N / Fs
For example, with a 16 kHz sampling rate:
- 256 samples = 16 ms
- 512 samples = 32 ms
- 1024 samples = 64 ms
A larger frame provides more frequency information but also increases the time span being analyzed.
This can increase algorithmic latency depending on the complete processing architecture.
For voice communication, conferencing, interactive audio, and embedded systems, latency can be as important as spectral resolution.
Therefore, FFT size should be selected according to the actual application rather than simply maximizing N.
What Is STFT?
The Short-Time Fourier Transform (STFT) applies Fourier analysis to short segments of an audio signal.
This is important because real-world audio signals are usually non-stationary.
Speech, for example, changes continuously.
A single FFT over an entire recording could tell us which frequencies occur somewhere in the recording, but it would not tell us precisely when those frequencies occur.
STFT addresses this by dividing the signal into short, usually overlapping frames.
The basic process is:
Audio signal
↓
Frame segmentation
↓
Windowing
↓
FFT for each frame
↓
Time-frequency representation
A simplified STFT equation is:
STFT{x}(m, k) = Σ x[n]w[n − mH]e^(-j2πkn/N)
where:
- x[n] is the audio signal
- w[n] is the analysis window
- m represents the frame position
- H is the hop size
- k represents the frequency bin
- N is the FFT size
The result contains information about both time and frequency.
Why STFT Is Better Suited to Speech and Environmental Audio
Consider a short voice recording.
At one moment, the speaker may produce a vowel with strong harmonic energy.
A few milliseconds later, the speaker may produce a consonant containing much broader high-frequency energy.
At the same time, a background fan or air-conditioning system may produce relatively stable low-frequency or tonal components.
A single FFT cannot clearly show this evolution.
STFT produces a time-frequency representation, often visualized as a spectrogram.
A spectrogram can show:
- horizontal axis → time
- vertical axis → frequency
- intensity → signal magnitude or power
This makes STFT particularly useful for:
- speech analysis
- speech enhancement
- noise analysis
- voice activity detection
- audio classification
- acoustic event detection
- music analysis
- machine listening
- AI audio processing
Windowing: Why It Is Necessary
Before applying an FFT to each STFT frame, engineers normally apply a window function.
Common windows include:
- Hann window
- Hamming window
- Blackman window
- Rectangular window
The purpose of windowing is to reduce spectral leakage caused by analyzing a finite segment of a signal.
Without windowing, a frequency component that does not align perfectly with an FFT bin can spread its energy across neighboring bins.
The choice of window affects:
- main-lobe width
- side-lobe level
- amplitude accuracy
- frequency discrimination
The Hann window is commonly used in practical audio applications because it provides a useful balance between spectral leakage and frequency resolution.
Spectral Leakage Explained
Suppose a sinusoidal signal has a frequency that does not correspond exactly to an FFT bin.
An ideal expectation might be:
one frequency → one FFT peak
In practice, the energy spreads into neighboring frequency bins.
This is called spectral leakage.
Windowing can reduce this leakage, although no window eliminates all trade-offs.
This is why FFT results should not be interpreted without considering:
- sampling rate
- FFT size
- window type
- window length
- signal frequency
- overlap
These parameters all influence the resulting spectrum.
Overlap and Hop Size in STFT
STFT frames are commonly overlapped.
For example, a system might use:
- 20–32 ms frame length
- 50% overlap
- 75% overlap
The hop size determines how far the analysis window moves between successive frames.
If:
N = frame length
and:
H = hop size
then the overlap ratio is:
Overlap = 1 − H/N
For example, if:
- N = 512
- H = 128
then:
Overlap = 75%
Higher overlap provides more frequent updates and smoother time-frequency tracking, but it also increases the number of FFT operations and therefore computational requirements.
STFT and Noise Reduction
STFT is particularly important in audio noise reduction because it converts the problem into a series of time-frequency processing operations.
A typical STFT-based noise reduction system looks like this:
Noisy audio
↓
Framing
↓
Windowing
↓
FFT
↓
Noise estimation
↓
Gain calculation / spectral mask
↓
Frequency-domain processing
↓
Inverse FFT
↓
Overlap-add
↓
Enhanced audio
This architecture is used in many traditional speech-enhancement systems.
For example, spectral subtraction can estimate the noise spectrum and attenuate frequency components associated with background noise.
Wiener filtering can calculate a frequency-dependent gain based on estimated signal and noise power.
STFT and Spectral Subtraction
Spectral subtraction is a good example of why STFT is useful.
Suppose:
Y(f) = X(f) + N(f)
where:
- X(f) = desired signal
- N(f) = noise
- Y(f) = observed signal
If the system can estimate the noise spectrum, it can attempt to recover the desired signal.
In a simplified power-spectrum implementation:
P̂x(f) = max[Py(f) − αPn(f), Pmin(f)]
where:
- Py(f) = noisy-signal power spectrum
- Pn(f) = estimated noise power spectrum
- α = oversubtraction factor
- Pmin(f) = spectral floor
Because the speech and noise characteristics change over time, this operation is normally performed frame by frame.
That is where STFT becomes extremely useful.
STFT and AI-Based Speech Enhancement
STFT is also widely used as a feature representation for AI-based audio processing.
A neural network can receive:
Noisy waveform
→ STFT
→ Magnitude / complex spectrum
→ Neural network
→ Enhanced spectrum
→ ISTFT
→ Enhanced waveform
Depending on the model, the network may estimate:
- clean magnitude spectrum
- ideal ratio mask
- complex spectrum
- noise spectrum
- time-frequency mask
This approach is common in speech enhancement and audio denoising research and engineering.
However, modern neural networks can also operate directly on waveforms, so STFT is not mandatory for every AI audio system.
The choice depends on the model architecture, computational requirements, latency, and target application.
FFT vs STFT: What Is the Difference?
The simplest distinction is:
FFT analyzes frequency content efficiently. STFT analyzes how frequency content changes over time.
| Feature | FFT | STFT |
|---|---|---|
| Main purpose | Frequency analysis | Time-frequency analysis |
| Time information | Limited for one FFT | Preserved across frames |
| Processing | One signal segment | Multiple overlapping segments |
| Typical output | Spectrum | Spectrogram / time-frequency matrix |
| Computational load | Lower for one transform | Higher because many FFTs are performed |
| Common applications | Spectrum analysis, filtering | Speech, noise reduction, transient analysis |
| Key parameters | FFT size, sampling rate | FFT size, window, hop size, overlap |
It is therefore more accurate to think of STFT as a framework that repeatedly applies Fourier analysis to short sections of a signal, rather than as a completely unrelated transform.
FFT vs STFT: Which One Should You Use?
The answer depends on the application.
Use FFT when you need:
- frequency spectrum measurement
- harmonic analysis
- frequency response analysis
- stationary signal analysis
- spectral monitoring
- simple frequency-domain processing
Use STFT when you need:
- speech analysis
- changing noise analysis
- transient detection
- time-frequency visualization
- speech enhancement
- spectral noise reduction
- continuously changing audio analysis
For most practical speech and environmental audio systems, STFT is often more informative because the acoustic signal changes over time.
Practical Example: Analyzing a Microphone Signal
Consider a MEMS microphone recording a person speaking in a room with an air-conditioning system running in the background.
The microphone captures:
Speech + HVAC noise + room noise + microphone/electronic noise
A raw waveform may not make it immediately obvious which components belong to speech and which belong to the background.
An FFT can reveal the overall frequency distribution.
An STFT can go further by showing:
- when the person is speaking
- which frequency bands contain speech energy
- whether the HVAC noise is relatively stable
- where transient noises occur
- how the spectrum changes between speech and silence
This information can then be used by downstream processing such as:
- noise estimation
- voice activity detection
- spectral filtering
- beamforming
- speech enhancement
- AI-based noise suppression
FFT and STFT in Microphone Array Systems
FFT and STFT become even more useful when multiple microphones are involved.
A microphone array may contain several synchronized MEMS microphones.
Each channel produces an audio stream:
Mic 1 → x₁(t)
Mic 2 → x₂(t)
Mic 3 → x₃(t)
Mic 4 → x₄(t)
and so on.
The signals can be transformed into the frequency domain and processed jointly.
This enables techniques such as:
- frequency-domain beamforming
- spatial filtering
- direction-of-arrival estimation
- multi-channel noise reduction
- post-filtering
- acoustic source separation
The relative phase and amplitude information between microphone channels becomes important.
This is one reason why accurate synchronization and consistent microphone characteristics are important in microphone array design.
FFT, STFT and Beamforming
In a frequency-domain beamforming system, the processing chain can be simplified as:
Multiple MEMS microphones
↓
Synchronized audio channels
↓
STFT
↓
Spatial filtering / beamforming
↓
Post-filtering
↓
Inverse STFT
↓
Enhanced audio
The system can use differences in the arrival time and phase of sound between microphones to emphasize a target direction and reduce unwanted spatial components.
This connects FFT/STFT directly to practical microphone array technologies.
Choosing FFT Parameters for Real-Time Audio
There is no universal FFT configuration.
Engineers normally consider several parameters together.
Sampling Rate
Higher sampling rates provide a wider usable frequency range but increase data and processing requirements.
Common speech/audio processing rates include:
- 16 kHz
- 24 kHz
- 32 kHz
- 44.1 kHz
- 48 kHz
The appropriate rate depends on the application and target frequency range.
FFT Size
Larger FFT sizes provide finer frequency spacing:
Δf = Fs/N
but increase the analysis window length and computational workload.
Frame Length
Frame length determines how much audio is analyzed at one time.
Short frames provide better temporal resolution.
Longer frames provide better frequency resolution.
Hop Size
A smaller hop size means more frequent processing updates.
This can improve temporal tracking but increases computational load.
Window Function
The window affects spectral leakage and frequency discrimination.
The Hann window is a common starting point, but the optimal choice depends on the measurement or processing objective.
A Practical STFT Configuration for Speech
As an engineering starting point, a speech-processing system might use:
- Sampling rate: 16 kHz
- Frame length: 20–32 ms
- FFT size: 512
- Window: Hann
- Overlap: 50–75%
These are examples rather than universal specifications.
The optimum parameters should be validated against:
- target latency
- speech quality
- noise characteristics
- processor capability
- memory requirements
- algorithm design
For embedded systems, parameter selection should always be evaluated together with the complete processing chain.
Common FFT and STFT Mistakes
Mistake 1: Assuming a Larger FFT Is Always Better
A larger FFT improves frequency-bin spacing but can reduce temporal resolution and increase latency.
Mistake 2: Ignoring Windowing
Applying FFT directly to a finite signal segment can produce significant spectral leakage.
Mistake 3: Confusing FFT Size With Frequency Resolution
Frequency resolution depends on both sampling rate and FFT size:
Δf = Fs/N
Increasing the sampling rate while keeping N unchanged actually increases the frequency-bin spacing.
Mistake 4: Ignoring Phase
Magnitude spectra are useful, but phase information can also be important, particularly for:
- multi-microphone processing
- beamforming
- signal reconstruction
- complex spectral enhancement
Mistake 5: Treating STFT as a Zero-Latency Operation
Real-time STFT processing introduces frame-based buffering and processing delay.
The complete system latency depends on:
- frame length
- hop size
- buffering
- FFT/IFFT processing
- algorithmic look-ahead
- hardware/software implementation
Python Example: FFT of an Audio Signal
A simple FFT workflow can be implemented with Python libraries such as NumPy and SciPy.
import numpy as np
from scipy.io import wavfile
fs, audio = wavfile.read("audio.wav")
# Use one channel if the recording is stereo
if audio.ndim > 1:
audio = audio[:, 0]
N = len(audio)
spectrum = np.fft.rfft(audio)
frequencies = np.fft.rfftfreq(N, d=1/fs)
magnitude = np.abs(spectrum)
print("Sampling rate:", fs)
print("Number of samples:", N)
print("Frequency resolution:", fs / N)This example calculates the one-sided FFT spectrum of an audio recording.
For real-time audio processing, engineers normally process shorter frames rather than calculating one FFT over the entire recording.
Python Example: STFT
SciPy provides an STFT implementation that can be used for time-frequency analysis.
import numpy as np
from scipy.io import wavfile
from scipy.signal import stft
fs, audio = wavfile.read("audio.wav")
if audio.ndim > 1:
audio = audio[:, 0]
frequencies, times, Zxx = stft(
audio,
fs=fs,
window="hann",
nperseg=512,
noverlap=256
)
magnitude = np.abs(Zxx)
print("Frequency bins:", len(frequencies))
print("Time frames:", len(times))The resulting matrix contains the complex STFT representation.
Its magnitude can be visualized as a spectrogram to observe how the audio spectrum changes over time.
SciPy’s signal-processing documentation provides further implementation details for STFT and related signal-processing functions.
From FFT and STFT to Modern Audio Intelligence
FFT and STFT are not simply academic signal-processing concepts.
They remain important building blocks in practical audio systems.
A modern audio-processing pipeline may look like:
↓
Analog / Digital Front End
↓
Audio Sampling
↓
Framing
↓
FFT / STFT
↓
Noise Estimation
↓
Beamforming
↓
DSP Noise Reduction
↓
AI Speech Enhancement
↓
Voice Recognition / Communication / Audio Output
This architecture illustrates an important point:
Good audio intelligence begins with good signal representation.
The microphone provides the acoustic information, while DSP and AI algorithms determine how that information is analyzed and enhanced.
Conclusion
FFT and STFT are fundamental tools in digital audio signal processing.
The FFT provides an efficient way to calculate the frequency-domain representation of a sampled signal. It is widely used for spectrum analysis, filtering, feature extraction, and real-time DSP.
STFT extends this approach by analyzing short, overlapping sections of the signal, making it possible to observe how frequency content changes over time.
For speech, environmental sound, and noise reduction, this time-frequency representation is particularly valuable.
In practical microphone systems, FFT and STFT can form part of a larger processing architecture involving noise estimation, spectral filtering, beamforming, microphone arrays, and AI-based speech enhancement.
The key engineering challenge is not simply choosing the largest FFT or the most sophisticated algorithm. It is selecting the appropriate combination of sampling rate, frame length, FFT size, window, overlap, latency, and processing architecture for the target application.
For developers working with MEMS microphones and multi-microphone systems, understanding FFT and STFT provides an essential foundation for designing more effective audio acquisition and noise reduction systems.
Frequently Asked Questions
What is FFT in audio processing?
FFT is an efficient algorithm for calculating the Discrete Fourier Transform. It converts sampled audio from the time domain into a frequency-domain representation.
What is STFT in audio processing?
STFT applies Fourier analysis to short, usually overlapping sections of an audio signal. It provides information about how the frequency content changes over time.
What is the difference between FFT and STFT?
FFT provides frequency information for a signal segment, while STFT repeatedly performs Fourier analysis on short segments to create a time-frequency representation.
Why is STFT used for speech processing?
Speech is non-stationary and its frequency content changes continuously. STFT captures these changes and is therefore useful for speech enhancement, noise reduction, and speech analysis.
Does a larger FFT size improve audio quality?
Not necessarily. A larger FFT improves frequency-bin spacing but can increase processing time, computational requirements, and latency. The appropriate FFT size depends on the application.
What is FFT frequency resolution?
FFT frequency-bin spacing is approximately:
Δf = Fs/N
where Fs is the sampling rate and N is the FFT size.
What window should be used for STFT?
The Hann window is a common choice for general audio analysis and processing, but the best window depends on the specific application and measurement requirements.
Is STFT necessary for AI noise reduction?
No. Many AI models use STFT features or time-frequency representations, but some modern models process raw audio waveforms directly. The appropriate architecture depends on the model and application.
Can FFT and STFT be used with microphone arrays?
Yes. FFT and STFT are widely used in multi-microphone processing, including frequency-domain beamforming, spatial filtering, noise reduction, and acoustic source analysis.