-
Notifications
You must be signed in to change notification settings - Fork 0
Compressor
mzuelch edited this page Jan 24, 2026
·
1 revision
plugin_id: compressor · UI: Kompression · Source: plugins/compressor.py
Envelope-based hard-knee compressor (peak detector) with configurable attack/release smoothing. For stereo/multi-channel signals the detector uses the peak across channels to preserve balance.
| Parameter | Type | Default | Range | Meaning |
|---|---|---|---|---|
threshold_db |
float | -18.0 |
(typ.) -60..0 dBFS | Threshold in dBFS. |
ratio |
float | 2.0 |
≥ 1.0 | Compression ratio above threshold. |
attack_ms |
float | 10.0 |
≥ 0 ms | Attack time constant (faster gain reduction). |
release_ms |
float | 100.0 |
≥ 0 ms | Release time constant (slower return to unity). |
- Detector (per-sample, linear domain):
det[i] = max_c |x[i,c]|
- Envelope follower with attack/release in linear domain:
a = exp(-1 / (fs * attack_s))
r = exp(-1 / (fs * release_s))
env[i] = coeff * env[i-1] + (1 - coeff) * det[i]
coeff = a if det[i] > env[i-1] # rising → attack
coeff = r otherwise # falling → release
- Hard-knee gain computer (dB domain):
env_db = 20*log10(max(env, eps))
over = env_db - threshold_db
out_db = env_db if over <= 0
out_db = threshold_db + over/ratio if over > 0
gain_db = out_db - env_db
gain = 10^(gain_db/20)
y[i,c] = x[i,c] * gain[i]
- Attack/release of
0 msmakes the envelope track immediately (coeff = 0). - No soft knee; for gentler behavior use a lower ratio and/or higher threshold.
- The same gain is applied to all channels (stereo-safe).
- D. Giannoulis, M. Massberg, J. D. Reiss, “Digital Dynamic Range Compressor Design—A Tutorial and Analysis,” Journal of the Audio Engineering Society, 60(6), pp. 399–408, 2012.
PATCHBAY • MIT License • Wiki content is intended to match PATCHBAY 0.1.x.
- Home
- Installation
- Quickstart
- User Guide
- Input & Anchors
- Description & Run
- Output
- Export & Files
- Runtime Settings
- Settings & Persistence
- FAQ
- Troubleshooting
- Architecture
- Data Flow
- Backend Interface
- Anchor Algorithms
- Chunking & Reconstruction
- Logging & Debugging
- Parameter Persistence