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

layer + stem + vertical position interaction #2517

Open
craigsapp opened this issue Nov 30, 2021 · 3 comments
Open

layer + stem + vertical position interaction #2517

craigsapp opened this issue Nov 30, 2021 · 3 comments

Comments

@craigsapp
Copy link
Contributor

In the following example, the first two beamed notes are rendered as desired:

Screen Shot 2021-11-30 at 12 42 19 PM

But afterwards, the stem-up attributes are ignored (or more precisely, the stems lengths have become negative). This seems to be related to the first note being placed below the staff. Maybe the beam positioning algorithm is not aware of the @ploc/@oloc parameters of the rest, and things that it is centered in the middle of the staff?

Also, the stem length of the first two beamed pairs are dependent on the horizontal spacing for some reason, which does not seem to have a good reason:

Screen Shot 2021-11-30 at 12 42 29 PM

In theory the beamed notes do not have to move out of the way in the second example, but it seems that some avoidance code is being triggered in this case.

MEI test data:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="https://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="https://purl.oclc.org/dsdl/schematron"?>
<mei xmlns="https://www.music-encoding.org/ns/mei" meiversion="4.0.0">
 <meiHead>
  <fileDesc>
   <titleStmt>
    <title />
   </titleStmt>
   <pubStmt />
  </fileDesc>
  <encodingDesc>
   <appInfo>
    <application isodate="2021-11-30T12:42:32" version="3.8.0-dev-b3abbd0-dirty">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="mrdknp0">
    <score xml:id="sel9uun">
     <scoreDef xml:id="srbwtvg">
      <staffGrp xml:id="s65lls4">
       <staffDef xml:id="s7n11zs" n="1" lines="5">
        <clef xml:id="clef-L2F1" shape="G" line="2" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <measure xml:id="measure-L1">
       <staff xml:id="sspq0xp" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <rest xml:id="rest-L6F1" dur="4" ploc="f" oloc="5" />
         <rest xml:id="rest-L8F1" dur="4" ploc="f" oloc="5" />
         <rest xml:id="rest-L10F1" dur="4" ploc="f" oloc="5" />
         <rest xml:id="rest-L12F1" dur="4" ploc="f" oloc="5" />
         <rest xml:id="rest-L14F1" dur="4" ploc="f" oloc="5" />
         <rest xml:id="rest-L16F1" dur="4" ploc="f" oloc="5" />
        </layer>
        <layer xml:id="layer-L2F1N2" n="2">
         <beam xml:id="beam-L6F2-L7F2" type="placed">
          <note xml:id="note-L6F2" dur="8" oct="4" pname="g" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L7F2" dur="8" oct="4" pname="c" stem.dir="up" accid.ges="n" />
         </beam>
         <beam xml:id="beam-L8F2-L9F2" type="placed">
          <note xml:id="note-L8F2" dur="8" oct="4" pname="f" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L9F2" dur="8" oct="4" pname="c" stem.dir="up" accid.ges="n" />
         </beam>
         <beam xml:id="beam-L10F2-L11F2" type="placed">
          <note xml:id="note-L10F2" dur="8" oct="4" pname="e" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L11F2" dur="8" oct="4" pname="c" stem.dir="up" accid.ges="n" />
         </beam>
         <beam xml:id="beam-L12F2-L13F2" type="placed">
          <note xml:id="note-L12F2" dur="8" oct="4" pname="d" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L13F2" dur="8" oct="4" pname="c" stem.dir="up" accid.ges="n" />
         </beam>
         <beam xml:id="beam-L14F2-L15F2" type="placed">
          <note xml:id="note-L14F2" dur="8" oct="4" pname="c" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L15F2" dur="8" oct="4" pname="c" stem.dir="up" accid.ges="n" />
         </beam>
         <beam xml:id="beam-L16F2-L17F2" type="placed">
          <note xml:id="note-L16F2" dur="8" oct="3" pname="b" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L17F2" dur="8" oct="4" pname="c" stem.dir="up" accid.ges="n" />
         </beam>
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>
@rettinghaus
Copy link
Contributor

Current develop shows this:
beam_avoidance

Still improvable, but I think this issue can be closed?

@craigsapp
Copy link
Contributor Author

Yes, it is good enough (but could improve). I am getting something slightly different from you (from devel branch as of yesterday, I think):

Screen Shot 2022-02-20 at 5 57 13 AM

@craigsapp
Copy link
Contributor Author

However, I will sneak in another example that is related:

