Skip to content

tempoBasedCompress

tempoBasedCompress(audioBuffer, ratio): Promise<AudioBuffer>

Defined in: packages/pleco-xa/src/scripts/compression.js:108

Tempo-based audio compression — PITCH-PRESERVING time stretch via the phase vocoder (src/effects/index.js time_stretch). Each channel is stretched independently; output length is round(input length * ratio) and the dominant pitch is unchanged.

AudioBuffer

Input audio buffer

number

Length ratio (0.8 = 20% shorter/faster, same pitch)

Promise<AudioBuffer>

Compressed audio buffer