Skip to content

Commit 3dfea0d

Browse files
committed
Fix VEL stretch minimum to 5 for extra short consonants
1 parent 298b303 commit 3dfea0d

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

KoreanCVVCPlusPhonemizer/KoreanCVVCPlusPhonemizer.cs

+9-10
Original file line numberDiff line numberDiff line change
@@ -741,9 +741,8 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN
741741
}
742742

743743
var nextAttr = nextNeighbour.Value.phonemeAttributes?.FirstOrDefault(attr => attr.index == 0) ?? default;
744-
// Minimam is 30 tick, maximum is half of note
745-
746-
ccLength = Convert.ToInt32(Math.Min(totalDuration / 2, Math.Max(30, ccLength * (nextAttr.consonantStretchRatio ?? 1))));
744+
// Minimum is 5 tick, maximum is half of note
745+
ccLength = Convert.ToInt32(Math.Min(totalDuration / 2, Math.Max(5, ccLength * (nextAttr.consonantStretchRatio ?? 1))));
747746

748747
if (singer.TryGetMappedOto(CV, note.tone + attr0.toneShift, attr0.voiceColor, out var oto1) && singer.TryGetMappedOto(FC, note.tone + attr0.toneShift, attr0.voiceColor, out var oto2) && singer.TryGetMappedOto(CC, note.tone + attr0.toneShift, attr0.voiceColor, out var oto3)) {
749748
CV = oto1.Alias;
@@ -782,8 +781,8 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN
782781
}
783782

784783
var nextAttr = nextNeighbour.Value.phonemeAttributes?.FirstOrDefault(attr => attr.index == 0) ?? default;
785-
// Minimam is 30 tick, maximum is half of note
786-
ccLength = Convert.ToInt32(Math.Min(totalDuration / 2, Math.Max(30, ccLength * (nextAttr.consonantStretchRatio ?? 1))));
784+
// Minimum is 5 tick, maximum is half of note
785+
ccLength = Convert.ToInt32(Math.Min(totalDuration / 2, Math.Max(5, ccLength * (nextAttr.consonantStretchRatio ?? 1))));
787786

788787
if (singer.TryGetMappedOto(CV, note.tone + attr0.toneShift, attr0.voiceColor, out var oto1) && singer.TryGetMappedOto(FC, note.tone + attr0.toneShift, attr0.voiceColor, out var oto2) && singer.TryGetMappedOto(CC, note.tone + attr0.toneShift, attr0.voiceColor, out var oto3)) {
789788
CV = oto1.Alias;
@@ -861,7 +860,7 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN
861860

862861
var nextAttr = nextNeighbour.Value.phonemeAttributes?.FirstOrDefault(attr => attr.index == 0) ?? default;
863862
// Minimam is 30 tick, maximum is half of note
864-
vcLength = Convert.ToInt32(Math.Min(totalDuration / 2, Math.Max(30, vcLength * (nextAttr.consonantStretchRatio ?? 1))));
863+
vcLength = Convert.ToInt32(Math.Min(totalDuration / 2, Math.Max(5, vcLength * (nextAttr.consonantStretchRatio ?? 1))));
865864

866865
if (singer.TryGetMappedOto(CV, note.tone + attr0.toneShift, attr0.voiceColor, out var oto1) && singer.TryGetMappedOto(VC, note.tone + attr0.toneShift, attr0.voiceColor, out var oto2)) {
867866
CV = oto1.Alias;
@@ -892,8 +891,8 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN
892891
}
893892

894893
var nextAttr = nextNeighbour.Value.phonemeAttributes?.FirstOrDefault(attr => attr.index == 0) ?? default;
895-
// Minimam is 30 tick, maximum is half of note
896-
vcLength = Convert.ToInt32(Math.Min(totalDuration / 2, Math.Max(30, vcLength * (nextAttr.consonantStretchRatio ?? 1))));
894+
// Minimum is 5 tick, maximum is half of note
895+
vcLength = Convert.ToInt32(Math.Min(totalDuration / 2, Math.Max(5, vcLength * (nextAttr.consonantStretchRatio ?? 1))));
897896

898897
if (singer.TryGetMappedOto(CV, note.tone + attr0.toneShift, attr0.voiceColor, out var oto1) && singer.TryGetMappedOto(VC, note.tone + attr0.toneShift, attr0.voiceColor, out var oto2)) {
899898
CV = oto1.Alias;
@@ -1153,8 +1152,8 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN
11531152
vcLength = MsToTick(oto0.Preutter);
11541153
}
11551154
}
1156-
// Minimam is 30 tick, maximum is half of note
1157-
vcLength = Convert.ToInt32(Math.Min(totalDuration / 2, Math.Max(30, vcLength * (nextAttr.consonantStretchRatio ?? 1))));
1155+
// Minimum is 5 tick, maximum is half of note
1156+
vcLength = Convert.ToInt32(Math.Min(totalDuration / 2, Math.Max(5, vcLength * (nextAttr.consonantStretchRatio ?? 1))));
11581157

11591158
return new Result {
11601159
phonemes = new Phoneme[] {

0 commit comments

Comments
 (0)