feat: stable note tracking, NOTE pitch source and unsure fallback
Producers found the tracked plugins jumpy: the shared tracker switched notes after 10 ms and retuned every 5 ms, so growls and formant basses flickered and every tracked plugin acted on wrong notes. Shared tracker (common-dsp): - A new note needs a steady read for 40 ms; an octave down 80 ms, an octave up 200 ms (an octave-up read still fits the note's period and counts as agreeing). Inside a note the tuning only moves past a 0.25 semitone deadband. Follow bends keeps the old fast behaviour as an option. - A trust score turns the note unsure while reads disagree; Tracker::active and NoteState report it, and Fallback latches "step back" across note ends. - Notes end when the window start stays below the gate's release level for 20 ms, so short gaps between notes are seen without waiting for the gate. - PitchSource replaces the old (midi, gate, glide) arguments: Audio, MIDI or Note mode (a set note, no detection), plus a key lock (minor, major, root only) that snaps reads to the key. - stems.rs: synthetic stems (growls, wobble, reese, formant, 808 slide, layered drop, noise riser) and a score; examples/tracker_report scores the corpus or real WAV stems. On the corpus the old behaviour makes up to 28 extra note starts per second; the stable default makes none. Plugins: - Anvil, Lathe, Temper, Knurl, Planish, Braze and Forge gain the NOTE pitch source, the key lock and Follow bends (shared common-params crate and a shared header switch in common-ui). - Unsure tracking: Anvil brings the original sub back in place of the sine, Lathe passes the audio through, Knurl fades its texture out; Temper, Planish and Braze hold their last sure tuning. Readouts show the note only when it is sure. - Anvil gains Mode: Replace or Enhance (keeps the original sub and adds the sine under it). - Planish slides its band edges over 6 ms on a new note instead of snapping. - Ballast defaults to Grid parts, which need no tracking.
This commit is contained in:
1 parent
7c873f2bd0
commit
adfb2c0287
66 files changed
+2246
-261
No files matched your search
@@ -137,3 +137,44 @@ fn settings_are_validated_and_serialise() {
|
||||
assert!(e.set_settings(bad).is_err());
|
||||
assert_eq!(e.settings(), s);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn note_mode_cuts_the_set_notes_harmonics() {
|
||||
let mut s = Settings::default();
|
||||
s.gains[2] = -12.;
|
||||
s.source = Source::Note;
|
||||
s.pitch.note = 29;
|
||||
let hz = 43.65;
|
||||
let x = saw(hz, 1., 0.5);
|
||||
let (mut e, l) = engine(s);
|
||||
let y = render(&mut e, &x);
|
||||
let a = harmonics(&x[..x.len() - l], hz);
|
||||
let b = harmonics(&y[l..], hz);
|
||||
assert!((b[2] - a[2] + 12.).abs() < 0.7, "{a:?} {b:?}");
|
||||
assert!((b[1] - a[1]).abs() < 1.);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unsure_tracking_passes_the_audio_through() {
|
||||
let mut s = Settings::default();
|
||||
s.gains[0] = -12.;
|
||||
s.gains[1] = -12.;
|
||||
s.gains[2] = -12.;
|
||||
let (mut e, l) = engine(s);
|
||||
// A clear note, then noise detection cannot read.
|
||||
let mut x = saw(55., 0.5, 0.5);
|
||||
let mut seed = 7u32;
|
||||
for _ in 0..RATE as usize {
|
||||
seed ^= seed << 13;
|
||||
seed ^= seed >> 17;
|
||||
seed ^= seed << 5;
|
||||
x.push((seed as f32 / u32::MAX as f32 - 0.5) * 0.5);
|
||||
}
|
||||
let y = render(&mut e, &x);
|
||||
let tail = (RATE * 1.0) as usize;
|
||||
let mut worst = 0f32;
|
||||
for i in tail..x.len() {
|
||||
worst = worst.max((y[i] - x[i - l]).abs());
|
||||
}
|
||||
assert!(worst < 1e-3, "{worst}");
|
||||
}
|
||||
Reference in new issue
Block a user