Skip to content

Commit

Permalink
[EN ARPA+] Fix ending vowel and consonant timings
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadlaxa committed Sep 2, 2024
1 parent 95a9afc commit c2ab19c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions OpenUtau.Plugin.Builtin/ArpasingPlusPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1743,15 +1743,15 @@ protected override double GetTransitionBasicLengthMs(string alias = "") {
var numbers = new List<string> { "1", "2", "3", "4", "5", "6", "7", "8", "9" };

foreach (var c in longConsonants) {
if (alias.Contains(c) && !alias.Contains("ng -")) {
return base.GetTransitionBasicLengthMs() * 2.6;
if (alias.Contains(c) && !alias.StartsWith(c) && !alias.Contains($"{c} -")) {
return base.GetTransitionBasicLengthMs() * 2.5;
}
}

foreach (var c in normalConsonants) {
foreach (var v in normalConsonants.Except(GlideVCCons)) {
foreach (var b in normalConsonants.Except(NormVCCons)) {
if (alias.Contains(c) &&
if (alias.Contains(c) && !alias.StartsWith(c) &&
!alias.Contains("dx") && !alias.Contains($"{c} -")) {
if ("b,d,g,k,p,t".Split(',').Contains(c)) {
hasCons = true;
Expand All @@ -1770,7 +1770,7 @@ protected override double GetTransitionBasicLengthMs(string alias = "") {
if (alias.Contains(c) && !alias.Contains("- ") && alias.Contains($"{v} {c}")
&& !alias.Contains("dx")) {
return base.GetTransitionBasicLengthMs() * 2.0;
}
}
}
}

Expand All @@ -1783,15 +1783,15 @@ protected override double GetTransitionBasicLengthMs(string alias = "") {
}

foreach (var c in affricates) {
if (alias.Contains(c)) {
if (alias.Contains(c) && !alias.StartsWith(c)) {
return base.GetTransitionBasicLengthMs() * 1.5;
}
}

foreach (var c in connectingGlides) {
foreach (var v in vowels.Except(excludedVowels)) {
if (alias.Contains($"{v} {c}") && !alias.Contains($"{c} -") && !alias.Contains($"{v} -")) {
return base.GetTransitionBasicLengthMs() * 2.3;
return base.GetTransitionBasicLengthMs() * 2.2;
}
}
}
Expand All @@ -1807,24 +1807,24 @@ protected override double GetTransitionBasicLengthMs(string alias = "") {

foreach (var c in semilongConsonants) {
foreach (var v in semilongConsonants.Except(excludedEndings)) {
if (alias.Contains(c) && !alias.Contains($"{c} -") && !alias.Contains($"- q")) {
if (alias.Contains(c) && !alias.StartsWith(c) && !alias.Contains($"{c} -") && !alias.Contains($"- q")) {
return base.GetTransitionBasicLengthMs() * 1.5;
}
}
}

foreach (var c in semiVowels) {
foreach (var v in semilongConsonants.Except(excludedEndings)) {
if (alias.Contains(c) && !alias.Contains($"{c} -")) {
return base.GetTransitionBasicLengthMs() * 1.6;
if (alias.Contains(c) && !alias.StartsWith(c) && !alias.Contains($"{c} -")) {
return base.GetTransitionBasicLengthMs() * 1.5;
}
}
}

if (hasCons) {
return base.GetTransitionBasicLengthMs() * 1.3; // Value for 'cons'
} else if (haslr) {
return base.GetTransitionBasicLengthMs() * 1.3; // Value for 'cons'
return base.GetTransitionBasicLengthMs() * 1.2; // Value for 'cons'
}

// Check if the alias ends with a consonant or vowel
Expand All @@ -1841,7 +1841,7 @@ protected override double GetTransitionBasicLengthMs(string alias = "") {
break;
}
}

// If the alias ends with a consonant or vowel, return 0.5 ms
if (isEndingConsonant || isEndingVowel) {
return base.GetTransitionBasicLengthMs() * 0.5;
Expand Down

0 comments on commit c2ab19c

Please sign in to comment.