Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report: Duplicate <measure number="1"> Causes Unexpected Behavior in Verovio #3902

Open
Dahurica opened this issue Dec 24, 2024 · 3 comments
Labels

Comments

@Dahurica
Copy link

Hello,

While using Verovio to render music scores, I encountered an issue when the XML contains two elements. In such cases, all data within the second is inherited by the first . This behavior leads to some unexpected bugs in the rendered score.

Could you please look into this issue? Let me know if you need additional details or examples to reproduce the problem.

Thank you for your assistance!

@lpugin
Copy link
Contributor

lpugin commented Dec 24, 2024

This issue does not fulfil the report requirements. It does not describe the issue accurately and provides no minimal data and expected output. Please do not open again an issue with so little information and fill the template as expected

@Dahurica
Copy link
Author

Hello, I was a bit busy last week and got delayed. Here is the problem XML. The original XML contained two songs in one file. I consulted the team member responsible for the piano content on our side, and they said it was reasonable.
So, I simply reproduced a problematic XML for this issue.

my xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 4.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="4.0">
  <work>
    <work-title>未命名乐谱</work-title>
    </work>
  <identification>
    <creator type="composer">作曲 / 编排</creator>
    <encoding>
      <software>MuseScore 4.3.0</software>
      <encoding-date>2024-12-30</encoding-date>
      <supports element="accidental" type="yes"/>
      <supports element="beam" type="yes"/>
      <supports element="print" attribute="new-page" type="no"/>
      <supports element="print" attribute="new-system" type="no"/>
      <supports element="stem" type="yes"/>
      </encoding>
    </identification>
  <part-list>
    <score-part id="P1">
      <part-name>钢琴</part-name>
      <part-abbreviation>Pno.</part-abbreviation>
      <score-instrument id="P1-I1">
        <instrument-name>钢琴</instrument-name>
        <instrument-sound>keyboard.piano</instrument-sound>
        </score-instrument>
      <midi-device id="P1-I1" port="1"></midi-device>
      <midi-instrument id="P1-I1">
        <midi-channel>1</midi-channel>
        <midi-program>1</midi-program>
        <volume>78.7402</volume>
        <pan>0</pan>
        </midi-instrument>
      </score-part>
    </part-list>
  <part id="P1">
    <measure number="1">
      <attributes>
        <divisions>1</divisions>
        <key>
          <fifths>0</fifths>
          </key>
        <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>
      <direction placement="above">
        <direction-type>
          <words font-weight="bold" font-size="12">Prestissimo</words>
          </direction-type>
        <staff>1</staff>
        <sound tempo="200"/>
        </direction>
      <direction placement="above">
        <direction-type>
          <words>open</words>
          </direction-type>
        <staff>1</staff>
        </direction>
      <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>1</staff>
        </note>
      <note>
        <pitch>
          <step>C</step>
          <octave>5</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>1</staff>
        </note>
      <note>
        <pitch>
          <step>C</step>
          <octave>5</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>1</staff>
        </note>
      <note>
        <pitch>
          <step>D</step>
          <octave>5</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>1</staff>
        </note>
      <backup>
        <duration>4</duration>
        </backup>
      <note>
        <pitch>
          <step>E</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>E</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>E</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>E</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <barline location="right">
        <bar-style>light-heavy</bar-style>
        </barline>
      </measure>
    <measure number="1">
      <direction placement="below">
        <direction-type>
          <dynamics>
            <fp/>
            </dynamics>
          </direction-type>
        <staff>1</staff>
        <sound dynamics="106.67"/>
        </direction>
      <direction placement="above">
        <direction-type>
          <words font-weight="bold" font-size="12">Vivace</words>
          </direction-type>
        <staff>1</staff>
        <sound tempo="172"/>
        </direction>
      <note>
        <pitch>
          <step>B</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>1</staff>
        </note>
      <direction placement="above">
        <direction-type>
          <words font-weight="bold" font-size="12">Vivace</words>
          </direction-type>
        <staff>1</staff>
        <sound tempo="172"/>
        </direction>
      <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>1</staff>
        </note>
      <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>1</staff>
        </note>
      <note>
        <pitch>
          <step>G</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>1</staff>
        </note>
      <backup>
        <duration>4</duration>
        </backup>
      <note>
        <pitch>
          <step>A</step>
          <octave>2</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>F</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>D</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>C</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>2</staff>
        </note>
      <barline location="right">
        <bar-style>light-heavy</bar-style>
        </barline>
      </measure>
    <measure number="1">
      <direction placement="above">
        <direction-type>
          <words font-weight="bold" font-size="12">Presto</words>
          </direction-type>
        <staff>1</staff>
        <sound tempo="187"/>
        </direction>
      <note>
        <pitch>
          <step>C</step>
          <octave>5</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>1</staff>
        </note>
      <direction placement="above">
        <direction-type>
          <words font-weight="bold" font-size="12">Larghetto</words>
          </direction-type>
        <staff>1</staff>
        <sound tempo="63"/>
        </direction>
      <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>1</staff>
        </note>
      <note>
        <pitch>
          <step>C</step>
          <octave>5</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>1</staff>
        </note>
      <note>
        <pitch>
          <step>G</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>1</staff>
        </note>
      <backup>
        <duration>4</duration>
        </backup>
      <note>
        <pitch>
          <step>A</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>A</step>
          <octave>2</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>F</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>C</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>2</staff>
        </note>
      <barline location="right">
        <bar-style>light-heavy</bar-style>
        </barline>
      </measure>
    </part>
  </score-partwise>

