audioJS

@audio/dynamics-compand

Status pending calibration

npm0.1.7licenseMIT

Multi-segment compander (SoX `compand`). Arbitrary piecewise-linear transfer

Overview

Install
Updated
Family
dynamics, 17 packages under it
Tags
shape
import 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-compand'

// 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