How Pitch Detection Algorithms Work (Autocorrelation vs FFT)
Pitch detection is the process of finding the fundamental frequency of a signal.
It tells us
- The musical note
- The vibration rate
- The rotation speed

What Is Pitch?
Pitch corresponds to the fundamental frequency f0
Strictly speaking, pitch and fundamental frequency are different, but for convenience, we describe it in terms of the fundamental frequency.
- Fundamental frequency = what physically exists in the signal (physical and objective)
- Pitch = what humans perceive from the signal (perceptual and subjective)
Example
- 440 Hz → musical note A
- 100 Hz → machine vibration
Intuition
“How high or low a sound is”
Two Main Approaches
Pitch detection is commonly done using
- Autocorrelation (time domain)
- FFT (frequency domain)
Method 1: Autocorrelation
Idea
Autocorrelation compares a signal with a delayed version of itself
“Does the signal repeat?”
Mathematical form

How It Works
- Shift signal
- Multiply signals
- Signal summation
- Find peak
The first peak → fundamental period
Fundamental Frequency
Strengths
- Good for noisy signals
- Works well for periodic signals
Weaknesses
- Less precise for complex signals
- Can detect wrong peaks
- High computational cost, O (N2)
Method 2: FFT-Based Detection
Idea
Convert signal to frequency domain:
"Find the largest value."
How It Works
- Apply FFT
- Find dominant frequency
Strengths
- Accurate frequency resolution
- Good for harmonic signals
- Relatively fast computation, O (N log N)
Weaknesses
- Sensitive to noise
- Requires sufficient resolution
Key Difference
| Feature | Autocorrelation | FFT |
|---|
| Domain | Time domain | Frequency domain |
| Outputs | Periodic time | Frequencies |
| Noise Robustness | High | Medium |
Real-World Example
Voice Signal
- Autocorrelation → detects pitch period
- FFT → detects harmonic structure
Machine Vibration
- Autocorrelation → rotation period
- FFT → frequency peaks
Which One Should You Use?
Use Autocorrelation
- Noisy signals
- Period detection
Use FFT
- Clean signals
- Spectral analysis
Best approach: Use both together
Autocorrelation-based pitch detection is especially effective in scenarios where the fundamental frequency is weak or missing
Harmonic signals having 400Hz, 600Hz, and 800Hz (missing fundamental freqeuncy 200Hz)
Harmonic signals: sin(400Hz) + sin(600Hz) + sin(800Hz)

FFT of harmonic signals: 400, 600, and 800Hz peaks, missing fundamental frequency 200Hz
Autocorrelation: Period of highest peak is 0.005sec, Fundament frequency (Pitch) is 1/0.005 = 200Hz
Key Takeaways
- Pitch = fundamental frequency
- Autocorrelation → time-based detection
- FFT → frequency-based detection
- Best results come from combining both
Conclusions
Pitch detection aims to find the fundamental frequency (f₀) of a signal, which determines its perceived pitch or repetition rate.
- Two main methods are used: autocorrelation (time domain) and FFT (frequency domain).
- Autocorrelation is robust to noise and effective for detecting periodicity, while FFT provides higher frequency resolution and clearer spectral information.
- Each method has strengths and limitations, so relying on only one can lead to errors in certain conditions.
In summary,
accurate pitch detection is best achieved by combining autocorrelation and FFT, leveraging both time-domain and frequency-domain insights.
Suggested Further Reading
##You may also find these topics helpful:
How Pitch Detection Algorithms Work (Autocorrelation vs FFT)
Pitch detection is the process of finding the fundamental frequency of a signal.
It tells us
What Is Pitch?
Pitch corresponds to the fundamental frequency f0
Strictly speaking, pitch and fundamental frequency are different, but for convenience, we describe it in terms of the fundamental frequency.
Example
Intuition
“How high or low a sound is”
Two Main Approaches
Pitch detection is commonly done using
Method 1: Autocorrelation
Idea
Autocorrelation compares a signal with a delayed version of itself
“Does the signal repeat?”
Mathematical form
How It Works
The first peak → fundamental period
Fundamental Frequency
Strengths
Weaknesses
Method 2: FFT-Based Detection
Idea
Convert signal to frequency domain:
"Find the largest value."
How It Works
Strengths
Weaknesses
Key Difference
Real-World Example
Voice Signal
Machine Vibration
Which One Should You Use?
Use Autocorrelation
Use FFT
Best approach: Use both together
Autocorrelation-based pitch detection is especially effective in scenarios where the fundamental frequency is weak or missing
Harmonic signals having 400Hz, 600Hz, and 800Hz (missing fundamental freqeuncy 200Hz)
FFT of harmonic signals: 400, 600, and 800Hz peaks, missing fundamental frequency 200Hz
Key Takeaways
Conclusions
Pitch detection aims to find the fundamental frequency (f₀) of a signal, which determines its perceived pitch or repetition rate.
In summary,
accurate pitch detection is best achieved by combining autocorrelation and FFT, leveraging both time-domain and frequency-domain insights.
Suggested Further Reading
##You may also find these topics helpful: