A real-time guitar tuner and chord detector built with ESP32 and an INMP441 I2S microphone. Features a web-based interface with Gruvbox dark theme for visual feedback.
- Real-time Processing
- Guitar Tuning Mode
- Chord Detection Mode
- Web Interface
| Component | Description |
|---|---|
| ESP32 | ESP32-S3 is used but any ESP32 board with I2S support should work |
| INMP441 | I2S MEMS microphone |
| Jumper wires | For connecting microphone to ESP32 |
INMP441 ESP32
------ -----
VDD 3.3V
GND GND
WS GPIO25
SCK GPIO26
SD GPIO33
L/R GND
- Audio Capture: I2S microphone captures audio
- FFT: FFT realised using ESP-DSP library
- Harmonic Product Spectrum (HPS): Compresses spectrum at multiple harmonic ratios to find fundamental frequency
- Quadratic Interpolation: Refines frequency estimate between FFT bins
- Octave Correction: Validates detected frequency against harmonic relationships
- Note Matching: Finds closest note in chromatic scale and calculates cents offset
- Pitch Class Extraction: Maps frequency components to pitch classes (C, C#, D, etc.)
- Energy Accumulation: Aggregates pitch energy over multiple frames
- Template Matching: Compares against major/minor chord templates using dot product
- Classification: Returns chord with highest match score above threshold
- ESP-IDF v5.0 or later
# Navigate to project directory
cd src
# Build the project
idf.py build
# Flash to ESP32 (replace PORT with your serial port)
# Linux: ls /dev/ttyUSB0 or /dev/ttyACM0
# macOS: ls /dev/cu.usbserial-*
idf.py -p PORT flash
# Monitor serial output
idf.py -p PORT monitorYou could also use the ESP-IDF extension in Visual Studio Code.
- Flash the firmware to the ESP32
- Connect to WiFi network
ESP_GUITAR_TUNER(password:12345678) - Open browser and navigate to IP adress provided, usually
192.168.4.1 - Go to the Tuner page and play a string
- The display shows detected note, frequency, and cents deviation
- Open
main/main.cand change the mode flag:#define CHORD_DETECTION_MODE 1
- Rebuild and flash the firmware
- Connect to the WiFi and web interface as above
- Strum a chord and view detection in serial monitor