@craigsapp
Copy link
Contributor

The MusicxML→Humdrum→MEI converter converts the MusicXML data closer to the intended original notation (which you should have included with the initial issue submission):

Screenshot 2024-12-29 at 18 14 33
Click to view MusicXML→Humdrum→MEI conversion.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/5.0/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/5.0/mei-all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="5.0">
 <meiHead>
  <fileDesc>
   <titleStmt>
    <title>未命名乐谱</title>
   </titleStmt>
   <pubStmt>
    <unpub>This MEI file was created by Verovio's Humdrum converter. When published, this unpub element should be removed, and the enclosing pubStmt element should be properly filled out.</unpub>
   </pubStmt>
  </fileDesc>
  <encodingDesc>
   <appInfo>
    <application isodate="2024-12-29T18:16:20" version="4.4.0-dev-f84695b-dirty">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work xml:id="work0_encoded" type="encoded">
    <title type="uniform">
     <titlePart type="main" analog="humdrum:OTL">未命名乐谱</titlePart>
    </title>
    <composer>
     <persName analog="humdrum:COM">作曲 / 编排</persName>
    </composer>
   </work>
  </workList>
  <extMeta>
   <frames xmlns="http://www.humdrum.org/ns/humxml">
    <metaFrame n="0" token="!!!COM: 作曲 / 编排" xml:id="L1">
     <frameInfo>
      <startTime float="0" />
      <frameType>reference</frameType>
      <referenceKey>COM</referenceKey>
      <referenceValue>作曲 / 编排</referenceValue>
     </frameInfo>
    </metaFrame>
    <metaFrame n="1" token="!!!OTL: 未命名乐谱" xml:id="L2">
     <frameInfo>
      <startTime float="0" />
      <frameType>reference</frameType>
      <referenceKey>OTL</referenceKey>
      <referenceValue>未命名乐谱</referenceValue>
     </frameInfo>
    </metaFrame>
    <metaFrame n="33" token="!!!system-decoration: {(s1,s2)}" xml:id="L34">
     <frameInfo>
      <startTime float="12" />
      <frameType>reference</frameType>
      <referenceKey>system-decoration</referenceKey>
      <referenceValue>{(s1,s2)}</referenceValue>
     </frameInfo>
    </metaFrame>
   </frames>
  </extMeta>
 </meiHead>
 <music decls="#work0_encoded">
  <body>
   <mdiv xml:id="mq2rl2b">
    <score xml:id="ssj19bj">
     <scoreDef xml:id="swcl7bi" tempo.dist="3.0000vu">
      <pgHead xml:id="p13dinry" func="first">
       <rend xml:id="re0lbvf" halign="center" valign="middle">
        <rend xml:id="rn4djnw" fontsize="large">未命名乐谱</rend>
        <lb xml:id="l1u10kzt" /> 
