Skip to content

Commit

Permalink
Merge pull request stakira#1022 from oxygen-dioxide/diffsinger-phonem…
Browse files Browse the repository at this point in the history
…izer-glide

diffsinger phonemizers: support glide phonemes
  • Loading branch information
stakira authored Jan 28, 2024
2 parents 0643434 + a3636b2 commit fae27c8
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion OpenUtau.Core/DiffSinger/DiffSingerBasePhonemizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,25 @@ List<phonemesPerNote> 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<dsPhonemes.Length; i++){
if(isVowel[i]){
if(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++;
Expand Down

0 comments on commit fae27c8

Please sign in to comment.