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
@@ -181,7 +181,9 @@ impl Engine {
|
||||
}
|
||||
pub fn set_settings(&mut self, s: Settings) -> Result<(), &'static str> {
|
||||
s.validate()?;
|
||||
self.tracker.set(s.source == Source::Midi, s.gate, true);
|
||||
// Unsure tracking sends no events, so the beating holds its last sure note.
|
||||
self.tracker
|
||||
.set(s.pitch.source(s.source.mode(), s.gate, true));
|
||||
if s.low_cut != self.settings.low_cut || self.fresh {
|
||||
let q = std::f32::consts::FRAC_1_SQRT_2;
|
||||
let hz = s.low_cut.min(0.45 * self.rate);
|
||||
@@ -340,7 +342,7 @@ impl Engine {
|
||||
let beat_hz = self.tempo / 60. / s.rate.quarters();
|
||||
f.ratio = 1. + (beat_hz / (s.harmonic as f64 * hz as f64)) as f32;
|
||||
}
|
||||
if self.tracker.sounding() && hz > 0. {
|
||||
if self.tracker.active() && hz > 0. {
|
||||
f.note = Some(hz_to_midi(hz).round().clamp(0., 127.) as u8);
|
||||
}
|
||||
f
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Host-independent controls. Levels in dB, amounts in percent, angles in degrees.
|
||||
use common_dsp::tracker::{Pitch, PitchMode};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Highest harmonic the beat rate can be set on.
|
||||
@@ -14,6 +15,24 @@ pub enum Source {
|
||||
Audio,
|
||||
/// Notes come from MIDI note input.
|
||||
Midi,
|
||||
/// Note starts are detected, the pitch is the set note: nothing is guessed.
|
||||
Note,
|
||||
}
|
||||
impl Source {
|
||||
pub fn mode(self) -> PitchMode {
|
||||
match self {
|
||||
Source::Audio => PitchMode::Audio,
|
||||
Source::Midi => PitchMode::Midi,
|
||||
Source::Note => PitchMode::Note,
|
||||
}
|
||||
}
|
||||
pub fn from_mode(mode: PitchMode) -> Self {
|
||||
match mode {
|
||||
PitchMode::Audio => Source::Audio,
|
||||
PitchMode::Midi => Source::Midi,
|
||||
PitchMode::Note => Source::Note,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// One beat cycle lasts this note value.
|
||||
@@ -75,6 +94,9 @@ impl Rate {
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Settings {
|
||||
pub source: Source,
|
||||
/// Note mode's note, the key lock and Follow bends.
|
||||
#[serde(default)]
|
||||
pub pitch: Pitch,
|
||||
/// How long one beat cycle of `harmonic` lasts.
|
||||
pub rate: Rate,
|
||||
/// The harmonic that beats exactly at `rate`. Harmonic n beats n/harmonic times as fast.
|
||||
@@ -100,6 +122,7 @@ impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
source: Source::Audio,
|
||||
pitch: Pitch::default(),
|
||||
rate: Rate::Eighth,
|
||||
// Harmonic 4 sits above the low cut on every bass note, and on F1 it asks for
|
||||
// about 45 cents of detune, a usual reese spread.
|
||||
@@ -117,6 +140,7 @@ impl Default for Settings {
|
||||
}
|
||||
impl Settings {
|
||||
pub fn validate(&self) -> Result<(), &'static str> {
|
||||
self.pitch.validate()?;
|
||||
let finite = [
|
||||
self.depth,
|
||||
self.low_cut,
|
||||
|
||||
Reference in new issue
Block a user