verovio icon indicating copy to clipboard operation
verovio copied to clipboard

tie / stem collision

Open o-sapov opened this issue 5 years ago • 3 comments

In this example, the tie does not recognizes the stem. Note that the beam direction is explicitly defined by @stem.dir="up".

Verovio, versions 3.0.1-7cda52c, 3.1.0-dev-b649cbf:

verovio_v3 1 0

Correct version would be: nma_m155-156 (Neue Mozart Ausgabe, K. 330/003)

MEI:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/4.0.1/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/4.0.1/mei-all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<mei meiversion="4.0.0" xmlns="http://www.music-encoding.org/ns/mei">
  <meiHead meiversion="4.0.1">
    <fileDesc>
      <titleStmt>
        <title label="NMA digital" type="unit">an example</title>
      </titleStmt>
      <pubStmt/>
    </fileDesc>
  </meiHead>
  <music meiversion="4.0.1">
    <body>
      <mdiv n="1" xml:id="mdiv_72">
        <score xml:id="score_78">
          <scoreDef key.mode="major" key.pname="c" key.sig="0" meter.count="2" meter.unit="4" xml:id="scoreDef_01">
            <staffGrp bar.thru="true" symbol="brace" xml:id="staffGrp_01">
              <staffDef clef.line="2" clef.shape="G" key.sig="0" lines="5" n="1" xml:id="staffDef_P1"/>
              <staffDef clef.line="4" clef.shape="F" key.sig="0" lines="5" n="2" xml:id="staffDef_P2"/>
            </staffGrp>
          </scoreDef>
          <section xml:id="section_A_m1-2">
            <measure n="1" xml:id="m1">
              <staff n="1" xml:id="staff_120">
                <layer n="1" xml:id="layer_126">
                  <beam xml:id="beam_132">
                    <tuplet bracket.visible="false" num="3" num.visible="false" numbase="2" xml:id="tuplet_138">
                      <note accid="f" dur="16" oct="5" pname="b" tstamp="1" xml:id="note_144"/>
                      <note dur="16" oct="5" pname="a" tstamp="1.16667" xml:id="note_150"/>
                      <note dur="16" oct="5" pname="g" tstamp="1.33333" xml:id="note_156"/>
                    </tuplet>
                  </beam>
                  <beam xml:id="beam_162">
                    <tuplet bracket.visible="false" num="3" num.visible="false" numbase="2" xml:id="tuplet_168">
                      <note dur="16" oct="5" pname="f" tstamp="1.5" xml:id="note_174"/>
                      <note dur="16" oct="5" pname="e" tstamp="1.66667" xml:id="note_180"/>
                      <note dur="16" oct="5" pname="d" tstamp="1.83333" xml:id="note_186"/>
                    </tuplet>
                  </beam>
                  <beam xml:id="beam_192">
                    <tuplet bracket.visible="false" num="3" num.visible="false" numbase="2" xml:id="tuplet_198">
                      <note dur="16" oct="5" pname="c" tstamp="2" xml:id="note_204"/>
                      <note dur="16" oct="5" pname="d" tstamp="2.16667" xml:id="note_210"/>
                      <note dur="16" oct="5" pname="c" tstamp="2.33333" xml:id="note_216"/>
                    </tuplet>
                  </beam>
                  <beam xml:id="beam_222">
                    <tuplet bracket.visible="false" num="3" num.visible="false" numbase="2" xml:id="tuplet_228">
                      <note accid="f" dur="16" oct="4" pname="b" tstamp="2.5" xml:id="note_234"/>
                      <note dur="16" oct="4" pname="a" tstamp="2.66667" xml:id="note_240"/>
                      <note accid="s" dur="16" oct="4" pname="g" tstamp="2.83333" xml:id="note_246"/>
                    </tuplet>
                  </beam>
                </layer>
              </staff>
              <staff n="2" xml:id="staff_252">
                <layer n="1" xml:id="layer_258">
                  <note dur="2" oct="4" pname="c" tstamp="1" xml:id="note_264"/>
                </layer>
                <layer n="2" xml:id="layer_270">
                  <note dots="1" dur="4" oct="3" pname="g" stem.dir="up" tstamp="1" xml:id="note_276"/>
                  <note accid="f" dur="8" oct="3" pname="b" stem.dir="up" tstamp="2.5" xml:id="note_282"/>
                </layer>
                <layer n="3" xml:id="layer_288">
                  <note dur="2" oct="3" pname="e" stem.dir="down" tstamp="1" xml:id="note_294"/>
                </layer>
              </staff>
              <supplied reason="NMAsource_B" resp="#NMA-editors" xml:id="supplied_300">
                <dynam staff="2" startid="#note_264" xml:id="dynam_306">f</dynam>
              </supplied>
              <slur curvedir="below" endid="#note_450" staff="2" startid="#note_294" xml:id="slur_318"/>
              <tie endid="#note_426" staff="2" startid="#note_264" xml:id="tie_324"/>
            </measure>
            <measure n="2" xml:id="m2">
              <staff n="1" xml:id="staff_336">
                <layer n="1" xml:id="layer_342">
                  <beam xml:id="beam_348">
                    <note artic="spicc" dur="16" oct="4" pname="a" tstamp="1" xml:id="note_354"/>
                    <note dur="16" oct="5" pname="a" tstamp="1.25" xml:id="note_360"/>
                    <note accid="s" dur="16" oct="5" pname="g" tstamp="1.5" xml:id="note_366"/>
                    <note dur="16" oct="5" pname="a" tstamp="1.75" xml:id="note_372"/>
                  </beam>
                  <beam xml:id="beam_378">
                    <note accid.ges="s" dur="16" oct="5" pname="g" tstamp="2" xml:id="note_384"/>
                    <note dur="16" oct="5" pname="a" tstamp="2.25" xml:id="note_390"/>
                    <note accid.ges="s" dur="16" oct="5" pname="g" tstamp="2.5" xml:id="note_396"/>
                    <note dur="16" oct="5" pname="a" tstamp="2.75" xml:id="note_402"/>
                  </beam>
                </layer>
              </staff>
              <staff n="2" xml:id="staff_408">
                <layer n="1" xml:id="layer_414">
                  <chord dur="4" tstamp="1" xml:id="chord_420">
                    <note oct="4" pname="c" xml:id="note_426"/>
                    <note oct="3" pname="a" xml:id="note_432"/>
                  </chord>
                  <rest dur="4" oloc="3" ploc="d" tstamp="2" xml:id="rest_438"/>
                </layer>
                <layer n="2" xml:id="layer_444">
                  <note dur="4" oct="3" pname="f" tstamp="1" xml:id="note_450"/>
                  <space dur="4" tstamp="2" xml:id="space_456"/>
                </layer>
              </staff>
              <supplied resp="#NMA-editors" xml:id="supplied_462">
                <dynam staff="1" startid="#note_360" xml:id="dynam_468">p</dynam>
              </supplied>
              <slur endid="#note_402" staff="1" startid="#note_360" xml:id="slur_480"/>
            </measure>
          </section>
        </score>
      </mdiv>
    </body>
  </music>
