feat(weld): phase alignment for layered bass, release 0.1.0
Check and Windows preview / check (anvil) (push) Successful in 2m0s
Check and Windows preview / check (crucible) (push) Successful in 1m29s
Check and Windows preview / check (lathe) (push) Successful in 1m27s
Check and Windows preview / check (patina) (push) Successful in 1m53s
Check and Windows preview / check (rivet) (push) Successful in 1m29s
Check and Windows preview / check (temper) (push) Successful in 1m29s
Check and Windows preview / check (weld) (push) Successful in 2m38s
Check and Windows preview / previews (push) Successful in 1m28s
Independent plugin release / plan (push) Successful in 8s
Check and Windows preview / windows (push) Successful in 3m14s
Independent plugin release / build (push) Successful in 3m50s
Independent plugin release / publish (push) Successful in 9s

Weld hears the other bass layer through the sidechain and fits polarity
plus up to four RBJ allpass sections to the measured cross-spectrum, so
the layers sum instead of cancelling. No latency; the layer on its own
keeps its sound.

- Worker thread: Welch cross-spectrum and coherence, Nelder-Mead fit with
  1/f weighting, a per-band loss penalty and model selection by share of
  the achievable gain; GCC-PHAT lag detection flags a late layer.
- Audio thread: allocation-free chain with a 40 ms warm-up and 40 ms
  crossfade per new fit; mono blocks go to the worker through a lock-free
  queue.
- Follow / Learn / Hold; the fit is persisted and restored without a
  crossfade.
- Editor: per-band loss and recovery against a perfect alignment, phase
  before and after, recovered dB, time offset and status.
- Tests for flat magnitude, crossfade, fit targets, Follow hysteresis,
  Learn, silence, realtime allocation and the persisted fit in the host.
This commit is contained in:
nvrl committed 2026-11-06 08:31:41 +01:00
1 parent 0a0917ac56
commit 9b3ddeaf56
26 files changed
+2898 -144

No files matched your search

+33 -4
View File
@@ -10,7 +10,11 @@ fn main() {
.find(|a| a[0] == "--plugin")
.map(|a| a[1].as_str())
.unwrap_or("rivet");
if !["rivet", "patina", "anvil", "crucible", "lathe", "temper", "weld"].contains(&plugin) {
if ![
"rivet", "patina", "anvil", "crucible", "lathe", "temper", "weld",
]
.contains(&plugin)
{
eprintln!("Use --plugin rivet, patina, anvil, crucible, lathe, temper or weld");
std::process::exit(2);
}
@@ -145,16 +149,41 @@ fn main() {
let mut weld_settings = weld_core::Settings::default();
let mut weld_state = weld_ui::State::default();
if weld {
// Two layers of an F1 saw bass; the sidechain layer is polarity-flipped.
// Two layers of an F1 saw bass. The sidechain layer is polarity-flipped and runs
// through an allpass at 400 Hz, as an EQ in its chain would leave it. The real
// analyzer measures them and its fits go back to the engine, as on the worker.
let mut engine = weld_core::Engine::new(48000., 2).unwrap();
engine.set_settings(weld_settings).unwrap();
let link = engine.link();
let mut analyzer = weld_core::Analyzer::new(48000., weld_core::Fit::NONE);
let mut other = weld_core::Chain::new(
weld_core::Fit {
flip: true,
count: 1,
sections: [weld_core::Section { fc: 400., q: 0.7 }; weld_core::MAX_SECTIONS],
},
48000.,
);
let mut saw = common_dsp::Saw::new(48000., 43.65);
for i in 0..36000 {
for i in 0..48000 * 4 {
let x = (saw.sample() * 1.6).tanh() * 0.4;
engine.process_sample([x, x], [-0.7 * x, -0.7 * x]);
let b = 0.8 * other.process(0, x);
engine.process_sample([x, x], [b, b]);
if i % 1600 == 0 {
weld_state.accept_frame(engine.take_analyzer());
}
while let Some(settings) = link.pop_settings() {
analyzer.set_settings(settings);
}
while let Some(block) = link.pop_block() {
analyzer.push(&block.a, &block.b);
if let Some(update) = analyzer.poll() {
if let Some(fit) = update.fit {
link.push_fit(fit);
}
weld_state.accept_report(update.report);
}
}
}
weld_state.accept_frame(engine.take_analyzer());
}