@audio/pitch-hps
v1.0.1
Published
Harmonic Product Spectrum (Schroeder, 1968)
Readme
@audio/pitch-hps

Harmonic Product Spectrum (Schroeder, 1968)
npm install @audio/pitch-hpsimport hps from '@audio/pitch-hps'Schroeder, 1968. Harmonic Product Spectrum — multiplies the spectrum by its downsampled copies so that harmonic peaks align at the fundamental. Robust to the missing-fundamental problem.
let result = hps(samples, { fs: 44100 })| Param | Default | |
|---|---|---|
| fs | 44100 | Sample rate (Hz) |
| harmonics | 5 | Number of harmonic products |
| minFreq | 50 | Minimum detectable frequency (Hz) |
| maxFreq | 4000 | Maximum detectable frequency (Hz) |
| cents | 10 | Candidate spacing in cents |
| threshold | 0.1 | Minimum clarity to accept |
Use when: Harmonic-rich signals (guitar, piano, brass). Naturally handles missing fundamentals. Not for: Pure sinusoids (only one harmonic), very noisy signals. Ref: Schroeder, "Period histogram and product spectrum", JASA 1968. Requires: Power-of-2 window length — throws otherwise.
Part of @audio/pitch — the pitch family umbrella. This README is generated from the umbrella docs.
MIT © audiojs
