Skip to content

the ultimate vocal synthesizer - sing, speak, beatbox, and more

Rust

Hill climb 29: /dʒ/ has a closure and a frication: its folds part for the release as /tʃ/'s do, in a 100 ms span (voicing through the release read as the vowel, so MFA halved it)

Jameson Hodge294ee342fc29
diff --git a/crates/chimera/src/phonetics/durations.rs b/crates/chimera/src/phonetics/durations.rs
index 8590383..8373154 100644
--- a/crates/chimera/src/phonetics/durations.rs
+++ b/crates/chimera/src/phonetics/durations.rs
@@ -45,10 +45,10 @@ fn table(ipa: &str) -> Option<(f64, f64)> {
"d" => (75.0, 50.0),
"g" => (80.0, 60.0),
"ʔ" => (40.0, 30.0),
- // not Klatt's 70/50, which can't hold a closure and its frication (his /t/ alone is 75):
- // the TSP speakers' /tʃ/ phone, 125-140 ms, with Klatt's ratio of minimum to inherent
+ // not Klatt's 70/50 and 50/30, which can't hold a closure and its frication (his /t/ alone is 75):
+ // the TSP speakers' phones, /tʃ/ 125-140 ms and /dʒ/ 100-110, with Klatt's ratios of minimum to inherent
"tʃ" => (125.0, 88.0),
- "dʒ" => (50.0, 30.0),
+ "dʒ" => (100.0, 60.0),
"f" => (100.0, 80.0),
"v" => (60.0, 40.0),
"θ" => (90.0, 60.0),
diff --git a/crates/chimera/src/phonetics/planner.rs b/crates/chimera/src/phonetics/planner.rs
index af66e8f..f3546b8 100644
--- a/crates/chimera/src/phonetics/planner.rs
+++ b/crates/chimera/src/phonetics/planner.rs
@@ -341,8 +341,7 @@ pub fn plan_utterance(input: &[Segment], o: &PlanOptions) -> Plan {
// apart from the closure on, and together again as the frication ends: in an
// affricate the frication is the voice onset time, with no [h] after it, and the
// vowel keeps its planned length
- let open = t0 + 0.15 * dur;
- gestures.push(Gesture::new(open, js_max(open, t1 - 0.03), 0.035, 0.03, 6.0, one(ControlKey::ABDUCTION, 0.36)).label("aspiration"));
+ gestures.push(affricate_folds(t0 + 0.15 * dur, t1).label("aspiration"));
} else if def.manner == Manner::Stop {
// aspirated when syllable-initial before a vowel and not after /s/ (English-like)
let aspirated = next_vowel && !prev_seg.is_some_and(|p| p.ipa == "s");
@@ -361,6 +360,11 @@ pub fn plan_utterance(input: &[Segment], o: &PlanOptions) -> Plan {
let after_nasal = prev_seg.and_then(|p| p.def.as_ref()).is_some_and(|d| d.manner == Manner::Nasal);
let opening = if def.ipa == "ð" && after_nasal { DH_OPENING } else { VOICED_FRICATIVE_OPENING };
gestures.push(Gesture::new(t0 - 0.015, t1, 0.03, 0.03, 3.0, one(ControlKey::ABDUCTION, opening)).label("voiced frication"));
+ } else if def.manner == Manner::Affricate {
+ // the speakers' /dʒ/ differs from their /tʃ/ at its ends, not its frication: voice carries into
+ // the closure and fades there, and the frication is as loud and as voiceless as /tʃ/'s
+ // (hill-climb log, experiment 29). So the same folds, parted only for the release.
+ gestures.push(affricate_folds(t0 + dur * AFFRICATE_CLOSURE, t1).label("voiced affricate"));
}
}
let open_end = o.open_end == Some(true);
@@ -443,9 +447,14 @@ pub fn plan_utterance(input: &[Segment], o: &PlanOptions) -> Plan {
}
/// The share of an affricate's span that is closure, the rest being frication (the TSP speakers'
-/// /tʃ/: about 55 ms of closure, 60-65 ms of frication and a fading tail).
+/// /tʃ/: about 55 ms of closure, 60-65 ms of frication and a fading tail; their /dʒ/: 45-55, about 45).
const AFFRICATE_CLOSURE: f64 = 0.45;
+/// An affricate's folds: apart by `open` for the frication, and together again by `t1`, as it ends.
+fn affricate_folds(open: f64, t1: f64) -> Gesture {
+ Gesture::new(open, js_max(open, t1 - 0.03), 0.035, 0.03, 6.0, one(ControlKey::ABDUCTION, 0.36))
+}
+
/// How much later a nasal's closure is aimed than its span's start (s). `oral_gestures_into` brings
/// contact to about its `a` (a median 0-9 ms early in running speech), but a nasal is heard from when
/// the oral area falls under about 0.05 cm², when the sound has already left for the nose, and that
diff --git a/crates/chimera/tests/affricates.rs b/crates/chimera/tests/affricates.rs
index 2fbafab..4a6a6ac 100644
--- a/crates/chimera/tests/affricates.rs
+++ b/crates/chimera/tests/affricates.rs
@@ -1,7 +1,8 @@
//! A voiceless affricate is a closure, then a release straight into frication that lasts until the
//! voicing starts (experiment 22). Its constriction used to let go 40 ms before the folds closed: a
-//! short /ʃ/ and then an [h], heard as a stop and an [h] ("chain" as "king").
-use chimera::anatomy::human::{BODY_FEMALE, BODY_MALE};
+//! short /ʃ/ and then an [h], heard as a stop and an [h] ("chain" as "king"). A voiced one is the same with
+//! a closure that starts voiced (experiment 29).
+use chimera::anatomy::human::{BODY_FEMALE, BODY_MALE, HumanBody};
use chimera::phonetics::ipa::tokenize_ipa;
use chimera::phonetics::planner::{PlanOptions, plan_utterance};
use chimera::voice::human_voice::{HumanVoice, SourcePatch};
@@ -29,28 +30,60 @@ fn frames(x: &[f32]) -> Vec<(f64, f64)> {
.collect()
}
+/// A VCV's frames, with where its affricate's span falls, in frames.
+fn say(ipa: &str, affricate: &str, body: HumanBody, name: &str, f0: f64) -> (Vec<(f64, f64)>, f64, f64) {
+ let plan = plan_utterance(&tokenize_ipa(ipa), &PlanOptions { body: name.into(), t0: 0.05, f0: Some(f0), ..Default::default() });
+ let span = plan.segments.iter().find(|s| s.ipa == affricate).unwrap();
+ let (t0, t1) = (span.t0, span.t1);
+ let mut v = HumanVoice::new(FS, body, 2);
+ v.set_source(&SourcePatch::f0(f0));
+ v.schedule(&plan.gestures);
+ let mut out = vec![0.0f32; (FS * (plan.end + 0.3)).round() as usize];
+ for chunk in out.chunks_mut(128) {
+ v.render(chunk);
+ }
+ (frames(&out), t0, t1)
+}
+
+/// How long the frication lasts (ms), and how long after it the voice arrives (ms).
+fn frication(fr: &[(f64, f64)], t0: f64, t1: f64, name: &str) -> (usize, usize) {
+ let at = |t: f64| (t * FS / FRAME as f64) as usize;
+ let vowel = fr[at(t1 + 0.1)..at(t1 + 0.14)].iter().map(|f| f.0).fold(f64::MIN, f64::max);
+ let fric: Vec<usize> = (at(t0)..at(t1 + 0.1)).filter(|&i| fr[i].1 < -10.0 && fr[i].0 > vowel - 30.0).collect();
+ let (first, last) = (*fric.first().unwrap_or_else(|| panic!("{name}: no frication")), *fric.last().unwrap());
+ let voiced = (last..fr.len()).find(|&i| fr[i].0 > vowel - 8.0).unwrap();
+ ((last - first + 1) * 10, (voiced - last - 1) * 10)
+}
+
+const VOICES: [(HumanBody, &str, f64); 2] = [(BODY_MALE, "male", 112.0), (BODY_FEMALE, "female", 205.0)];
+
#[test]
fn a_voiceless_affricates_frication_runs_into_the_vowel_with_no_h_after_it() {
- for (body, name, f0) in [(BODY_MALE, "male", 112.0), (BODY_FEMALE, "female", 205.0)] {
- let plan = plan_utterance(&tokenize_ipa("ˈɑtʃɑ"), &PlanOptions { body: name.into(), t0: 0.05, f0: Some(f0), ..Default::default() });
- let span = plan.segments.iter().find(|s| s.ipa == "tʃ").unwrap();
- let (t0, t1) = (span.t0, span.t1);
- let mut v = HumanVoice::new(FS, body, 2);
- v.set_source(&SourcePatch::f0(f0));
- v.schedule(&plan.gestures);
- let mut out = vec![0.0f32; (FS * (plan.end + 0.3)).round() as usize];
- for chunk in out.chunks_mut(128) {
- v.render(chunk);
- }
- let fr = frames(&out);
- let at = |t: f64| (t * FS / FRAME as f64) as usize;
- let vowel = fr[at(t1 + 0.1)..at(t1 + 0.14)].iter().map(|f| f.0).fold(f64::MIN, f64::max);
- let fric: Vec<usize> = (at(t0)..at(t1 + 0.1)).filter(|&i| fr[i].1 < -10.0 && fr[i].0 > vowel - 30.0).collect();
- let (first, last) = (*fric.first().unwrap(), *fric.last().unwrap());
- let voiced = (last..fr.len()).find(|&i| fr[i].0 > vowel - 8.0).unwrap();
- let (length, gap) = ((last - first + 1) * 10, (voiced - last - 1) * 10);
+ for (body, name, f0) in VOICES {
+ let (fr, t0, t1) = say("ˈɑtʃɑ", "tʃ", body, name, f0);
+ let (length, gap) = frication(&fr, t0, t1, name);
println!("{name}: frication {length} ms, then {gap} ms to the voice");
assert!(length >= 50, "{name}: frication lasts {length} ms (real /tʃ/: 50-80)");
assert!(gap <= 20, "{name}: {gap} ms between the frication and the voice");
}
}
+
+/// A voiced affricate has frication too (experiment 29). Its folds stayed together, so voicing ran through
+/// a release with no audible frication, MFA called that the vowel, and /dʒ/ read half its length. What sets
+/// it apart from /tʃ/ is that the voice carries into its closure and fades there, where /tʃ/'s folds have
+/// parted and its closure starts with a breath. The closing's frames: their least share below 1 kHz.
+#[test]
+fn a_voiced_affricate_closes_on_the_voice_and_releases_into_frication() {
+ let at = |t: f64| (t * FS / FRAME as f64) as usize;
+ let closing = |f: &[(f64, f64)], t: f64| f[at(t - 0.01)..at(t + 0.03)].iter().map(|x| x.1).fold(f64::MAX, f64::min);
+ for (body, name, f0) in VOICES {
+ let (fr, t0, t1) = say("ˈɑdʒɑ", "dʒ", body, name, f0);
+ let (length, gap) = frication(&fr, t0, t1, name);
+ let (tsh, s0, _) = say("ˈɑtʃɑ", "tʃ", body, name, f0);
+ let (voiced, breathy) = (closing(&fr, t0), closing(&tsh, s0));
+ println!("{name}: frication {length} ms, then {gap} ms to the voice; closing's share below 1 kHz {voiced:.1} dB, /tʃ/ {breathy:.1} dB");
+ assert!(length >= 30, "{name}: frication lasts {length} ms (the speakers' /dʒ/: about 45-60)");
+ assert!(gap <= 20, "{name}: {gap} ms between the frication and the voice");
+ assert!(voiced > breathy + 3.0, "{name}: closing's share below 1 kHz {voiced:.1} dB, /tʃ/ {breathy:.1} dB");
+ }
+}