<lb xml:id="lun8dfj" /> </rend>
       <rend xml:id="r12zuknt" halign="right" valign="bottom" fontsize="small">作曲 / 编排</rend>
      </pgHead>
      <staffGrp xml:id="spg8gux" bar.thru="true" symbol="brace">
       <label xml:id="l16sv830">钢琴</label>
       <labelAbbr xml:id="lffblhu">Pno.</labelAbbr>
       <staffDef xml:id="staffdef-L3F2" n="1" lines="5">
        <clef xml:id="clef-L8F2" shape="G" line="2" />
        <keySig xml:id="keysig-L9F2" sig="0" />
        <meterSig xml:id="metersig-L10F2" count="4" unit="4" />
       </staffDef>
       <staffDef xml:id="staffdef-L3F1" n="2" lines="5">
        <clef xml:id="clef-L8F1" shape="F" line="4" />
        <keySig xml:id="keysig-L9F1" sig="0" />
        <meterSig xml:id="metersig-L10F1" count="4" unit="4" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L3F1">
      <measure xml:id="measure-L1" right="end" n="1">
       <staff xml:id="staff-L3F2" n="1">
        <layer xml:id="layer-L1F2N1" n="1">
         <note xml:id="note-L14F2" dur="4" oct="4" pname="a" accid.ges="n" />
         <note xml:id="note-L15F2" dur="4" oct="5" pname="c" accid.ges="n" />
         <note xml:id="note-L16F2" dur="4" oct="5" pname="c" accid.ges="n" />
         <note xml:id="note-L17F2" dur="4" oct="5" pname="d" accid.ges="n" />
        </layer>
       </staff>
       <staff xml:id="staff-L3F1" n="2">
        <layer xml:id="layer-L1F1N1" n="1">
         <note xml:id="note-L14F1" dur="4" oct="3" pname="e" accid.ges="n" />
         <note xml:id="note-L15F1" dur="4" oct="3" pname="e" accid.ges="n" />
         <note xml:id="note-L16F1" dur="4" oct="3" pname="e" accid.ges="n" />
         <note xml:id="note-L17F1" dur="4" oct="3" pname="e" accid.ges="n" />
        </layer>
       </staff>
       <dir xml:id="dir-L12F2" place="above" staff="1" tstamp="1">
        <rend xml:id="rawcmgu" fontstyle="normal">open</rend>
       </dir>
       <dir xml:id="dir-L13F2" place="above" staff="1" tstamp="1">
        <rend xml:id="rw4iuc0" fontstyle="normal" fontweight="bold">Prestissimo</rend>
       </dir>
      </measure>
      <measure xml:id="measure-L18" right="end">
       <staff xml:id="staff-L18F2N1" n="1">
        <layer xml:id="layer-L18F2N1" n="1">
         <note xml:id="note-L20F2" dur="4" oct="4" pname="b" accid.ges="n" />
         <note xml:id="note-L22F2" dur="4" oct="4" pname="a" accid.ges="n" />
         <note xml:id="note-L23F2" dur="4" oct="4" pname="a" accid.ges="n" />
         <note xml:id="note-L24F2" dur="4" oct="4" pname="g" accid.ges="n" />
        </layer>
       </staff>
       <staff xml:id="staff-L18F1N1" n="2">
        <layer xml:id="layer-L18F1N1" n="1">
         <note xml:id="note-L20F1" dur="4" oct="2" pname="a" accid.ges="n" />
         <note xml:id="note-L22F1" dur="4" oct="3" pname="f" accid.ges="n" />
         <note xml:id="note-L23F1" dur="4" oct="3" pname="d" accid.ges="n" />
         <note xml:id="note-L24F1" dur="4" oct="3" pname="c" accid.ges="n" />
        </layer>
       </staff>
       <dynam xml:id="dynam-L20F3" place="between" staff="1 2" tstamp="1">fp</dynam>
       <dir xml:id="dir-L19F2" place="above" staff="1" tstamp="1">
        <rend xml:id="r1abobdr" fontstyle="normal" fontweight="bold">Vivace</rend>
       </dir>
       <dir xml:id="dir-L21F2" place="above" staff="1" tstamp="2">
        <rend xml:id="r11616kt" fontstyle="normal" fontweight="bold">Vivace</rend>
       </dir>
      </measure>
      <measure xml:id="measure-L25" right="end">
       <staff xml:id="staff-L25F2N1" n="1">
        <layer xml:id="layer-L25F2N1" n="1">
         <note xml:id="note-L27F2" dur="4" oct="5" pname="c" accid.ges="n" />
         <note xml:id="note-L29F2" dur="4" oct="4" pname="a" accid.ges="n" />
         <note xml:id="note-L30F2" dur="4" oct="5" pname="c" accid.ges="n" />
         <note xml:id="note-L31F2" dur="4" oct="4" pname="g" accid.ges="n" />
        </layer>
       </staff>
       <staff xml:id="staff-L25F1N1" n="2">
        <layer xml:id="layer-L25F1N1" n="1">
         <note xml:id="note-L27F1" dur="4" oct="3" pname="a" accid.ges="n" />
         <note xml:id="note-L29F1" dur="4" oct="2" pname="a" accid.ges="n" />
         <note xml:id="note-L30F1" dur="4" oct="3" pname="f" accid.ges="n" />
         <note xml:id="note-L31F1" dur="4" oct="3" pname="c" accid.ges="n" />
        </layer>
       </staff>
       <dir xml:id="dir-L26F2" place="above" staff="1" tstamp="1">
        <rend xml:id="r1n96k8j" fontstyle="normal" fontweight="bold">Presto</rend>
       </dir>
       <dir xml:id="dir-L28F2" place="above" staff="1" tstamp="2">
        <rend xml:id="r16npvhq" fontstyle="normal" fontweight="bold">Larghetto</rend>
       </dir>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>

