Treating schwa as a separate phone

This commit is contained in:
Daniel Wolf 2016-09-30 17:12:10 +02:00
parent 1f6f6d6175
commit 503ba9104a
4 changed files with 11 additions and 3 deletions

View File

@ -22,6 +22,7 @@ EnumConverter<Phone>::member_data PhoneConverter::getMemberData() {
{ Phone::IH, "IH" },
{ Phone::UH, "UH" },
{ Phone::AH, "AH" },
{ Phone::Schwa, "Schwa" },
{ Phone::AE, "AE" },
{ Phone::EY, "EY" },
{ Phone::AY, "AY" },

View File

@ -15,7 +15,8 @@ enum class Phone {
EH, // [ɛ] as in r[e]d, m[e]n
IH, // [ɪ] as in b[i]g, w[i]n
UH, // [ʊ] as in sh[ou]ld, c[ou]ld
AH, // [ʌ, ə] as in b[u]t, s[u]n, [a]lone, disc[u]s
AH, // [ʌ] as in b[u]t, s[u]n
Schwa, // [ə] as in [a]lone, disc[u]s
AE, // [æ] as in [a]t, b[a]t
// ... diphthongs

View File

@ -60,7 +60,8 @@ Timeline<Viseme> animate(optional<Phone> phone, centiseconds duration, centiseco
case Phone::EH: return single({ { C }, 20_cs, { D } });
case Phone::IH: return single({ B });
case Phone::UH: return single({ E });
case Phone::AH: return single({ { B, C, D, E, F }, 6_cs, { C } }); // Heuristic: < 6_cs is schwa
case Phone::AH: return single({ C });
case Phone::Schwa: return single({ { B, C, D, E, F } });
case Phone::AE: return single({ D });
case Phone::EY: return diphtong({ { C }, 20_cs, { D } }, { B });
case Phone::AY: return diphtong({ D }, { B });

View File

@ -203,7 +203,12 @@ optional<Timeline<Phone>> getPhoneAlignment(
// Add entry
centiseconds start(phoneEntry->start);
centiseconds duration(phoneEntry->duration);
Timed<Phone> timedPhone(start, start + duration, PhoneConverter::get().parse(phoneName));
Phone phone = PhoneConverter::get().parse(phoneName);
if (phone == Phone::AH && duration < 6_cs) {
// Heuristic: < 6_cs is schwa. Pocketsphinx doesn't differentiate.
phone = Phone::Schwa;
}
Timed<Phone> timedPhone(start, start + duration, phone);
result.set(timedPhone);
}
return result;