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
686 stars 185 forks source link

Lyrics overlap when placed in different layers #3843

Open axgeertinger opened 3 weeks ago

axgeertinger commented 3 weeks ago

When syllables belonging to the same verse are placed across different layers due to rhythmic variants, the spacing algorithm does not seem to be aware of collisions.

overlapping lyrics

MEI:

<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="5.0">
 <meiHead xml:id="m1kany1y">
  <fileDesc xml:id="f11e8pzr">
   <titleStmt xml:id="tov514c">
    <title/>
   </titleStmt>
   <pubStmt xml:id="pi9o7k5">
    <date isodate="2024-11-01" type="encoding-date">2024-11-01</date>
   </pubStmt>
  </fileDesc>
 </meiHead>
 <music meiversion="5.0">
  <body>
   <mdiv xml:id="mvtoi16">
    <score xml:id="sh0ehz8">
     <scoreDef xml:id="sclg8qy">
      <staffGrp xml:id="s19aaxt5">
       <staffDef xml:id="P1" n="1" lines="5" ppq="4">
        <clef xml:id="cdia6if" shape="G" line="2"/>
        <meterSig xml:id="m1x2yam7" count="2" unit="4"/>
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="s1y139no">
      <measure xml:id="m1dgssja" n="1">
       <staff xml:id="s1m0q1i3" n="1">
        <layer xml:id="ljltyox" n="1">
         <note xml:id="n13nnjt9" dur.ppq="4" dur="4" oct="5" pname="c" stem.dir="up" accid.ges="s">
          <verse xml:id="v1f3qkbi" n="1">
           <syl xml:id="s15eld9x" con="s" wordpos="s">ei</syl>
          </verse>
         </note>
         <beam xml:id="bjh0pw7">
          <note xml:id="n1dxmf41" dur.ppq="2" dur="8" oct="4" pname="b" stem.dir="up">
           <verse xml:id="vh6l6a5" n="1">
            <syl xml:id="s19k1vdt" con="d" wordpos="i">gjen</syl>
           </verse>
           <verse xml:id="v1vajskt" n="2">
            <syl xml:id="smud4jd" con="d" wordpos="i">gjen</syl>
           </verse>
          </note>
          <note xml:id="n1qtrg5u" dur.ppq="2" dur="8" oct="4" pname="f" stem.dir="up" accid.ges="s">
           <verse xml:id="vjoavut" n="1">
            <syl xml:id="s1a0m8jh" con="s" wordpos="t">nem</syl>
           </verse>
           <verse xml:id="v12dsqhw" n="2">
            <syl xml:id="s1cyzw32" con="s" wordpos="t">nem</syl>
           </verse>
          </note>
         </beam>
        </layer>
        <layer xml:id="l1yots0t" n="2">
         <beam xml:id="b1q92ev0">
          <note xml:id="niyj1az" dots="1" dur.ppq="3" dur="8" oct="5" pname="c" stem.dir="down" accid.ges="s">
           <verse xml:id="v1d20tg2" n="2">
            <syl xml:id="s1m59zst" con="d" wordpos="i">al</syl>
           </verse>
          </note>
          <note xml:id="ndap39j" dur.ppq="1" dur="16" oct="5" pname="c" stem.dir="down" accid.ges="s">
           <verse xml:id="v1alumos" n="2">
            <syl xml:id="sketyg2" con="s" wordpos="t">drig</syl>
           </verse>
          </note>
         </beam>
         <space xml:id="s15sypgc" dur.ppq="4" dur="4"/>
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>
lpugin commented 1 week ago

What would be the expected order? Do you have some publication examples?

craigsapp commented 1 week ago

I would expect this layout:

Screenshot 2024-11-19 at 04 31 33

The main thing is that the first syllable of the second verse does not have an offset (unlike the first note of the second verse).

Often the first two notes for the second verse will be cue sized to increase readability.

axgeertinger commented 1 week ago

@craigsapp Exactly. This is the printed source. samson_pigens_sang

lpugin commented 6 days ago

Unfortunately fixing this will require some in-depth refactoring of the lyric layout algorithm.

In the meantime, the best work-around I can think of is to put the beam in the second layer. This is clearly not optimal, but at least the rendering outcome it correct.

image
```xml </titleStmt> <pubStmt xml:id="pi9o7k5"> <date isodate="2024-11-01" type="encoding-date">2024-11-01</date> </pubStmt> </fileDesc> </meiHead> <music meiversion="5.0"> <body> <mdiv xml:id="mvtoi16"> <score xml:id="sh0ehz8"> <scoreDef xml:id="sclg8qy"> <staffGrp xml:id="s19aaxt5"> <staffDef xml:id="P1" n="1" lines="5" ppq="4"> <clef xml:id="cdia6if" shape="G" line="2"/> <meterSig xml:id="m1x2yam7" count="2" unit="4"/> </staffDef> </staffGrp> </scoreDef> <section xml:id="s1y139no"> <measure xml:id="m1dgssja" n="1"> <staff xml:id="s1m0q1i3" n="1"> <layer xml:id="ljltyox" n="1"> <note xml:id="n13nnjt9" dur.ppq="4" dur="4" oct="5" pname="c" stem.dir="up" accid.ges="s"> <verse xml:id="v1f3qkbi" n="1"> <syl xml:id="s15eld9x" con="s" wordpos="s">ei</syl> </verse> </note> <space dur="4"></space> </layer> <layer xml:id="l1yots0t" n="2"> <beam xml:id="b1q92ev0"> <note xml:id="niyj1az" dots="1" dur.ppq="3" dur="8" oct="5" pname="c" stem.dir="down" accid.ges="s"> <verse xml:id="v1d20tg2" n="2"> <syl xml:id="s1m59zst" con="d" wordpos="i">al</syl> </verse> </note> <note xml:id="ndap39j" dur.ppq="1" dur="16" oct="5" pname="c" stem.dir="down" accid.ges="s"> <verse xml:id="v1alumos" n="2"> <syl xml:id="sketyg2" con="s" wordpos="t">drig</syl> </verse> </note> </beam> <beam xml:id="bjh0pw7"> <note xml:id="n1dxmf41" dur.ppq="2" dur="8" oct="4" pname="b" stem.dir="up"> <verse xml:id="vh6l6a5" n="1"> <syl xml:id="s19k1vdt" con="d" wordpos="i">gjen</syl> </verse> <verse xml:id="v1vajskt" n="2"> <syl xml:id="smud4jd" con="d" wordpos="i">gjen</syl> </verse> </note> <note xml:id="n1qtrg5u" dur.ppq="2" dur="8" oct="4" pname="f" stem.dir="up" accid.ges="s"> <verse xml:id="vjoavut" n="1"> <syl xml:id="s1a0m8jh" con="s" wordpos="t">nem</syl> </verse> <verse xml:id="v12dsqhw" n="2"> <syl xml:id="s1cyzw32" con="s" wordpos="t">nem</syl> </verse> </note> </beam> </layer> </staff> </measure> </section> </score> </mdiv> </body> </music> </mei> ``` </details> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/axgeertinger"><img src="https://avatars.githubusercontent.com/u/3779074?v=4" />axgeertinger</a> commented <strong> 5 days ago</strong> </div> <div class="markdown-body"> <p>Okay, thanks. I'll do that for now.</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>