verovio icon indicating copy to clipboard operation
verovio copied to clipboard

read the @dur(.ges) value in mRest

Open frakel opened this issue 3 years ago • 2 comments

If an @dur(.ges) in mRest is coded, Verovio should consider the coded values when rendering the rest: This feature is important for cadenza-like structures as for instance in this example: image

instead Verovio renders a brevis rest although [email protected]="1": image

Click here for the MEI code

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/4.0.1/mei-CMN.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/4.0.1/mei-CMN.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<mei meiversion="4.0.0" xmlns="http://www.music-encoding.org/ns/mei">
  <meiHead>
    <fileDesc>
      <titleStmt>
        <title label="NMA digital" type="unit">K. 311/3, m.173a</title>
      </titleStmt>
      <pubStmt/>
    </fileDesc>
  </meiHead>
  <music>
    <body>
      <mdiv n="1" xml:id="mdiv_72">
        <score xml:id="score_78">
          <scoreDef key.mode="major" key.pname="d" key.sig="2s" meter.count="4" meter.sym="common" meter.unit="4" xml:id="scoreDef_01">
            <staffGrp bar.thru="true" symbol="brace" xml:id="staffGrp_01">
              <staffDef clef.line="2" clef.shape="G" key.sig="2s" lines="5" n="1" xml:id="staffDef_P1"/>
              <staffDef clef.line="4" clef.shape="F" key.sig="2s" lines="5" n="2" xml:id="staffDef_P2"/>
            </staffGrp>
          </scoreDef>
          <section xml:id="section_A_m1-1">
            <measure metcon="false" n="173a" right="invis" xml:id="m173a_k311_003">
              <tempo midi.bpm="45" place="above" staff="1" tstamp="1" xml:id="tempo03">Andante</tempo>
              <staff n="1" xml:id="staff_31272">
                <layer n="1" xml:id="layer_31278">
                  <beam xml:id="beam_31284">
                    <note accid.ges="n" dots="1" dur="8" oct="5" pname="g" xml:id="note_31290"/>
                    <note accid.ges="n" dur="16" oct="5" pname="e" xml:id="note_31296"/>
                  </beam>
                  <beam xml:id="beam_31302">
                    <note accid.ges="s" dots="1" dur="8" oct="6" pname="c" xml:id="note_31308"/>
                    <note accid.ges="n" dur="16" oct="5" pname="a" xml:id="note_31314"/>
                  </beam>
                  <note accid.ges="n" dots="1" dur="4" oct="6" pname="e" xml:id="note_31320"/>
                  <note accid.ges="n" dur="8" oct="6" pname="d" xml:id="note_31326"/>
                  <beam xml:id="beam_31332">
                    <note accid.ges="s" dur="8" oct="6" pname="c" xml:id="note_31338"/>
                    <note accid.ges="n" dur="8" oct="5" pname="b" xml:id="note_31344"/>
                    <note accid.ges="n" dur="8" oct="5" pname="a" xml:id="note_31350"/>
                    <note accid="s" dur="8" oct="5" pname="g" xml:id="note_31356"/>
                  </beam>
                  <tuplet bracket.visible="false" num="6" num.visible="false" numbase="4" xml:id="tuplet_31362">
                    <beam xml:id="beam_31362">
                      <note accid.ges="n" dur="16" oct="5" pname="a" xml:id="note_31368"/>
                      <note accid="s" dur="16" oct="5" pname="a" xml:id="note_31374"/>
                      <note accid.ges="n" dur="16" oct="5" pname="b" xml:id="note_31380"/>
                      <note accid="n" dur="16" oct="5" pname="a" xml:id="note_31386"/>
                      <note accid="n" dur="16" oct="5" pname="g" xml:id="note_31392"/>
                      <note accid.ges="s" dur="16" oct="5" pname="f" xml:id="note_31398"/>
                    </beam>
                  </tuplet>
                  <tuplet bracket.visible="false" num="6" num.visible="false" numbase="4" xml:id="tuplet_31404">
                    <beam xml:id="beam_31404">
                      <note accid.ges="n" dur="16" oct="5" pname="a" xml:id="note_31410"/>
                      <note accid.ges="n" dur="16" oct="5" pname="g" xml:id="note_31416"/>
                      <note accid.ges="n" dur="16" oct="5" pname="b" xml:id="note_31422"/>
                      <note accid.ges="n" dur="16" oct="5" pname="a" xml:id="note_31428"/>
                      <note accid.ges="n" dur="16" oct="5" pname="g" xml:id="note_31434"/>
                      <note accid.ges="s" dur="16" oct="5" pname="f" xml:id="note_31440"/>
                    </beam>
                  </tuplet>
                  <tuplet bracket.visible="false" num="6" num.visible="false" numbase="4" xml:id="tuplet_31446">
                    <beam xml:id="beam_31446">
                      <note accid.ges="n" dur="16" oct="5" pname="e" xml:id="note_31452"/>
                      <note accid.ges="s" dur="16" oct="5" pname="f" xml:id="note_31458"/>
                      <note accid.ges="n" dur="16" oct="5" pname="g" xml:id="note_31464"/>
                      <note accid.ges="s" dur="16" oct="5" pname="f" xml:id="note_31470"/>
                      <note accid.ges="n" dur="16" oct="5" pname="a" xml:id="note_31476"/>
                      <note accid.ges="n" dur="16" oct="5" pname="g" xml:id="note_31482"/>
                    </beam>
                  </tuplet>
                  <tuplet bracket.visible="false" num="6" num.visible="false" numbase="4" xml:id="tuplet_31488">
                    <beam xml:id="beam_31488">
                      <note accid.ges="s" dur="16" oct="5" pname="f" xml:id="note_31494"/>
                      <note accid.ges="n" dur="16" oct="5" pname="e" xml:id="note_31500"/>
                      <note accid.ges="n" dur="16" oct="5" pname="d" xml:id="note_31506"/>
                      <note accid.ges="s" dur="16" oct="5" pname="c" xml:id="note_31512"/>
                      <note accid.ges="n" dur="16" oct="4" pname="b" xml:id="note_31518"/>
                      <note accid.ges="n" dur="16" oct="4" pname="a" xml:id="note_31524"/>
                    </beam>
                  </tuplet>
                </layer>
              </staff>
              <staff n="2" xml:id="staff_31530">
                <layer n="1" xml:id="layer_31536">
                  <mRest dur.ges="1" xml:id="mRest_31734a"/>
                </layer>
              </staff>
              <slur endid="#note_31296" staff="1" startid="#note_31290" xml:id="slur_31542"/>
              <slur endid="#note_31314" staff="1" startid="#note_31308" xml:id="slur_31548"/>
              <slur endid="#note_31356" staff="1" startid="#note_31320" xml:id="slur_31554"/>
              <slur endid="#note_31524" staff="1" startid="#note_31368" xml:id="slur_31560"/>
              <fermata startid="#mRest_31734a" xml:id="fermata_31908b"/>
            </measure>
          </section>
        </score>
      </mdiv>
    </body>
  </music>
