humdrum-tools / verovio-humdrum-viewer

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

Implement mid-measure key signature changes #830

Closed bel28kent closed 1 year ago

bel28kent commented 1 year ago

This mid-measure key signature does not render in VHV. I cannot find documentation or a previous issue addressing this.

Screen Shot 2023-08-15 at 5 59 07 PM

VHV Link

Here is the reference score: Screen Shot 2023-08-15 at 6 16 47 PM

craigsapp commented 1 year ago

I am not aware of MEI allowing key signature changes in the middle of measures (is that right @rettinghaus and/or @lpugin)? There is a current fix which is to insert an invisible barline just before the key signature:

Screenshot 2023-08-16 at 04 26 53

View in VHV

craigsapp commented 1 year ago

There is a keyboard shortcut in VHV to view the spine/layer/voice information: alt-l (lowercase L) will show the first subspine as black, the second as green, the third as purple, and so on:

Screenshot 2023-08-16 at 04 38 49

View in VHV

Preferably the first subspine will be left-most (black) and the second one will be to the right after that. This is opposite of the preferred order for spines. To switch to the preferred order, you can use the flipper flilter:

Screenshot 2023-08-16 at 04 42 20

Specifically, now the tie directions are correct (otherwise you need to manually specify the direction of every tie). If the entire score has reversed subspines, then flipper -a can be used; otherwise, you can mark in the score the subspines to flip before running the filter.

Here is the data after the flipper filter:

Screenshot 2023-08-16 at 04 44 04

The stem directions remain correct because you add to every note. This is good, particularly if you want to encode a diplomatic score. In my encodings of piano music I typically remove all stem directions and allow them to be inferred by their subspine positions. Verovio will render the first subspine/layer with stems up, the second with stems down, the third with stems up, the fourth with stems down and so on. Then I only encode the exceptions. Here is the data without stem directions which is less cluttered and easier to read (using autostem -r to remove stems):

Screenshot 2023-08-16 at 05 06 52

In the future I will implement a system where a double stem marker such as // and \\ mark an exception to the default layout direction so that when stems are removed from a score, the double stemmed ones will not be removed (that should be easy to implement, so I should do it sooner rather than later).

Here is what the data looks like after removing the stems before and after running flipper:

Before:

Screenshot 2023-08-16 at 04 58 16

After:

Screenshot 2023-08-16 at 04 58 41

The Chopin Institute encodes diplomatic scores will all stem directions: https://github.com/pl-wnifc/humdrum-polish-scores

I encode with only the exceptions in stem directions: https://github.com/craigsapp/mozart-piano-sonatas/tree/master/kern

bel28kent commented 1 year ago

It does not make sense to me for subspines to be ordered this way. I raised this issue in a post to the humlib repo; this sentence is a link to that issue. Putting the upper voice in the leftmost column seems to contradict the kern logic as I learned it. My understanding of the kern encoding is that it corresponds to the notated score turned 90 degrees to the right. So if the lowest staves are to the left of the file in spine order, then lower voices (i.e., down-stemmed voices) should be to the left in subspine order. Can you explain the motivation or reasoning for putting subspines in the opposite order of spines?

rettinghaus commented 1 year ago

@craigsapp MEI allows mid-measure key changes, but support in Verovio is limited.

<staff n="1">
   <layer n="1">
      <note />
      <note />
      <note />
      <keySig />
      <note />
      <note />
      <note />
   </layer>
</staff>
craigsapp commented 1 year ago

Thanks @rettinghaus, I see that it is basically working, but refinements in spacing and dealing with key changes to C major/A minor needs implementing (as well as keySig@cancelaccid for in-layer keySig).

Screenshot 2023-08-16 at 12 40 17
<?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-08-16T12:35:52" version="3.17.0-dev-ffd96fd">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="m1lukk1m">
    <score xml:id="s1w0w01t">
     <scoreDef xml:id="s99xtmz">
      <staffGrp xml:id="s1jfj3ny">
       <staffDef xml:id="staffdef-L1F1" n="1" lines="5">
        <clef xml:id="cwcsq9" shape="G" line="2" />
        <keySig xml:id="keysig-L3F1" sig="2s" />
        <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-L1F1" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <note xml:id="note-L6F1" dur="2" oct="4" pname="e" accid.ges="n" />
         <keySig xml:id="keysig-L8F1" sig="3f" cancelaccid="before" />
         <note xml:id="note-L9F1" dur="2" oct="4" pname="f" accid="n" />
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>
craigsapp commented 1 year ago