The problem is that the MusicXML→MEI converter is assuming unique measures numbers. Unless you (verovio programmers) can provide documentation for MusicXML that says that measure numbers must be unique, the insertion of the <dir> should not make this assumption (in theory the measure numbers should be unique, at least in early MusicXML, but that requirement for converting between score-wise and part-wise seems to have softened over time).

https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/measure-partwise

This page says "should" and not "must" for unique measure@number values:

Screenshot 2024-12-29 at 18 46 19

The problem is that there are three <measure number="1"> in a row, and the MusicXML→MEI converter is having problems with that. It would be better if the text directions are inserted within the measure that they are found in rather than relying on measure@number.

First measure of example (prestissimo):

    <measure number="1">
      <attributes>
        <divisions>1</divisions>
        <key>
          <fifths>0</fifths>
          </key>
        <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>
      <direction placement="above">
        <direction-type>
          <words font-weight="bold" font-size="12">Prestissimo</words>
          </direction-type>
        <staff>1</staff>
        <sound tempo="200"/>
        </direction>
      <direction placement="above">
        <direction-type>
          <words>open</words>
          </direction-type>
        <staff>1</staff>
        </direction>
      <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>1</staff>
        </note>
      <note>
        <pitch>
          <step>C</step>
          <octave>5</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>1</staff>
        </note>
      <note>
        <pitch>
          <step>C</step>
          <octave>5</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>1</staff>
        </note>
      <note>
        <pitch>
          <step>D</step>
          <octave>5</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>1</staff>
        </note>
      <backup>
        <duration>4</duration>
        </backup>
      <note>
        <pitch>
          <step>E</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>E</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>E</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>E</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <barline location="right">
        <bar-style>light-heavy</bar-style>
        </barline>
      </measure>

Second measure ("vivace" on notes1 and duplicated on note 2 for some reason?):

   <measure number="1">
      <direction placement="below">
        <direction-type>
          <dynamics>
            <fp/>
            </dynamics>
          </direction-type>
        <staff>1</staff>
        <sound dynamics="106.67"/>
        </direction>
      <direction placement="above">
        <direction-type>
          <words font-weight="bold" font-size="12">Vivace</words>
          </direction-type>
        <staff>1</staff>
        <sound tempo="172"/>
        </direction>
      <note>
        <pitch>
          <step>B</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>1</staff>
        </note>
      <direction placement="above">
        <direction-type>
          <words font-weight="bold" font-size="12">Vivace</words>
          </direction-type>
        <staff>1</staff>
        <sound tempo="172"/>
        </direction>
      <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>1</staff>
        </note>
      <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>1</staff>
        </note>
      <note>
        <pitch>
          <step>G</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>1</staff>
        </note>
      <backup>
        <duration>4</duration>
        </backup>
      <note>
        <pitch>
          <step>A</step>
          <octave>2</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>F</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>D</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>C</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>2</staff>
        </note>
      <barline location="right">
        <bar-style>light-heavy</bar-style>
        </barline>
      </measure>

