@audio/dynamics-transient-shaper
v0.1.5
Published
Transient shaper — independently boosts/cuts attack and sustain portions
Downloads
966
Readme
@audio/dynamics-transient-shaper

Transient shaper — independently boosts/cuts attack and sustain portions (SPL Transient Designer class)
npm install @audio/dynamics-transient-shaperimport transientShaper from '@audio/dynamics-transient-shaper'Dual envelope followers (1 ms fast / 50 ms slow) separate transient from sustain: transient = max(fast − slow, 0) / slow, near 1 on attacks and near 0 on sustained material. Output gain is 1 + attackGain·transient + sustainGain·(1 − transient) — a linear multiplier, not dB: attackGain: 1 roughly doubles attack peaks, attackGain: -1 can null them out. Mutates data in place and returns it; no separate streaming factory — pass the same params object across calls (it carries _envFast/_envSlow) to continue state across chunks.
transientShaper(data, { attackGain: 0.5, sustainGain: -0.3 }) // punchier attacks, tucked sustain
transientShaper(data, { attackGain: -0.5 }) // soften/glue transients
let params = { attackGain: 0.5 }
transientShaper(block1, params) // state carried in `params`
transientShaper(block2, params)| Param | Default | |
|---|---|---|
| attackGain | 0 | linear gain delta on the transient portion (not dB) |
| sustainGain | 0 | linear gain delta on the sustain portion (not dB) |
| fs | 44100 | Hz |
Use when: drum punch/glue, percussive attack shaping without a threshold to tune.
Not for: level-controlled dynamics — use compressor or unlimit for deficit-gated transient restoration.
Part of @audio/dynamics — the dynamics family umbrella.
MIT © audiojs
