Multiband compressor — Linkwitz-Riley split + per-band soft-knee compression, flat sum (SoX mcompand class)
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').multiband()
// "Local Forecast" by Kevin MacLeod (incompetech.com), CC BY 4.0, incompetech.com/music/royalty-free/faq.html
Parameters
low- 200 Hz
- 40 to 1000 Hz
high- 2000 Hz
- 1000 to 12000 Hz
threshold- −24 dB
- −60 to 0 dB
ratio- 3
- 1 to 20
upThreshold- −40 dB
- −80 to 0 dB
upRatio- 1
- 1 to 20
depth- 1
- 0 to 2
attack- 5 ms
- 0.1 to 100 ms
release- 150 ms
- 20 to 2000 ms
makeup- 0 dB
- −12 to 24 dB
import multiband from '@audio/dynamics-multiband'
Multiband compressor — Linkwitz-Riley crossover split, an independent compressor per band (upward half included), flat sum by construction (SoX mcompand class): each band also carries the allpasses of the crossovers over it, so with nothing compressed the bands add to the crossovers' allpass, the input's magnitude with its phase turned (flat within 1e-5 dB). Up to 0.4.3, three bands summed 0.12 dB down at 1.5 kHz with crossovers at 200 and 2000 Hz, and 2.5 dB down where the two met. The manifest (multiband/audio) is a 3-band "one-knob" mastering stage — one shared setting across low/mid/high, split at low/high. The kernel (multiband(data, opts)) takes N-1 crossover points and per-band settings directly, for full control; every bands entry is spread straight into compressor(), so upward compression and depth are already there per band.
import multiband from '@audio/dynamics-multiband'
// one-knob: shared setting across 3 bands split at 200/2000 Hz
multiband(data, { freqs: [200, 2000], bands: { threshold: -24, ratio: 3 } })
// per-band settings, N bands (mutates data in place)
multiband(data, {
freqs: [400, 4000],
bands: [
{ threshold: -24, ratio: 3 }, // low
{ threshold: -20, ratio: 4, makeup: 2 }, // mid
null, // high: pass through uncompressed
],
})
OTT-class upward+downward multiband — Xfer OTT's "upward + downward compression on 3 bands" recipe, reproduced with this atom's upThreshold/upRatio/depth:
let depth = 1 // OTT's "Depth" macro — 0 is a transparent pass, 1 is full effect, up to 2 overshoots it
multiband(data, {
freqs: [88.3, 2500], // OTT's own crossover points
bands: [
{ threshold: -24, ratio: 4, upThreshold: -30, upRatio: 2, attack: 2, release: 35, depth }, // low
{ threshold: -24, ratio: 4, upThreshold: -30, upRatio: 2, attack: 5, release: 60, depth }, // mid
{ threshold: -24, ratio: 4, upThreshold: -30, upRatio: 2, attack: 2, release: 35, depth }, // high
],
})
| Param | Default | |
|---|---|---|
freqs |
[200, 2000] |
Hz, N-1 crossover points for N bands |
bands |
— | per-band {threshold, ratio, knee, attack, release, makeup, upThreshold, upRatio, upKnee, upRange, depth}, or one object shared by all bands; null passes a band through uncompressed |
order |
4 |
Linkwitz-Riley crossover order (2, 4, 8) |
fs |
44100 |
Hz |
Manifest params (3-band one-knob form): low, high, threshold, ratio, upThreshold, upRatio, depth, attack, release, makeup.
Use when: mastering-stage glue across the spectrum; OTT-style "upward + downward everywhere" aggressive multiband; taming one band without touching others.
Not for: single-band dynamics — use compressor directly.
Part of @audio/dynamics — the dynamics family umbrella. This README is generated from the umbrella docs.
MIT © audiojs