Skip to content

pitchBasedCompress

pitchBasedCompress(audioBuffer, ratio): Promise<AudioBuffer>

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

Pitch-based audio compression — a plain linear-interpolation resample kept at the original sample rate, so PITCH AND TEMPO CHANGE TOGETHER (like playing a record at the wrong speed). No anti-aliasing filter is applied. Use tempoBasedCompress for pitch-preserving tempo change.

AudioBuffer

Input audio buffer

number

Length ratio (0.8 = 20% shorter, faster AND higher-pitched)

Promise<AudioBuffer>

Compressed audio buffer