diff --git a/OpenUtau.Core/KoreanPhonemizerUtil.cs b/OpenUtau.Core/KoreanPhonemizerUtil.cs index 5f91af913..a08236b83 100644 --- a/OpenUtau.Core/KoreanPhonemizerUtil.cs +++ b/OpenUtau.Core/KoreanPhonemizerUtil.cs @@ -8,7 +8,6 @@ using OpenUtau.Classic; using Serilog; using static OpenUtau.Api.Phonemizer; -using OpenUtau.Api; namespace OpenUtau.Core { /// @@ -372,7 +371,7 @@ private static Hashtable Variate(Hashtable firstCharSeparated, Hashtable nextCha nextFirstConsonant = "ㅇ"; } - if ((!firstLastConsonant.Equals("")) && nextFirstConsonant.Equals("ㅇ") && (!firstLastConsonant.Equals("ㅇ"))) { + if ((!firstLastConsonant.Equals(" ")) && nextFirstConsonant.Equals("ㅇ") && (!firstLastConsonant.Equals("ㅇ"))) { // 연음 2 nextFirstConsonant = firstLastConsonant; firstLastConsonant = " "; diff --git a/OpenUtau.Plugin.Builtin/KoreanCBNNPhonemizer.cs b/OpenUtau.Plugin.Builtin/KoreanCBNNPhonemizer.cs index 0ee400ff3..008f86847 100644 --- a/OpenUtau.Plugin.Builtin/KoreanCBNNPhonemizer.cs +++ b/OpenUtau.Plugin.Builtin/KoreanCBNNPhonemizer.cs @@ -141,11 +141,11 @@ private Result ConvertForCBNN(Note[] notes, string[] prevLyric, string[] thisLyr } string frontCV; string batchim; - string VC = $"{thisMidVowelTail} {FIRST_CONSONANTS[nextLyric[0]]}"; + string VC = $"{thisMidVowelTail} {FIRST_CONSONANTS[nextLyric[0]]}{MIDDLE_VOWELS[nextLyric[1]][1]}"; string VV = $"{MIDDLE_VOWELS[prevLyric[1]][2]} {thisMidVowelTail}"; string VSv = $"{thisMidVowelTail} {MIDDLE_VOWELS[nextLyric[1]][1]}"; isItNeedsVSv = thisLyric[2] == " " && nextLyric[0] == "ㅇ" && !PLAIN_VOWELS.Contains(nextLyric[1]) && FindInOto(VSv, note, true) != null; - isItNeedsVC = thisLyric[2] == " " && nextLyric[0] != "ㅇ" && nextLyric[0] != "null" && FindInOto(VC, note, true) != null; + isItNeedsVC = thisLyric[2] == " " && nextLyric[0] != "ㅇ" && nextLyric[0] != "null"; frontCV = $"- {CV}"; if (FindInOto(frontCV, note, true) == null) { @@ -155,6 +155,15 @@ private Result ConvertForCBNN(Note[] notes, string[] prevLyric, string[] thisLyr } } + if (FindInOto(VC, note, true) == null) { + if (VC.EndsWith("w") || VC.EndsWith("y")) { + VC = VC.Substring(0, VC.Length - 1); + } + if (FindInOto(VC, note, true) == null) { + isItNeedsVC = false; + } + } + if (isItNeedsVV) {CV = VV;} @@ -214,26 +223,22 @@ private Result ConvertForCBNN(Note[] notes, string[] prevLyric, string[] thisLyr } - private string HandleEmptyFirstConsonant(string lyric) { - return lyric == " " ? "ㅇ" : lyric; - } - public override Result ConvertPhonemes(Note[] notes, Note? prev, Note? next, Note? prevNeighbour, Note? nextNeighbour, Note[] prevNeighbours) { Note note = notes[0]; Hashtable lyrics = KoreanPhonemizerUtil.Variate(prevNeighbour, note, nextNeighbour); string[] prevLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ" - HandleEmptyFirstConsonant((string)lyrics[0]), + (string)lyrics[0], (string)lyrics[1], (string)lyrics[2] }; string[] thisLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ" - HandleEmptyFirstConsonant((string)lyrics[3]), + (string)lyrics[3], (string)lyrics[4], (string)lyrics[5] }; string[] nextLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ" - HandleEmptyFirstConsonant((string)lyrics[6]), + (string)lyrics[6], (string)lyrics[7], (string)lyrics[8] }; @@ -257,7 +262,7 @@ public override Result GenerateEndSound(Note[] notes, Note? prev, Note? next, No Hashtable lyrics = KoreanPhonemizerUtil.Separate(prevNeighbour_.lyric); string[] prevLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ" - HandleEmptyFirstConsonant((string)lyrics[0]), + (string)lyrics[0], (string)lyrics[1], (string)lyrics[2] }; diff --git a/OpenUtau.Plugin.Builtin/KoreanCVPhonemizer.cs b/OpenUtau.Plugin.Builtin/KoreanCVPhonemizer.cs index 2e77ff344..9713aed06 100644 --- a/OpenUtau.Plugin.Builtin/KoreanCVPhonemizer.cs +++ b/OpenUtau.Plugin.Builtin/KoreanCVPhonemizer.cs @@ -232,26 +232,22 @@ private Result ConvertForCV(Note[] notes, string[] prevLyric, string[] thisLyric } - private string HandleEmptyFirstConsonant(string lyric) { - return lyric == " " ? "ㅇ" : lyric; - } - public override Result ConvertPhonemes(Note[] notes, Note? prev, Note? next, Note? prevNeighbour, Note? nextNeighbour, Note[] prevNeighbours) { Note note = notes[0]; Hashtable lyrics = KoreanPhonemizerUtil.Variate(prevNeighbour, note, nextNeighbour); string[] prevLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ" - HandleEmptyFirstConsonant((string)lyrics[0]), + (string)lyrics[0], (string)lyrics[1], (string)lyrics[2] }; string[] thisLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ" - HandleEmptyFirstConsonant((string)lyrics[3]), + (string)lyrics[3], (string)lyrics[4], (string)lyrics[5] }; string[] nextLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ" - HandleEmptyFirstConsonant((string)lyrics[6]), + (string)lyrics[6], (string)lyrics[7], (string)lyrics[8] }; @@ -275,7 +271,7 @@ public override Result GenerateEndSound(Note[] notes, Note? prev, Note? next, No Hashtable lyrics = KoreanPhonemizerUtil.Separate(prevNeighbour_.lyric); string[] prevLyric = new string[]{ // "ㄴ", "ㅑ", "ㅇ" - HandleEmptyFirstConsonant((string)lyrics[0]), + (string)lyrics[0], (string)lyrics[1], (string)lyrics[2] };