</mei>

frakel avatar Jan 13 '23 16:01 frakel

Yes, this will be very useful, in particular for cadenzas as illustrated in the above post.

Display of the whole-measure rest in such cases should considered carefully, because this may otherwise conflict with other whole-measure rests which require the breve rest:

Screenshot 2023-01-13 at 9 07 53 AM
Click to view MEI test 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="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/dev/mei-all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="5.0.0-dev">
 <meiHead>
  <fileDesc>
   <titleStmt>
    <title />
   </titleStmt>
   <pubStmt />
  </fileDesc>
  <encodingDesc>
   <appInfo>
    <application isodate="2023-01-13T09:07:58" version="3.15.0-dev-5d898ce-dirty">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
  <extMeta>
   <frames xmlns="http://www.humdrum.org/ns/humxml">
    <metaFrame n="17" token="!!!verovio: spacingNonLinear 0.5" xml:id="L18">
     <frameInfo>
      <startTime float="40" />
      <frameType>reference</frameType>
      <referenceKey>verovio</referenceKey>
      <referenceValue>spacingNonLinear 0.5</referenceValue>
     </frameInfo>
    </metaFrame>
   </frames>
  </extMeta>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="ms9rwif">
    <score xml:id="sy4tgwz">
     <scoreDef xml:id="s7c661w" midi.bpm="400.000000">
      <staffGrp xml:id="s1cl72i">
       <staffDef xml:id="staffdef-L1F1" n="1" lines="5">
        <clef xml:id="cstg3qa" shape="G" line="2" />
        <meterSig xml:id="metersig-L2F1" count="2" unit="1" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <measure xml:id="measure-L1">
       <staff xml:id="staff-L1F1" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <note xml:id="note-L4F1" dur="1" oct="4" pname="c" accid.ges="n" />
         <note xml:id="note-L5F1" dur="1" oct="4" pname="d" accid.ges="n" />
        </layer>
       </staff>
      </measure>
      <measure xml:id="measure-L6">
       <staff xml:id="staff-L6F1N1" n="1">
        <layer xml:id="layer-L6F1N1" n="1">
         <note xml:id="note-L7F1" dur="breve" oct="4" pname="e" accid.ges="n" />
        </layer>
       </staff>
      </measure>
      <measure xml:id="measure-L8">
       <staff xml:id="staff-L8F1N1" n="1">
        <layer xml:id="layer-L8F1N1" n="1">
         <mRest xml:id="mrest-L9F1" />
        </layer>
       </staff>
      </measure>
      <measure xml:id="measure-L10">
       <staff xml:id="staff-L10F1N1" n="1">
        <layer xml:id="layer-L10F1N1" n="1">
         <note xml:id="note-L11F1" dur="2" oct="4" pname="f" accid.ges="n" />
         <note xml:id="note-L12F1" dur="2" oct="4" pname="g" accid.ges="n" />
         <note xml:id="note-L13F1" dur="1" oct="4" pname="e" accid.ges="n" />
        </layer>
       </staff>
      </measure>
      <measure xml:id="measure-L14" right="end">
       <staff xml:id="staff-L14F1N1" n="1">
        <layer xml:id="layer-L14F1N1" n="1">
         <note xml:id="note-L15F1" dur="breve" oct="4" pname="c" accid.ges="n" />
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>

A good algorithm for display of the <mRest> shape could be to examine the prevailing time signature of the music. In the cadenza example, the meter is 4/4, so a whole rest should be used to display the <mRest>. In a 2/1 meter, the <mRest> would be displayed as a breve rest, and in 4/1, the <mRest> would be displayed as a long rest.

Currently <mRest> visual rests are calculated by the duration of the rest without regard to the prevailing meter. So I propose ignoring the intended duration of the rest and looking at the time signature information instead.

It would still be useful to have @dur.ges for <mRest> to use for exceptions to the above algorithm.

craigsapp avatar Jan 13 '23 17:01 craigsapp

o yes, maybe it's even better to look at the preceding meter signature definition. Then there is no need to code @dur.ges which normally corresponds with the prevailing time signature

frakel avatar Jan 16 '23 08:01 frakel