FROM AGPEDIA — AGENCY THROUGH KNOWLEDGE

YIN (algorithm)

YIN is an algorithm for estimating the fundamental frequency (F0) of speech or musical sounds, published by Alain de Cheveigné and Hideki Kawahara in 2002. It starts from the autocorrelation method and adds a series of modifications that together prevent errors. On speech recorded with a laryngograph signal, its error rates were about three times lower than those of the best competing methods.[1:1] Its name, from yin and yang, refers to the interplay between autocorrelation and cancellation in the method.[1:2] YIN became popular beyond speech processing, especially in the analysis of singing,[2:1] and it is the basis of the probabilistic variant pYIN.[2:2]

Background

YIN is a pitch detection algorithm. Its authors define the fundamental frequency as the inverse of the period, the smallest time shift that leaves a signal unchanged, and describe the task as dealing usefully with the ways speech and music depart from periodicity.[1:3] The autocorrelation method it starts from picks the highest peak of the autocorrelation function within a range of lags, and can be misled toward the peak at zero lag or a peak at a multiple of the period.[1:4]

Method

The paper builds YIN in six steps, measuring an error rate after each on a small database for illustration.

  1. Autocorrelation. The starting point, with an illustrative gross error rate of 10.0%.[1:5]
  2. Difference function. The squared difference between the signal and a copy delayed by a trial lag is zero at the period and at all its multiples. Using it in place of autocorrelation cut the error rate to 1.95%.[1:5]
  3. Cumulative mean normalization. Each value of the difference function is divided by its average over shorter lags, so the function starts at 1 and falls below 1 only where the difference is below average. This reduced errors in which the estimate is too high (to 1.69%) and removed the need for an upper limit on frequency.[1:6]
  4. Absolute threshold. A dip at a multiple of the period can be deeper than the dip at the period, causing a subharmonic error. YIN takes the smallest lag whose dip falls below a threshold, or the global minimum if none does; with a threshold of 0.1 the error rate fell to 0.78%.[1:7]
  5. Parabolic interpolation. A parabola fitted to each dip and its neighbours gives a period finer than one sample, more cheaply than upsampling the signal.[1:8]
  6. Best local estimate. For each analysis point, YIN looks at nearby points for a better estimate and then re-estimates within 20% of it, choosing on quality rather than continuity. This brought the error rate to 0.5%.[1:9]

The authors considered step 3 probably the key to YIN's success, since it lets errors that are too high and too low be dealt with separately.[1:10] David Gerhard's survey of pitch extraction describes the same core: YIN minimizes the difference between a waveform and its delayed copy, rather than maximizing their product as autocorrelation does, and uses a cumulative mean to reduce subharmonic errors.[3:1]

Evaluation

The formal evaluation used five databases, 1.9 hours of speech by 48 speakers of Japanese, English and French, each recorded with a laryngograph.[1:11] An estimate more than 20% from the reference counted as a gross error. YIN had the lowest error rate on every database, about a third of the best competitor's on average; about 99% of its estimates were within 20%, 94% within 5% and about 60% within 1%.[1:12]

YIN was evaluated on music only informally. Its authors expected its open search range and its lack of continuity constraints to suit music's wide range and fast changes of pitch, and noted that no well-labelled, representative music database existed for testing it.[1:13]

Properties

YIN needs no upper limit on its search range, though it tends to fail above a quarter of the sampling rate.[1:14] Because the threshold step can stop at the first acceptable dip, its latency can be cut to the longest expected period plus the period found, which matters for interactive music systems. The value of the normalized difference at the chosen period serves as a confidence measure; the MPEG-7 standard uses it so that F0 series down-sampled for multimedia indexing keep the reliable estimates.[1:15] The published method leaves out smoothing and voicing detection, to keep its evaluation clear; the authors suggested the same aperiodicity measure as a basis for voicing detection.[1:16]

The authors credited earlier work for parts of the method. Autocorrelation for periodicity analysis goes back to Licklider in 1951, steps 3 and 4 had been applied by de Cheveigné to the average magnitude difference function, and parabolic interpolation was a standard technique. New were step 6, the combination of steps, the analysis of why it works and the formal evaluation.[1:17]

Later use

A comparative study of pitch trackers on singing found YIN state of the art and particularly good at fine pitch.[2:1] Because it outputs one estimate per frame, later smoothing cannot recover from a wrong estimate. pYIN, published in 2014, addresses this by drawing several candidates from a distribution of thresholds.[2:2] In 2018 the authors of the neural pitch tracker CREPE found YIN-based methods the state of the art among earlier approaches,[4:1] and found pYIN almost unaffected by low-frequency noise, a robustness they attributed to YIN.[4:2]

  1. ^ ↗ yin-abstract ^ ↗ yin-name ^ ↗ yin-period-definition ^ ↗ yin-acf-method ^a ^b ↗ yin-difference-function ^ ↗ yin-cmndf ^ ↗ yin-threshold ^ ↗ yin-parabolic ^ ↗ yin-step6 ^ ↗ yin-step3-key ^ ↗ yin-databases ^ ↗ yin-evaluation ^ ↗ yin-music ^ ↗ yin-no-upper-limit ^ ↗ yin-latency-confidence ^ ↗ yin-no-postprocessing-voicing ^ ↗ yin-whats-new 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.
  2. ^a ^b ↗ pyin-yin-in-singing ^a ^b ↗ pyin-abstract 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.
  3. ^ ↗ gerhard-yin 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.
  4. ^ ↗ crepe-history-of-methods ^ ↗ crepe-noise 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.
Available in