Skip to main content
CodeLint.Dev Dev Tools

Pitch Detector — Real-Time Frequency & Note

Detects the fundamental frequency from your microphone and shows the nearest note with its cent offset.

−50+500
No pitch detected

Why pitch detection is harder than it looks

Finding the loudest frequency in a signal is easy. Finding the pitch is not, because the loudest frequency is frequently not the fundamental.

Almost every real instrument produces a harmonic series — a fundamental plus integer multiples of it. Depending on the instrument, the playing technique and the microphone, the second or third harmonic can be stronger than the fundamental. A naive peak-picking detector then reports a note an octave or a fifth too high.

Worse, the human ear does not need the fundamental at all. Play a note through a small speaker that cannot reproduce 100 Hz and you still hear the pitch, because the brain infers it from the spacing of the harmonics. This is the "missing fundamental" effect, and it is why telephone speech sounds pitched despite carrying almost nothing below 300 Hz.

Robust detectors therefore work in the time domain rather than by picking spectral peaks — autocorrelation, or the YIN algorithm and its descendants, which look for the period at which the waveform best repeats. That handles the missing fundamental correctly and is far less prone to octave errors.

Getting a stable reading

  • Sustain the noteDetection needs several complete cycles. A short staccato note at low pitch may not last long enough to analyse.
  • Low notes are harderA 41 Hz low E has a 24 ms period, so a reliable estimate takes a meaningful fraction of a second. Expect slower, less stable readings down there.
  • Play softly for a cleaner fundamentalA hard attack emphasises upper harmonics and increases the chance of an octave error.
  • One note at a timeThese algorithms are monophonic. A chord produces an unstable reading that jumps between constituent notes — polyphonic pitch detection is a substantially harder problem.
  • Reduce background noiseFans, air conditioning and traffic all add low-frequency energy that competes with the fundamental you are trying to find.

About

The Pitch Detector listens to your microphone and uses an autocorrelation algorithm to detect the dominant pitch in real time. It displays the closest musical note (e.g. A4), the exact frequency in Hz, and how many cents sharp or sharp you are — just like a guitar tuner. The needle gauge gives immediate visual feedback.

How to use

  1. 1 Click Start Mic and allow microphone access.
  2. 2 Sing or play an instrument near the microphone.
  3. 3 The note name, frequency, and cents deviation update in real time.
  4. 4 The needle on the gauge shows whether you are flat (left) or sharp (right).
  5. 5 A green needle means you are within ±5 cents of the target note.
How does the pitch detector work?
The tool uses the autocorrelation algorithm on the microphone input to detect periodicity in the waveform, which corresponds to the fundamental frequency (pitch). Autocorrelation is preferred over FFT for pitch detection because it is more accurate for monophonic signals like a single voice or instrument string, especially at lower frequencies.
What does "cents" mean in pitch detection?
A cent is 1/100th of a semitone (the smallest interval on a standard keyboard). A pitch deviation of +50 cents means you are halfway between your note and the note above; -50 cents means halfway below. ±10 cents is generally acceptable for ensemble playing; ±5 cents or closer is ideal. Professional players and in-tune voices typically stay within ±10 cents of the target pitch.
Why does the pitch detector show an incorrect note for some instruments?
Some instruments produce strong overtones (harmonics) that can confuse pitch detection algorithms. Electric guitars with distortion, bowed strings with high bow pressure, and brass instruments can produce harmonics strong enough to be detected as the "dominant" pitch instead of the fundamental. For best results, play single clean notes at a moderate volume directly into the microphone, minimising background noise.