MusicXML import ignores relative-x and relative-y on expression words

Open
#35,695 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
57/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp, xml

Research direction

Start with the MusicXML importer branch in src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp around lines 3648–3676, which the issue identifies. Compare imports of the supplied fixture with and without relative-x and relative-y, and trace how expression words retain layout overrides while preserving staff and rhythmic attachment. Done means the attributes affect the imported word positions, while the version without them keeps automatic positioning.

Written by the indexing model from the issue text.

Description

needs review
Issue type

MusicXML import / layout compatibility

Steps to reproduce
  1. Save the original one-bar MusicXML fixture below and open it in MuseScore Studio 4.7.7 (b750c43e316cf6a00e70451870b231b12f400bda), on Windows. The issue is visible on the first import; no native save or reopen is required.
  2. Open a second copy with only relative-x="40" relative-y="-80" removed from <words>.

Actual: The six glyphs of cresc. have identical PDF positions in both versions. The text remains below the staff and at its original beat in both.

Expected/request: Preserve the MusicXML words positions as a layout override when importing layout, without changing the direction's staff or rhythmic attachment. Here the second copy should still use automatic positioning.

The pinned importer uses placement and the rhythmic offset for the generic text branch, with default-y used as an ordering hint; it does not apply the two relative attributes to this expression. Related reports #35691 (note positions), #34539 (native expression and hairpin interaction), and #35009 (text classification) concern different paths.

The original fixture is MusicXML 4.0 schema-valid and needs no external files.

<?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>1</divisions>
        <time><beats>2</beats><beat-type>4</beat-type></time>
        <clef><sign>G</sign><line>2</line></clef>
      </attributes>
      <direction placement="below">
        <direction-type><words relative-x="40" relative-y="-80" font-style="italic">cresc.</words></direction-type>
      </direction>
      <note><pitch><step>A</step><octave>4</octave></pitch><duration>1</duration><type>quarter</type></note>
      <note><pitch><step>E</step><octave>5</octave></pitch><duration>1</duration><type>quarter</type></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.