feat(quench): add Quench sub-safe clipper

Quench splits the signal with a Linkwitz-Riley crossover and lets the sub
pass unclipped. The top is clipped symmetrically at the ceiling minus the
sub's held peak, so it does not pump at the sub's rate and the sum stays
under the ceiling. What the clip removes is high-passed at the split, so its
products stay out of the low band. Two correction passes and an oversampled
hard clip hold the ceiling; a safety clip catches the downsampler's ringing.

- Controls: Drive, Ceiling, Split, Hold, Soft, Bypass.
- Listen to Quench, a plain clipper at the same settings, or the delta.
- Editor meter compares how much the low band changed for Quench and for a
  plain clip, with a scope of the output, the sub and the top's room.
- Measured: sub level +0.04 dB against -2.2 dB for a plain clip, low-band
  products -35 dB against -16 dB, at 0.5-1.2 dB less RMS.
- Registered in the catalog, workflows, editor-check, README, chain and
  development docs, and the website copy.
This commit is contained in:
nvrl committed 2026-11-06 15:51:36 +01:00
1 parent 77ee4a9078
commit 3d316cbe49
28 files changed
+4397 -17

No files matched your search

+34 -6
View File
@@ -12,13 +12,13 @@ fn main() {
.unwrap_or("rivet");
if ![
"rivet", "patina", "anvil", "crucible", "lathe", "temper", "weld", "knurl", "planish",
"braze",
"braze", "quench",
]
.contains(&plugin)
{
eprintln!(
"Use --plugin rivet, patina, anvil, crucible, lathe, temper, weld, knurl, planish \
or braze"
"Use --plugin rivet, patina, anvil, crucible, lathe, temper, weld, knurl, planish, \
braze or quench"
);
std::process::exit(2);
}
@@ -32,7 +32,10 @@ fn main() {
let knurl = plugin == "knurl";
let planish = plugin == "planish";
let braze = plugin == "braze";
let (width, height) = if braze {
let quench = plugin == "quench";
let (width, height) = if quench {
(quench_ui::WIDTH, quench_ui::HEIGHT)
} else if braze {
(braze_ui::WIDTH, braze_ui::HEIGHT)
} else if planish {
(planish_ui::WIDTH, planish_ui::HEIGHT)
@@ -229,6 +232,27 @@ fn main() {
}
braze_state.accept_frame(engine.take_analyzer());
}
let mut quench_settings = quench_core::Settings {
drive: 9.,
..Default::default()
};
let mut quench_state = quench_ui::State::default();
if quench {
// A 49 Hz sub under a distorted saw top two octaves up, driven 9 dB into the clipper.
let mut engine = quench_core::Engine::new(48000., 2).unwrap();
engine.set_settings(quench_settings).unwrap();
let mut saw = common_dsp::Saw::new(48000., 196.);
for i in 0..48000 {
let t = i as f32 / 48000.;
let sub = 0.18 * (std::f32::consts::TAU * 49. * t).sin();
let top = (saw.sample() * 3.).tanh() * 0.3;
engine.process_sample([sub + top, sub + top], quench_core::Monitor::Quench);
if i % 1600 == 0 {
quench_state.accept_frame(engine.take_analyzer());
}
}
quench_state.accept_frame(engine.take_analyzer());
}
let mut weld_settings = weld_core::Settings::default();
let mut weld_state = weld_ui::State::default();
if weld {
@@ -358,7 +382,9 @@ fn main() {
let session_motif = session.motifs[0].id;
shared.replace(session).unwrap();
let ctx = egui::Context::default();
if braze {
if quench {
quench_ui::style(&ctx);
} else if braze {
braze_ui::style(&ctx);
} else if planish {
planish_ui::style(&ctx);
@@ -399,7 +425,9 @@ fn main() {
},
|ui| {
egui::CentralPanel::default().show(ui, |ui| {
if braze {
if quench {
quench_ui::show(ui, &mut quench_settings, &mut quench_state);
} else if braze {
braze_ui::show(ui, &mut braze_settings, &mut braze_state);
} else if planish {
planish_ui::show(ui, &mut planish_settings, &mut planish_state);