@audio/dynamics-compressor

中文文档
0.3.1发布于 2026/10/08MITTypeScriptES Module零依赖近 30 天下载 6606

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

原始使用文档

@audio/dynamics-compressor npm MIT

Feed-forward soft-knee compressor (Giannoulis-Massberg topology)

npm install @audio/dynamics-compressor
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 })
ParamDefault
threshold-20dB
ratio4—
knee6dB (soft-knee width)
attack5ms
release100ms
makeup0dB
depth1scales the summed up+down gain before makeup (OTT "Depth" macro; 0 = identity)
upThresholdnulldB; null disables upward compression
upRatio2— (1 is a mathematical no-op)
upKnee6dB
upRange12dB, 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

版本与发布记录

@audio/dynamics-compressor 共发布 9 个版本,首次发布于 2026/07/09;过去 12 个月发布了 9 个版本。

版本发布日期距今
0.3.1latest2026/10/0830 天前
0.3.02026/09/291 个月前
0.2.12026/07/113 个月前
0.2.02026/07/113 个月前
0.1.42026/07/113 个月前
0.1.32026/07/103 个月前

关于 @audio/dynamics-compressor 的常见问题

@audio/dynamics-compressor 是什么?

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

如何安装 @audio/dynamics-compressor?

在项目目录运行 npm install @audio/dynamics-compressor,或使用 pnpm add / yarn add / bun add。

@audio/dynamics-compressor 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@audio/dynamics-compressor 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@audio/dynamics-compressor 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@audio/dynamics-compressor 可以商用吗?

@audio/dynamics-compressor 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@audio/dynamics-compressor 的下载量有多少?

根据 npm 官方下载统计,@audio/dynamics-compressor 在 2026/10/07 – 2026/11/05 这 30 天内被下载 6,606 次,日均约 220 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@audio/dynamics-compressor 还在维护吗?

最新版本 0.3.1 发布于 2026/10/08(30 天前);至今共发布 9 个版本,其中过去 12 个月发布了 9 个;首次发布于 2026/07/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。