feat(audio): mix-bus soft peak limiter

Replace the mixer's per-sample hard clamp with a lossless i32 bus sum fed
through a feed-forward soft limiter (instant attack, ~120ms release). Below
the ceiling it's transparent and sample-exact; loud multi-peer moments are
ridden down to the ceiling instead of shattering into hard-clip distortion.
State carries across frames so a sustained-loud stretch doesn't re-attack
every 20ms frame. The master output gain now applies inside the limiter so a
boost past the ceiling is limited too.

mix_frames now returns the lossless i32 sum (saturation responsibility moved
to the limiter); its tests assert losslessness, and the new limiter module
carries the saturation/transparency/release guarantees.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 21:27:32 -04:00
co-authored by Claude Opus 4.8
parent c5962f2703
commit 38c92ced62
3 changed files with 200 additions and 30 deletions
+1
View File
@@ -53,5 +53,6 @@ pub trait AudioBackend: Send + Sync {
pub mod echo_cancel;
pub mod gate;
pub mod limiter;
pub mod pipewire_impl;
pub mod pw_cli;