humdrum-tools / verovio-humdrum-viewer

Verovio Humdrum Viewer
http://verovio.humdrum.org
37 stars 9 forks source link

Add notehead shape parameters #444

Open craigsapp opened 4 years ago

craigsapp commented 4 years ago

Add notehead layout parameters:

**kern
4c
!LO:N:head=x
4d
!LO:N:head=slash
4e
!LO:N:head=rhombus
4f
*-

Target rendering:

Screen Shot 2020-10-09 at 8 05 38 PM
<?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-09T20:03:54" version="3.0.0-dev-35d8e40">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="mdiv-0000000880513587">
    <score xml:id="score-0000000270638085">
     <scoreDef xml:id="scoredef-0000001708561103">
      <staffGrp xml:id="staffgrp-0000001081536482">
       <staffDef xml:id="staffdef-0000000044818993" n="1" lines="5">
        <clef xml:id="clef-0000000793559007" shape="G" line="2" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <measure xml:id="measure-L1" right="invis">
       <staff xml:id="staff-0000001185464085" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <note xml:id="note-L2F1" dur="4" oct="4" pname="c" accid.ges="n" />
         <note xml:id="note-L4F1" dur="4" oct="4" pname="d" head.shape="x" accid.ges="n" />
         <note xml:id="note-L5F1" dur="4" oct="4" pname="e" head.shape="slash" accid.ges="n" />
         <note xml:id="note-L6F1" dur="4" oct="4" pname="f" head.shape="diamond" accid.ges="n" />
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>

Also add an interpretation that sets all noteheads to a particular shape after the interpretation:

**kern
4c
*head:x
4d
4e
4f
*-

Target rendering:

Screen Shot 2020-10-09 at 8 13 12 PM

Target MEI conversion

<?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-09T20:03:54" version="3.0.0-dev-35d8e40">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="mdiv-0000000880513587">
    <score xml:id="score-0000000270638085">
     <scoreDef xml:id="scoredef-0000001708561103">
      <staffGrp xml:id="staffgrp-0000001081536482">
       <staffDef xml:id="staffdef-0000000044818993" n="1" lines="5">
        <clef xml:id="clef-0000000793559007" shape="G" line="2" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <measure xml:id="measure-L1" right="invis">
       <staff xml:id="staff-0000001185464085" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <note xml:id="note-L2F1" dur="4" oct="4" pname="c" accid.ges="n" />
         <note xml:id="note-L4F1" dur="4" oct="4" pname="d" head.shape="x" accid.ges="n" />
         <note xml:id="note-L5F1" dur="4" oct="4" pname="e" head.shape="x" accid.ges="n" />
         <note xml:id="note-L6F1" dur="4" oct="4" pname="f" head.shape="x" accid.ges="n" />
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>

See example 8 from the verovio note test suite for currently available note shapes.

craigsapp commented 4 years ago

The layout parameter method is implemented with commit https://github.com/rism-ch/verovio/commit/00a20cd8245106835ad47345c6ae10045e6f41a0. This is the way to change a notehead shape on an individual note basis.

Example:

Screen Shot 2020-10-10 at 10 13 22 PM

These are the currently available notehead shapes, and more can be added later (here is the full MEI list of notehead shapes).

**kern
=1
4f
!LO:N:head=x
4f
!LO:N:head=slash
4f
!LO:N:head=rhombus
4f
!LO:N:head=plus
4f
!LO:N:head=half
4f
!LO:N:head=whole
4f
=2
4ee
!LO:N:head=x
4ee
!LO:N:head=slash
4ee
!LO:N:head=rhombus
4ee
!LO:N:head=plus
4ee
!LO:N:head=half
4ee
!LO:N:head=whole
4ee
=3
!LO:N:n=1:head=x
!LO:N:n=2:head=plus
!LO:N:n=3:head=diamond
!LO:N:n=4:head=quarter
2c 2f 2b 2ee
!LO:N:n=1:head=x
!LO:N:n=2:head=plus
!LO:N:n=3:head=diamond
!LO:N:n=4:head=quarter
2aa 2ee 2b 2f
=
*-

MEI conversion:

