Online Guitar Tuner using Microphone

Published 2022-02-05

IU Home > Projects > guitar-tuner
An online guitar tuner that runs in your browser. The tuner will listen through your microphone input and help tune your instrument correctly. No audio data leaves your device. All processing is done locally in your browser.
VU
Pitch you are Playing Target string Pitch
 

How to Tune Your Guitar

To use the online tuner, sit close to your devices microphone and repeatedly play a single open string on your guitar once every few seconds. The virtual fretboard will highlight which string it thinks you are playing. This is the target string for the tuning.

If the target string is below the one you are playing you need to tighten your string. If the target string is above the one you are playing you need to slacken your string.

You will receive real time advice once the string is close to being in tune just above the fretboard. Once in tune the target and played pitch frequencies will be within 1% of each other.

Silence all strings before moving to a new string. Tune each string of your instrument until all strings are in tune.

If you have an electric or electro-acoustic guitar, connecting it to your devices microphone input will give the best results. Otherwise try to minimise background noise that could confuse the tuner.

About the Tuner

The guitar is always tuned using an equal temperament scale due to the fixed position of the frets on the instrument. This is similar to the way a piano or organ must be tuned.

Chromatic Tuning

The equal temperament scale is a chromatic tuning used widely in western music. It provides a compromise between perfect intervals and a range of notes whose frequencies are close to perfect intervals but far more practical when playing a musical tune of more than a few key progressions with an ensemble of instruments.

Perfect intervals can be produced by singers or players of none fretted or stopped instruments for a given key. The frequencies in perfect intervals are related by whole numbers and produce no dissonance, physically there are no beats in the wave form, giving a very pure sound. The perfect interval is often described as feeling fully resolved. The chromatic tuning contains more imperfect intervals which give the music a more tense feeling requiring the melody to move towards perfect intervals to relieve tension in the listeners mind.

The equal temperament scale of this tuner is calibrated such that the note A4 is at a frequency of 440 Hz (Hertz). This is the ISO standard for this musical note.

Pitch Detection Algorithm

The algorithm takes a sample of audio from your microphone. It then analyses the sample using Fourier analysis on your device to determine its fundamental frequency. The frequency is used to pick the string being tuned by comparing it to a precomputed equal temperament scale of frequencies.

The difference between the detected frequency and the pre computed table frequency is used to provide the real time advice on how to tighten and slacken the string.

A volume unit (VU) meter is displayed so you can see how loud the signal to the tuner is. A louder signal will give a more accurate result as the ratio of the signal to background noise will be higher.