audio

@audio/dynamics-compand0.2.0

Multi-segment compander

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

Status
pending calibration
Updated
Family
dynamics, 17 packages under it
Plugin
compand, effect, streaming, 6 parameters
Category
effects
Licence
MIT
Dependencies
1 package, all permissive: MIT
Downloads
3,366 last month
Tests
92 in audiojs/dynamics's CI, passed at 2ee3ad9,

Listen

// "Local Forecast" by Kevin MacLeod (incompetech.com), CC BY 4.0, incompetech.com/music/royalty-free/faq.html
audio('/samples/music/modern/local-forecast.mp3').compand()

// "Local Forecast" by Kevin MacLeod (incompetech.com), CC BY 4.0, incompetech.com/music/royalty-free/faq.html

Parameters

  • effect
  • streaming
out0
−90 dB
−90 to 0 dB
out1
−60 dB
−90 to 0 dB
out2
−20 dB
−90 to 0 dB
out3
−8 dB
−90 to 0 dB
attack
5 ms
0.1 to 200 ms
release
200 ms
1 to 2000 ms
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