diff --git a/OpenUtau.Plugin.Builtin/BaseKoreanPhonemizer.cs b/OpenUtau.Plugin.Builtin/BaseKoreanPhonemizer.cs index 3eed0c1ea..6a8604293 100644 --- a/OpenUtau.Plugin.Builtin/BaseKoreanPhonemizer.cs +++ b/OpenUtau.Plugin.Builtin/BaseKoreanPhonemizer.cs @@ -40,7 +40,10 @@ protected virtual bool additionalTest(string lyric) { int? alt = attr.alternate ?? GetParentAlternate(); if (phoneme.Equals("")) {return phoneme;} - if (singer.TryGetMappedOto(phoneme + alt, note.tone + toneShift, color, out var oto)) { + if (singer.TryGetMappedOto(phoneme + alt, note.tone + toneShift, color, out var otoAlt)) { + phonemeToReturn = otoAlt.Alias; + } + else if (singer.TryGetMappedOto(phoneme, note.tone + toneShift, color, out var oto)) { phonemeToReturn = oto.Alias; } else if (singer.TryGetMappedOto(phoneme, note.tone, color, out oto)) { diff --git a/OpenUtau.Plugin.Builtin/CantoneseSyoPhonemizer.cs b/OpenUtau.Plugin.Builtin/CantoneseSyoPhonemizer.cs index 410ac8aee..4b90801b0 100644 --- a/OpenUtau.Plugin.Builtin/CantoneseSyoPhonemizer.cs +++ b/OpenUtau.Plugin.Builtin/CantoneseSyoPhonemizer.cs @@ -312,7 +312,9 @@ private bool checkOtoUntilHit(List input, Note note, out UOto oto) { var otos = new List(); foreach (string test in input) { - if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoCandidacy)) { + if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoAlt)) { + otos.Add(otoAlt); + } else if (singer.TryGetMappedOto(test, note.tone + shift, color, out var otoCandidacy)) { otos.Add(otoCandidacy); } } @@ -337,7 +339,9 @@ private bool checkOtoUntilHitFinal(List input, Note note, out UOto oto) var otos = new List(); foreach (string test in input) { - if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoCandidacy)) { + if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoAlt)) { + otos.Add(otoAlt); + } else if (singer.TryGetMappedOto(test, note.tone + shift, color, out var otoCandidacy)) { otos.Add(otoCandidacy); } } diff --git a/OpenUtau.Plugin.Builtin/ChineseCVVPlusPhonemizer.cs b/OpenUtau.Plugin.Builtin/ChineseCVVPlusPhonemizer.cs index 8071effd9..0ff97bb3e 100644 --- a/OpenUtau.Plugin.Builtin/ChineseCVVPlusPhonemizer.cs +++ b/OpenUtau.Plugin.Builtin/ChineseCVVPlusPhonemizer.cs @@ -236,7 +236,9 @@ public bool isExistPhonemeInOto(string phoneme, Note note) { return false; } - if (singer.TryGetMappedOto(phoneme + alt, note.tone + toneShift, color, out var oto)) { + if (singer.TryGetMappedOto(phoneme + alt, note.tone + toneShift, color, out var otoAlt)) { + return true; + } else if (singer.TryGetMappedOto(phoneme, note.tone + toneShift, color, out var oto)) { return true; } else if (singer.TryGetMappedOto(phoneme, note.tone, color, out oto)) { return true; @@ -251,7 +253,10 @@ string GetOtoAlias(string phoneme, Note note) { var toneShift = attr.toneShift ?? GetParentToneShift(); int? alt = attr.alternate ?? GetParentAlternate(); - if (singer.TryGetMappedOto(phoneme + alt, note.tone + toneShift, color, out var oto)) { + + if (singer.TryGetMappedOto(phoneme + alt, note.tone + toneShift, color, out var otoAlt)) { + return otoAlt.Alias; + } else if (singer.TryGetMappedOto(phoneme, note.tone + toneShift, color, out var oto)) { return oto.Alias; } else if (singer.TryGetMappedOto(phoneme, note.tone, color, out oto)) { return oto.Alias; diff --git a/OpenUtau.Plugin.Builtin/JapaneseCVVCPhonemizer.cs b/OpenUtau.Plugin.Builtin/JapaneseCVVCPhonemizer.cs index 11acdceea..820e17f12 100644 --- a/OpenUtau.Plugin.Builtin/JapaneseCVVCPhonemizer.cs +++ b/OpenUtau.Plugin.Builtin/JapaneseCVVCPhonemizer.cs @@ -109,7 +109,9 @@ private bool checkOtoUntilHit(string[] input, Note note, out UOto oto) { var otos = new List(); foreach (string test in input) { - if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoCandidacy)) { + if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoAlt)) { + otos.Add(otoAlt); + } else if (singer.TryGetMappedOto(test, note.tone + shift, color, out var otoCandidacy)) { otos.Add(otoCandidacy); } } @@ -135,7 +137,9 @@ private bool checkOtoUntilHitVc(string[] input, Note note, out UOto oto) { var otos = new List(); foreach (string test in input) { - if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoCandidacy)) { + if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoAlt)) { + otos.Add(otoAlt); + } else if (singer.TryGetMappedOto(test, note.tone + shift, color, out var otoCandidacy)) { otos.Add(otoCandidacy); } } diff --git a/OpenUtau.Plugin.Builtin/JapanesePresampPhonemizer.cs b/OpenUtau.Plugin.Builtin/JapanesePresampPhonemizer.cs index 648fcd414..424fb0720 100644 --- a/OpenUtau.Plugin.Builtin/JapanesePresampPhonemizer.cs +++ b/OpenUtau.Plugin.Builtin/JapanesePresampPhonemizer.cs @@ -340,7 +340,9 @@ private bool checkOtoUntilHit(List input, Note note, out UOto oto) { var otos = new List(); foreach (string test in input) { - if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoCandidacy)) { + if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoAlt)) { + otos.Add(otoAlt); + } else if (singer.TryGetMappedOto(test, note.tone + shift, color, out var otoCandidacy)) { otos.Add(otoCandidacy); } } @@ -365,7 +367,9 @@ private bool checkOtoUntilHit(List input, Note note, int index, out UOto var otos = new List(); foreach (string test in input) { - if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoCandidacy)) { + if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoAlt)) { + otos.Add(otoAlt); + } else if (singer.TryGetMappedOto(test, note.tone + shift, color, out var otoCandidacy)) { otos.Add(otoCandidacy); } } diff --git a/OpenUtau.Plugin.Builtin/JapaneseVCVPhonemizer.cs b/OpenUtau.Plugin.Builtin/JapaneseVCVPhonemizer.cs index 281075fd1..08c06dc60 100644 --- a/OpenUtau.Plugin.Builtin/JapaneseVCVPhonemizer.cs +++ b/OpenUtau.Plugin.Builtin/JapaneseVCVPhonemizer.cs @@ -96,7 +96,9 @@ private bool CheckOtoUntilHit(string[] input, Note note, out UOto oto) { var otos = new List(); foreach (string test in input) { - if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoCandidacy)) { + if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoAlt)) { + otos.Add(otoAlt); + } else if (singer.TryGetMappedOto(test, note.tone + shift, color, out var otoCandidacy)) { otos.Add(otoCandidacy); } } diff --git a/OpenUtau.Plugin.Builtin/KOtoJAPhonemizer.cs b/OpenUtau.Plugin.Builtin/KOtoJAPhonemizer.cs index a85e5f680..2defa7e38 100644 --- a/OpenUtau.Plugin.Builtin/KOtoJAPhonemizer.cs +++ b/OpenUtau.Plugin.Builtin/KOtoJAPhonemizer.cs @@ -477,7 +477,9 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN } } // Map alias (apply shift + color) - if (singer.TryGetMappedOto(currPhoneme + alt, note.tone + shift, color, out var oto)) { + if (singer.TryGetMappedOto(currPhoneme + alt, note.tone + shift, color, out var otoAlt)) { + currPhoneme = otoAlt.Alias; + } else if (singer.TryGetMappedOto(currPhoneme, note.tone + shift, color, out var oto)) { currPhoneme = oto.Alias; } @@ -677,7 +679,9 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN if (substituteLookup.TryGetValue(consonant ?? string.Empty, out con)) { vcPhonemes[1] = $"{prevConnect} {con}"; } - if (singer.TryGetMappedOto(currPhoneme + alt1, note.tone + shift1, color1, out var oto0)) { + if (singer.TryGetMappedOto(currPhoneme + alt1, note.tone + shift1, color1, out var otoAlt)) { + currPhoneme = otoAlt.Alias; + } else if (singer.TryGetMappedOto(currPhoneme, note.tone + shift1, color1, out var oto0)) { currPhoneme = oto0.Alias; } string secondPhoneme = (currIMF[1][0] == 'w' || currIMF[1][0] == 'y') ? currIMF[1].Remove(0, 1) : currIMF[1]; @@ -739,13 +743,19 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN int noteLength = 0; for (int i = 0; i < notes.Length; i++) noteLength += notes[i].duration; int secondPosition = Math.Max(noteLength - (nextNeighbour == null ? 120 : 180), noteLength / 2); - if (singer.TryGetMappedOto(currPhoneme + alt1, note.tone + shift1, color1, out oto0)) { + if (singer.TryGetMappedOto(currPhoneme + alt1, note.tone + shift1, color1, out var otoAlt0)) { + currPhoneme = otoAlt0.Alias; + } else if (singer.TryGetMappedOto(currPhoneme, note.tone + shift1, color1, out var oto0)) { currPhoneme = oto0.Alias; } - if (singer.TryGetMappedOto(vcPhoneme ?? vcPhonemes[1] ?? string.Empty + alt, prevNeighbour.Value.tone + shift, color, out var otoVc)) { + if (singer.TryGetMappedOto(vcPhoneme ?? vcPhonemes[1] ?? string.Empty + alt, prevNeighbour.Value.tone + shift, color, out var otoVcAlt)) { + vcPhoneme = otoVcAlt.Alias; + } else if (singer.TryGetMappedOto(vcPhoneme ?? vcPhonemes[1] ?? string.Empty, prevNeighbour.Value.tone + shift, color, out var otoVc)) { vcPhoneme = otoVc.Alias; } - if (singer.TryGetMappedOto(secondPhoneme + alt2, note.tone + shift2, color2, out var oto3)) { + if (singer.TryGetMappedOto(secondPhoneme + alt2, note.tone + shift2, color2, out var otoAlt3)) { + secondPhoneme = otoAlt3.Alias; + } else if (singer.TryGetMappedOto(secondPhoneme, note.tone + shift2, color2, out var oto3)) { secondPhoneme = oto3.Alias; } if (singer.TryGetMappedOto(vcPhoneme, note.tone + shift, color, out _) @@ -794,7 +804,9 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN if (string.IsNullOrEmpty(currIMF[2])) { // Map alias (apply shift + color) - if (singer.TryGetMappedOto(currPhoneme + alt, note.tone + shift, color, out var oto)) { + if (singer.TryGetMappedOto(currPhoneme + alt, note.tone + shift, color, out var otoAlt)) { + currPhoneme = otoAlt.Alias; + } else if (singer.TryGetMappedOto(currPhoneme, note.tone + shift, color, out var oto)) { currPhoneme = oto.Alias; } return new Result { @@ -863,10 +875,14 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN for (int i = 0; i < notes.Length; i++) noteLength += notes[i].duration; int secondPosition = Math.Max(noteLength - (nextNeighbour == null ? 120 : 180), noteLength / 2); // Map alias (apply shift + color) - if (singer.TryGetMappedOto(currPhoneme + alt, note.tone + shift, color, out var oto)) { + if (singer.TryGetMappedOto(currPhoneme + alt, note.tone + shift, color, out var otoAlt)) { + currPhoneme = otoAlt.Alias; + } else if (singer.TryGetMappedOto(currPhoneme, note.tone + shift, color, out var oto)) { currPhoneme = oto.Alias; } - if (singer.TryGetMappedOto(secondPhoneme + alt1, note.tone + shift1, color1, out oto)) { + if (singer.TryGetMappedOto(secondPhoneme + alt1, note.tone + shift1, color1, out var otoalt)) { + secondPhoneme = otoalt.Alias; + } else if (singer.TryGetMappedOto(secondPhoneme, note.tone + shift1, color1, out var oto)) { secondPhoneme = oto.Alias; } // Return Result diff --git a/OpenUtau.Plugin.Builtin/KoreanVCVPhonemizer.cs b/OpenUtau.Plugin.Builtin/KoreanVCVPhonemizer.cs index 2bbcfbff3..0fdbcf71c 100644 --- a/OpenUtau.Plugin.Builtin/KoreanVCVPhonemizer.cs +++ b/OpenUtau.Plugin.Builtin/KoreanVCVPhonemizer.cs @@ -208,7 +208,9 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN } // Map alias (apply shift + color) - if (singer.TryGetMappedOto(currPhoneme + alt, note.tone + shift, color, out var oto)) { + if (singer.TryGetMappedOto(currPhoneme + alt, note.tone + shift, color, out var otoAlt)) { + currPhoneme = otoAlt.Alias; + } else if (singer.TryGetMappedOto(currPhoneme, note.tone + shift, color, out var oto)) { currPhoneme = oto.Alias; } @@ -295,7 +297,9 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN if (string.IsNullOrEmpty(currIMF[2])) { // Map alias (apply shift + color) - if (singer.TryGetMappedOto(currPhoneme + alt, note.tone + shift, color, out var oto)) { + if (singer.TryGetMappedOto(currPhoneme + alt, note.tone + shift, color, out var otoAlt)) { + currPhoneme = otoAlt.Alias; + } else if (singer.TryGetMappedOto(currPhoneme, note.tone + shift, color, out var oto)) { currPhoneme = oto.Alias; } @@ -337,11 +341,15 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN int secondPosition = Math.Max(noteLength - (nextNeighbour == null ? 120 : 180), noteLength / 2); // Map alias (apply shift + color) - if (singer.TryGetMappedOto(currPhoneme + alt, note.tone + shift, color, out var oto)) { + if (singer.TryGetMappedOto(currPhoneme + alt, note.tone + shift, color, out var otoAlt)) { + currPhoneme = otoAlt.Alias; + } else if (singer.TryGetMappedOto(currPhoneme, note.tone + shift, color, out var oto)) { currPhoneme = oto.Alias; } - if (singer.TryGetMappedOto(secondPhoneme + alt1, note.tone + shift1, color1, out oto)) { + if (singer.TryGetMappedOto(secondPhoneme + alt1, note.tone + shift1, color1, out var otoAlt1)) { + secondPhoneme = otoAlt1.Alias; + } else if (singer.TryGetMappedOto(secondPhoneme, note.tone + shift1, color1, out var oto)) { secondPhoneme = oto.Alias; } diff --git a/OpenUtau.Plugin.Builtin/TurkishCVVCPhonemizer.cs b/OpenUtau.Plugin.Builtin/TurkishCVVCPhonemizer.cs index d4a4f555c..4be80f1ca 100644 --- a/OpenUtau.Plugin.Builtin/TurkishCVVCPhonemizer.cs +++ b/OpenUtau.Plugin.Builtin/TurkishCVVCPhonemizer.cs @@ -27,7 +27,9 @@ private bool checkOtoUntilHit(string[] input, Note note, out UOto oto) { var otos = new List(); foreach (string test in input) { - if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoCandidacy)) { + if (singer.TryGetMappedOto(test + alt, note.tone + shift, color, out var otoAlt)) { + otos.Add(otoAlt); + } else if (singer.TryGetMappedOto(test, note.tone + shift, color, out var otoCandidacy)) { otos.Add(otoCandidacy); } }