<?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-10T22:13:26" version="3.0.0-dev-35d8e40">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="mdiv-0000001307063733">
    <score xml:id="score-0000001209935368">
     <scoreDef xml:id="scoredef-0000000698230363">
      <staffGrp xml:id="staffgrp-0000000056447247">
       <staffDef xml:id="staffdef-0000000220992998" n="1" lines="5">
        <clef xml:id="clef-0000000068489777" shape="G" line="2" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <measure xml:id="measure-L1" n="1">
       <staff xml:id="staff-0000001645653643" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <note xml:id="note-L3F1" dur="4" oct="4" pname="f" accid.ges="n" />
         <note xml:id="note-L5F1" dur="4" oct="4" pname="f" head.shape="x" accid.ges="n" />
         <note xml:id="note-L7F1" dur="4" oct="4" pname="f" head.shape="slash" accid.ges="n" />
         <note xml:id="note-L9F1" dur="4" oct="4" pname="f" head.shape="diamond" accid.ges="n" />
         <note xml:id="note-L11F1" dur="4" oct="4" pname="f" head.shape="+" accid.ges="n" />
         <note xml:id="note-L13F1" dur="4" oct="4" pname="f" head.shape="half" accid.ges="n" />
         <note xml:id="note-L15F1" dur="4" oct="4" pname="f" head.shape="whole" accid.ges="n" />
        </layer>
       </staff>
      </measure>
      <measure xml:id="measure-L16" n="2">
       <staff xml:id="staff-L16F1N1" n="1">
        <layer xml:id="layer-L16F1N1" n="1">
         <note xml:id="note-L17F1" dur="4" oct="5" pname="e" accid.ges="n" />
         <note xml:id="note-L19F1" dur="4" oct="5" pname="e" head.shape="x" accid.ges="n" />
         <note xml:id="note-L21F1" dur="4" oct="5" pname="e" head.shape="slash" accid.ges="n" />
         <note xml:id="note-L23F1" dur="4" oct="5" pname="e" head.shape="diamond" accid.ges="n" />
         <note xml:id="note-L25F1" dur="4" oct="5" pname="e" head.shape="+" accid.ges="n" />
         <note xml:id="note-L27F1" dur="4" oct="5" pname="e" head.shape="half" accid.ges="n" />
         <note xml:id="note-L29F1" dur="4" oct="5" pname="e" head.shape="whole" accid.ges="n" />
        </layer>
       </staff>
      </measure>
      <measure xml:id="measure-L30" n="3">
       <staff xml:id="staff-L30F1N1" n="1">
        <layer xml:id="layer-L30F1N1" n="1">
         <chord xml:id="chord-L35F1" dur="2">
          <note xml:id="note-L35F1S1" oct="4" pname="c" head.shape="x" accid.ges="n" />
          <note xml:id="note-L35F1S2" oct="4" pname="f" head.shape="+" accid.ges="n" />
          <note xml:id="note-L35F1S3" oct="4" pname="b" head.shape="diamond" accid.ges="n" />
          <note xml:id="note-L35F1S4" oct="5" pname="e" head.shape="quarter" accid.ges="n" />
         </chord>
         <chord xml:id="chord-L40F1" dur="2">
          <note xml:id="note-L40F1S1" oct="5" pname="a" head.shape="x" accid.ges="n" />
          <note xml:id="note-L40F1S2" oct="5" pname="e" head.shape="+" accid.ges="n" />
          <note xml:id="note-L40F1S3" oct="4" pname="b" head.shape="diamond" accid.ges="n" />
          <note xml:id="note-L40F1S4" oct="4" pname="f" head.shape="quarter" accid.ges="n" />
         </chord>
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>
craigsapp commented 4 years ago

Interpretation method implemented with commit https://github.com/rism-ch/verovio/commit/12ea01390a59b6e400ddda090e8382dccbac1dcd

Example:

Screen Shot 2020-10-10 at 10 41 29 PM

Humdrum data:

**kern
*head:x
8cL
8d
8e
8fJ
*head:rhombus
12gL
12a
12bJ
8qcc
1c 1f 1a 1ee
=
*-

MEI conversion:

<?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-10T22:41:10" version="3.0.0-dev-35d8e40">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="mdiv-0000000286328364">
    <score xml:id="score-0000001957444468">
     <scoreDef xml:id="scoredef-0000001114454614">
      <staffGrp xml:id="staffgrp-0000001190301256">
       <staffDef xml:id="staffdef-0000001575816527" n="1" lines="5">
        <clef xml:id="clef-0000001628284311" shape="G" line="2" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <measure xml:id="measure-L1">
       <staff xml:id="staff-0000000027153688" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <beam xml:id="beam-L3F1-L6F1">
          <note xml:id="note-L3F1" dur="8" oct="4" pname="c" head.shape="x" accid.ges="n" />
          <note xml:id="note-L4F1" dur="8" oct="4" pname="d" head.shape="x" accid.ges="n" />
          <note xml:id="note-L5F1" dur="8" oct="4" pname="e" head.shape="x" accid.ges="n" />
          <note xml:id="note-L6F1" dur="8" oct="4" pname="f" head.shape="x" accid.ges="n" />
         </beam>
         <tuplet xml:id="tuplet-L8F1-L10F1" num="3" numbase="2" bracket.visible="false" num.format="count">
          <beam xml:id="beam-L8F1-L10F1">
           <note xml:id="note-L8F1" dur="8" oct="4" pname="g" head.shape="diamond" accid.ges="n" />
           <note xml:id="note-L9F1" dur="8" oct="4" pname="a" head.shape="diamond" accid.ges="n" />
           <note xml:id="note-L10F1" dur="8" oct="4" pname="b" head.shape="diamond" accid.ges="n" />
          </beam>
         </tuplet>
         <note xml:id="note-L11F1" dur="8" oct="5" pname="c" grace="unacc" head.shape="diamond" accid.ges="n" />
         <chord xml:id="chord-L12F1" dur="1">
          <note xml:id="note-L12F1S1" oct="4" pname="c" head.shape="diamond" accid.ges="n" />
          <note xml:id="note-L12F1S2" oct="4" pname="f" head.shape="diamond" accid.ges="n" />
          <note xml:id="note-L12F1S3" oct="4" pname="a" head.shape="diamond" accid.ges="n" />
          <note xml:id="note-L12F1S4" oct="5" pname="e" head.shape="diamond" accid.ges="n" />
         </chord>
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>
craigsapp commented 3 years ago

Add odia for an open diamond shape.