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:

  1. Parses the input into IR
  2. Normalizes the IR
  3. Exports to the opposite format
  4. Re-parses the export back into IR
  5. Normalizes the re-parsed IR
  6. 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

Exit Codes

Code Meaning
0 Semantic equivalence verified
1 Semantic differences detected
2 Roundtrip cannot be completed (parse or export error)

See Also