MusicXML export moves lower-staff text to staff 1 when no note or rest starts at its tick

Aperta Adatta ai principianti
#35,683 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cpp
Ambito
backend

Direzione di ricerca

Start in src/importexport/musicxml/internal/export/exportmusicxml.cpp, especially annotationsWithoutNote() and its call to commonAnnotations() when no note or rest starts at the annotation tick. The report identifies the fallback staff number as the source; trace how the annotation track maps to a part-relative staff. Done when the reproduction exports <staff>2</staff> for the lower-staff text and it remains on staff 2 after reimport.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

needs review
Issue type

Import/export issue

Description with steps to reproduce
  1. Save the complete MusicXML below as lower-staff-text.musicxml and open it in MuseScore Studio. The text Lower staff only belongs to the lower staff, at beat 2 (where neither staff has a new note or rest).
  2. Export the score as uncompressed MusicXML and inspect the <direction> for that text.
  3. Open the exported MusicXML in MuseScore Studio.

Expected: The exported direction contains <staff>2</staff>, and the text remains on the lower staff at beat 2 after reimport.

Actual: The exported direction contains <staff>1</staff>. On reimport the text belongs to the upper staff. I checked the native score model before export and after reimport: the text changes from staff 2 to staff 1; the notes stay where they were.

Supporting files, videos and screenshots

Complete, schema-validated, one-measure reproduction (no other files needed):

<?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>4</divisions>
        <time><beats>4</beats><beat-type>4</beat-type></time>
        <staves>2</staves>
        <clef number="1"><sign>G</sign><line>2</line></clef>
        <clef number="2"><sign>F</sign><line>4</line></clef>
      </attributes>
      <note>
        <pitch><step>C</step><octave>5</octave></pitch>
        <duration>16</duration><voice>1</voice><type>whole</type><staff>1</staff>
      </note>
      <backup><duration>16</duration></backup>
      <direction placement="above">
        <direction-type><words>Lower staff only</words></direction-type>
        <offset sound="no">4</offset>
        <staff>2</staff>
      </direction>
      <note>
        <pitch><step>C</step><octave>3</octave></pitch>
        <duration>16</duration><voice>5</voice><type>whole</type><staff>2</staff>
      </note>
    </measure>
  </part>
</score-partwise>
In which versions of MuseScore Studio is this issue present?

Reproduced in 4.7.7 (revision b750c43). The same fallback is present in main at 6da159d; no nightly build was run.

Regression

I was unable to check.

Operating system

Windows 11

Additional context

In annotationsWithoutNote(), if there is no note or rest track for the annotation at that tick, commonAnnotations() is called with staves > 1 ? 1 : 0. In a multi-staff part that fallback writes staff 1 rather than deriving the part-relative staff from the annotation's own track. This concerns ordinary <direction><direction-type><words> staff text, not the chord symbols in #23240 or the voice-number issue #25663.

Lingua principale
C++
Stelle
15.5k
Fork
3.4k
Merge medio
2g 18h
PR unite (30g)
114

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di musescore/MuseScore

Tutte le issue di musescore/MuseScore

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.