verovio icon indicating copy to clipboard operation
verovio copied to clipboard

System breaks misplaced with long staff text

Open bryantgeorge opened this issue 2 years ago • 5 comments

Describe the problem System breaks are misplaced in the MEI when there is long staff text near the end of the measure with the system break in certain cases

To Reproduce Steps to reproduce the behavior:

  1. Load the following MusicXML:
Click to see MusicXML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.1 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="3.1">
  <identification>
    <encoding>
      <software>MuseScore 3.6.2</software>
      <encoding-date>2023-05-17</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>
  <defaults>
    <scaling>
      <millimeters>6.99912</millimeters>
      <tenths>40</tenths>
      </scaling>
    <page-layout>
      <page-height>1697.36</page-height>
      <page-width>1200.15</page-width>
      <page-margins type="even">
        <left-margin>85.7251</left-margin>
        <right-margin>85.7251</right-margin>
        <top-margin>85.7251</top-margin>
        <bottom-margin>85.7251</bottom-margin>
        </page-margins>
      <page-margins type="odd">
        <left-margin>85.7251</left-margin>
        <right-margin>85.7251</right-margin>
        <top-margin>85.7251</top-margin>
        <bottom-margin>85.7251</bottom-margin>
        </page-margins>
      </page-layout>
    <word-font font-family="Edwin" font-size="10"/>
    <lyric-font font-family="Edwin" font-size="10"/>
    </defaults>
  <part-list>
    <score-part id="P1">
      <part-name></part-name>
      <score-instrument id="P1-I1">
        <instrument-name></instrument-name>
        </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" width="978.70">
      <print>
        <system-layout>
          <system-margins>
            <left-margin>50.00</left-margin>
            <right-margin>0.00</right-margin>
            </system-margins>
          <top-system-distance>170.00</top-system-distance>
          </system-layout>
        </print>
      <attributes>
        <divisions>1</divisions>
        <key>
          <fifths>0</fifths>
          </key>
        <time>
          <beats>4</beats>
          <beat-type>4</beat-type>
          </time>
        <clef>
          <sign>G</sign>
          <line>2</line>
          </clef>
        </attributes>
      <note default-x="73.72" default-y="-20.00">
        <pitch>
          <step>B</step>
          <octave>4</octave>
          </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>whole</type>
        </note>
      </measure>
    <measure number="2" width="1028.70">
      <print new-system="yes">
        <system-layout>
          <system-margins>
            <left-margin>0.00</left-margin>
            <right-margin>0.00</right-margin>
            </system-margins>
          <system-distance>150.00</system-distance>
          </system-layout>
        </print>
      <note default-x="58.59" default-y="-20.00">
        <pitch>
          <step>B</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        </note>
      <note default-x="300.67" default-y="-20.00">
        <pitch>
          <step>B</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        </note>
      <note default-x="542.75" default-y="-20.00">
        <pitch>
          <step>B</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        </note>
      <direction placement="above">
        <direction-type>
          <words relative-y="10.00">AAAAAAAAAAAAAAA</words>
          </direction-type>
        </direction>
      <note default-x="784.82" default-y="-20.00">
        <pitch>
          <step>B</step>
          <octave>4</octave>
          </pitch>
        <duration>1</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>down</stem>
        </note>
      </measure>
    <measure number="3" width="209.91">
      <print new-system="yes">
        <system-layout>
          <system-margins>
            <left-margin>0.00</left-margin>
            <right-margin>818.79</right-margin>
            </system-margins>
          <system-distance>150.00</system-distance>
          </system-layout>
        </print>
      <note default-x="58.59" default-y="-20.00">
        <pitch>
          <step>B</step>
          <octave>4</octave>
          </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>whole</type>
        </note>
      <barline location="right">
        <bar-style>light-heavy</bar-style>
        </barline>
      </measure>
    </part>
  </score-partwise>
  1. Use the following options:
{breaks: 'line'}
  1. Output as MEI, I was getting the following:
