audio

@audio/stretch-pghi1.3.0

Phase Gradient Heap Integration vocoder

Phase Gradient Heap Integration vocoder (Průša & Holighaus "Phase Vocoder Done Right") — no peak picking, no transient heuristics

Status
calibrated
Updated
Family
stretch, 10 packages under it
Plugin
stretch-pghi, effect, whole signal, 1 parameter
Category
time & pitch
Licence
MIT
Dependencies
1 package, all permissive: MIT
Downloads
3,185 last month
Tests
47 in audiojs/stretch's CI, passed at b844b07,

Parameters

  • effect
  • whole signal
factor
1
0.25 to 4

Phase Gradient Heap Integration vocoder — "Phase Vocoder Done Right" (Průša & Holighaus, 2017), causal RTPGHI variant. Synthesis phase is integrated from the analysis phase gradients (instantaneous frequency across time, stretched group delay across frequency), visiting bins in order of decreasing magnitude via a max-heap — phase always flows from strong bins into their neighbourhoods.

No peak picking, no transient heuristics: chirps, vibrato and dense spectra stay coherent by construction.

import pghi from '@audio/stretch-pghi'
let out = pghi(data, { factor: 2 })
Param Default
factor 1 Time stretch ratio
frameSize 2048 FFT size (power of 2)
hopSize frameSize/8 Hop — gradient integration wants denser frames than peak locking
tolerance 1e-6 Bins below tolerance×max get random phase

Sliding stretch: factor may be a function t => ratio of source time in seconds, read at every analysis frame. pghi(data, { factor: t => t < 5 ? 1 : 2, sampleRate: 48000 }) keeps the first 5 s as is and plays the rest at half speed; sampleRate (default 44100) converts frame positions to t.

Use when: modulated material — vibrato, glides, chirps, pitch-unstable sources (measured: beats @audio/stretch-pvoc-lock on tones/glissandi, ~4× better than plain pvoc on sweeps).
Not for: steady polyphony — identity phase locking reproduces exact intra-region phase relations that first-order gradient integration only approximates; use @audio/stretch-pvoc-lock there.

Part of @audio/stretch.

License

MIT · ॐ