humdrum-tools / verovio-humdrum-viewer

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

Visual key signature #809

Closed craigsapp closed 1 year ago

craigsapp commented 1 year ago

In this music:

image

The key signature on the bottom staff is incorrect (it should have no sharps/flats). This is for a B-flat clarinet, but the copyist made a mistake (probably since the previous movement has clarinets in C and this movement does not display instrument names).

Probably a good way of handling this would be to add *vk[] for a visual key signature that is displayed instead of the logical key signature (*k[]) when converting to MEI/verovio:

Screenshot 2023-04-14 at 8 56 40 AM

Also add keySig@type="visual-key-signature" when converting to MEI to allow the line:

!!!verovio: svgCss g.keySig.visual-key-signature { fill: red };

To color the visual key signature (to indicate in the score that it is an error). Test to see if the key signature @type continues on to key signatures on new systems.

Also allow tandem interpretations to be used with the sic tool. In that case the key signature should be encoded as:

*k[b-e-]
*LO:SIC:s=*
*vk[b-e-a-d-]

or

*k[b-e-]
*LO:SIC:o=*vk[b-e-a-d-]
*

Then applying sic -s would remove the visual key signature.

Full score related to this issue: http://polishscores.org/?id=pl-wtm--r-1664--004

craigsapp commented 1 year ago

Implemented with commit https://github.com/rism-digital/verovio/commit/56a9944bb6284e81d372b8b21e46c3b7fc2b761b

Example:

