Support DiffSinger pitch local retaking#2183
Open
KakaruHayate wants to merge 3 commits into
Open
Conversation
Pull the per-frame retake mask construction (DsPitch.Process) and the absolute-tick -> phrase-local note-index mapping (LoadRenderedPitch overload) out into pure static helpers in DiffSingerRetake so the padding-shift indexing logic and the position lookup can be unit tested without instantiating RenderPhrase / a singer / ONNX. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a user-facing preference and supporting plumbing to enable “local retake” when loading DiffSinger-rendered pitch, so pitch generation/editing can be scoped to selected notes rather than always reprocessing the whole phrase.
Changes:
- Adds a new preference (
DiffSingerLocalRetaking) and exposes it in the Preferences UI + string resources. - Extends pitch loading to accept selected note positions and propagates a per-frame retake mask through
RenderPitchResult. - Updates the “Load rendered pitch” batch edit to only write curve points for retaken frames; adds unit tests for retake helpers.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| OpenUtau/Views/PreferencesDialog.axaml | Adds a toggle for DiffSinger pitch local retaking. |
| OpenUtau/ViewModels/PreferencesViewModel.cs | Wires the new toggle to persisted preferences. |
| OpenUtau/Strings/Strings.axaml | Adds EN string for the new toggle label. |
| OpenUtau/Strings/Strings.zh-CN.axaml | Adds zh-CN string for the new toggle label. |
| OpenUtau.Core/Util/Preferences.cs | Persists the new boolean preference with defaults. |
| OpenUtau.Core/Render/IRenderer.cs | Adds retake mask to pitch result and a pitch-load overload that accepts selected note positions. |
| OpenUtau.Core/Editing/NoteBatchEdits.cs | Uses the retake mask to skip writing curve points for non-retaken frames. |
| OpenUtau.Core/DiffSinger/DiffSingerRetake.cs | Adds helper utilities for mapping selection → note indexes and building a frame mask. |
| OpenUtau.Core/DiffSinger/DiffSingerRenderer.cs | Implements selection-aware pitch loading for DiffSinger when enabled by preference. |
| OpenUtau.Core/DiffSinger/DiffSingerPitch.cs | Adds support for partial retake in pitch predictor (retake mask + optional existing pitch). |
| OpenUtau.Test/Core/DiffSinger/DiffSingerRetakeTest.cs | Adds unit tests for the new retake helper logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix retake frame mask incorrectly indexing past gap-rest segments inserted in noteDurMsList; callers now supply a paddedToRealNoteIndex array kept in lockstep with the padded duration list. Gap rests follow the preceding real note for continuity. - Mark nullable parameters on Process / BuildRetakeFrameMask / MapSelectedPositionsToNoteIndexes and the retakeMask field. - Guard retakeMask bounds in NoteBatchEdits to tolerate shorter masks. - Move retake tests into OpenUtau.Core.DiffSinger namespace and add coverage for gap-rest mapping and the -1 sentinel.
yqzhishen
approved these changes
Jun 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.