audio

@audio/dynamics-compressor0.4.0

Feed-forward soft-knee compressor, gain reduction smoothed in the log domain

Feed-forward soft-knee compressor, gain reduction smoothed in the log domain (Giannoulis, Massberg & Reiss 2012)

Status
pending calibration
Updated
Family
dynamics, 17 packages under it
Plugin
compressor, effect, streaming, 11 parameters
Category
effects
Licence
MIT
Dependencies
none
Downloads
20,225 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').compressor()

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

Parameters

  • effect
  • streaming
  • key input
threshold
−20 dB
−60 to 0 dB
ratio
4
1 to 20
knee
6 dB
0 to 24 dB
makeup
0 dB
−12 to 24 dB
upThreshold
−40 dB
−80 to 0 dB
upRatio
1
1 to 20
upKnee
6 dB
0 to 24 dB
upRange
12 dB
0 to 40 dB
attack
5 ms
0.1 to 100 ms
release
100 ms
1 to 1000 ms
link
0
0 to 1
import compressor from '@audio/dynamics-compressor'

Feed-forward soft-knee downward compressor, as Giannoulis, Massberg & Reiss recommend: level in dB → quadratic soft-knee gain curve → gain reduction smoothed in the log domain by the smooth decoupled peak detector → linear gain applied to input. attack and release are the time constants of the gain reduction itself (1 − 1/e), at any depth of compression; the first sample over the threshold is already reduced.

Downward compression (above threshold, reduces gain) is one half of the canonical four-quadrant dynamics taxonomy — downward/upward compression, downward/upward expansion (Giannoulis, Massberg & Reiss 2012; Izhaki, Mixing Audio). Setting upThreshold engages the other compression half: upward compression lifts quiet passages toward the threshold instead of squashing loud ones — the "OTT up" half popularized by Xfer OTT. Both curves read the same envelope and sum in the dB domain, so a single compressor call can glue loud material down and lift quiet material up at once.

import compressor from '@audio/dynamics-compressor'

compressor(data, { threshold: -18, ratio: 4 })
compressor(data, { threshold: -24, ratio: 2, knee: 12, attack: 10, release: 200, makeup: 6 })

// upward + downward together (OTT-style): lift quiet passages, squash loud ones
compressor(data, { threshold: -18, ratio: 4, upThreshold: -40, upRatio: 2, upRange: 12 })
Param Default
threshold -20 dB
ratio 4 —
knee 6 dB (soft-knee width)
attack 5 ms
release 100 ms
makeup 0 dB
depth 1 scales the summed up+down gain before makeup (OTT "Depth" macro; 0 = identity)
upThreshold null dB; null disables upward compression
upRatio 2 — (1 is a mathematical no-op)
upKnee 6 dB
upRange 12 dB, max upward lift — without a ceiling, silence would take unbounded gain

Use when: vocals, bass, drum bus, mix glue; add upThreshold for OTT-style up+down "aggressive" glue.
Not for: peak control at the master bus — use limiter. Transparent loudness shaping — use compand with gentle slope.


Part of @audio/dynamics — the dynamics family umbrella. This README is generated from the umbrella docs.

MIT © audiojs