Real-Time Audio Spectrum Analysis Using MCU and FPGA

Daniel Cao EIM Technology

Abstract

This project implements a real-time audio spectrum analyzer using a heterogeneous MCU–FPGA architecture. A 64-point Fast Fourier Transform (FFT), operating on audio samples at 22.05 kS/s, converts post-equalization signals into a live 32-band spectrum display. The FPGA performs digital filtering, windowing, FFT computation, and precisely timed audio output, while the microcontroller manages file access, user interaction, and visualization. The project demonstrates the integration of Fourier analysis, digital signal processing, and hardware-efficient embedded system design.

Keywords: Fast Fourier Transform (FFT) Digital Signal Processing (DSP) FPGA Microcontroller Digital Audio Hardware–Software Co-design
| Alt text: Real-time audio visualizer on the STEPICO RP2040 board with microphone front end and ST7789 display | under the project 5 heading

Graphical Abstract

Example block diagram of an electronics project signal chain | after the evidence table, before the paragraph that starts "When a measurement disagrees with theory

01. Scientific Principles

Fourier analysis reveals the frequency components underlying a time-domain signal. Complex audio waveforms can be decomposed into sinusoidal components, allowing their spectral characteristics to be examined independently of their original waveform.

For a discrete signal containing N samples, the Discrete Fourier Transform (DFT) is defined as:

X[k] = ∑n=0N−1 x[n]e−j2πkn/N

The system uses a 64-point FFT at a sampling rate of 22.05 kS/s, producing a frequency-bin spacing of approximately 344.5 Hz. A Hann window is applied before transformation to reduce spectral leakage, at the expense of wider spectral peaks.

Δf = fs / N = 22050 / 64 ≈ 344.5 Hz

02. System Architecture

The system distributes computational and control tasks between an RP2040 microcontroller (STEPICO) and a MachXO2 FPGA (STEPFPGA).

The MCU streams PCM audio samples from a microSD card to the FPGA over SPI. Following digital equalization, the processed signal is routed to both a 10-bit R-2R DAC and a dedicated FFT module.

The FFT is implemented through six stages of butterfly operations using 16-bit real and imaginary components. A state machine sequences the computation, sharing a serial multiplier between windowing and FFT processing to reduce hardware resource consumption.

Technical Specifications

ParameterSpecification
MicrocontrollerRP2040
FPGAMachXO2
Sampling Rate22.05 kS/s
FFT Length64 points
Frequency Bin Spacing344.5 Hz
Spectrum Display32 bars
Window FunctionHann
FFT ArchitectureSix-stage butterfly
Complex Data Width16-bit real + 16-bit imaginary
Audio Output10-bit R-2R DAC
CommunicationSPI

03. Experimental Results

The system visualizes the post-EQ audio spectrum through 32 frequency bars spanning approximately 345 Hz to 11 kHz. Six selectable equalization presets allow the relationship between audible frequency balance and spectral distribution to be investigated.

EQ PresetExpected Spectral Response
NormalReference response
ClassicalGreater high-frequency emphasis
JazzGreater low-frequency emphasis
RockEnhanced low and high frequencies
Bass BoostDominant lower frequencies
TelephoneNarrower mid-frequency emphasis

These responses depend on the frequency content of the original audio signal. The relatively coarse frequency resolution provides a useful overview of musical content, although deep-bass components and closely spaced frequencies cannot be clearly resolved. Audio streaming is prioritized over display updates to maintain continuous playback.

04. Further Exploration

The same architecture can be extended toward acoustic monitoring, digital instrumentation, real-time filter characterization, and embedded audio analysis. Increasing the FFT length, investigating alternative window functions, and optimizing FPGA arithmetic provide further opportunities to explore the trade-offs between frequency resolution, computational latency, and hardware resource utilization.

Hardware Platform
Digital & Embedded Electronics Lab Kit (FE22)
Explore the platform →

BECOME A PIONEER

Subscribe our monthly newsletter to gain access to exclusive hardware deep-dives and priority testing for new EIM innovations.

One high-value briefing per month. No spam, just pure engineering. Unsubscribe anytime.