Skip to content

Commit bd13e0a

Browse files
committed
fix(diffsinger): keep rest-note midi/pitch values instead of zeroing
Rest notes had note_midi and ph_midi forced to 0. In all-rest segments the nearest-fill pass has no non-rest neighbor to overwrite them, so models received zero midi and either predicted degenerate durations/pitch or failed outright. Always seed from the original key (pitch also adds cents/100) and keep isRest masks + nearest fill untouched.
1 parent e9ba379 commit bd13e0a

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

‎plugins/diffsinger/duration/DurationInference.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace srt::svs {
7171
const auto &note = word.notes[idx];
7272
const auto rest = static_cast<uint8_t>(note.is_rest);
7373
isRest.push_back(rest);
74-
phMidi.push_back(rest ? 0 : note.key);
74+
phMidi.push_back(note.key);
7575
}
7676

7777
if (!ds::infer::inferutil::fillRestMidiWithNearestInPlace<int64_t>(phMidi, isRest)) {

‎plugins/diffsinger/pitch/PitchInference.cpp‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,8 @@ namespace srt::svs {
268268
for (const auto &word : pitchInput->words) {
269269
for (const auto &note : word.notes) {
270270
noteRest.emplace_back(note.is_rest ? 1 : 0);
271-
noteMidi.emplace_back(note.is_rest ? 0
272-
: (static_cast<float>(note.key) +
273-
static_cast<float>(note.cents) / 100.0f));
271+
noteMidi.emplace_back(static_cast<float>(note.key) +
272+
static_cast<float>(note.cents) / 100.0f);
274273
int64_t noteDurPrevFrames = std::llround(noteDurSum / frameWidth);
275274
noteDurSum += note.duration;
276275
int64_t noteDurCurrFrames = std::llround(noteDurSum / frameWidth);

0 commit comments

Comments
 (0)