Third measure ("presto" on first note and "larghetto" on second note of measure):

    <measure number="1">
      <direction placement="above">
        <direction-type>
          <words font-weight="bold" font-size="12">Presto</words>
          </direction-type>
        <staff>1</staff>
        <sound tempo="187"/>
        </direction>
      <note>
        <pitch>
          <step>C</step>
          <octave>5</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>1</staff>
        </note>
      <direction placement="above">
        <direction-type>
          <words font-weight="bold" font-size="12">Larghetto</words>
          </direction-type>
        <staff>1</staff>
        <sound tempo="63"/>
        </direction>
      <note>
        <pitch>
          <step>A</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>1</staff>
        </note>
      <note>
        <pitch>
          <step>C</step>
          <octave>5</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>1</staff>
        </note>
      <note>
        <pitch>
          <step>G</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>1</staff>
        </note>
      <backup>
        <duration>4</duration>
        </backup>
      <note>
        <pitch>
          <step>A</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>A</step>
          <octave>2</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>F</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>down</stem>
        <staff>2</staff>
        </note>
      <note>
        <pitch>
          <step>C</step>
          <octave>3</octave>
          </pitch>
        <duration>1</duration>
        <voice>5</voice>
        <type>quarter</type>
        <stem>up</stem>
        <staff>2</staff>
        </note>
      <barline location="right">
        <bar-style>light-heavy</bar-style>
        </barline>
      </measure>

Note that the MusicXML element <opus> is required for correct encoding of multiple movements:

https://www.w3.org/2021/06/musicxml40/opus-reference/elements/opus

Likely the MuseScore developers do not know this, unless this is a hack to represent multiple movements in MuseScore/MusicXml by resetting the measure numbers. In any case the conversion of this MusicXML file will not/should not expand into three movements in the MEI conversion since <opus> is not being used. But the MEI conversion should not assume unique measure numbers, and instead place the converted <dir> within the measure that the original <direction> was found.

Opening the MusicXML file back into MuseScore:

Screenshot 2024-12-29 at 19 03 18

Exporting as MEI and then rendering with verovio, the preservation of the text is better, but the first <dir> in each measure is missing:

