@audio/ pitch-yin
Status calibrated
npm1.0.6licenseMIT
YIN pitch detection (de Cheveigné & Kawahara, 2002)
Overview
- Install
- Updated
- Family
- pitch, 8 packages under it
- Tags
- measure, time & pitch
import yin from '@audio/pitch-yin'
de Cheveigné & Kawahara, 2002. The reference algorithm for monophonic pitch estimation. Most cited, most tested, most robust.
let result = yin(samples, { fs: 44100 })
// → { freq: 440.1, clarity: 0.97 } or null
| Param | Default | |
|---|---|---|
fs |
44100 |
Sample rate (Hz) |
threshold |
0.15 |
CMND threshold — lower = stricter, fewer detections |
minFreq |
— | Minimum frequency (Hz); also uses more of the frame for low pitches |
maxFreq |
— | Maximum frequency (Hz) |
Pass the expected range when known: yin(samples, { fs, minFreq: 60, maxFreq: 520 }). Besides rejecting out-of-range results, minFreq lets YIN use a longer comparison window and improves low-pitch detection near onsets.
Use when: General-purpose monophonic pitch tracking — speech, singing, solo instruments. The most reliable choice when in doubt.
Not for: Polyphonic audio (returns dominant or null), real-time with hard latency budgets (needs full window).
Ref: de Cheveigné & Kawahara, "YIN, a fundamental frequency estimator for speech and music", JASA 2002.
Complexity: — two nested passes over half the window.
Part of @audio/pitch — the pitch family umbrella. This README is generated from the umbrella docs.
MIT © audiojs