**kern  **kern  **kern
*Iclars *Ioboe  *Iflt
*ITrd1c2    *   *
*clefG2 *clefG2 *clefG2
*k[b-e-]    *k[b-e-]    *k[b-e-]
!LO:SIC:s=* !   !
*vk[b-e-a-d-]   *   *
*M3/4   *M3/4   *M3/4
=   =   =
(<8b-L 8dL  (8ddL   (8ddL
8ccJ 8e-J   8ee-J   8ee-J
=   =   =
4.dd/ 4.f/) 4.ff)   4.ff)
(<8dd 8fL>  (8ffL   8ffL
8ee- 8g 8gg 8gg
8cc 8aJ 8aaJ    8aaJ
=   =   =
4.dd 4.b-)  4.bb-)  4.bb-
*-  *-  *-
!!!RDF**kern: > = above
!!!RDF**kern: < = below
!!!verovio: svgCss g.keySig.visual-key-signature { fill: red };
Click to view MEI conversion of above Humdrum data ```xml </titleStmt> <pubStmt /> </fileDesc> <encodingDesc> <appInfo> <application isodate="2023-04-14T16:17:15" version="3.16.0-dev-9880298"> <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="19" token="!!!RDF**kern: > = above" xml:id="L20"> <frameInfo> <startTime float="5.5" ratfrac="1/2" /> <frameType>reference</frameType> <referenceKey>RDF**kern</referenceKey> <referenceValue>> = above</referenceValue> </frameInfo> </metaFrame> <metaFrame n="20" token="!!!RDF**kern: < = below" xml:id="L21"> <frameInfo> <startTime float="5.5" ratfrac="1/2" /> <frameType>reference</frameType> <referenceKey>RDF**kern</referenceKey> <referenceValue>< = below</referenceValue> </frameInfo> </metaFrame> <metaFrame n="21" token="!!!verovio: svgCss g.keySig.visual-key-signature { fill: red };" xml:id="L22"> <frameInfo> <startTime float="5.5" ratfrac="1/2" /> <frameType>reference</frameType> <referenceKey>verovio</referenceKey> <referenceValue>svgCss g.keySig.visual-key-signature { fill: red };</referenceValue> </frameInfo> </metaFrame> </frames> </extMeta> </meiHead> <music> <body> <mdiv xml:id="mu61wy0"> <score xml:id="s1iidity"> <scoreDef xml:id="sj537y"> <staffGrp xml:id="s1vvutxp" symbol="bracket"> <staffDef xml:id="staffdef-L1F3" n="1" lines="5"> <label xml:id="label-L2F3">Flute</label> <clef xml:id="clef-L4F3" shape="G" line="2" /> <keySig xml:id="keysig-L5F3" sig="2f" /> <meterSig xml:id="metersig-L8F3" count="3" unit="4" /> <instrDef xml:id="i1vhzl6i" midi.instrnum="73" midi.instrname="Flute" /> </staffDef> <staffDef xml:id="staffdef-L1F2" n="2" lines="5"> <label xml:id="label-L2F2">Oboe</label> <clef xml:id="clef-L4F2" shape="G" line="2" /> <keySig xml:id="keysig-L5F2" sig="2f" /> <meterSig xml:id="metersig-L8F2" count="3" unit="4" /> </staffDef> <staffDef xml:id="staffdef-L1F1" n="3" lines="5" trans.diat="-1" trans.semi="-2"> <label xml:id="label-L2F1">Clarinet in B<rend xml:id="r1q3x8i6" fontfam="smufl"></rend> </label> <clef xml:id="clef-L4F1" shape="G" line="2" /> <keySig xml:id="keysig-L7F1" type="visual-key-signature" sig="2f" /> <meterSig xml:id="metersig-L8F1" count="3" unit="4" /> <instrDef xml:id="iga2cqw" midi.instrnum="71" midi.instrname="Clarinet" /> </staffDef> </staffGrp> </scoreDef> <section xml:id="section-L1F1"> <measure xml:id="measure-L1"> <staff xml:id="staff-L1F3" n="1"> <layer xml:id="layer-L1F3N1" n="1"> <beam xml:id="beam-L10F3-L11F3"> <note xml:id="note-L10F3" dur="8" oct="5" pname="d" accid.ges="n" /> <note xml:id="note-L11F3" dur="8" oct="5" pname="e" accid.ges="f" /> </beam> </layer> </staff> <staff xml:id="staff-L1F2" n="2"> <layer xml:id="layer-L1F2N1" n="1"> <beam xml:id="beam-L10F2-L11F2"> <note xml:id="note-L10F2" dur="8" oct="5" pname="d" accid.ges="n" /> <note xml:id="note-L11F2" dur="8" oct="5" pname="e" accid.ges="f" /> </beam> </layer> </staff> <staff xml:id="staff-L1F1" n="3"> <layer xml:id="layer-L1F1N1" n="1"> <beam xml:id="beam-L10F1-L11F1"> <chord xml:id="chord-L10F1" dur="8"> <note xml:id="note-L10F1S1" oct="5" pname="c" accid.ges="n" /> <note xml:id="note-L10F1S2" oct="4" pname="e" accid.ges="n" /> </chord> <chord xml:id="chord-L11F1" dur="8"> <note xml:id="note-L11F1S1" oct="5" pname="d" accid.ges="n" /> <note xml:id="note-L11F1S2" oct="4" pname="f" accid.ges="n" /> </chord> </beam> </layer> </staff> <slur xml:id="slur-L10F3-L13F3" staff="1" startid="#note-L10F3" endid="#note-L13F3" /> <slur xml:id="slur-L10F2-L13F2" staff="2" startid="#note-L10F2" endid="#note-L13F2" /> <slur xml:id="slur-L10F1-L13F1" type="placed" staff="3" startid="#chord-L10F1" endid="#chord-L13F1" curvedir="below" /> </measure> <measure xml:id="measure-L12"> <staff xml:id="staff-L12F3N1" n="1"> <layer xml:id="layer-L12F3N1" n="1"> <note xml:id="note-L13F3" dots="1" dur="4" oct="5" pname="f" accid.ges="n" /> <beam xml:id="beam-L14F3-L16F3"> <note xml:id="note-L14F3" dur="8" oct="5" pname="f" accid.ges="n" /> <note xml:id="note-L15F3" dur="8" oct="5" pname="g" accid.ges="n" /> <note xml:id="note-L16F3" dur="8" oct="5" pname="a" accid.ges="n" /> </beam> </layer> </staff> <staff xml:id="staff-L12F2N1" n="2"> <layer xml:id="layer-L12F2N1" n="1"> <note xml:id="note-L13F2" dots="1" dur="4" oct="5" pname="f" accid.ges="n" /> <beam xml:id="beam-L14F2-L16F2"> <note xml:id="note-L14F2" dur="8" oct="5" pname="f" accid.ges="n" /> <note xml:id="note-L15F2" dur="8" oct="5" pname="g" accid.ges="n" /> <note xml:id="note-L16F2" dur="8" oct="5" pname="a" accid.ges="n" /> </beam> </layer> </staff> <staff xml:id="staff-L12F1N1" n="3"> <layer xml:id="layer-L12F1N1" n="1"> <chord xml:id="chord-L13F1" type="placed" dots="1" dur="4" stem.dir="up"> <note xml:id="note-L13F1S1" oct="5" pname="e" accid.ges="n" /> <note xml:id="note-L13F1S2" oct="4" pname="g" accid.ges="n" /> </chord> <beam xml:id="beam-L14F1-L16F1" type="placed"> <chord xml:id="chord-L14F1" dur="8" stem.dir="up"> <note xml:id="note-L14F1S1" oct="5" pname="e" accid.ges="n" /> <note xml:id="note-L14F1S2" oct="4" pname="g" accid.ges="n" /> </chord> <chord xml:id="chord-L15F1" dur="8" stem.dir="up"> <note xml:id="note-L15F1S1" oct="5" pname="f" accid.ges="n" /> <note xml:id="note-L15F1S2" oct="4" pname="a" accid.ges="n" /> </chord> <chord xml:id="chord-L16F1" dur="8" stem.dir="up"> <note xml:id="note-L16F1S1" oct="5" pname="d" accid.ges="n" /> <note xml:id="note-L16F1S2" oct="4" pname="b" accid.ges="n" /> </chord> </beam> </layer> </staff> <slur xml:id="slur-L14F2-L18F2" staff="2" startid="#note-L14F2" endid="#note-L18F2" /> <slur xml:id="slur-L14F1-L18F1" type="placed" staff="3" startid="#chord-L14F1" endid="#chord-L18F1" curvedir="below" /> </measure> <measure xml:id="measure-L17" right="invis"> <staff xml:id="staff-L17F3N1" n="1"> <layer xml:id="layer-L17F3N1" n="1"> <note xml:id="note-L18F3" dots="1" dur="4" oct="5" pname="b" accid.ges="f" /> </layer> </staff> <staff xml:id="staff-L17F2N1" n="2"> <layer xml:id="layer-L17F2N1" n="1"> <note xml:id="note-L18F2" dots="1" dur="4" oct="5" pname="b" accid.ges="f" /> </layer> </staff> <staff xml:id="staff-L17F1N1" n="3"> <layer xml:id="layer-L17F1N1" n="1"> <chord xml:id="chord-L18F1" dots="1" dur="4"> <note xml:id="note-L18F1S1" oct="5" pname="e" accid.ges="n" /> <note xml:id="note-L18F1S2" oct="5" pname="c" accid.ges="n" /> </chord> </layer> </staff> </measure> </section> </score> </mdiv> </body> </music> </mei> ``` </details> <p>Rendering:</p> <img width="655" alt="Screenshot 2023-04-14 at 4 17 36 PM" src="https://user-images.githubusercontent.com/3487289/232169431-44645485-b7fc-4e31-8d3c-b79976d520bf.png"> <p>MEI 5 (in development) has <code>keySig@color</code> and <code>KeyAccid@color</code>, so I will add a verovio issue to implement them, and then I can also implement <code>!LO:KS:color=red</code> to allow coloring through MEI as well as through SVG CSS.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/craigsapp"><img src="https://avatars.githubusercontent.com/u/3487289?v=4" />craigsapp</a> commented <strong> 1 year ago</strong> </div> <div class="markdown-body"> <p>Example using <code>!LO:SIC</code> and <code>sic -s</code> to add correction to the score:</p> <pre><code class="language-tsv">**kern **kern **kern *Iclars *Ioboe *Iflt *ITrd1c2 * * *clefG2 *clefG2 *clefG2 *k[b-e-] *k[b-e-] *k[b-e-] !LO:SIC:s=* ! ! *vk[b-e-a-d-] * * *M3/4 *M3/4 *M3/4 = = = (<8b-L 8dL (8ddL (8ddL 8ccJ 8e-J 8ee-J 8ee-J = = = 4.dd/ 4.f/) 4.ff) 4.ff) (<8dd 8fL> (8ffL 8ffL 8ee- 8g 8gg 8gg 8cc 8aJ 8aaJ 8aaJ = = = 4.dd 4.b-) 4.bb-) 4.bb- *- *- *- !!!RDF**kern: > = above !!!RDF**kern: < = below !!!verovio: svgCss g.keySig.visual-key-signature { fill: red }; !!!filter: sic -s</code></pre> <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-04-14T16:38:19" version="3.16.0-dev-9880298"> <name>Verovio</name> <p>Transcoded from Humdrum</p> </application> </appInfo> </encodingDesc> <workList> <work> <title xml:id="title-L23" analog="humdrum:Xfi" type="translated">sic -s reference RDF**kern > = above reference RDF**kern < = below reference verovio svgCss g.keySig.visual-key-signature { fill: red }; reference Xfilter sic -s
```

Rendering:

Screenshot 2023-04-14 at 4 38 55 PM
craigsapp commented 1 year ago

See also https://github.com/rism-digital/verovio/issues/3374