@maruaudio/dsp/dynamics/plosive-repair attenuates low-frequency bursts in a stereo signal. A one-pole low-pass per channel isolates the low band; its linked peak drives a stereo-compressor detector (ratio 8, 1 ms attack) and 8 ms and 150 ms envelopes. With protection on, reduction is gated by rising energy, clamp((fast − 1.4·slow) / (0.6·slow + 1e−6), 0, 1), a heuristic, not speech recognition. The gain (floor −amount) scales only the low band: removed is low·(1 − gain), output input − removed, so the two rebuild the input.
const state = initStereoPlosiveRepair(48000)
setStereoPlosiveRepairParameter(state, PLOSIVE_REPAIR_AMOUNT_DB, 12)
stereoPlosiveRepairTick(state, left, right) // state.outLeft, state.outRightParameters
setStereoPlosiveRepairParameter(state, id, value) returns false and changes nothing for a non-finite value, an unknown id or a value out of range.
| Parameter id | Accepted values | Default | Unit |
|---|---|---|---|
PLOSIVE_REPAIR_CUTOFF_HZ | 80 to 350 | 160 | Hz |
PLOSIVE_REPAIR_THRESHOLD_DB | −48 to −6 | −24 | dB |
PLOSIVE_REPAIR_AMOUNT_DB | 0 to 18 (maximum reduction) | 9 | dB |
PLOSIVE_REPAIR_RELEASE_MS | 20 to 250 | 80 | ms |
PLOSIVE_REPAIR_MANUAL | 0 or 1; 1 applies the full amount | 0 | flag |
PLOSIVE_REPAIR_TRANSIENT_PROTECTION | 0 or 1 | 1 | flag |
PLOSIVE_REPAIR_AUDITION | 0 processed, 1 removed, 2 dry | 0 | mode |
Cutoff, floor, manual and audition changes glide through an 8 ms one-pole.
Lifecycle
initStereoPlosiveRepair(sampleRate) (unsupported rate gives 48 kHz) and prepareStereoPlosiveRepair(state, rate) (false outside 8 to 192 kHz) run outside rendering; prepare rebuilds the detector and resets. Setters → stereoPlosiveRepairTick per frame (refreshes derived controls after a change) → resetStereoPlosiveRepair, which restores initial controls and histories.
When to use it
Cleaning pops from close-miked speech or vocals, auditioning what is removed.
Limits
- Stereo, linked, sample tick, no latency. Outputs are f32; NaN input is read as 0.
- Reset returns every control to its default, not only the histories; set them again.