audio

@audio/shift-paulstretch1.2.0

Paulstretch-style randomized-phase pitch shift for textural blur

Status
calibrated
Updated
Family
shift, 15 packages under it
Plugin
paulstretch, effect, whole signal, 2 parameters
Category
time & pitch
Licence
MIT
Dependencies
2 packages, all permissive: MIT
Downloads
3,221 last month
Tests
69 in audiojs/shift's CI, passed at befb754,

Listen

// "Goldberg Variations, Aria" by Kimiko Ishizaka, CC0, freemusicarchive.org/music/Kimiko_Ishizaka/The_Open_Goldberg_Variations/KIMIKO_ISHIZAKA_-_Goldberg_Variations_BWV_988_-_01_-_Aria__44k-24b/
audio('/samples/music/classical/goldberg-aria.mp3').paulstretch()

// "Goldberg Variations, Aria" by Kimiko Ishizaka, CC0, freemusicarchive.org/music/Kimiko_Ishizaka/The_Open_Goldberg_Variations/KIMIKO_ISHIZAKA_-_Goldberg_Variations_BWV_988_-_01_-_Aria__44k-24b/

Parameters

  • effect
  • whole signal
  • tail
semitones
0 st
−24 to 24 st
frame
0.37 s
0.05 to 2 s
import paulstretch from '@audio/shift-paulstretch'

Large-frame (16k) phase randomization. Magnitudes pulled from source bins at k/ratio; phases drawn from a seeded PRNG every frame. Destroys temporal structure by design.

paulstretch(audio, { ratio: 1.5 })
paulstretch(audio, { ratio: 1.5, seed: 42 })
Param Default
seed fixed (0x1f123bb5) 32-bit PRNG seed for the per-frame phase draw

Deterministic: the same seed (the shipped default, or one you pass) always reproduces the same phase sequence and therefore byte-identical output. Pass seed to get a different, still-reproducible draw.

Preserves long-term magnitude-spectrum statistics.
Destroys phase, transients, rhythm — by design.

f0 err THD% alias attack corr formant dist phase coh shift
0.00 0.2 0.230 0.935 7.371 0.518 2.221

Worst formant dist by a wide margin (7.371 — the next-worst is granular at 3.486) because random phases smear spectral energy across the frame; the smear is the aesthetic. Alias 0.230 is the same smear leaking past Nyquist.

Use when: Ambient/drone textures, extreme shift ratios.
Not for: Anything requiring temporal precision.

Stream

let write = paulstretch({ ratio: 1.5 })
let out = write(inputBlock)
let tail = write()  // flush

paulstretch streams per-frame: each write(chunk) call renormalizes and emits audio as soon as a frame completes, and re-chunking the same input differently reproduces the batch output byte for byte.

Data

Input is a Float32Array (mono) or an array of Float32Array channels ([left, right, ...]) — anything else throws TypeError. ratio also accepts a function t => ratio (seconds from stream start) or a Float32Array breakpoint envelope (resampled across the input via ratioDuration, default the input's own duration) for time-varying pitch.


Part of @audio/shift — the shift family umbrella. This README is generated from the umbrella docs.

MIT © audiojs