Categories
Linux News PC Reviews Technology

Automatic Guitar Tuner

Reading Time: 3 minutes

Guyrandy Jean-Gilles is a musical maker who took Raspberry Pi Pico and created something rather special. “The goal of the project was to make a low-cost, automatic guitar tuner,” he tells us. “I’d been meaning to do a project with Pico and there are few development boards as cheap and well-documented.”

Pico power

Guyrandy developed his idea over a two-month period, and the result is a very useful device. The guitarist chooses whichever string they want to tune and then places the tuner on the appropriate tuning peg. A button on the automatic tuner is held down by the user which then activates the microphone, and the tuner begins to determine the pitch of the tone coming from the plucked string. It then twists/adjusts the peg as necessary to ensure accurate tuning for sweet sounds.

Guyrandy tells us that Pico is the brains of the entire tuner: “It samples an electret microphone at 4096 samples per second, computes an FFT (fast Fourier transform), finds the strongest magnitude frequency in the audio, then turns a DC motor clockwise or counter-clockwise until the target frequency and the strongest frequency in the audio match.” 

Change your tune

As with all electronic makes, this was a learning experience with a few bridges to be crossed, and the trickiest part of the build was determining a guitar string’s pitch from audio. “There’s a lot of academic research in the area that I wasn’t aware of before starting the project,” says Guyrandy. “This version found the strongest magnitude in a fast Fourier transform, and assumed that was the fundamental frequency.”

In terms of accuracy, he found a few blips that he had to even out. “The tuner’s frequency detection is repeatable but inaccurate. It will mistakenly think harmonics are the fundamental frequency for almost all cases. I had to hard-code harmonic frequencies into the firmware to make the tuner work appropriately,” he explains. 

That said, the tunings are reliably inaccurate so they can be used to correctly tune a guitar. “For example, the low E string is 82.4 Hz in standard tuning, but the project repeatable thinks it’s 250 Hz. Currently alternate tunings aren’t possible, but with a firmware change, drop tunings can be achieved.”

Guyrandy has had plenty of suggestions from other makers in terms of potential improvements, including adding a vibration sensor so the tuner can be used in a noisy setting, and also “to make a tuner that fits over all the tuning heads of the guitar and tunes all the strings simultaneously. While this is cool, I’m not sure how I’d separate two different fundamental frequencies from one audio signal.”

He is currently working on a second version of the tuner and will be trying the YIN algorithm to detect frequency, as well as incorporating some piezo-electric sensors to pick up vibrations, along with a stronger motor.

If you’d like to have a go at making your own version of the tuner, Guyrandy has generously made his code open-source, and information on exactly what you need in order to build it can be found on his GitLab page. Why not dust off that old guitar and get making?

Facebook Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.