Click to see MEI
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/dev/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/dev/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.0-dev">
   <meiHead>
      <fileDesc>
         <titleStmt>
            <title />
            <respStmt />
         </titleStmt>
         <pubStmt><date isodate="2023-05-17" type="encoding-date">2023-05-17</date>
         </pubStmt>
      </fileDesc>
      <encodingDesc xml:id="encodingdesc-i7kacw">
         <appInfo xml:id="appinfo-k685s5">
            <application xml:id="application-x1ee6d" isodate="2023-05-17T10:43:34" version="3.15.0-5abc7c0">
               <name xml:id="name-1qcehis">Verovio</name>
               <p xml:id="p-vxoe9m">Transcoded from MusicXML</p>
            </application>
         </appInfo>
      </encodingDesc>
   </meiHead>
   <music>
      <body>
         <mdiv xml:id="m1d5u3zl">
            <score xml:id="s1x23nmn">
               <scoreDef xml:id="s1fapiha">
                  <staffGrp xml:id="s3lz7ta">
                     <staffDef xml:id="P1" n="1" lines="5" ppq="1">
                        <instrDef xml:id="idtg2wr" midi.channel="0" midi.instrnum="0" midi.volume="78.00%" />
                        <clef xml:id="c19bbeoy" shape="G" line="2" />
                        <keySig xml:id="k1swrjds" sig="0" />
                        <meterSig xml:id="m1qbzlwr" count="4" unit="4" />
                     </staffDef>
                  </staffGrp>
               </scoreDef>
               <section xml:id="skrh56s">
                  <pb xml:id="pdlgbx6" />
                  <measure xml:id="m1crmtjb" n="1">
                     <staff xml:id="s9cvidf" n="1">
                        <layer xml:id="l1ultwao" n="1">
                           <note xml:id="naf1fv2" dur.ppq="4" dur="1" oct="4" pname="b" />
                        </layer>
                     </staff>
                  </measure>
                  <sb xml:id="s15fm5vt" />
                  <sb xml:id="sh0pj3n" />
                  <measure xml:id="mk36jas" n="2">
                     <staff xml:id="sqy96go" n="1">
                        <layer xml:id="l1lrokmf" n="1">
                           <note xml:id="nh8hgho" dur.ppq="1" dur="4" oct="4" pname="b" stem.dir="down" />
                           <note xml:id="npl80jh" dur.ppq="1" dur="4" oct="4" pname="b" stem.dir="down" />
                           <note xml:id="n28ycep" dur.ppq="1" dur="4" oct="4" pname="b" stem.dir="down" />
                           <note xml:id="n1lgxfbv" dur.ppq="1" dur="4" oct="4" pname="b" stem.dir="down" />
                        </layer>
                     </staff>
                     <dir xml:id="d1i5dg3n" place="above" staff="1" tstamp="4.000000" vgrp="200">AAAAAAAAAAAAAAA</dir>
                  </measure>
                  <measure xml:id="m132u5ur" right="end" n="3">
                     <staff xml:id="scd9obl" n="1">
                        <layer xml:id="lixrytz" n="1">
                           <note xml:id="ntsyz8y" dur.ppq="4" dur="1" oct="4" pname="b" />
                        </layer>
                     </staff>
                  </measure>
               </section>
            </score>
         </mdiv>
      </body>
   </music>
</mei>

Expected behavior I would expect that the second <sb> after the first <measure> would instead be placed after the second <measure>, resulting in the following MEI:

