Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EN ARPA+] Add dynamic variations for 'dynMid_vv' #1371

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion OpenUtau.Plugin.Builtin/ArpasingPlusPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ protected override List<string> ProcessSyllable(Syllable syllable) {
} else {
{
if (HasOto($"{prevV} {v}", syllable.vowelTone) || HasOto(ValidateAlias($"{prevV} {v}"), syllable.vowelTone)) {
basePhoneme = AliasFormat($"{prevV} {v}", "dynMid", syllable.vowelTone, "");
basePhoneme = AliasFormat($"{prevV} {v}", "dynMid_vv", syllable.vowelTone, "");
} else if (HasOto(v, syllable.vowelTone) || HasOto(ValidateAlias(v), syllable.vowelTone)) {
basePhoneme = v;
} else {
Expand Down Expand Up @@ -723,6 +723,7 @@ private string AliasFormat(string alias, string type, int tone, string prevV) {
// Define alias formats for different types
{ "dynStart", new string[] { "" } },
{ "dynMid", new string[] { "" } },
{ "dynMid_vv", new string[] { "" } },
{ "dynEnd", new string[] { "" } },
{ "startingV", new string[] { "-", "- ", "_", "" } },
{ "vcEx", new string[] { $"{prevV} ", $"{prevV}" } },
Expand Down Expand Up @@ -798,6 +799,29 @@ private string AliasFormat(string alias, string type, int tone, string prevV) {
}
}

if (type.Contains("dynMid_vv")) {
string consonant = "";
string vowel = "";
if (alias.Contains(" ")) {
var parts = alias.Split(' ');
consonant = parts[0];
vowel = parts[1];
} else {
consonant = alias;
}
var dynamicVariations1 = new List<string> {
$"{consonant} {vowel}", // "C V"
$"{consonant}{vowel}", // "CV"
$"{consonant}_{vowel}", // "C_V"
};
// Check each dynamically generated format
foreach (var variation1 in dynamicVariations1) {
if (HasOto(variation1, tone) || HasOto(ValidateAlias(variation1), tone)) {
return variation1;
}
}
}

if (type.Contains("dynEnd")) {
string consonant = "";
string vowel = "";
Expand Down
Loading