</mei>

o-sapov avatar Nov 09 '20 10:11 o-sapov

The problem still exists. Maybe it is helpful to break the @o-sapov example above down to a more reduced one (minimal running code):

<?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">
  <meiHead>
    <fileDesc>
      <titleStmt>
        <title label="NMA digital" type="unit">tie / stem collision</title>
      </titleStmt>
      <pubStmt/>
    </fileDesc>
  </meiHead>
  <music>
    <body>
      <mdiv n="1" xml:id="mdiv_72">
        <score xml:id="score_78">
          <scoreDef key.mode="major" key.pname="c" meter.count="2" meter.unit="4" xml:id="scoreDef_01">
            <staffGrp bar.thru="true" xml:id="staffGrp_01">
              <staffDef clef.line="4" clef.shape="F" lines="5" n="2" xml:id="staffDef_P2"/>
            </staffGrp>
          </scoreDef>
          <section xml:id="section_A_m1-2">
            <measure n="1" xml:id="kv330-3-m155">
              <staff n="2" xml:id="staff_252">
                <layer n="1" xml:id="layer_258">
                  <note dur="2" oct="4" pname="c" tstamp="1" xml:id="note_264"/>
                </layer>
                <layer n="2" xml:id="layer_270">
                  <note dots="1" dur="4" oct="3" pname="g" stem.dir="up" tstamp="1" xml:id="note_276"/>
                  <note accid="f" dur="8" oct="3" pname="b" stem.dir="up" tstamp="2.5" xml:id="note_282"/>
                </layer>
              </staff>
              <tie color="green" endid="#note_426" staff="2" startid="#note_264" xml:id="tie_324"/>
            </measure>
            <measure n="2" xml:id="kv330-3-m156">
              <staff n="2" xml:id="staff_408">
                <layer n="1" xml:id="layer_414">
                  <chord dur="4" tstamp="1" xml:id="chord_420">
                    <note oct="4" pname="c" xml:id="note_426"/>
                    <note oct="3" pname="a" xml:id="note_432"/>
                  </chord>
                  <rest dur="4" oloc="3" ploc="d" tstamp="2" xml:id="rest_438"/>
                </layer>
              </staff>
            </measure>
          </section>
        </score>
      </mdiv>
    </body>
  </music>
</mei>

frakel avatar Jan 12 '24 08:01 frakel

The problem is that ties do not have collision avoidance. Note in this example that there is a tie between the two C4 notes in the first two measures, but I convert it to a slur in the second pair of measures, where it then renders properly:

