Ukulele Tuner
Standard GCEA tuning, in your browser — the audio never leaves your device.
The microphone switches itself off when you leave the tab or after a few minutes of silence.
Which string?
Pick a peg or string to lock the tuner to it; otherwise it guesses.
Tuning: auto-detect
Reference tones
Play a string's pitch through your speakers and tune by ear.
Core algorithm
The tuner answers one question sixty times a second: given a short slice of microphone audio, what is its fundamental frequency? Everything else — the note name, the needle — falls out of that one number.
1. Autocorrelation
A plucked string is periodic: the waveform repeats every T seconds, and the pitch is 1/T. To find T, slide the signal against a copy of itself by a lag k and multiply overlapping samples:
c(k) = Σi xi · xi+k
When the lag equals the period, peaks land on peaks and the sum is large. The first strong peak after the initial descent is the period in samples, so the frequency is sampleRate / T₀. A parabola fitted through that peak and its two neighbours recovers a fractional lag — without it, the readout would quantise into visible steps, since one whole sample of lag is worth several cents at these frequencies.
2. Octave folding
Autocorrelation is prone to locking onto a harmonic — reporting 784 Hz for a 392 Hz string, because a signal that repeats every T also repeats every 2T. The four ukulele pitches all sit inside a single octave starting at C4, so the fix is to halve or double the detected frequency until it lands back in that octave. A reading outside 70–1400 Hz before folding is discarded as noise rather than dragged into range.
3. Cents
Pitch is perceived logarithmically, so the error is reported in cents — 1200 to the octave, 100 to a semitone:
cents = 1200 · log2(f / ftarget)
The tuner picks whichever of the four strings gives the smallest absolute cents value and calls anything within ±5¢ in tune. That threshold is roughly the limit of what an ear can pick out on a ukulele.
4. Smoothing
Raw frame-to-frame readings jitter by a few cents even on a steady note, which makes the needle unreadable. The displayed value is an exponential moving average that leans on its own history and folds in each new reading gently. When the detected note changes, the average resets rather than sliding across from the old string.