Screen Shot 2022-02-20 at 6 12 55 AM

The staff 2 notes in measures 2 and 3 (tests for chords and single notes) have beams that is overlapping the cross-staff notes. Ideally the beams for these notes would be above/on/below the second staff line, but currently it seems that the beam is unaware of the notes in the cross-staff layer.

This could be related to different code for cross-staff beaming rather than rests (and also is about avoiding note heads rather than rests)

Click for MEI data for above example.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/dev/mei-all.rng" type="application/xml" schematypens="https://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/dev/mei-all.rng" type="application/xml" schematypens="https://purl.oclc.org/dsdl/schematron"?>
<mei xmlns="https://www.music-encoding.org/ns/mei" meiversion="5.0.0-dev">
 <meiHead>
  <fileDesc>
   <titleStmt>
    <title />
   </titleStmt>
   <pubStmt />
  </fileDesc>
  <encodingDesc>
   <appInfo>
    <application isodate="2022-02-20T06:10:54" version="3.9.0-dev-93a6934">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="mp50ypz">
    <score xml:id="syi7j20">
     <scoreDef xml:id="s4b9ig7">
      <staffGrp xml:id="svwv5xx" bar.thru="true" symbol="brace">
       <staffDef xml:id="s1advbs" n="1" lines="5">
        <clef xml:id="clef-L2F2" shape="G" line="2" />
        <keySig xml:id="keysig-L3F2" pname="d" mode="minor" sig="1f" />
        <meterSig xml:id="metersig-L5F2" count="4" sym="common" unit="4" />
       </staffDef>
       <staffDef xml:id="st0ipoh" n="2" lines="5">
        <clef xml:id="clef-L2F1" shape="F" line="4" />
        <keySig xml:id="keysig-L3F1" pname="d" mode="minor" sig="1f" />
        <meterSig xml:id="metersig-L5F1" count="4" sym="common" unit="4" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <measure xml:id="measure-L1" n="7">
       <staff xml:id="sjkavz" n="1">
        <layer xml:id="layer-L1F2N1" n="1">
         <beam xml:id="beam-L8F2-L15F2">
          <note xml:id="note-L8F2" dur="16" oct="4" pname="d" accid.ges="n" />
          <note xml:id="note-L9F2" dur="16" oct="4" pname="d" accid.ges="n" />
          <note xml:id="note-L10F2" dur="16" oct="3" pname="a" accid.ges="n" />
          <note xml:id="note-L11F2" dur="16" oct="3" pname="a" accid.ges="n" />
          <note xml:id="note-L12F2" dur="16" oct="3" pname="a" accid.ges="n" />
          <note xml:id="note-L13F2" dur="16" oct="3" pname="a" accid.ges="n" />
          <note xml:id="note-L14F2" dur="16" oct="3" pname="g" accid="s" />
          <note xml:id="note-L15F2" dur="16" oct="3" pname="g" accid.ges="s" />
         </beam>
         <beam xml:id="beam-L16F2-L23F2">
          <note xml:id="note-L16F2" dur="16" oct="4" pname="c" accid.ges="n" />
          <note xml:id="note-L17F2" dur="16" oct="4" pname="c" accid.ges="n" />
          <note xml:id="note-L18F2" dur="16" oct="3" pname="g" accid="n" />
          <note xml:id="note-L19F2" dur="16" oct="3" pname="g" accid.ges="n" />
          <note xml:id="note-L20F2" dur="16" oct="3" pname="g" accid.ges="n" />
          <note xml:id="note-L21F2" dur="16" oct="3" pname="g" accid.ges="n" />
          <note xml:id="note-L22F2" dur="16" oct="3" pname="f" accid="s" />
          <note xml:id="note-L23F2" dur="16" oct="3" pname="f" accid.ges="s" />
         </beam>
        </layer>
       </staff>
       <staff xml:id="s8wgjxr" n="2">
        <layer xml:id="layer-L1F1N1" n="1">
         <beam xml:id="beam-L8F1-L14F1">
          <chord xml:id="chord-L8F1" dur="8">
           <note xml:id="note-L8F1S1" oct="1" pname="d" accid.ges="n" />
           <note xml:id="note-L8F1S2" oct="2" pname="d" accid.ges="n" />
          </chord>
          <chord xml:id="chord-L10F1" dur="8">
           <note xml:id="note-L10F1S1" oct="1" pname="a" accid.ges="n" />
           <note xml:id="note-L10F1S2" oct="2" pname="a" accid.ges="n" />
          </chord>
          <chord xml:id="chord-L12F1" dur="8">
           <note xml:id="note-L12F1S1" oct="1" pname="a" accid.ges="n" />
           <note xml:id="note-L12F1S2" oct="2" pname="a" accid.ges="n" />
          </chord>
          <chord xml:id="chord-L14F1" dur="8">
           <note xml:id="note-L14F1S1" oct="1" pname="g" accid="s" />
           <note xml:id="note-L14F1S2" oct="2" pname="g" accid="s" />
          </chord>
         </beam>
         <beam xml:id="beam-L16F1-L22F1">
          <chord xml:id="chord-L16F1" dur="8">
           <note xml:id="note-L16F1S1" oct="1" pname="d" accid.ges="n" />
           <note xml:id="note-L16F1S2" oct="2" pname="d" accid.ges="n" />
          </chord>
          <chord xml:id="chord-L18F1" dur="8">
           <note xml:id="note-L18F1S1" oct="1" pname="g" accid="n" />
           <note xml:id="note-L18F1S2" oct="2" pname="g" accid="n" />
          </chord>
          <chord xml:id="chord-L20F1" dur="8">
           <note xml:id="note-L20F1S1" oct="1" pname="g" accid.ges="n" />
           <note xml:id="note-L20F1S2" oct="2" pname="g" accid.ges="n" />
          </chord>
          <chord xml:id="chord-L22F1" dur="8">
           <note xml:id="note-L22F1S1" oct="1" pname="f" accid="s" />
           <note xml:id="note-L22F1S2" oct="2" pname="f" accid="s" />
          </chord>
         </beam>
        </layer>
       </staff>
      </measure>
      <measure xml:id="measure-L24" n="8">
       <staff xml:id="staff-L24F2N1" n="1">
        <layer xml:id="layer-L24F2N1" n="1">
         <beam xml:id="beam-L25F2-L32F2" beam.with="below">
          <note xml:id="note-L25F2" dur="16" staff="2" oct="3" pname="b" stem.dir="up" accid.ges="f" />
          <note xml:id="note-L26F2" dur="16" staff="2" oct="3" pname="b" stem.dir="up" accid.ges="f" />
          <note xml:id="note-L27F2" dur="16" staff="2" oct="3" pname="f" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L28F2" dur="16" staff="2" oct="3" pname="f" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L29F2" dur="16" staff="2" oct="3" pname="f" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L30F2" dur="16" staff="2" oct="3" pname="f" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L31F2" dur="16" staff="2" oct="3" pname="e" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L32F2" dur="16" staff="2" oct="3" pname="e" stem.dir="up" accid.ges="n" />
         </beam>
         <beam xml:id="beam-L33F2-L40F2" beam.with="below">
          <note xml:id="note-L33F2" dur="16" staff="2" oct="3" pname="a" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L34F2" dur="16" staff="2" oct="3" pname="a" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L35F2" dur="16" staff="2" oct="3" pname="e" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L36F2" dur="16" staff="2" oct="3" pname="e" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L37F2" dur="16" staff="2" oct="3" pname="e" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L38F2" dur="16" staff="2" oct="3" pname="e" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L39F2" dur="16" staff="2" oct="3" pname="d" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L40F2" dur="16" staff="2" oct="3" pname="d" stem.dir="up" accid.ges="n" />
         </beam>
        </layer>
       </staff>
       <staff xml:id="staff-L24F1N1" n="2">
        <layer xml:id="layer-L24F1N1" n="1">
         <beam xml:id="beam-L25F1-L31F1">
          <chord xml:id="chord-L25F1" type="placed" dur="8" stem.dir="up">
           <note xml:id="note-L25F1S1" oct="1" pname="d" accid.ges="n" />
           <note xml:id="note-L25F1S2" oct="2" pname="d" accid.ges="n" />
          </chord>
          <chord xml:id="chord-L27F1" type="placed" dur="8" stem.dir="up">
           <note xml:id="note-L27F1S1" oct="1" pname="f" accid.ges="n" />
           <note xml:id="note-L27F1S2" oct="2" pname="f" accid.ges="n" />
          </chord>
          <chord xml:id="chord-L29F1" type="placed" dur="8" stem.dir="up">
           <note xml:id="note-L29F1S1" oct="1" pname="f" accid.ges="n" />
           <note xml:id="note-L29F1S2" oct="2" pname="f" accid.ges="n" />
          </chord>
          <chord xml:id="chord-L31F1" type="placed" dur="8" stem.dir="up">
           <note xml:id="note-L31F1S1" oct="1" pname="e" accid.ges="n" />
           <note xml:id="note-L31F1S2" oct="2" pname="e" accid.ges="n" />
          </chord>
         </beam>
         <beam xml:id="beam-L33F1-L39F1">
          <chord xml:id="chord-L33F1" type="placed" dur="8" stem.dir="up">
           <note xml:id="note-L33F1S1" oct="1" pname="d" accid.ges="n" />
           <note xml:id="note-L33F1S2" oct="2" pname="d" accid.ges="n" />
          </chord>
          <chord xml:id="chord-L35F1" type="placed" dur="8" stem.dir="up">
           <note xml:id="note-L35F1S1" oct="1" pname="e" accid.ges="n" />
           <note xml:id="note-L35F1S2" oct="2" pname="e" accid.ges="n" />
          </chord>
          <chord xml:id="chord-L37F1" type="placed" dur="8" stem.dir="up">
           <note xml:id="note-L37F1S1" oct="1" pname="e" accid.ges="n" />
           <note xml:id="note-L37F1S2" oct="2" pname="e" accid.ges="n" />
          </chord>
          <chord xml:id="chord-L39F1" type="placed" dur="8" stem.dir="up">
           <note xml:id="note-L39F1S1" oct="1" pname="d" accid.ges="n" />
           <note xml:id="note-L39F1S2" oct="2" pname="d" accid.ges="n" />
          </chord>
         </beam>
        </layer>
       </staff>
      </measure>
      <measure xml:id="measure-L41" right="invis" n="9">
       <staff xml:id="staff-L41F2N1" n="1">
        <layer xml:id="layer-L41F2N1" n="1">
         <beam xml:id="beam-L42F2-L49F2" beam.with="below">
          <note xml:id="note-L42F2" dur="16" staff="2" oct="3" pname="b" stem.dir="up" accid.ges="f" />
          <note xml:id="note-L43F2" dur="16" staff="2" oct="3" pname="b" stem.dir="up" accid.ges="f" />
          <note xml:id="note-L44F2" dur="16" staff="2" oct="3" pname="f" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L45F2" dur="16" staff="2" oct="3" pname="f" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L46F2" dur="16" staff="2" oct="3" pname="f" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L47F2" dur="16" staff="2" oct="3" pname="f" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L48F2" dur="16" staff="2" oct="3" pname="e" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L49F2" dur="16" staff="2" oct="3" pname="e" stem.dir="up" accid.ges="n" />
         </beam>
         <beam xml:id="beam-L50F2-L57F2" beam.with="below">
          <note xml:id="note-L50F2" dur="16" staff="2" oct="3" pname="a" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L51F2" dur="16" staff="2" oct="3" pname="a" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L52F2" dur="16" staff="2" oct="3" pname="e" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L53F2" dur="16" staff="2" oct="3" pname="e" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L54F2" dur="16" staff="2" oct="3" pname="e" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L55F2" dur="16" staff="2" oct="3" pname="e" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L56F2" dur="16" staff="2" oct="3" pname="d" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L57F2" dur="16" staff="2" oct="3" pname="d" stem.dir="up" accid.ges="n" />
         </beam>
        </layer>
       </staff>
       <staff xml:id="staff-L41F1N1" n="2">
        <layer xml:id="layer-L41F1N1" n="1">
         <beam xml:id="beam-L42F1-L48F1">
          <note xml:id="note-L42F1" type="placed" dur="8" oct="2" pname="d" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L44F1" type="placed" dur="8" oct="2" pname="f" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L46F1" type="placed" dur="8" oct="2" pname="f" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L48F1" type="placed" dur="8" oct="2" pname="e" stem.dir="up" accid.ges="n" />
         </beam>
         <beam xml:id="beam-L50F1-L56F1">
          <note xml:id="note-L50F1" type="placed" dur="8" oct="2" pname="d" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L52F1" type="placed" dur="8" oct="2" pname="e" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L54F1" type="placed" dur="8" oct="2" pname="e" stem.dir="up" accid.ges="n" />
          <note xml:id="note-L56F1" type="placed" dur="8" oct="2" pname="d" stem.dir="up" accid.ges="n" />
         </beam>
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>

I am also wondering why the stems on the cross-staff notes are so long.

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

No branches or pull requests

2 participants