How this pitch detector works
Your microphone captures an 8192-sample buffer in the browser — about 170 ms at 48 kHz, long enough to see several cycles even of low bass notes. The tool runs a McLeod-style normalized autocorrelation over that window — it compares the recent waveform with shifted copies of itself and looks for the strongest repeating cycle. That cycle length is the period of the wave; the inverse of the period is the frequency in Hz. The frequency is then converted to the closest musical note plus a cents offset (one semitone = 100 cents).
Before analysis we ask the browser to skip auto-gain, echo cancellation, and noise suppression on the microphone stream. Those filters smear the waveform and pull pitch readings off by tens of cents on quiet voices and low instruments, so disabling them is the single biggest accuracy win. A short median filter on the last few frames absorbs single-frame outliers without adding visible lag.
This approach tracks sustained, single-pitched sounds better than a plain FFT, particularly at low frequencies, because it is less likely to mistake upper harmonics for the note you are playing. The trade-off: it can't follow chords, vibrato makes the cents reading wobble, and a noisy background pushes it off the trail.
Reference: standard tuning
The detector starts at concert pitch A4 = 440 Hz, and you can adjust the reference if your instrument or ensemble uses another standard. Every other note is a fixed ratio away — the twelfth root of two (≈1.05946) per semitone. Octaves double the frequency: A3 is 220 Hz, A5 is 880 Hz. Cents measure how far off you are within a single semitone; differences under ±5 cents are generally inaudible.
Reading the display
- Big note — the closest semitone we've heard for the last few frames.
- Cents bar — the marker is centred when you're in tune, drifts left if you're flat, right if you're sharp. Green = in tune (±5 ¢), amber = close (±20 ¢), red = clearly off.
- Piano keyboard — highlights the detected note in its octave across C1–B6. Notes outside that span still appear in the readout.
- Last detected — every time you change to a new sustained pitch, we add it to a running list so you can review what you just sang or played.
Tips for accurate readings
- Sustain a single note for at least half a second — the detector needs a few frames of agreement before it commits.
- Quiet room. Fans, traffic, and keyboard clicks add up faster than you think.
- Hold the note steady. Vibrato shifts the cents reading even when the average pitch is correct.
- Use an external microphone where possible. Laptop mics roll off below ~80 Hz, which truncates the lowest bass notes.
- Get close. Doubling the distance to the mic quarters the level the detector sees.
Frequently asked questions
What instruments can I tune with this?
Anything that produces a single sustained pitch in roughly the 40 Hz – 2.2 kHz window: guitar, bass guitar, ukulele, violin, viola, cello, harp, brass, woodwinds, and your singing voice. Drums, cymbals, and full piano chords won't track — autocorrelation needs a single dominant frequency.
The note jumps around when I sing — is that me or the tool?
Mostly you, but not in the way you think. Microphones pick up your voice, your breath, and the room together, and small pitch wobbles that are inaudible to the ear show up as ±20 cent swings. Hold a louder, steadier note and the readout settles down.
Why does it stop detecting on very low or very high notes?
The detector is restricted to roughly 40 Hz – 2.2 kHz. Below 40 Hz most laptop microphones roll off; above 2.2 kHz harmonics start aliasing and the pitch estimate becomes unreliable. Within that range the tool covers everything from a low B0 on a 5-string bass to the top of a soprano's range.
Is anything recorded or sent to a server?
No. All audio analysis happens inside your browser using the Web Audio API. Nothing is uploaded, stored, or transmitted. Stop the detector or close the tab and the stream ends.