Guitar Tuner With Raspberry and Python

Karol, 27 September 2020

As one of projects on the university I've made my own guitar tuner using Raspberry Pi. Everything was coded in Python 3. The tuner is packed up in 3d printed enclosure (but it's only a prototype, needs to be polished :) ).

guitar tuner using RPI

Things I used to build guitar tuner

  • Raspberry Pi 3B+,
  • USB sound card,
  • Tie clip microphone,
  • LED diode,
  • 2x buttons,
  • 2x16 LCD display,
  • 10k potentiometer
USB external soundcard is needed as Rpi doesn't have microphone input. As microphone I used tie clip mic - it can be attachet easily to the guitar near the strings. LED diode is for indication. Button is needed for turning on and off the tuner. Potentiometer is needed for LCD display.

Video with the tuner.

In the video above it is visible how the tuner works. After startup you can turn on tuner with the button. The second button is used to turn off the tuner when it is running, or shutdown the Linux system when the Rpi is waiting for turning on the tuner.
The program responsible for tuning is written in python. The audio is collected using pyaudio lib. Then audio signal is filtrated and transformed with Fourier Transformation. With finding the peaks in Fourier transform of a signal, the program matches string frequency with musical notes.

In the midlle of the screen, the current note and arrow(tune up, or down) is displayed. On the left we have string frequency and on the right there is an octave of the played note.

The tuners accuarcy is about +/-0.3 Hz. But the accuarcy can be easily increased with zero-padding in Fourier Transformation. Anyway 0.3Hz is quite good and makes the tuner very fast (I didn't try increasing accuarcy more than 0.3 Hz, but I think it won't strongly affect the speed of tuner).

Some more photos below:

guitar tuner using RPI 2

guitar tuner bottom side

guitar tuner inside

I will post the code if there will be request - email me with the form on the main page ;)