Speed a recording up and you have a choice: let the pitch rise like a record
played too fast, or keep the pitch and shrink only the timing. This page
shortens the same tone both ways so you can hear — and measure — the
difference. A 1 s 440 Hz tone is shortened to 0.8× by both tiers:
pitchBasedCompress is an honest record-speed resample — pitch
and tempo move together, so the tone must measure ≈550 Hz (440 ÷ 0.8) —
while tempoBasedCompress is a real phase-vocoder time stretch —
same length, but the tone must still measure ≈440 Hz. Badges assert the
exact length contract (17640 samples) and the measured zero-crossing pitch
of each output; the buttons make the difference audible. The same asserts
run headless in examples/node/compression.mjs.
| signal | length | measured pitch |
|---|