From a3636b240890d0a02df1c5e0fd1ba21e9841e3b6 Mon Sep 17 00:00:00 2001 From: oxygen-dioxide <54425948+oxygen-dioxide@users.noreply.github.com> Date: Sat, 27 Jan 2024 08:41:10 +0800 Subject: [PATCH] diffsinger phonemizers: support glide phonemes --- .../DiffSinger/DiffSingerBasePhonemizer.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/OpenUtau.Core/DiffSinger/DiffSingerBasePhonemizer.cs b/OpenUtau.Core/DiffSinger/DiffSingerBasePhonemizer.cs index 9615b7248..63b662bb9 100644 --- a/OpenUtau.Core/DiffSinger/DiffSingerBasePhonemizer.cs +++ b/OpenUtau.Core/DiffSinger/DiffSingerBasePhonemizer.cs @@ -133,11 +133,25 @@ List ProcessWord(Note[] notes){ }; var dsPhonemes = GetDsPhonemes(notes[0]); var isVowel = dsPhonemes.Select(s => g2p.IsVowel(s.Symbol)).ToArray(); + var isGlide = dsPhonemes.Select(s => g2p.IsGlide(s.Symbol)).ToArray(); var nonExtensionNotes = notes.Where(n=>!IsSyllableVowelExtensionNote(n)).ToArray(); + var isStart = new bool[dsPhonemes.Length]; + if(!isStart.Any()){ + isStart[0] = true; + } + for(int i=0; i=2 && isGlide[i-1] && !isVowel[i-2]){ + isStart[i-1] = true; + }else{ + isStart[i] = true; + } + } + } //distribute phonemes to notes var noteIndex = 0; for (int i = 0; i < dsPhonemes.Length; i++) { - if (isVowel[i] && noteIndex < nonExtensionNotes.Length) { + if (isStart[i] && noteIndex < nonExtensionNotes.Length) { var note = nonExtensionNotes[noteIndex]; wordPhonemes.Add(new phonemesPerNote(note.position, note.tone)); noteIndex++;