Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion OpenUtau.Plugin.Builtin/BaseKoreanPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
8 changes: 6 additions & 2 deletions OpenUtau.Plugin.Builtin/CantoneseSyoPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ private bool checkOtoUntilHit(List<string> input, Note note, out UOto oto) {

var otos = new List<UOto>();
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);
}
}
Expand All @@ -337,7 +339,9 @@ private bool checkOtoUntilHitFinal(List<string> input, Note note, out UOto oto)

var otos = new List<UOto>();
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);
}
}
Expand Down
9 changes: 7 additions & 2 deletions OpenUtau.Plugin.Builtin/ChineseCVVPlusPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions OpenUtau.Plugin.Builtin/JapaneseCVVCPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ private bool checkOtoUntilHit(string[] input, Note note, out UOto oto) {

var otos = new List<UOto>();
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);
}
}
Expand All @@ -135,7 +137,9 @@ private bool checkOtoUntilHitVc(string[] input, Note note, out UOto oto) {

var otos = new List<UOto>();
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);
}
}
Expand Down
8 changes: 6 additions & 2 deletions OpenUtau.Plugin.Builtin/JapanesePresampPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,9 @@ private bool checkOtoUntilHit(List<string> input, Note note, out UOto oto) {

var otos = new List<UOto>();
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);
}
}
Expand All @@ -365,7 +367,9 @@ private bool checkOtoUntilHit(List<string> input, Note note, int index, out UOto

var otos = new List<UOto>();
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);
}
}
Expand Down
4 changes: 3 additions & 1 deletion OpenUtau.Plugin.Builtin/JapaneseVCVPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ private bool CheckOtoUntilHit(string[] input, Note note, out UOto oto) {

var otos = new List<UOto>();
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);
}
}
Expand Down
32 changes: 24 additions & 8 deletions OpenUtau.Plugin.Builtin/KOtoJAPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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 _)
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
16 changes: 12 additions & 4 deletions OpenUtau.Plugin.Builtin/KoreanVCVPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 3 additions & 1 deletion OpenUtau.Plugin.Builtin/TurkishCVVCPhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ private bool checkOtoUntilHit(string[] input, Note note, out UOto oto) {

var otos = new List<UOto>();
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);
}
}
Expand Down
Loading