MSCZ saved after importing a MusicXML hairpin on fractional tuplet positions fails to reopen in CLI

Open
#35,685 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
54/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
backend, cli

Research direction

Start with the MusicXML importer code at src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp lines 1658–1680, where the issue says spanner endpoints are stored as integer ticks. Use the self-contained fixture and the two MuseScore CLI conversion commands to reproduce the failure: reopening the saved MSCZ exits 1303. Done means the MSCZ reopens and exports with all 15 notes, two slurs, and one hairpin intact.

Written by the indexing model from the issue text.

Description

needs review
Issue type

MusicXML import produces a native score that fails to reopen in CLI

Steps to reproduce

Save the original two-bar MusicXML below as seven-rounds-down.musicxml. Convert it to MSCZ with MuseScore Studio 4.7.7, then convert the MSCZ back to MusicXML:

MuseScore4.exe -o initial.mscz seven-rounds-down.musicxml
MuseScore4.exe -o reopened.musicxml initial.mscz

Expected: The MSCZ reopens and exports with the 15 notes, two slurs and one hairpin.

Actual: Initial conversion writes a ZIP-valid MSCZ and a direct export from the input still contains the 15 notes and two slurs. Starting a new conversion from the saved MSCZ exits 1303 without output. This is a CLI observation on Windows (b750c43e316cf6a00e70451870b231b12f400bda), not a claim about a GUI crash. Regression status and nightly untested.

The wedge's endpoints at quarter-note positions 2/7 and 13/7 are not exact on the integer tick grid. On import their native span becomes 377/960 whole notes instead of 11/28. The initial native score contains two pairs of zero-net voice cursor offsets, of magnitudes 1/13440 and 1/4480 whole notes, near the affected anchors. Removing the wedge from the fixture lets the two slurs survive a save/reopen. As a native-only control, replacing the forward/backward hairpin spans with the exact +/-11/28 and removing those cursor pairs lets an otherwise equivalent MSCZ reopen with all original note clocks, both slurs and one hairpin.

Possibly relevant: importer stores spanner endpoints as integer ticks. Related #35597 is about snapping an offset already representable as an integer tick; this fixture concerns fractional endpoint persistence and a failure after native save. No external attachment is needed.

Self-contained MusicXML 4.0 fixture
<?xml version='1.0' encoding='utf-8'?>
<score-partwise version="4.0">
  <part-list>
    <score-part id="P1">
      <part-name>Piano</part-name>
    </score-part>
  </part-list>
  <part id="P1">
    <measure number="1">
      <attributes>
        <divisions>28</divisions>
        <time>
          <beats>2</beats>
          <beat-type>4</beat-type>
        </time>
        <clef>
          <sign>G</sign>
          <line>2</line>
        </clef>
      </attributes>
      <note>
        <pitch>
          <step>C</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <type>16th</type>
        <time-modification>
          <actual-notes>7</actual-notes>
          <normal-notes>4</normal-notes>
        </time-modification>
        <notations>
          <slur type="start" number="1" />
          <tuplet type="start" />
        </notations>
      </note>
      <note>
        <pitch>
          <step>E</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <type>16th</type>
        <time-modification>
          <actual-notes>7</actual-notes>
          <normal-notes>4</normal-notes>
        </time-modification>
      </note>
      <direction placement="below">
        <direction-type>
          <wedge type="diminuendo" number="1" />
        </direction-type>
      </direction>
      <note>
        <pitch>
          <step>G</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <type>16th</type>
        <time-modification>
          <actual-notes>7</actual-notes>
          <normal-notes>4</normal-notes>
        </time-modification>
      </note>
      <note>
        <pitch>
          <step>F</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <type>16th</type>
        <time-modification>
          <actual-notes>7</actual-notes>
          <normal-notes>4</normal-notes>
        </time-modification>
      </note>
      <note>
        <pitch>
          <step>D</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <type>16th</type>
        <time-modification>
          <actual-notes>7</actual-notes>
          <normal-notes>4</normal-notes>
        </time-modification>
      </note>
      <note>
        <pitch>
          <step>G</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <type>16th</type>
        <time-modification>
          <actual-notes>7</actual-notes>
          <normal-notes>4</normal-notes>
        </time-modification>
      </note>
      <note>
        <pitch>
          <step>B</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <type>16th</type>
        <time-modification>
          <actual-notes>7</actual-notes>
          <normal-notes>4</normal-notes>
        </time-modification>
        <notations>
          <tuplet type="stop" />
        </notations>
      </note>
      <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <type>16th</type>
        <time-modification>
          <actual-notes>7</actual-notes>
          <normal-notes>4</normal-notes>
        </time-modification>
        <notations>
          <tuplet type="start" />
        </notations>
      </note>
      <note>
        <pitch>
          <step>F</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <type>16th</type>
        <time-modification>
          <actual-notes>7</actual-notes>
          <normal-notes>4</normal-notes>
        </time-modification>
      </note>
      <note>
        <pitch>
          <step>D</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <type>16th</type>
        <time-modification>
          <actual-notes>7</actual-notes>
          <normal-notes>4</normal-notes>
        </time-modification>
      </note>
      <note>
        <pitch>
          <step>C</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <type>16th</type>
        <time-modification>
          <actual-notes>7</actual-notes>
          <normal-notes>4</normal-notes>
        </time-modification>
      </note>
      <note>
        <pitch>
          <step>E</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <type>16th</type>
        <time-modification>
          <actual-notes>7</actual-notes>
          <normal-notes>4</normal-notes>
        </time-modification>
      </note>
      <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <type>16th</type>
        <time-modification>
          <actual-notes>7</actual-notes>
          <normal-notes>4</normal-notes>
        </time-modification>
      </note>
      <direction placement="below">
        <direction-type>
          <wedge type="stop" number="1" />
        </direction-type>
      </direction>
      <note>
        <pitch>
          <step>F</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <type>16th</type>
        <time-modification>
          <actual-notes>7</actual-notes>
          <normal-notes>4</normal-notes>
        </time-modification>
        <notations>
          <slur type="stop" number="1" />
          <slur type="start" number="2" />
          <tuplet type="stop" />
        </notations>
      </note>
    </measure>
    <measure number="2">
      <note>
        <pitch>
          <step>B</step>
          <octave>4</octave>
        </pitch>
        <duration>56</duration>
        <type>half</type>
        <notations>
          <slur type="stop" number="2" />
        </notations>
      </note>
    </measure>
  </part>
</score-partwise>
Dominant language
C++
Stars
15.5k
Forks
3.5k
Avg merge
2d 19h
Merged PRs (30d)
124

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from musescore/MuseScore

All issues in musescore/MuseScore

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.