humdrum-tools / verovio-humdrum-viewer

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

Encode verse numbers #460

Open craigsapp opened 3 years ago

craigsapp commented 3 years ago

Add a system for representing verse numbers, such as:

Screen Shot 2020-11-19 at 5 39 47 PM

The verse numbers should not be included in the text, but as an interpretation (or possibly a layout parameter). Here is a proposed representation:

**kern      **text      **text
*clefG2     *       *
*M4/4       *       *
=1      =1      =1
*       *v:1. 3.    *v:2.
1c      test        verse
=       =       =
*-      *-      *-

Where *v: means a verse number. Either allow the contents of *v: to be a string, such as "1. 3." for the first and third verse, or allow for a second parameter to override automatic text generation from a pure number system. If the numbering is systematic, then this will allow creating a tool to automatically extract verses.

With automatic text generation, mabe encode as:

**kern      **text      **text
*clefG2     *       *
*M4/4       *       *
=1      =1      =1
*       *v:1,3      *v:2
1c      test        verse
=       =       =
*-      *-      *-

Here is the target MEI data for the above example, where <label> is given since of the <verse> which includes the contents of the verse number. There is also <labelAbbr> which will redisplay its contents at the start of every system break (maybe encode as *vv:)

<?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-11-19T17:38:37" version="3.1.0-dev-94a4985-dirty">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="mdiv-0000001771709613">
    <score xml:id="score-0000000317842251">
     <scoreDef xml:id="scoredef-0000001764336878" midi.bpm="400">
      <staffGrp xml:id="staffgrp-0000000748113884">
       <staffDef xml:id="staffdef-0000000594297048" n="1" lines="5">
        <clef xml:id="clef-L2F1" shape="G" line="2" />
        <meterSig xml:id="metersig-L3F1" count="4" unit="4" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <measure xml:id="measure-L1" n="1">
       <staff xml:id="staff-0000000543903102" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <note xml:id="note-L6F1" dur="1" oct="4" pname="c" accid.ges="n">
          <verse xml:id="verse-L6F2" n="1">
           <label>1. 3.</label>
           <syl xml:id="syl-L6F2">test</syl>
          </verse>
          <verse xml:id="verse-L6F3" n="2">
            <label>2.</label>
           <syl xml:id="syl-L6F3">verse</syl>
          </verse>
         </note>
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>
craigsapp commented 3 years ago

Humdrum documentation says to use:

*S/1,3        *S/2

for the verse numbers.

(I made up the comma for separating separate shared verse numbers, though)

See tandem interpretation section of the page:

https://www.humdrum.org/Humdrum/representations/text.rep.html

craigsapp commented 3 years ago

A basic implementation of verse numbers has been implemented. Here is the test example data from above:

Screen Shot 2020-11-23 at 5 54 48 AM

I implemented the *v: method, because I do not use the strophe system for different verses when converting from MusicXML for example. Also I might want to reserve the strophe system for variants, since it can also be used for that purpose (but there is currently no way of distinguishing between verse strophes and variant strophes.

The interpretation *v:2 means the second verse, and a period (.) is added after the number automatically when rendering. If there should be a different display, then perhaps adding an extra parameter for the text content of the label could be added, such as *v:2:t=2&colon; to display 2: rather than 2.. If only a 2 should be shown, then that would be *v:2:t=2.

There should be a method of indicating a refrain which is in the same spine as a numbered verse so that a program could extract a particular verse, but keep the refrain along with any verse. (I.e., duplicate the capability of the strophe system). This would allow conversion to/from the strophe system for lyrics as well. Maybe something like *v:all would be good to indicate text in the first column that functions as a refrain.

Another improvement to make will be to render *v:1,3 as 1., 3.