File tree 2 files changed +16
-6
lines changed
2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ List<phonemesPerNote> ProcessWord(Note[] notes){
120
120
//distribute phonemes to notes
121
121
var noteIndex = 0 ;
122
122
for ( int i = 0 ; i < symbols . Length ; i ++ ) {
123
- if ( isVowel [ i ] && noteIndex <= nonExtensionNotes . Length ) {
123
+ if ( isVowel [ i ] && noteIndex < nonExtensionNotes . Length ) {
124
124
var note = nonExtensionNotes [ noteIndex ] ;
125
125
wordPhonemes . Add ( new phonemesPerNote ( note . position , note . tone , new List < string > ( ) ) ) ;
126
126
noteIndex ++ ;
Original file line number Diff line number Diff line change @@ -147,13 +147,23 @@ public RenderPitchResult Process(RenderPhrase phrase){
147
147
new DenseTensor < long > ( new long [ ] { speedup } , new int [ ] { 1 } , false ) ) ) ;
148
148
var pitchOutputs = pitchModel . Run ( pitchInputs ) ;
149
149
var pitch_out = pitchOutputs . First ( ) . AsTensor < float > ( ) . ToArray ( ) ;
150
-
151
- return new RenderPitchResult {
152
- ticks = Enumerable . Range ( 0 , n_frames )
150
+ var pitchEnd = phrase . timeAxis . MsPosToTickPos ( startMs + ( n_frames - 1 ) * frameMs ) - phrase . position ;
151
+ if ( pitchEnd <= phrase . duration ) {
152
+ return new RenderPitchResult {
153
+ ticks = Enumerable . Range ( 0 , n_frames )
153
154
. Select ( i=> ( float ) phrase . timeAxis . MsPosToTickPos ( startMs + i * frameMs ) - phrase . position )
155
+ . Append ( ( float ) phrase . duration + 1 )
154
156
. ToArray ( ) ,
155
- tones = pitch_out
156
- } ;
157
+ tones = pitch_out . Append ( pitch_out [ ^ 1 ] ) . ToArray ( )
158
+ } ;
159
+ } else {
160
+ return new RenderPitchResult {
161
+ ticks = Enumerable . Range ( 0 , n_frames )
162
+ . Select ( i=> ( float ) phrase . timeAxis . MsPosToTickPos ( startMs + i * frameMs ) - phrase . position )
163
+ . ToArray ( ) ,
164
+ tones = pitch_out
165
+ } ;
166
+ }
157
167
}
158
168
}
159
169
}
You can’t perform that action at this time.
0 commit comments