Skip to content

Commit

Permalink
Fixed error phoneme when non-Korean Character came
Browse files Browse the repository at this point in the history
  • Loading branch information
EX3exp committed Jan 16, 2024
1 parent 40b9195 commit 2d09e90
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions OpenUtau.Core/KoreanPhonemizerUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static class KoreanPhonemizerUtil {
/// A hashtable of basicsounds - ㄱ/ㄷ/ㅂ/ㅅ/ㅈ.
/// <br/><br/>예사소리 테이블입니다.
/// </summary>
static readonly Hashtable basicSounds = new Hashtable() {
public static readonly Hashtable basicSounds = new Hashtable() {
[""] = 0,
[""] = 1,
[""] = 2,
Expand All @@ -59,7 +59,7 @@ public static class KoreanPhonemizerUtil {
/// <br/><br/>거센소리 테이블입니다.
/// <br/>[4]의 중복값 "ㅌ"은 오타가 아니며 격음화(거센소리되기) 수행 시에 활용됩니다.
/// </summary>
static readonly Hashtable aspirateSounds = new Hashtable() {
public static readonly Hashtable aspirateSounds = new Hashtable() {
[0] = "",
[1] = "",
[2] = "",
Expand All @@ -71,7 +71,7 @@ public static class KoreanPhonemizerUtil {
/// A hashtable of fortis sounds - ㄲ/ㄸ/ㅃ/ㅆ/ㅉ.
/// <br/><br/>된소리 테이블입니다.
/// </summary>
static readonly Hashtable fortisSounds = new Hashtable() {
public static readonly Hashtable fortisSounds = new Hashtable() {
[0] = "",
[1] = "",
[2] = "",
Expand All @@ -83,7 +83,7 @@ public static class KoreanPhonemizerUtil {
/// A hashtable of nasal sounds - ㄴ/ㅇ/ㅁ.
/// <br/><br/>비음 테이블입니다.
/// </summary>
static readonly Hashtable nasalSounds = new Hashtable() {
public static readonly Hashtable nasalSounds = new Hashtable() {
[""] = 0,
[""] = 1,
[""] = 2
Expand Down Expand Up @@ -537,6 +537,7 @@ private static Hashtable Variate(Hashtable separated) {
/// </returns>
private static Hashtable Variate(string firstChar, string nextChar, int returnCharIndex = 0) {
// 글자 넣어도 쓸 수 있음

Hashtable firstCharSeparated = Separate(firstChar);
Hashtable nextCharSeparated = Separate(nextChar);
return Variate(firstCharSeparated, nextCharSeparated, returnCharIndex);
Expand Down Expand Up @@ -649,15 +650,28 @@ public static Hashtable Variate(Note? prevNeighbour, Note note, Note? nextNeighb
[2] = "null"
};

Hashtable thisNoteSeparated = Variate(lyrics[1], lyrics[2], -1); // 현글자 뒤글자

result.Add(3, thisNoteSeparated[0]); // 현 글자
result.Add(4, thisNoteSeparated[1]);
result.Add(5, thisNoteSeparated[2]);
if (IsHangeul(lyrics[2])) {
Hashtable thisNoteSeparated = Variate(lyrics[1], lyrics[2], -1); // 현글자 뒤글자

result.Add(3, thisNoteSeparated[0]); // 현 글자
result.Add(4, thisNoteSeparated[1]);
result.Add(5, thisNoteSeparated[2]);

result.Add(6, thisNoteSeparated[3]); // 뒤 글자 없음
result.Add(7, thisNoteSeparated[4]);
result.Add(8, thisNoteSeparated[5]);
result.Add(6, thisNoteSeparated[3]);
result.Add(7, thisNoteSeparated[4]);
result.Add(8, thisNoteSeparated[5]);
}
else {
Hashtable thisNoteSeparated = Variate(lyrics[1]);
result.Add(3, thisNoteSeparated[0]); // 현 글자
result.Add(4, thisNoteSeparated[1]);
result.Add(5, thisNoteSeparated[2]);

result.Add(6, "null");
result.Add(7, "null");
result.Add(8, "null");
}


return result;
}
Expand Down

0 comments on commit 2d09e90

Please sign in to comment.