A real-time Digital Signal Processing (DSP) system for detecting the fundamental frequency (pitch) of the human voice using the Autocorrelation Method on the STM32F401RE microcontroller.
This project was developed for the Microprocessors and Assembly Language Course
(Academic Year 2025–2026).
This system captures analog voice signals through the ADC peripheral of the STM32F401RE and processes them in real time to estimate the speaker’s pitch within the human vocal range (85 Hz – 350 Hz).
The detected frequency is mapped to the nearest musical note and displayed on a 16x2 Character LCD.
The implementation focuses on:
- Real-time signal acquisition
- Time-domain DSP processing
- Low-level embedded programming
- Efficient memory management
- Register-level peripheral control without HAL abstraction
Detects the fundamental frequency of human speech using the Autocorrelation Function (ACF).
LCD communication is implemented entirely using custom drivers in both:
- 4-bit mode
- 8-bit mode
No HAL LCD libraries or external drivers are used.
Efficient FIFO-based sample storage for continuous ADC acquisition.
Input amplitudes are normalized before autocorrelation to improve resolution and stability.
Converts detected frequencies into corresponding musical notes such as:
- A4
- C3
- E2
- etc.
Includes a complete Proteus project for simulation and testing.
The system uses the Autocorrelation Function to detect periodicity in quasi-periodic voice signals.
The autocorrelation of the discrete signal
The pitch period is determined by finding the first significant non-zero peak in the autocorrelation output.
The pitch frequency is then calculated using:
Where:
-
$f_s$ → Sampling frequency -
$l_{peak}$ → Lag corresponding to the first autocorrelation peak
| Component | Description |
|---|---|
| Microcontroller | STM32F401RE (ARM Cortex-M4) |
| Display | 16x2 LCD (HD44780 Compatible) |
| Input Source | Microphone / Function Generator |
| Development Tools | STM32CubeIDE / Keil MDK |
| Simulation | Proteus Design Suite |
The ADC continuously samples the analog input signal and stores the data inside a circular FIFO buffer.
The system computes the autocorrelation function over a fixed analysis window.
Noise and insignificant peaks are ignored using threshold-based logic to identify the first valid autocorrelation peak.
The lag value is converted into the estimated pitch frequency.
The frequency is mapped to the nearest musical note.
Detected pitch and note information are displayed on the LCD in real time.
├── main core/
├── 4-bit LCD driver
├── Core DSP algorithms
│ ├── System initialization
│ └── Main application logic
│
├── 8bit mode LCD manipulation/
│ ├── 8-bit LCD driver
│ └── Register-level LCD routines
│
├── proteus project/
│ ├── Proteus schematic
│ └── Simulation files (.pdsprj)
│
├── audio files/
│ ├── Sample WAV files
│ └── Test audio signals
│
├── Final technical report
└── Design specifications
The complete project description, implementation details, mathematical analysis, hardware design, and final report are available in the PDF documents included in the repository.