Pitch detection algorithm
A pitch detection algorithm (PDA) estimates the fundamental frequency (F0) of a sound, usually frame by frame, from a recording of speech or music. The perceived pitch of a sound does not correspond exactly to its fundamental frequency, but the two agree over a wide range, so F0 estimators are commonly called pitch detectors.[1:1][2:1] Computational methods have been studied for more than half a century.[2:2] Most do well on a single clean pitched sound, but many still fail when the signal is noisy or when several pitches sound at once.[3:1]
Pitch and fundamental frequency
The fundamental frequency of a periodic signal is the inverse of its period, the smallest time shift that leaves the signal unchanged. Speech and music depart from strict periodicity, and estimating F0 means dealing with their departures from periodicity in a useful and consistent way.[1:2] Musical pitch is a perceptual feature, studied in psychoacoustics, and only loosely related to the logarithm of frequency; most of the research goes under the name of pitch detection even though what is estimated is F0.[3:2] Pitch usually follows the fundamental frequency, with some exceptions.[1:1] It is heard even when the fundamental itself is absent from the spectrum (see missing fundamental).[4:1]
Time-domain methods
The most basic methods work on the waveform itself. One family counts events that occur once per period, such as zero crossings, whose rate is inversely related to the period.[3:3] The autocorrelation of a periodic waveform is itself periodic, and its first large peak marks the period; with a harmonically rich sound, smaller peaks at the periods of upper harmonics have to be told apart from it.[3:4] The autocorrelation method picks the highest peak within a range of lags. If the range starts too near zero it can pick the peak at zero lag, and if it extends too far it can pick a peak at a multiple of the period.[1:3]
Related functions for generating candidate periods include the average magnitude difference function, the normalized cross-correlation used by the RAPT algorithm and the Praat program, and the cumulative mean normalized difference function of YIN.[2:2] YIN, published in 2002, reported error rates on speech about three times lower than the best competing methods.[1:4]
Frequency-domain methods
Pitched sounds are usually made of harmonically related partials, and frequency-domain methods identify these partials and derive F0 from them. Martin Piszczalski was working on such pitch detection as the first step of an automatic music transcription system as early as 1979.[3:5] The cepstrum, the Fourier transform of the log magnitude spectrum, turns the evenly spaced harmonic peaks of a pitched sound into a single peak at its period. It was developed for speech and assumes evenly spaced partials, so it fails on inharmonic sounds such as bells and on pure sine tones.[3:6] The SWIPE algorithm matches the spectrum against the template of a sawtooth waveform.[2:2]
Errors and evaluation
A common error is to take a harmonic or a subharmonic for the fundamental, especially when the fundamental is weak; such errors can make an estimate jump back and forth within a single note.[3:7] They are often called octave errors, although the wrong value need not be a power of two away from the right one.[1:5]
Evaluation is difficult because performance depends on the kind of sound and because F0 is itself hard to measure for a reference.[3:8] Estimators designed for one domain, such as speech or musical notes, tend to work less well in another.[3:9] YIN's evaluation used speech recorded together with a laryngograph signal and counted estimates more than 20% from the reference as gross errors.[1:4][1:6] Music information retrieval more often reports raw pitch accuracy, the share of frames within 50 cents of the reference, and uses synthesized audio when an exact reference is needed.[2:3][2:4]
Tracking, probability and learning
Frame-by-frame estimates are usually smoothed afterwards, but a method that gives one estimate per frame leaves the smoothing nothing to fall back on. pYIN (2014) keeps several candidates per frame, each with a probability, and chooses among them with a hidden Markov model.[5:1] By 2018 comparative studies had found YIN-based methods the state of the art, with pYIN the best performing.[2:2] Until then the methods were heuristics, not learned from data apart from hand-tuned parameters.[2:5] CREPE (2018) instead learns the task with a convolutional neural network applied to the waveform, and its authors reported higher accuracy than pYIN and SWIPE, especially within tight tolerances.[2:6][2:7]
Later work has gone two ways. Self-supervised methods learn without pitch labels: SPICE trains a network so that the difference between its outputs for two pitch-shifted copies of the same audio matches the shift,[6:1] and PESTO, with fewer than 30,000 parameters, came within two percentage points of CREPE.[7:1] Supervised methods have grown more accurate and robust: PENN improved CREPE-style models and measured voicing from the entropy of their output,[8:1][8:2] and RMVPE estimates a singer's pitch directly from a full mix.[9:1] Rankings depend on the data. In a community benchmark of 19 trackers on recordings degraded by noise, reverberation and microphone filtering, maintained by the author of one of the trackers, RMVPE and SwiftF0 scored highest and pYIN lowest.[10:1][10:2][11:1]
Assumptions and uses
Most algorithms assume a single pitched source that is steady within each frame and a particular kind of audio, and there may be no single algorithm that handles every periodic input without error.[3:10] F0 estimation serves the study of speech prosody and tonal languages, automatic score transcription, real-time interactive music systems and the indexing of multimedia.[1:7] It is a prerequisite for analysing intonation in speech and singing.[5:2] In music research, monophonic pitch tracks are used to annotate multitrack datasets and within melody extraction systems.[2:8]
- ^a ^b ↗ yin-pda-term ^ ↗ yin-period-definition ^ ↗ yin-acf-method ^a ^b ↗ yin-abstract ^ ↗ yin-threshold ^ ↗ yin-evaluation ^ ↗ yin-applications Cheveigné, Alain de; Kawahara, Hideki (2002-04). YIN, a fundamental frequency estimator for speech and music. The Journal of the Acoustical Society of America. https://doi.org/10.1121/1.1458024 https://doi.org/10.1121/1.1458024.
- ^ ↗ crepe-pitch-and-f0 ^a ^b ^c ^d ↗ crepe-history-of-methods ^ ↗ crepe-method-metrics ^ ↗ crepe-datasets ^ ↗ crepe-heuristics ^ ↗ crepe-abstract ^ ↗ crepe-results ^ ↗ crepe-music-uses Kim, Jong Wook; Salamon, Justin; Li, Peter; Bello, Juan Pablo (2018-04). CREPE: A Convolutional Representation for Pitch Estimation. 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). https://doi.org/10.1109/ICASSP.2018.8461329 https://arxiv.org/abs/1802.06182.
- ^ ↗ gerhard-abstract ^ ↗ gerhard-pitch-vs-f0 ^ ↗ gerhard-time-domain ^ ↗ gerhard-autocorrelation ^ ↗ gerhard-frequency-domain ^ ↗ gerhard-cepstrum ^ ↗ gerhard-subharmonic-errors ^ ↗ gerhard-evaluation ^ ↗ gerhard-domain ^ ↗ gerhard-assumptions Gerhard, David (2003-11). Pitch Extraction and Fundamental Frequency: History and Current Techniques. Department of Computer Science, University of Regina, Regina, Saskatchewan. ISBN 0-7731-0455-0. https://www.cs.bu.edu/fac/snyder/cs583/Literature%20and%20Resources/PitchExtractionMastersThesis.pdf.
- ^ ↗ th-pitch Pitch. Handbook for Acoustic Ecology. Simon Fraser University. https://www.sfu.ca/sonic-studio-webdav/cmns/Handbook5/handbook/Pitch.html.
- ^ ↗ pyin-abstract ^ ↗ pyin-intonation Mauch, Matthias; Dixon, Simon (2014-05). PYIN: A fundamental frequency estimator using probabilistic threshold distributions. 2014 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). https://doi.org/10.1109/ICASSP.2014.6853678 https://webspace.eecs.qmul.ac.uk/s.e.dixon/pub/2014/MauchDixon-PYIN-ICASSP2014.pdf.
- ^ ↗ spice-method Gfeller, Beat; Frank, Christian; Roblek, Dominik; Sharifi, Matt; et al. (2020). SPICE: Self-Supervised Pitch Estimation. IEEE/ACM Transactions on Audio, Speech, and Language Processing. https://doi.org/10.1109/TASLP.2020.2982285 https://arxiv.org/abs/1910.11664.
- ^ ↗ pesto-results Riou, Alain; Lattner, Stefan; Hadjeres, Gaëtan; Peeters, Geoffroy (2023). PESTO: Pitch Estimation with Self-supervised Transposition-equivariant Objective. Proceedings of the 24th International Society for Music Information Retrieval Conference (ISMIR 2023). Milan. https://arxiv.org/abs/2309.02265.
- ^ ↗ penn-results ^ ↗ penn-entropy Morrison, Max; Hsieh, Caedon; Pruyne, Nathan; Pardo, Bryan (2023). Cross-domain Neural Pitch and Periodicity Estimation. arXiv. https://arxiv.org/abs/2301.12258.
- ^ ↗ rmvpe-abstract Wei, Haojie; Cao, Xueke; Dan, Tangpeng; Chen, Yueguo (2023-08). RMVPE: A Robust Model for Vocal Pitch Estimation in Polyphonic Music. Interspeech 2023. https://doi.org/10.21437/Interspeech.2023-528 https://arxiv.org/abs/2306.15412.
- ^ ↗ bench-scope ^ ↗ bench-ranking Nieradzik, Lars. Pitch Detection Benchmark (README, version 2.1). GitHub: lars76/pitch-benchmark. https://github.com/lars76/pitch-benchmark.
- ^ ↗ swiftf0-benchmark-author Nieradzik, Lars (2025-08). SwiftF0: Fast and Accurate Monophonic Pitch Detection. arXiv. https://arxiv.org/abs/2508.18440.
Wikidata: Q7198851