@audio/dynamics-compand
v0.1.6
Published
Multi-segment compander (SoX `compand`). Arbitrary piecewise-linear transfer
Downloads
1,132
Readme
@audio/dynamics-compand

Multi-segment compander (SoX compand). Arbitrary piecewise-linear transfer
npm install @audio/dynamics-compandimport compand from '@audio/dynamics-compand'SoX-style multi-segment compander. Arbitrary piecewise-linear transfer in dB unifies compression, expansion, and gating under one curve — points below the identity line compress; above, they expand.
import { compand } from '@audio/dynamics'
// Default: compress above -20 dB
compand(data)
// Broadcast leveler: lift -40..-20 dB, compress above -10 dB
compand(data, {
points: [[-90, -90], [-40, -30], [-20, -18], [-10, -10], [0, -4]],
attack: 20, release: 500
})| Param | Default | |
|---|---|---|
| points | [[-90,-90],[-60,-60],[-20,-20],[0,-8]] | [[inDb, outDb], ...] |
| attack | 5 | ms |
| release | 200 | ms |
Use when: broadcast leveling, speech normalization, any time a single compressor's fixed ratio is too rigid. Not for: simple threshold compression — use compressor.
Part of @audio/dynamics — the dynamics family umbrella. This README is generated from the umbrella docs.
MIT © audiojs