Screenshot 2024-12-29 at 19 06 08
Click for MEI directly exported from MuseScore.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/5.0/mei-basic.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/5.0/mei-basic.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="5.0+basic">
 <meiHead>
  <fileDesc>
   <titleStmt>
    <title type="main">未命名乐谱</title>
    <respStmt>
     <persName role="composer">作曲 / 编排</persName>
    </respStmt>
   </titleStmt>
   <pubStmt>
    <date isodate="2024-12-29T19:05:39" />
   </pubStmt>
  </fileDesc>
 </meiHead>
 <music>
  <body>
   <mdiv>
    <score>
     <scoreDef>
      <pgHead>
       <rend halign="center" valign="top">
        <rend type="title" fontsize="x-large">未命名乐谱</rend>
       </rend>
       <rend halign="right" valign="bottom">
        <rend type="composer">作曲 / 编排</rend>
       </rend>
      </pgHead>
      <staffGrp>
       <staffGrp bar.thru="true" symbol="brace">
        <label>钢琴</label>
        <labelAbbr>Pno.</labelAbbr>
        <staffDef n="1" lines="5" meter.count="4" meter.unit="4">
         <clef shape="G" line="2" />
        </staffDef>
        <staffDef n="2" lines="5" meter.count="4" meter.unit="4">
         <clef shape="F" line="4" />
        </staffDef>
       </staffGrp>
      </staffGrp>
     </scoreDef>
     <section xml:id="s1">
      <pb />
      <measure xml:id="mf1sl8c" right="end" n="1">
       <staff xml:id="m1s1" n="1">
        <layer xml:id="m1s1l1" n="1">
         <note xml:id="neyezz4" dur="4" pname="a" oct="4" stem.dir="up" />
         <note xml:id="n1jkfbbr" dur="4" pname="c" oct="5" stem.dir="down" />
         <note xml:id="n79qdiv" dur="4" pname="c" oct="5" stem.dir="down" />
         <note xml:id="nndl9j6" dur="4" pname="d" oct="5" stem.dir="down" />
        </layer>
       </staff>
       <staff xml:id="m1s2" n="2">
        <layer xml:id="m1s2l1" n="1">
         <note xml:id="n13vgbv8" dur="4" pname="e" oct="3" stem.dir="down" />
         <note xml:id="n19pxtvl" dur="4" pname="e" oct="3" stem.dir="down" />
         <note xml:id="n1cr88mn" dur="4" pname="e" oct="3" stem.dir="down" />
         <note xml:id="n1a0rfqt" dur="4" pname="e" oct="3" stem.dir="down" />
        </layer>
       </staff>
       <dir xml:id="dpljz9u" type="mscore-staff-text" startid="#neyezz4" place="above">open</dir>
       <tempo xml:id="teyf04h" tstamp="1.000000" place="above" midi.bpm="200.000000">Prestissimo</tempo>
      </measure>
      <measure xml:id="m1anltjv" right="end" n="1">
       <staff xml:id="m2s1" n="1">
        <layer xml:id="m2s1l1" n="1">
         <note xml:id="n42i81s" dur="4" pname="b" oct="4" stem.dir="down" />
         <note xml:id="ns67gqz" dur="4" pname="a" oct="4" stem.dir="up" />
         <note xml:id="ntwugor" dur="4" pname="a" oct="4" stem.dir="up" />
         <note xml:id="n15dvvc8" dur="4" pname="g" oct="4" stem.dir="up" />
        </layer>
       </staff>
       <staff xml:id="m2s2" n="2">
        <layer xml:id="m2s2l1" n="1">
         <note xml:id="nze2poq" dur="4" pname="a" oct="2" stem.dir="up" />
         <note xml:id="nxbsns8" dur="4" pname="f" oct="3" stem.dir="down" />
         <note xml:id="n1ah6mgs" dur="4" pname="d" oct="3" stem.dir="down" />
         <note xml:id="nlmgzqp" dur="4" pname="c" oct="3" stem.dir="up" />
        </layer>
       </staff>
       <dynam xml:id="dv4s4t1" label="fp" startid="#n42i81s" place="below">fp</dynam>
       <tempo xml:id="t89av98" tstamp="1.000000" place="above" midi.bpm="172.000000">Vivace</tempo>
       <tempo xml:id="t1tnd97m" startid="#ns67gqz" place="above" midi.bpm="172.000000">Vivace</tempo>
      </measure>
      <measure xml:id="mrnb47e" right="end" n="1">
       <staff xml:id="m3s1" n="1">
        <layer xml:id="m3s1l1" n="1">
         <note xml:id="noc6ayr" dur="4" pname="c" oct="5" stem.dir="down" />
         <note xml:id="n1yz19el" dur="4" pname="a" oct="4" stem.dir="up" />
         <note xml:id="nau65ng" dur="4" pname="c" oct="5" stem.dir="down" />
         <note xml:id="n1xw3tc1" dur="4" pname="g" oct="4" stem.dir="up" />
        </layer>
       </staff>
       <staff xml:id="m3s2" n="2">
        <layer xml:id="m3s2l1" n="1">
         <note xml:id="n9pmp7n" dur="4" pname="a" oct="3" stem.dir="down" />
         <note xml:id="ng463es" dur="4" pname="a" oct="2" stem.dir="up" />
         <note xml:id="n1kh9v94" dur="4" pname="f" oct="3" stem.dir="down" />
         <note xml:id="n19qlyr" dur="4" pname="c" oct="3" stem.dir="up" />
        </layer>
       </staff>
       <tempo xml:id="t1q015fg" tstamp="1.000000" place="above" midi.bpm="187.000000">Presto</tempo>
       <tempo xml:id="t8dwxyx" startid="#n1yz19el" place="above" midi.bpm="63.000000">Larghetto</tempo>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>

Note there are three <measure n="1"> measures as with the MusicXML export from MuseScore.


Here is how the measures are renumbered in MuseScore:

First select a measure and right click, then choose "Measure properties..."

Screenshot 2024-12-29 at 18 53 20

Then "Add to measure number" a value that will set the current measure to 1 (I was testing with the first "movement" being 9 measure long in this case):

Screenshot 2024-12-29 at 18 53 41

Result is converting measure 9 into measure 1:

Screenshot 2024-12-29 at 18 53 50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants