rism-digital / verovio

🎵 Music notation engraving library for MEI with MusicXML and Humdrum support and various toolkits (JavaScript, Python)
https://www.verovio.org
GNU Lesser General Public License v3.0
683 stars 185 forks source link

`<tupletSpan>` wrongly converted to `<tuplet>` #3859

Open th-we opened 1 week ago

th-we commented 1 week ago

Describe the problem

When converting <tupletSpan>s with @startid and @endid inside beams to MEI basic, Verovio wraps the entire beam into a tuplet instead of just the tuplet notes.

To Reproduce Steps to reproduce the behavior:

  1. Save the below MEI as tuplet-span.mei
  2. On the command line, do: verovio -a -f mei -t mei-basic -o tuplet-basic.mei tuplet-span.mei
  3. The <layer> element that Verovio exports to tuplet-basic.mei looks like this:
    <layer xml:id="lngvvyg" n="1">
    <tuplet xml:id="tssp0fk" type="tupletSpan" num="3" numbase="2">
      <beam xml:id="b12h26eu">
         <note xml:id="n1lfq8kp" dur="8" oct="4" pname="a" />
         <note xml:id="n1i1ycu8" dur="8" oct="4" pname="a" />
         <note xml:id="tupletStart" dur="8" oct="4" pname="a" />
         <note xml:id="nij7hcn" dur="8" oct="4" pname="a" />
         <note xml:id="tupletEnd" dur="8" oct="4" pname="a" />
      </beam>
    </tuplet>
    </layer>    

Expected behavior

The <layer> element resulting from the below test data should look like this:

<layer n="1">
  <beam>
    <note dur="8" oct="4" pname="a" />
    <note dur="8" oct="4" pname="a" />
    <tuplet num="3" numbase="2">
      <note dur="8" oct="4" pname="a" xml:id="tupletStart" />
      <note dur="8" oct="4" pname="a" />
      <note dur="8" oct="4" pname="a" xml:id="tupletEnd" />  
    </tuplet>
  </beam>
</layer>

Input data

<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="5.0">
  <meiHead>
    <fileDesc>
      <titleStmt>
        <title />
      </titleStmt>
      <pubStmt />
    </fileDesc>
  </meiHead>
  <music>
    <body>
      <mdiv>
        <score>
          <scoreDef meter.count="2" meter.unit="4">
            <staffGrp>
              <staffDef n="1" lines="5" clef.shape="G" clef.line="2" />
            </staffGrp>
          </scoreDef>
          <section>
            <measure n="1">
              <staff n="1">
                <layer n="1">
                  <beam>
                    <note dur="8" oct="4" pname="a" />
                    <note dur="8" oct="4" pname="a" />
                    <note dur="8" oct="4" pname="a" xml:id="tupletStart" />
                    <note dur="8" oct="4" pname="a" />
                    <note dur="8" oct="4" pname="a" xml:id="tupletEnd" />
                  </beam>
                </layer>
              </staff>
              <tupletSpan startid="#tupletStart" endid="#tupletEnd" num="3" numbase="2" />
            </measure>
          </section>
        </score>
      </mdiv>
    </body>
  </music>
</mei>

Verovio information

Environment

lpugin commented 1 week ago

This is not limited to MEI-basic. The Handling of tupletSpan is indeed very limited.

lpugin commented 1 week ago

If you want to give a try improving it, this is where all the restructuring is happing: https://github.com/rism-digital/verovio/blob/911d63c433494aeb9cf20bf50a9e205f006a0349/src/iomei.cpp#L8206-L8225