Click to see MEI
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/dev/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/dev/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.0-dev">
   <meiHead>
      <fileDesc>
         <titleStmt>
            <title />
            <respStmt />
         </titleStmt>
         <pubStmt><date isodate="2023-05-17" type="encoding-date">2023-05-17</date>
         </pubStmt>
      </fileDesc>
      <encodingDesc xml:id="encodingdesc-i7kacw">
         <appInfo xml:id="appinfo-k685s5">
            <application xml:id="application-x1ee6d" isodate="2023-05-17T10:43:34" version="3.15.0-5abc7c0">
               <name xml:id="name-1qcehis">Verovio</name>
               <p xml:id="p-vxoe9m">Transcoded from MusicXML</p>
            </application>
         </appInfo>
      </encodingDesc>
   </meiHead>
   <music>
      <body>
         <mdiv xml:id="m1d5u3zl">
            <score xml:id="s1x23nmn">
               <scoreDef xml:id="s1fapiha">
                  <staffGrp xml:id="s3lz7ta">
                     <staffDef xml:id="P1" n="1" lines="5" ppq="1">
                        <instrDef xml:id="idtg2wr" midi.channel="0" midi.instrnum="0" midi.volume="78.00%" />
                        <clef xml:id="c19bbeoy" shape="G" line="2" />
                        <keySig xml:id="k1swrjds" sig="0" />
                        <meterSig xml:id="m1qbzlwr" count="4" unit="4" />
                     </staffDef>
                  </staffGrp>
               </scoreDef>
               <section xml:id="skrh56s">
                  <pb xml:id="pdlgbx6" />
                  <measure xml:id="m1crmtjb" n="1">
                     <staff xml:id="s9cvidf" n="1">
                        <layer xml:id="l1ultwao" n="1">
                           <note xml:id="naf1fv2" dur.ppq="4" dur="1" oct="4" pname="b" />
                        </layer>
                     </staff>
                  </measure>
                  <sb xml:id="s15fm5vt" />
                  <measure xml:id="mk36jas" n="2">
                     <staff xml:id="sqy96go" n="1">
                        <layer xml:id="l1lrokmf" n="1">
                           <note xml:id="nh8hgho" dur.ppq="1" dur="4" oct="4" pname="b" stem.dir="down" />
                           <note xml:id="npl80jh" dur.ppq="1" dur="4" oct="4" pname="b" stem.dir="down" />
                           <note xml:id="n28ycep" dur.ppq="1" dur="4" oct="4" pname="b" stem.dir="down" />
                           <note xml:id="n1lgxfbv" dur.ppq="1" dur="4" oct="4" pname="b" stem.dir="down" />
                        </layer>
                     </staff>
                     <dir xml:id="d1i5dg3n" place="above" staff="1" tstamp="4.000000" vgrp="200">AAAAAAAAAAAAAAA</dir>
                  </measure>
                  <sb xml:id="sh0pj3n" />
                  <measure xml:id="m132u5ur" right="end" n="3">
                     <staff xml:id="scd9obl" n="1">
                        <layer xml:id="lixrytz" n="1">
                           <note xml:id="ntsyz8y" dur.ppq="4" dur="1" oct="4" pname="b" />
                        </layer>
                     </staff>
                  </measure>
               </section>
            </score>
         </mdiv>
      </body>
   </music>
</mei>

Verovio information

  • Version of Verovio: 3.15.0
  • Binding: JavaScript

Environment information (as appropriate)

  • OS: MacOS
  • Browser: Chrome

bryantgeorge avatar May 17 '23 15:05 bryantgeorge

The breaks option has no effect on the MusicXML conversion.

rettinghaus avatar May 17 '23 15:05 rettinghaus

The breaks option has no effect on the MusicXML conversion.

My bad, but is it intentional that the resulting MEI has two <sb> elements right next to each other though?

ie. I guess the breaks option was unrelated to this issue, but I wonder if the system breaks still aren't being placed correctly in the MEI

bryantgeorge avatar May 17 '23 16:05 bryantgeorge

No, this looks indeed wrong.

rettinghaus avatar May 17 '23 17:05 rettinghaus

As it turns out the breaks option indeed affects the order of elements in the MEI output. For now you can use {breaks: 'none'} to disable layout process for conversion, then everything is right.

rettinghaus avatar May 17 '23 20:05 rettinghaus

For now you can use {breaks: 'none'} to disable layout process for conversion, then everything is right.

This didn't seem to work for me, but I may have done something incorrectly. In any case, I have some custom code to adjust the MEI afterwards to fix this issue for now.

bryantgeorge avatar May 18 '23 13:05 bryantgeorge