The roundtrip command verifies semantic preservation across the .pta ↔ MusicXML conversion boundary.
Syntax
partitura roundtrip <input>
partitura roundtrip <input> --direction pta-to-musicxml
partitura roundtrip <input> --direction musicxml-to-pta
Arguments
| Argument |
Required |
Description |
<input> |
Yes |
Input file (.pta, .xml, .musicxml, or .mxl) |
Flags
| Flag |
Description |
--direction pta-to-musicxml |
.pta → IR → MusicXML → IR → .pta (default for .pta input) |
--direction musicxml-to-pta |
MusicXML → IR → .pta → IR → MusicXML (default for MusicXML input) |
--verbose |
Prints the full IR comparison detail |
--output <path> |
Writes the roundtrip output file to the specified path |
Direction
| Value |
Description |
pta-to-musicxml |
.pta → IR → MusicXML → IR → .pta |
musicxml-to-pta |
MusicXML → IR → .pta → IR → MusicXML |
The direction is inferred from the input format when --direction is not provided.
Behavior
The command:
- Parses the input into IR
- Normalizes the IR
- Exports to the opposite format
- Re-parses the export back into IR
- Normalizes the re-parsed IR
- Compares the two normalized IR forms for semantic equivalence
Output
Success
roundtrip: semantic equivalence verified
input: example.pta
direction: .pta → MusicXML → .pta
compared: metadata, structure, measures, events, notations
result: equivalent
Failure
roundtrip: semantic differences detected
input: example.xml
direction: MusicXML → .pta → MusicXML
differences:
- part "Piano", measure 3: missing tied notation on event 2
- metadata: missing rightsholder "Acme Music"
result: 2 differences
Requirements
- Accepts
.pta, .xml, .musicxml, and .mxl input
- Infers direction from input format when
--direction is not provided
- Compares normalized IR forms, not raw text
- Reports specific semantic differences on failure
Exit Codes
| Code |
Meaning |
0 |
Semantic equivalence verified |
1 |
Semantic differences detected |
2 |
Roundtrip cannot be completed (parse or export error) |
See Also