humdrum-tools / verovio-humdrum-viewer

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

*Xped (or *Xtuplet) damages rendering #124

Closed jacekiwaszko1 closed 6 years ago

jacekiwaszko1 commented 6 years ago

In the following example taken from Nocturne op. 37 no 1 rendering is incorrect when there are both *Xtuplet and *Xped interpretations:

Source image: ped1

KERN:

**kern  **kern  **dynam
*part1  *part1  *part1
*staff2 *staff1 *
*clefF4 *clefG2 *
*k[b-e-]    *k[b-e-]    *
*M4/4   *M4/4   *
*met(c) *met(c) *
=5  =5  =5
*   *^  *
4BB- 4BBB-  4dd 2ryy    .
.   (<8qd/  .   .
.   8qd/L   .   .
.   8qf/    .   .
.   8qb-/J  .   .
*   *Xtuplet    *   *
4F  12ddL/  .   .
*Xped   *   *   *
.   12cc    .   .
.   12b-J)  .   .
.   .   [<8qc/L .
.   .   [<8qd/  .
.   .   [8qf#X/J    .
4DD 8b-L    4f#] 4d] 4c]    .
.   8aJ .   .
[4D 4r  4r  .
*   *v  *v  *
==  ==  ==
*-  *-  *-
!!!RDF**kern: > = above
!!!RDF**kern: < = below

MEI:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://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="2018-07-02T13:41:51" version="2.0.0-dev-c25c14a">
                    <name>Verovio</name>
                    <p>Transcoded from Humdrum</p>
                </application>
            </appInfo>
        </encodingDesc>
        <workDesc>
            <work>
                <titleStmt>
                    <title />
                </titleStmt>
            </work>
        </workDesc>
        <extMeta>
            <frames xmlns:humxml="http://www.humdrum.org/ns/humxml">
                <metaFrame n="28" token="!!!RDF**kern: &gt; = above" xml:id="loc28">
                    <frameInfo>
                        <startTime float="4" />
                        <frameType>reference</frameType>
                        <referenceKey>RDF**kern</referenceKey>
                        <referenceValue>&gt; = above</referenceValue>
                    </frameInfo>
                </metaFrame>
                <metaFrame n="29" token="!!!RDF**kern: &lt; = below" xml:id="loc29">
                    <frameInfo>
                        <startTime float="4" />
                        <frameType>reference</frameType>
                        <referenceKey>RDF**kern</referenceKey>
                        <referenceValue>&lt; = below</referenceValue>
                    </frameInfo>
                </metaFrame>
            </frames>
        </extMeta>
    </meiHead>
    <music>
        <body>
            <mdiv xml:id="mdiv-0000000232614426">
                <score xml:id="score-0000001223915112">
                    <scoreDef xml:id="scoredef-0000000712151314">
                        <staffGrp xml:id="staffgrp-0000001808408272" symbol="brace" barthru="true">
                            <staffDef xml:id="staffdef-0000000828641677" clef.shape="G" clef.line="2" key.sig="2f" meter.count="4" meter.unit="4" meter.sym="common" n="1" lines="5">
                                <label xml:id="label-0000001819269095" />
                            </staffDef>
                            <staffDef xml:id="staffdef-0000000730735366" clef.shape="F" clef.line="4" key.sig="2f" meter.count="4" meter.unit="4" meter.sym="common" n="2" lines="5" />
                        </staffGrp>
                    </scoreDef>
                    <section xml:id="section-L1F1">
                        <measure xml:id="measure-L8" right="end" n="5">
                            <staff xml:id="staff-L8F2N1" n="1">
                                <layer xml:id="layer-L8F2N1" n="1">
                                    <note xml:id="note-L10F2" dur="4" oct="5" pname="d" stem.len="6.000000" accid.ges="n" />
                                    <note xml:id="note-L11F2" dur="8" oct="4" pname="d" grace="unacc" stem.dir="up" accid.ges="n" />
                                    <beam xml:id="beam-L12F2-L13F2">
                                        <note xml:id="note-L12F2" dur="8" oct="4" pname="d" grace="unacc" stem.dir="up" accid.ges="n" />
                                        <note xml:id="note-L13F2" dur="8" oct="4" pname="f" grace="unacc" stem.dir="up" accid.ges="n" />
                                        <note xml:id="note-L14F2" dur="8" oct="4" pname="b" grace="unacc" stem.dir="up" accid.ges="f" />
                                    </beam>
                                    <tuplet xml:id="tuplet-L16F2-L19F2" num="3" numbase="2" num.visible="false" bracket.visible="false" num.format="count">
                                        <beam xml:id="beam-L16F2-L19F2">
                                            <note xml:id="note-L16F2" dur="8" oct="5" pname="d" stem.dir="up" accid.ges="n" />
                                            <note xml:id="note-L18F2" dur="8" oct="5" pname="c" accid.ges="n" />
                                            <note xml:id="note-L19F2" dur="8" oct="4" pname="b" accid.ges="f" />
                                        </beam>
                                    </tuplet>
                                    <beam xml:id="beam-L23F2-L24F2">
                                        <note xml:id="note-L23F2" dur="8" oct="4" pname="b" accid.ges="f" />
                                        <note xml:id="note-L24F2" dur="8" oct="4" pname="a" accid.ges="n" />
                                    </beam>
                                    <rest xml:id="rest-L25F2" dur="4" ploc="b" oloc="4" />
                                </layer>
                                <layer xml:id="layer-L10F3N2" n="2">
                                    <space xml:id="space-L10F3" dur="2" />
                                    <space xml:id="space-0000000178835625" />
                                    <beam xml:id="beam-L20F3-L21F3">
                                        <note xml:id="note-L20F3" dur="8" oct="4" pname="c" grace="unacc" stem.dir="up" accid.ges="n" />
                                        <note xml:id="note-L21F3" dur="8" oct="4" pname="d" grace="unacc" stem.dir="up" accid.ges="n" />
                                        <note xml:id="note-L22F3" dur="8" oct="4" pname="f" grace="unacc" stem.dir="up" accid="s" />
                                    </beam>
                                    <chord xml:id="chord-L23F3" dur="4">
                                        <note xml:id="note-L23F3S1" oct="4" pname="f" accid.ges="s" />
                                        <note xml:id="note-L23F3S2" oct="4" pname="d" accid.ges="n" />
                                        <note xml:id="note-L23F3S3" oct="4" pname="c" accid.ges="n" />
                                    </chord>
                                    <rest xml:id="rest-L25F3" dur="4" ploc="b" oloc="4" />
                                </layer>
                            </staff>
                            <staff xml:id="staff-L8F1N1" n="2">
                                <layer xml:id="layer-L8F1N1" n="1">
                                    <chord xml:id="chord-L10F1" dur="4">
                                        <note xml:id="note-L10F1S1" oct="2" pname="b" accid.ges="f" />
                                        <note xml:id="note-L10F1S2" oct="1" pname="b" accid.ges="f" />
                                    </chord>
                                    <note xml:id="note-L16F1" dur="4" oct="3" pname="f" accid.ges="n" />
                                    <note xml:id="note-L23F1" dur="4" oct="2" pname="d" accid.ges="n" />
                                    <note xml:id="note-L25F1" dur="4" oct="3" pname="d" accid.ges="n" />
                                </layer>
                            </staff>
                            <slur xml:id="slur-L11F2-L19F2N1" staff="1" startid="#note-L11F2" endid="#note-L19F2" curvedir="below" />
                            <tie xml:id="tie-L22F3-L23F3S1" startid="#note-L22F3" endid="#note-L23F3S1" />
                            <tie xml:id="tie-L21F3-L23F3S2" startid="#note-L21F3" endid="#note-L23F3S2" curvedir="below" />
                            <tie xml:id="tie-L20F3-L23F3S3" startid="#note-L20F3" endid="#note-L23F3S3" curvedir="below" />
                            <pedal xml:id="pedal-0000002135213756" staff="2" tstamp="2.333333" dir="up" vgrp="200" />
                        </measure>
                    </section>
                </score>
            </mdiv>
        </body>
    </music>
</mei>

Rendering:

ped2

Removing one of the * lines fixes rendering:

KERN:

**kern  **kern  **dynam
*part1  *part1  *part1
*staff2 *staff1 *
*clefF4 *clefG2 *
*k[b-e-]    *k[b-e-]    *
*M4/4   *M4/4   *
*met(c) *met(c) *
=5  =5  =5
*   *^  *
4BB- 4BBB-  4dd 2ryy    .
.   (<8qd/  .   .
.   8qd/L   .   .
.   8qf/    .   .
.   8qb-/J  .   .
4F  12ddL/  .   .
*Xped   *   *   *
.   12cc    .   .
.   12b-J)  .   .
.   .   [<8qc/L .
.   .   [<8qd/  .
.   .   [8qf#X/J    .
4DD 8b-L    4f#] 4d] 4c]    .
.   8aJ .   .
[4D 4r  4r  .
*   *v  *v  *
==  ==  ==
*-  *-  *-
!!!RDF**kern: > = above
!!!RDF**kern: < = below

or

**kern  **kern  **dynam
*part1  *part1  *part1
*staff2 *staff1 *
*clefF4 *clefG2 *
*k[b-e-]    *k[b-e-]    *
*M4/4   *M4/4   *
*met(c) *met(c) *
=5  =5  =5
*   *^  *
4BB- 4BBB-  4dd 2ryy    .
.   (<8qd/  .   .
.   8qd/L   .   .
.   8qf/    .   .
.   8qb-/J  .   .
*   *Xtuplet    *   *
4F  12ddL/  .   .
.   12cc    .   .
.   12b-J)  .   .
.   .   [<8qc/L .
.   .   [<8qd/  .
.   .   [8qf#X/J    .
4DD 8b-L    4f#] 4d] 4c]    .
.   8aJ .   .
[4D 4r  4r  .
*   *v  *v  *
==  ==  ==
*-  *-  *-
!!!RDF**kern: > = above
!!!RDF**kern: < = below

give proper result:

ped3

craigsapp commented 6 years ago

A temporary solution is to move the *Xtuplet interpretation earlier in the music. This is a style setting that can be set any time before it is needed to force the tuplet numbers to be hidden:

**kern  **kern  **dynam
*part1  *part1  *part1
*staff2 *staff1 *
*clefF4 *clefG2 *
*k[b-e-]    *k[b-e-]    *
*M4/4   *M4/4   *
*met(c) *met(c) *
=5  =5  =5
*   *^  *
*   *Xtuplet    *   *
*ped    *   *   *
4BB- 4BBB-  4dd 2ryy    .
.   (<8qd   .   .
.   8qdL    .   .
.   8qf .   .
.   8qb-J   .   .
4F  12ddL>  .   .
*Xped   *   *   *
.   12cc    .   .
.   12b-J)  .   .
.   .   [<8qcL  .
.   .   [<8qd   .
.   .   [8qf#XJ .
4DD 8b-L    4f#] 4d] 4c]    .
.   8aJ .   .
[4D 4r  4r  .
*   *v  *v  *
==  ==  ==
*-  *-  *-
!!!RDF**kern: > = above
!!!RDF**kern: < = below
screen shot 2018-07-02 at 2 52 14 pm

But I will look into more detail about what is happening to cause the problems with the layers.

craigsapp commented 6 years ago

The cause of the problem is related to an extra <space> element being added to the MEI conversion:

 <space xml:id="space-0000001040982965" />

This space has no duration, and probably what verovio is doing is assigning the duration of a breve to the space, thus forcing the second layer to be displayed out of alignment with the first layer. Ideally verovio should not do that, but also the converter should not add an empty space, so I will fix the converter so that it does not add the extra <space> element.

screen shot 2018-07-02 at 3 02 02 pm

Extra space in conversion highlighted in text editor:

screen shot 2018-07-02 at 3 02 27 pm
craigsapp commented 6 years ago

Fixed with commit: https://github.com/rism-ch/verovio/commit/ada10a24af0a0191bc0fff1dc18be0d382650733

Distilled example:

screen shot 2018-07-03 at 7 10 01 am
**kern
*clefG2
*M4/4
=
*^
*   *
4dd 2r
*Xtuplet    *
12ddL>  .
*   *
12cc    .
12bJ)   .
8bL 4c
8aJ .
4r  4r
*v  *v
=
*-

Original example now displays properly:

screen shot 2018-07-03 at 7 14 56 am

The fix is not fully generalized, so there may be other similar situations that will be related.

jacekiwaszko1 commented 6 years ago

Spacing problem with the converter in this example:

**kern  **kern  **dynam
*clefF4 *clefG2 *
*k[f#c#g#d#]    *k[f#c#g#d#]    *
*M4/4   *M4/4   *
*met(c) *met(c) *
=89 =89 =89
*   *^  *
*ped    *   *   *
12GG#L  (4cc#   4rc .
12Eny   .   .   .
12c#    .   .   .
12E 2gg#^   8rc .
12GG#   .   .   .
.   .   16r .
*Xped   *   *   *
12CC#J  .   .   .
.   .   16any   .
*ped    *   *   *
12BBBnyL    .   (>20a'>LL   .
.   .   20b'>   .
12BBny  .   .   .
.   .   20a'>   .
.   .   20g#'>  .
12d#y   .   .   .
.   .   20a'>JJ)    .
12Any   4ff#)   8.bL    .
12BB    .   .   .
*Xped   *   *   *
12BBBJ  .   .   .
.   .   16f#Jk  .
=90 =90 =90 =90
*ped    *   *   *
12EEnyL (2eeny  1g# .
12BBny  .   .   .
12eny   .   .   .
12G#    .   .   .
12BB    .   .   .
*Xped   *   *   *
12DD#yJ .   .   .
*ped    *   *   *
12CC#L  4ee'<   .   .
12GG#   .   .   .
12G#    .   .   .
12C#    4ee'<   .   .
12GG#   .   .   .
*Xped   *   *   *
12CC#J  .   .   .
=91 =91 =91 =91
!!linebreak:original
*ped    *   *   *
12CC#L  2ee 4bny    .
!   !   !   !LO:HP:a
12GG#   .   .   <
12c#    .   .   .
12E#X   .   8.cc#L  .
12GG#   .   .   .
*Xped   *   *   *
12CC#J  .   .   .
.   .   16bJk   [
*ped    *   *   *
12CC#L  [2ff#)  4b  .
12AAny  .   .   .
12c#    .   .   .
12F#    .   8.anyL  .
12AA    .   .   .
*Xped   *   *   *
12CC#J  .   .   .
.   .   16g#Jk  .
=   =   =   =
*-  *-  *-  *-

extraspace

craigsapp commented 6 years ago

Minimal example that still has the problem:

**kern  **kern
*clefF4 *clefG2
*M4/4   *M4/4
=   =
*ped    *
4F  1g
12GL    .
12E .
*Xped   *
12DJ    .
*ped    *
4C  .
12CL    .
12D .
*Xped   *
12CJ    .
=   =
*-  *-
screen shot 2018-07-16 at 8 05 39 pm

The problem is that the whole note is split twice with a pedal mark inside of a tuplet. The previous fix only compensated for one such occurrence.

craigsapp commented 6 years ago

Should be fixed with commit https://github.com/rism-ch/verovio/commit/0337215eca0eb730a12cb2b0d1acf5685527b2ef

Example:

screen shot 2018-07-16 at 8 56 08 pm