Mid measure key signatures are implemented in commit https://github.com/rism-digital/verovio/commit/fdf041393f016d6d2430e3b20f0076df559ea041

Example:

**kern
*M4/4
*k[f#]
=1
1c
=2
2d
*k[b-]
2e
=
*-

Rendering:

Screenshot 2023-08-17 at 13 22 39
Click to view MEI conversion of above Humdrum data ```xml </titleStmt> <pubStmt /> </fileDesc> <encodingDesc> <appInfo> <application isodate="2023-08-17T13:23:10" version="3.17.0-dev-ffd96fd"> <name>Verovio</name> <p>Transcoded from Humdrum</p> </application> </appInfo> </encodingDesc> <workList> <work> <title /> </work> </workList> </meiHead> <music> <body> <mdiv xml:id="m9xt05d"> <score xml:id="s1ut797s"> <scoreDef xml:id="s1so24fo" midi.bpm="400.000000"> <staffGrp xml:id="s1oq43hn"> <staffDef xml:id="staffdef-L1F1" n="1" lines="5"> <clef xml:id="c1rb3gbm" shape="G" line="2" /> <keySig xml:id="keysig-L3F1" sig="1s" /> <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-L1F1" n="1"> <layer xml:id="layer-L1F1N1" n="1"> <note xml:id="note-L5F1" dur="1" oct="4" pname="c" accid.ges="n" /> </layer> </staff> </measure> <measure xml:id="measure-L6" n="2"> <staff xml:id="staff-L6F1N1" n="1"> <layer xml:id="layer-L6F1N1" n="1"> <note xml:id="note-L7F1" dur="2" oct="4" pname="d" accid.ges="n" /> <keySig xml:id="keysig-L8F1" type="mid-measure" sig="1f" /> <note xml:id="note-L9F1" dur="2" oct="4" pname="e" accid.ges="n" /> </layer> </staff> </measure> </section> </score> </mdiv> </body> </music> </mei> ``` </details> <hr /> <p>Note that when the mid-measure key signature changes to C major/A minor, the cancellation naturals are not shown yet:</p> <pre><code class="language-tsv">**kern *M4/4 *k[f#] =1 1c =2 2d *k[] 2e = *-</code></pre> <p>Rendering:</p> <img width="582" alt="Screenshot 2023-08-17 at 13 24 35" src="https://github.com/humdrum-tools/verovio-humdrum-viewer/assets/3487289/25657bf3-c845-4700-b748-2c7e73999ede"> <details> <summary> Click to view MEI conversion of above Humdrum data </summary> ```xml <?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-08-17T13:25:15" version="3.17.0-dev-ffd96fd"> <name>Verovio</name> <p>Transcoded from Humdrum</p> </application> </appInfo> </encodingDesc> <workList> <work> <title /> </work> </workList> </meiHead> <music> <body> <mdiv xml:id="m1s4j3x3"> <score xml:id="s1c5xu57"> <scoreDef xml:id="srk0660" midi.bpm="400.000000"> <staffGrp xml:id="spxsrhh"> <staffDef xml:id="staffdef-L1F1" n="1" lines="5"> <clef xml:id="c1o64pwg" shape="G" line="2" /> <keySig xml:id="keysig-L3F1" sig="1s" /> <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-L1F1" n="1"> <layer xml:id="layer-L1F1N1" n="1"> <note xml:id="note-L5F1" dur="1" oct="4" pname="c" accid.ges="n" /> </layer> </staff> </measure> <measure xml:id="measure-L6" n="2"> <staff xml:id="staff-L6F1N1" n="1"> <layer xml:id="layer-L6F1N1" n="1"> <note xml:id="note-L7F1" dur="2" oct="4" pname="d" accid.ges="n" /> <keySig xml:id="keysig-L8F1" type="mid-measure" sig="0" cancelaccid="before" /> <note xml:id="note-L9F1" dur="2" oct="4" pname="e" accid.ges="n" /> </layer> </staff> </measure> </section> </score> </mdiv> </body> </music> </mei> ``` </details> <p>This is related to issue <a href="https://github.com/rism-digital/verovio/issues/3497#issue-1853010843">https://github.com/rism-digital/verovio/issues/3497#issue-1853010843</a></p> <p>To make visible in the meantime, add an invisible barline as mentioned above.</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>