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

beam/note@stem.pos #1375

Open craigsapp opened 4 years ago

craigsapp commented 4 years ago

The note@stem.pos parameter can be used to change the side of the note the stem is attached, such as in measure 2 of this example:

Screen Shot 2020-03-24 at 21 54 59

MEI 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="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="4.0.0">
 <meiHead>
  <fileDesc>
   <titleStmt>
    <title />
   </titleStmt>
   <pubStmt />
  </fileDesc>
  <encodingDesc>
   <appInfo>
    <application isodate="2020-03-24T21:50:47" version="2.7.0-dev-4397242">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="mdiv-0000001244977722">
    <score xml:id="score-0000001753406272">
     <scoreDef xml:id="scoredef-0000001027826020">
      <staffGrp xml:id="staffgrp-0000000195083349">
       <staffDef xml:id="staffdef-0000000044079545" n="1" lines="5">
        <clef xml:id="clef-0000000001828467" shape="G" line="2" />
        <meterSig xml:id="metersig-L2F1" count="4" unit="4" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <measure xml:id="measure-L1" n="1">
       <staff xml:id="staff-0000001752597584" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <note xml:id="note-L4F1" dur="2" oct="5" pname="g" accid.ges="n" />
         <note xml:id="note-L5F1" dur="4" oct="5" pname="f" accid.ges="n" />
         <note xml:id="note-L6F1" dur="4" oct="5" pname="g" accid.ges="n" />
        </layer>
       </staff>
      </measure>
      <measure xml:id="measure-L7" right="end">
       <staff xml:id="staff-L7F1N1" n="1">
        <layer xml:id="layer-L7F1N1" n="1">
         <note xml:id="note-L9F1" dur="2" oct="5" pname="g" stem.pos="right" accid.ges="n" />
         <note xml:id="note-L10F1" dur="4" oct="5" pname="f" stem.pos="right" accid.ges="n" />
         <note xml:id="note-L11F1" dur="4" oct="5" pname="g" stem.pos="right" accid.ges="n" />
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>

However, note@stem.pos is ignored when the note is within a beam:

Screen Shot 2020-03-25 at 01 13 35

All of the notes in the second measure have @stem.pos="right", but notes in then beam are not affected.

MEI data for example:

<?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="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="4.0.0">
 <meiHead>
  <fileDesc>
   <titleStmt>
    <title />
   </titleStmt>
   <pubStmt />
  </fileDesc>
  <encodingDesc>
   <appInfo>
    <application isodate="2020-03-25T01:13:04" version="2.7.0-dev-4397242">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="mdiv-0000001850292481">
    <score xml:id="score-0000001768564188">
     <scoreDef xml:id="scoredef-0000001319384905">
      <staffGrp xml:id="staffgrp-0000001602141285">
       <staffDef xml:id="staffdef-0000001025484704" n="1" lines="5">
        <clef xml:id="clef-0000001498040926" shape="G" line="2" />
        <meterSig xml:id="metersig-L2F1" count="3" unit="4" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <measure xml:id="measure-L1" n="1">
       <staff xml:id="staff-0000001170925741" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <note xml:id="note-L4F1" dur="2" oct="5" pname="g" accid.ges="n" />
         <beam xml:id="beam-L5F1-L6F1">
          <note xml:id="note-L5F1" dots="1" dur="8" oct="5" pname="f" accid.ges="n" />
          <note xml:id="note-L6F1" dur="16" oct="5" pname="g" accid.ges="n" />
         </beam>
        </layer>
       </staff>
      </measure>
      <measure xml:id="measure-L7" right="end">
       <staff xml:id="staff-L7F1N1" n="1">
        <layer xml:id="layer-L7F1N1" n="1">
         <note xml:id="note-L9F1" dur="2" oct="5" pname="g" stem.pos="right" accid.ges="n" />
         <beam xml:id="beam-L10F1-L11F1">
          <note xml:id="note-L10F1" dots="1" dur="8" oct="5" pname="f" stem.pos="right" accid.ges="n" />
          <note xml:id="note-L11F1" dur="16" oct="5" pname="g" stem.pos="right" accid.ges="n" />
         </beam>
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>

Related to issue https://github.com/humdrum-tools/verovio-humdrum-viewer/issues/134#issuecomment-600007831 which has a longer example and explains motive is for preserving scribal style of manuscript.

craigsapp commented 4 years ago

Also needed for tremolo beams:

Screen Shot 2020-10-04 at 8 18 11 PM

Unbeamed notes have stems on right, but beamed notes do not (all notes have @stem.pos="right" on them).

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="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="4.0.0">
 <meiHead>
  <fileDesc>
   <titleStmt>
    <title />
   </titleStmt>
   <pubStmt />
  </fileDesc>
  <encodingDesc>
   <appInfo>
    <application isodate="2020-10-04T20:16:30" version="3.0.0-dev-312bf65">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="mdiv-0000000381901681">
    <score xml:id="score-0000001940415331">
     <scoreDef xml:id="scoredef-0000000445439989">
      <staffGrp xml:id="staffgrp-0000000614739530">
       <staffDef xml:id="staffdef-0000001543675239" n="1" lines="5">
        <clef xml:id="clef-0000001167372246" shape="G" line="2" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <measure xml:id="measure-L1" right="end" n="1">
       <staff xml:id="staff-0000001170385633" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <note xml:id="note-L4F1" dur="8" oct="5" pname="f" stem.pos="right" accid.ges="n" />
         <note xml:id="note-L5F1" dur="4" oct="5" pname="f" stem.pos="right" accid.ges="n" />
         <note xml:id="note-L6F1" dur="2" oct="5" pname="f" stem.pos="right" accid.ges="n" />
         <bTrem xml:id="btrem-L8F1-L11F1" unitdur="8">
          <note xml:id="note-L8F1" dur="2" oct="5" pname="g" stem.pos="right" accid.ges="n" />
         </bTrem>
         <fTrem xml:id="ftrem-L12F1-L15F1" beams="1" unitdur="8">
          <note xml:id="note-L12F1" dur="2" oct="5" pname="g" stem.pos="right" accid.ges="n" />
          <note xml:id="note-L15F1" dur="2" oct="5" pname="c" stem.pos="right" accid.ges="n" />
         </fTrem>
         <beam xml:id="beam-L16F1-L17F1">
          <note xml:id="note-L16F1" dur="8" oct="5" pname="f" stem.pos="right" accid.ges="n" />
          <note xml:id="note-L17F1" dur="8" oct="5" pname="a" stem.pos="right" accid.ges="n" />
         </beam>
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>