Screenshot 2024-01-12 at 01 11 29
Click to view MEI data for above example
<?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 />
   </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-01-12T01:11:44" version="4.2.0-dev-ee2f51d-dirty">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
 </meiHead>
 <music decls="#work0_encoded">
  <body>
   <mdiv xml:id="mys3tps">
    <score xml:id="sb8j08z">
     <scoreDef xml:id="s19yqte5">
      <staffGrp xml:id="s1pv6fma">
       <staffDef xml:id="staffdef-L1F1" n="1" lines="5">
        <clef xml:id="clef-L2F1" shape="F" line="4" />
        <meterSig xml:id="metersig-L3F1" count="2" unit="4" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <measure xml:id="measure-L1" n="1">
       <staff xml:id="staff-L1F1" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <note xml:id="note-L8F1" dur="2" oct="4" pname="c" accid.ges="n" />
        </layer>
        <layer xml:id="layer-L1F1N2" n="2">
         <note xml:id="note-L8F2" dur="2" oct="3" pname="e" accid.ges="n" />
        </layer>
        <layer xml:id="layer-L1F1N3" n="3">
         <note xml:id="note-L8F3" dots="1" dur="4" oct="3" pname="g" accid.ges="n" />
         <note xml:id="note-L9F3" dur="8" oct="3" pname="b" accid="f" />
        </layer>
       </staff>
       <dir xml:id="dir-L7F1" place="above" staff="1" tstamp="1.000000">
        <rend xml:id="rdqfful" fontstyle="normal">tie</rend>
       </dir>
       <tie xml:id="tie-L8F1S1-L12F1S1" startid="#note-L8F1" endid="#note-L12F1S1" />
       <slur xml:id="slur-L8F2-L12F2" staff="1" startid="#note-L8F2" endid="#note-L12F2" />
      </measure>
      <measure xml:id="measure-L10" right="dbl" n="2">
       <staff xml:id="staff-L10F1N1" n="1">
        <layer xml:id="layer-L10F1N1" n="1">
         <chord xml:id="chord-L12F1" dur="4">
          <note xml:id="note-L12F1S1" oct="4" pname="c" accid.ges="n" />
          <note xml:id="note-L12F1S2" oct="3" pname="a" accid.ges="n" />
         </chord>
         <rest xml:id="rest-L14F1" dur="4" />
        </layer>
        <layer xml:id="layer-L10F2N2" n="2">
         <note xml:id="note-L12F2" dur="4" oct="3" pname="f" accid.ges="n" />
         <space xml:id="s137bo7o" type="filler" dur="4" />
        </layer>
        <layer xml:id="layer-L10F3N3" n="3" />
       </staff>
      </measure>
      <measure xml:id="measure-L15" n="3">
       <staff xml:id="staff-L15F1N1" n="1">
        <layer xml:id="layer-L15F1N1" n="1">
         <note xml:id="note-L19F1" dur="2" oct="4" pname="c" accid.ges="n" />
        </layer>
        <layer xml:id="layer-L15F2N2" n="2">
         <note xml:id="note-L19F2" dur="2" oct="3" pname="e" accid.ges="n" />
        </layer>
        <layer xml:id="layer-L15F3N3" n="3">
         <note xml:id="note-L19F3" dots="1" dur="4" oct="3" pname="g" accid.ges="n" />
         <note xml:id="note-L20F3" dur="8" oct="3" pname="b" accid="f" />
        </layer>
       </staff>
       <dir xml:id="dir-L18F1" place="above" staff="1" tstamp="1.000000">
        <rend xml:id="ry78fbb" fontstyle="normal">slur</rend>
       </dir>
       <slur xml:id="slur-L19F1-L23F1" staff="1" startid="#note-L19F1" endid="#chord-L23F1" />
       <slur xml:id="slur-L19F2-L23F2" staff="1" startid="#note-L19F2" endid="#note-L23F2" />
      </measure>
      <measure xml:id="measure-L21" n="4">
       <staff xml:id="staff-L21F1N1" n="1">
        <layer xml:id="layer-L21F1N1" n="1">
         <chord xml:id="chord-L23F1" dur="4">
          <note xml:id="note-L23F1S1" oct="4" pname="c" accid.ges="n" />
          <note xml:id="note-L23F1S2" oct="3" pname="a" accid.ges="n" />
         </chord>
         <rest xml:id="rest-L25F1" dur="4" />
        </layer>
        <layer xml:id="layer-L21F2N2" n="2">
         <note xml:id="note-L23F2" dur="4" oct="3" pname="f" accid.ges="n" />
         <space xml:id="s1bwbv9c" type="filler" dur="4" />
        </layer>
        <layer xml:id="layer-L21F3N3" n="3" />
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>

So either collision avoidance should be added to ties, or some new attribute should be added to allow a tie to be treated as if it were a slur to enable the collision avoidance.

craigsapp avatar Jan 12 '24 09:01 craigsapp

Thanks for this very helpful insider tip @craigsapp 🙏

frakel avatar Jan 12 '24 16:01 frakel