the ultimate vocal synthesizer - sing, speak, beatbox, and more
Rust
Hill climb: a target test for the click before /f/ and /v/, under the artifact keep rule
Jameson Hodge0e76223cd41f
diff --git a/crates/chimera/tests/consonant_artifacts.rs b/crates/chimera/tests/consonant_artifacts.rsindex c2deefe..ff701b4 100644--- a/crates/chimera/tests/consonant_artifacts.rs+++ b/crates/chimera/tests/consonant_artifacts.rs@@ -1,5 +1,6 @@//! Artifacts a listener reported in running speech (2026-11-07): a tinny ring as sounds fade, and-//! a pop on the /p/ of "sharp" in "A cold paper walks under the sharp tree." (still open)+//! a pop on the /p/ of "sharp" in "A cold paper walks under the sharp tree.", and a click before+//! every /f/ and /v/ (found in experiment 18).use chimera::anatomy::human::{BODY_FEMALE, BODY_MALE, HumanBody};use chimera::phonetics::Plan;use chimera::phonetics::english::EnglishG2P;@@ -108,3 +109,50 @@ fn the_p_of_sharp_does_not_pop() {assert!(db < -3.0, "{name}: the /p/ of sharp releases at {db:+.1} dB re the loudest vowel");}}++/// dB of the 2 ms peaks in [t0, t1), relative to `re`.+fn peaks_2ms(x: &[f32], t0: f64, t1: f64, re: f64) -> Vec<f64> {+ let mut v = vec![];+ let mut t = t0;+ while t + 0.002 <= t1 + 1e-9 {+ v.push(20.0 * (peak(x, idx(t), idx(t + 0.002)) / re + 1e-12).log10());+ t += 0.002;+ }+ v+}++#[test]+#[ignore = "target for the pronunciation batch: run with --ignored to measure it"]+fn an_f_does_not_click() {+ // The lips nearly closed, then sprang open as the lower lip tucked under the incisors (two+ // steps in the labiodental geometry): a 2-4 ms [b]-like click about 16 ms before every /f/ and+ // /v/, 15-20 dB above the fricative around it. Measured as the loudest 2 ms peak from 20 ms+ // before the fricative to 10 ms into it, over the median 2 ms peak of its first 30 ms. Only+ // where nothing else is in that window: between vowels, and the /f/ that opens a sentence (in+ // "work faced" the /k/ release would count).+ let mut g = EnglishG2P::new();+ g.load_dict("four\tF AO1 R\nhours\tAW1 ER0 Z\nof\tAH1 V\nsteady\tS T EH1 D IY0\nwork\tW ER1 K\nfaced\tF EY1 S T\nus\tAH1 S\n");+ let inputs: Vec<PhraseInput> = g+ .to_phrases("Four hours of steady work faced us.")+ .into_iter()+ .map(|p| PhraseInput { segments: p.segments, intonation: Some(p.intonation), pause: Some(p.pause) })+ .collect();+ let mut loud = vec![];+ for (body, name, f0) in VOICES {+ for (what, plan) in [("ɑfɑ", plan_utterance(&tokenize_ipa("ˈɑfɑ"), &options(name, f0))), ("ɑvɑ", plan_utterance(&tokenize_ipa("ˈɑvɑ"), &options(name, f0))), ("four hours", plan_phrases(&inputs, &options(name, f0)))] {+ let (plan, out) = render(plan, body, f0);+ let first_only = what == "four hours";+ for s in plan.segments.iter().filter(|s| s.ipa == "f" || s.ipa == "v").take(if first_only { 1 } else { usize::MAX }) {+ let onset = peaks_2ms(&out, s.t0 - 0.02, s.t0 + 0.01, 1.0).into_iter().fold(f64::MIN, f64::max);+ let mut body_db = peaks_2ms(&out, s.t0, s.t0 + 0.03, 1.0);+ body_db.sort_by(|a, b| a.partial_cmp(b).unwrap());+ let excess = onset - body_db[body_db.len() / 2];+ println!("{what} ({name}): /{}/ at {:.2} s: onset peak {excess:+.1} dB over the fricative", s.ipa, s.t0);+ if excess > 6.0 {+ loud.push(format!("{what} ({name}) /{}/ {excess:+.1} dB", s.ipa));+ }+ }+ }+ }+ assert!(loud.is_empty(), "f/v onsets that click: {loud:?}");+}diff --git a/docs/hill-climb/README.md b/docs/hill-climb/README.mdindex 001d01e..18d31a1 100644--- a/docs/hill-climb/README.md+++ b/docs/hill-climb/README.md@@ -33,10 +33,13 @@ cared more about pronunciation. So batch 2 swaps the roles of the judges:releases are loud in general (about −5 dB in "apa"; female −13 dB).4. Anything else Whisper's errors point at: the training sentences' wrong words are listed bythe speech judge.-- **Target 3 has its own keep rule.** One pop can't move the word error rate by 1.5 points, so a- change aimed at it is kept when `the_p_of_sharp_does_not_pop` passes (un-ignore it in that+- **Audible artifacts have their own keep rule.** Whisper can't count a pop or a click, and fixing+ one can't move the word error rate by 1.5 points. A change aimed at an artifact with a target+ test in `tests/consonant_artifacts.rs` is kept when that test passes (un-ignore it in thatcommit; this is the one test edit allowed), the speech verdict is not WORSE, and the singer- guard above holds. Everything else (bench, tests) as usual.+ guard above holds. Everything else (bench, tests) as usual. Targets: the pop on "sharp"+ (`the_p_of_sharp_does_not_pop`, fixed by experiment 16) and the click before /f/ and /v/+ (`an_f_does_not_click`, found by experiment 18).- **Branch:** `t3/pronunciation-hill-climb`, stacked on `t3/consonant-fixes` (the fix for thebuzz, and the Bright control).diff --git a/docs/hill-climb/log.md b/docs/hill-climb/log.mdindex c625825..f9f85ad 100644--- a/docs/hill-climb/log.md+++ b/docs/hill-climb/log.md@@ -1193,3 +1193,13 @@ voice's sung consonants."Her round" → "Roundtable" is an 80 ms /ɝ/ running into /ɹaʊ/ with no boundary betweenthem: a lead for the /ɝ/ + /ɹ/ sequence, not the onset.- Don't retry the speech breath lead on its own.++### Decision after experiment 18: a test for the /f/ click, under the artifact rule++Experiment 18 found a click before every /f/ and /v/, as loud as a vowel. Whisper doesn't count+it, but a listener would, so it gets the same treatment as the pop on "sharp": an ignored target+test, `an_f_does_not_click` (the loudest 2 ms peak from 20 ms before the fricative to 10 ms into+it, over the fricative's median 2 ms peak; between vowels and sentence-initially, both voices;+fails above 6 dB). On the current engine it reads +8 to +20 dB; with experiment 18's patch+(`out/onset/exp18-labiodental.patch`, `LAB_FRONT_OPENS` 0.7) +0.3 to +4.6 dB. The README's+keep rule for target 3 now covers any artifact with such a test.