How FFT Works in Pitch Detection: Peaks Are Not Always Notes

An FFT efficiently calculates the frequency components of a sampled signal; it does not automatically identify the played musical note. Pitch estimation needs another step that interprets spectral structure, periodicity or both.

This distinction matters for voices and instruments. The strongest component can be an overtone, while the note you hear corresponds to a lower fundamental. A spectrum is useful evidence, but selecting its tallest peak is not a complete general-purpose tuner.

What does the FFT actually calculate?

The fast Fourier transform is an efficient algorithm for computing a discrete Fourier transform. It transforms a finite block of samples into values associated with frequency bins.

Those values describe magnitude and phase relationships within the analysed block. A display commonly plots magnitude against frequency. A spectrogram repeats this process over successive blocks to show spectral changes over time.

The spectrogram guide explains how time, frequency and intensity appear in that view. Its bright lines are spectral components, not automatically a list of separately performed notes.

From microphone samples to a spectral estimate

  1. Capture or decode audio with a known sample rate.
  2. Select a frame containing a limited number of samples.
  3. Apply appropriate preprocessing and a window.
  4. Calculate the transform.
  5. Inspect peaks or harmonic patterns.
  6. Estimate the relevant fundamental, then map it to a reference grid.

The final steps depend on the method. Some systems use harmonic summation or products; others combine spectral evidence with time-domain periodicity. The FFT supplies a representation, not the complete decision rule.

Why the largest peak may be wrong for pitch

Suppose an illustrative voice has a fundamental near 220 Hz, with components near 440, 660 and 880 Hz. Resonances can make 440 or 660 stronger than the fundamental. Picking the strongest peak could therefore return an octave or another harmonic above the intended F0.

A missing or weak fundamental creates a related challenge. The harmonic spacing can still support a lower pitch estimate even when there is little energy exactly at that frequency.

Do not “correct” the singer merely because a spectrum maximum differs from a monophonic detector’s output. First ask what each display is measuring.

FFT size and frequency-bin spacing

For a sample rate Fs and transform size N, the bin spacing is Fs/N. At 48,000 samples per second, a 2,048-sample block has bins about 23.44 Hz apart.

Calculated examples at 48 kHz; frame duration is not complete end-to-end latency
SamplesFrame durationBin spacing
2,04842.67 ms23.44 Hz
4,09685.33 ms11.72 Hz
8,192170.67 ms5.86 Hz

Longer observation windows can provide more information about nearby frequency structure, but they also span more musical time. A moving note may change substantially inside a long block.

Bin spacing is not the same as a final pitch-error guarantee. Window shape, signal-to-noise ratio, interpolation and the estimation rule all affect the result. Reporting one bin width as a universal accuracy limit is too simplistic.

What windowing does

A frame cuts out a finite piece of sound. If its edges do not join smoothly under the transform’s periodic interpretation, energy spreads across bins, commonly called spectral leakage.

A window such as Hann reduces edge discontinuities, with a trade-off in peak shape and effective frequency discrimination. There is no one window that removes every problem for every signal.

Quiet notes, transients and competing instruments still require sensible interpretation. Applying a named window is not proof that the highest peak represents the source’s fundamental.

Does zero-padding make detection more accurate?

Zero-padding adds zeros before the transform and provides a more densely sampled representation of the spectrum. It can help interpolate the location of an isolated spectral peak.

It does not add new recorded information or make a short observation equivalent to a genuinely longer recording. The ability to separate nearby components still depends on the underlying signal duration, window and conditions.

Julius O. Smith’s spectral-audio material explains zero-padding as interpolation. That distinction helps avoid confusing a smoother plot with newly measured detail.

Frame length, hop size and latency are different

Frame length is the amount of audio analysed at once. Hop size is the spacing between successive analyses. A smaller hop can produce more frequent estimates without shortening the frame itself.

End-to-end latency also includes capture buffering, processing, scheduling, smoothing and display updates. A 10 ms plot step does not prove that the result reflects sound from only 10 ms ago.

For low notes, enough cycles must be observed to support an estimate. At 50 Hz, one cycle takes 20 ms. Several overlapping frames do not magically create missing cycle information in a very short observation.

FFT versus autocorrelation and YIN

Time-domain methods examine repetition in the waveform. They can estimate a fundamental without treating the largest spectral peak as the answer. They still face noise, octave ambiguities and frame-length trade-offs.

The autocorrelation and YIN guide explains those methods. Some autocorrelation implementations can themselves be accelerated with FFT-related computation, so the categories are not always mutually exclusive.

For a complete track, temporal decisions matter too. See pitch tracking versus pitch detection for the distinction.

For a useful troubleshooting comparison, keep the recording unchanged while varying one analysis setting. Otherwise, a cleaner-looking spectrum might reflect a different performance or input level rather than the effect of transform size or windowing.

When an FFT peak seems an octave too high, the guide to harmonics and multiple tuner notes explains why a prominent spectral component need not be the fundamental.

Frequently asked questions

Can an FFT show more than one frequency?

Yes. That is its purpose. Converting those components into separate notes or sources in polyphonic music requires additional analysis.

Does a larger FFT always improve pitch tracking?

No. It changes the time-frequency trade-off and processing cost. A very long frame can blur changes that matter in a fast melody.

Why do I see doubled frequencies?

They may be harmonics of one source. A second peak at twice a fundamental does not necessarily mean a second note was played.

Should I trust more decimal places?

Only when the estimation method and evidence support them. Display precision is not a measured accuracy guarantee.

Reference basis: MDN’s AnalyserNode window-size documentation, Julius O. Smith’s Spectral Audio Signal Processing and established Fourier and periodicity relationships. Examples are calculated.

Scroll to Top