Repository navigation
Conversation
Xiantaidu
force-pushed
the
feat/copyvocal-cvf-import
branch
from
November 12, 2026 10:03
bfd032c to
42a13e0
Compare
CopyVocal exports a correction job as a versioned document; OpenTune imports it as a project that can still be edited, rather than as a flat rendered wav. The student reference audio, the notes, the student's original F0, CopyVocal's corrected target F0 mapped back to source time, and the source->output time grid all enter the editing model. The format is CopyVocal's: identifier "copyvocal.file", extension .cvf. This repository carries only the reader and a user-facing import guide; the format definition lives in CopyVocal's own docs/. There is no compatibility path for the earlier experimental spelling -- the format had no external users. - Source/Utils/CopyVocalBundle.* parses and validates the JSON, decodes the base64 F0 arrays, and builds the editable domain types (Note / PitchCurve / TimeGridSnapshot). It is deliberately free of the audio engine, project session and UI so it can be tested on its own. - ProjectSession::prepareCopyVocalBundle runs on a worker: it fits the student media to the bundle's declared duration, injects both F0 layers (no extraction is started) and proposes an .otproj path next to the bundle. - The editor accepts files by menu and by drag-and-drop; the chooser, the drag test and the loader all read the extension from CopyVocalBundle::kFileExtension instead of spelling it out at each call site. Two TimeGrid points the importer depends on: - buildTimeGrid emits word granularity. A region spans one word, so its student/teacher start and end are the anchors worth exposing; the region's teacher_anchors/student_anchors arrays are sub-word phoneme splits, and silence/mute regions have a zero-length student span and map nothing. Expanding the phoneme arrays put 38 handles on a 17-word sentence with gaps down to 30 ms -- a wall of handles nobody edits by hand. - TimeGridSnapshot::validate exempts pairs touching a High-confidence anchor from the 150 ms minimum source spacing. That limit is an editing-UX constraint, not a DSP invariant, and an externally imported analysis is entitled to place anchors closer than a human would. Without the exemption a dense grid fails validation and buildTimeGrid silently falls back to identity, so the import succeeds with the time mapping gone. docs/copyvocal-import.md is the user-facing walkthrough and is whitelisted in .gitignore, which ignores docs/ wholesale. The whitelist uses docs/* rather than docs/ -- a trailing slash excludes the directory itself, and Git then never descends to apply the ! exception. Tests: CopyVocalBundleTests parses a synthetic bundle and rejects a future formatVersion and a duration mismatch (it also takes a real export as argv[1] for a round-trip); CopyVocalImportTests drives the full prepare path including the trim case where corrected output is shorter than the student media.
Xiantaidu
force-pushed
the
feat/copyvocal-cvf-import
branch
from
November 12, 2026 10:43
42a13e0 to
96d4bbf
Compare
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.
What
CopyVocal exports a correction job as a versioned document; this imports it into
OpenTune as a project that can still be edited, rather than as a flat rendered
wav. The student reference audio, the notes, the student's original F0,
CopyVocal's corrected target F0 mapped back to source time, and the
source→output time grid all enter the editing model.
The format identifier is
copyvocal.fileand the extension is.cvf. Theformat is CopyVocal's: this repository carries only the reader and a
user-facing import guide, and the authoritative definition lives in CopyVocal's
own
docs/copyvocal-bundle-v1.md.Structure
Source/Utils/CopyVocalBundle.*parses and validates the JSON, decodes thebase64 F0 arrays, and builds the editable domain types (Note / PitchCurve /
TimeGridSnapshot). It is deliberately free of the audio engine, project
session and UI so it can be tested on its own.
ProjectSession::prepareCopyVocalBundleruns on a worker: it fits the studentmedia to the bundle's declared duration, injects both F0 layers (no extraction
is started) and proposes an
.otprojpath next to the bundle.drag-accept test and the loader all read the extension from
CopyVocalBundle::kFileExtensioninstead of spelling it out at each call site.Time grid granularity
buildTimeGridemits word granularity. A region spans one word, so itsstudent/teacher start and end are the anchors worth exposing; the region's
teacher_anchors/student_anchorsarrays are sub-word phoneme splits, andsilence/muteregions have a zero-length student span and map nothing.Expanding the phoneme arrays put 38 handles on a 17-word sentence, with gaps
down to 30 ms — a wall of handles nobody edits by hand, and dense enough to
fail
TimeGridSnapshot::validate's 150 ms editing-spacing rule. Using regionendpoints yields 22 anchors, all on word boundaries, minimum spacing 150 ms.
TimeGridSnapshot::validatenow exempts pairs touching aConfidence::Highanchor from that 150 ms minimum. The limit is an editing-UX constraint, not a
DSP invariant, and an externally imported analysis is entitled to place anchors
closer than a human would. Without the exemption a dense grid fails validation
and
buildTimeGridsilently falls back to identity — the import "succeeds" withthe time mapping gone, which is the worst possible failure mode.
Docs
docs/copyvocal-import.mdis the user-facing walkthrough for this importer andis whitelisted because
docs/is gitignored upstream. The.gitignorechangeuses
docs/*rather thandocs/— a trailing slash excludes the directoryitself, and Git then never descends to apply the
!exception.The bundle format itself is not documented here:
.cvfis CopyVocal's file, soits definition lives in the CopyVocal repository. This repository carries only
the reader.
Requires a matching CopyVocal change
The format identifier is now
copyvocal.fileand.cvfis the only acceptedextension. CopyVocal's exporter was renamed and updated in the same effort
(
application/copyvocal_file.py,--export-cvf, default outputcopyvocal.cvf), and itsdocs/copyvocal-bundle-v1.mddefines the format.There is no compatibility path for the earlier experimental spelling: files
carrying
opentune.copyvocal-bundleor a.cvotextension are rejected. Thefeature had no external users before this rename.
Tests
CopyVocalBundleTests— parses a synthetic bundle; rejects a futureformatVersionand a duration mismatch; takes a real export asargv[1]fora round-trip.
CopyVocalImportTests— drives the full prepare path, including the trim casewhere corrected output is shorter than the student media.
41/41 ctest passing. Verified that this branch builds and passes on its own,
without the Stage 1 bake branch.
Relationship to the other PR
Independent of #58, in either merge order. That PR changes how an imported grid
is rendered; this one changes how it is constructed. Both were verified
standalone.