Skip to content

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

Rust

Review details: hand-written syllables may leave out wordEnd and phraseEnd; the docs say `vot` is relative to the 50 ms default; an outdated test comment

Joshua Pham9cc70c212e35
diff --git a/crates/chimera/src/phonetics/mod.rs b/crates/chimera/src/phonetics/mod.rs
index 9a0edbe..47411db 100644
--- a/crates/chimera/src/phonetics/mod.rs
+++ b/crates/chimera/src/phonetics/mod.rs
@@ -108,8 +108,11 @@ pub struct Syllable {
/// continue the previous syllable's vowel at a new pitch
#[serde(default, skip_serializing_if = "Option::is_none")]
pub melisma: Option<bool>,
- /// last syllable of a word (codas sound here; phrase breaks follow punctuation)
+ /// last syllable of a word (codas sound here; phrase breaks follow punctuation); may be left
+ /// out of hand-written JSON (false)
+ #[serde(default)]
pub word_end: bool,
- /// a breath follows (comma, full stop, line break)
+ /// a breath follows (comma, full stop, line break); may be left out (false)
+ #[serde(default)]
pub phrase_end: bool,
}
diff --git a/crates/chimera/tests/sounds.rs b/crates/chimera/tests/sounds.rs
index d1370b0..136cea3 100644
--- a/crates/chimera/tests/sounds.rs
+++ b/crates/chimera/tests/sounds.rs
@@ -6,7 +6,7 @@ use chimera::phonetics::ipa::tokenize_ipa;
#[test]
fn affricates_tokenize_as_one_segment() {
let ipa: Vec<String> = tokenize_ipa("tɕi tɕʰi dʑa tʂa dʐu ɕy ʑə ɥɛ").into_iter().map(|s| s.ipa).collect();
- // ʰ is not modelled and drops, as before
+ // ʰ isn't a segment: it sets the stop's aspiration (#73)
assert_eq!(ipa, ["tɕ", "i", "tɕ", "i", "dʑ", "a", "tʂ", "a", "dʐ", "u", "ɕ", "y", "ʑ", "ə", "ɥ", "ɛ"]);
}
diff --git a/crates/chimera/tests/syllables.rs b/crates/chimera/tests/syllables.rs
index 981df85..36bb268 100644
--- a/crates/chimera/tests/syllables.rs
+++ b/crates/chimera/tests/syllables.rs
@@ -144,3 +144,10 @@ fn hangul_keeps_its_spelling_and_mixes_with_english() {
[("twin", false, false), ("kle", true, false), ("빵", false, false), ("야", true, false), ("빵", false, false), ("야", true, true), ("star", true, false)]
);
}
+
+#[test]
+fn hand_written_syllables_may_leave_out_word_and_phrase_ends() {
+ let s: chimera::phonetics::Syllable = serde_json::from_str(r#"{"text": "풀", "onset": [{"ipa": "p", "aspirated": true, "vot": 0.09}], "nucleus": {"ipa": "u"}, "coda": [{"ipa": "l"}]}"#).unwrap();
+ assert!(!s.word_end && !s.phrase_end);
+ assert_eq!(s.onset[0].vot, Some(0.09));
+}
diff --git a/docs/language-front-ends.md b/docs/language-front-ends.md
index b322ad3..d5f1476 100644
--- a/docs/language-front-ends.md
+++ b/docs/language-front-ends.md
@@ -66,14 +66,17 @@ Every front end writes the same thing, one sung syllable per sounding note:
- `onset` / `coda`: consonants and glides from the inventory (`phonetics/inventory.rs`).
- A stop or affricate may say `"aspirated": true|false` (unsaid: English's rule; `ʰ` and `˭` in
- IPA text) and `"vot"`, how long its aspiration lasts in seconds (unsaid: English's 50 ms). Each
- millisecond more or less than 50 moves the voice's return by a millisecond.
+ IPA text) and `"vot"`, its aspiration time in seconds relative to the 50 ms default (unsaid:
+ English's 50 ms). Each millisecond more or less than 50 moves the voice's return by a
+ millisecond; the measured voice onset also depends on the place and the voice (the Korean table
+ above: 45 asked gives 53–69 ms, 90 gives 96–110).
- `nucleus`: one vowel, or a diphthong the planner knows.
- A melisma note is `"melisma": true` with the same nucleus; its coda moves to the run's last note.
- `text` is what the lyrics panel and the piano roll show.
+- `wordEnd` and `phraseEnd` may be left out (false).
Any front end's output can be frozen to JSON, edited and sung with `"syllables"` instead of
-`"lyrics"`, in `render notes`, `DemoSong.syllables` and duet melody files. Use it to fix a reading
+`"lyrics"`, in `render notes` and duet melody files. Use it to fix a reading
by hand, or to sing a language that has no front end yet.
## Adding a language