rism-digital / verovio

🎵 Music notation engraving library for MEI with MusicXML and Humdrum support and various toolkits (JavaScript, Python)
https://www.verovio.org
GNU Lesser General Public License v3.0
660 stars 181 forks source link

How to deal with Highly Compressed Justification #875

Closed CCInc closed 6 years ago

CCInc commented 6 years ago

Some of my scores have been receiving the warning "Justification is highly compressed". For example, the attached MEI file when run with the parameters --page-margin-bottom=240 --page-margin-top=240 --page-margin-right=240 --page-margin-left=240 -s 30 -w 2040 -h 2640 have some areas where measures are much too compressed:

image image

How do you deal with these cases with the new justification system? Do I need to change the scale and height so that scale is closer to 100? Or is this a code issue?

Black Note Study Op 10 no 5 FINALE XSLT.zip

craigsapp commented 6 years ago

Here is an example of it in VHV:

screen shot 2018-05-24 at 10 52 58 pm

Where it is looking reasonably spaced with these options:

{
"adjustPageHeight":1,
"appXPathQuery":"./rdg[contains(@label, 'asiuahetlkj')]",
"barLineWidth":0.12,
"breaks":"auto",
"font":"Leipzig",
"humType":1,
"inputFormat":"auto",
"noFooter":1,
"noHeader":1,
"pageHeight":1055,
"pageMarginBottom":20,
"pageMarginLeft":20,
"pageMarginRight":20,
"pageMarginTop":20,
"pageWidth":2072.5,
"scale":40,
"spacingLinear":0.25,
"spacingNonLinear":0.6,
"staffLineWidth":0.12
}

I think the most important parameters are:

"spacingLinear":0.25,
"spacingNonLinear":0.6,
CCInc commented 6 years ago

Interesting, I didn't know about the spacing-linear and spacing-non-linear options, but according to the documentation it looks like .25 and .60 are the default values anyways, so I don't believe that's the issue.

Scale does not have any relevance in this - it looks like some combination of the margins and the width/height (I'm leaning towards the margins being the culprit), but ideally I'd like to keep these parameters the same and have verovio just add a break in.

Interestingly, without margins but at the same width/height, verovio renders the same measures in a single system, as in your example (81-end):

image

CCInc commented 6 years ago

This is just me brainstorming, but could it be the clef changes that are not properly accounted for in determining where to break a system?

CCInc commented 6 years ago

Not sure what to do about this one - probably just bad notation, I can't think of a way to make this better on verovio's end but perhaps you have some thoughts?

image

<?xml version="1.0" encoding="UTF-8"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" xmlns:xlink="http://www.w3.org/1999/xlink" meiversion="2013">
    <music>
        <body>
            <mdiv>
                <score>
                    <scoreDef ppq="1024" meter.count="12" meter.unit="8" key.sig="3f" key.mode="major">
                        <staffGrp>
                            <staffGrp xml:id="P1" symbol="brace" isPart="true" midi.instrnum="0" midi.patchname="keyboard.piano" label="Piano">
                                <instrDef xml:id="P1-I1" midi.instrnum="0" midi.patchname="keyboard.piano" midi.volume="100" midi.pan="57"/>
                                <staffDef n="1" lines="5" clef.line="2" clef.shape="G"/>
                                <staffDef n="2" lines="5" clef.line="4" clef.shape="F"/>
                            </staffGrp>
                        </staffGrp>
                    </scoreDef>
                    <section>
                        <measure n="34" xml:id="d1e26114">
                            <staff n="1">
                                <layer n="1">
                                    <beam>
                                        <note xml:id="d1e26136" tstamp.ges="0" pname="c" accid="f" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26162" tstamp.ges="256" pname="b" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e26184" tstamp.ges="512" pname="c" accid="n" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26206" tstamp.ges="768" pname="a" accid="n" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e26228" tstamp.ges="1024" pname="c" accid="f" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26252" tstamp.ges="1280" pname="b" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e26274" tstamp.ges="1536" pname="c" accid="n" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26297" tstamp.ges="1792" pname="a" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down" accid.ges="n"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e26317" tstamp.ges="2048" pname="c" accid="f" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26341" tstamp.ges="2304" pname="b" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e26363" tstamp.ges="2560" pname="c" accid="n" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26385" tstamp.ges="2816" pname="a" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down" accid.ges="n"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e26405" tstamp.ges="3072" pname="c" accid="f" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26429" tstamp.ges="3328" pname="b" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e26451" tstamp.ges="3584" pname="c" accid="n" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26473" tstamp.ges="3840" pname="a" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down" accid.ges="n"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e26493" tstamp.ges="4096" pname="c" accid="f" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26517" tstamp.ges="4352" pname="b" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e26540" tstamp.ges="4608" pname="c" accid="n" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26562" tstamp.ges="4864" pname="a" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down" accid.ges="n"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e26582" tstamp.ges="5120" pname="c" accid="f" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26606" tstamp.ges="5376" pname="b" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e26628" tstamp.ges="5632" pname="c" accid="n" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26650" tstamp.ges="5888" pname="a" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down" accid.ges="n"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e26676" tstamp.ges="6144" pname="c" accid="f" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26700" tstamp.ges="6400" pname="b" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e26722" tstamp.ges="6656" pname="c" accid="n" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26744" tstamp.ges="6912" pname="a" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down" accid.ges="n"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e26765" tstamp.ges="7168" pname="c" accid="f" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26789" tstamp.ges="7424" pname="b" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e26811" tstamp.ges="7680" pname="c" accid="n" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26838" tstamp.ges="7936" pname="a" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down" accid.ges="n"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e26864" tstamp.ges="8192" pname="c" accid="f" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26895" tstamp.ges="8448" pname="b" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e26917" tstamp.ges="8704" pname="c" accid="n" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26939" tstamp.ges="8960" pname="a" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down" accid.ges="n"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e26960" tstamp.ges="9216" pname="c" accid="f" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e26984" tstamp.ges="9472" pname="b" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e27006" tstamp.ges="9728" pname="c" accid="n" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e27028" tstamp.ges="9984" pname="a" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down" accid.ges="n"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e27054" tstamp.ges="10240" pname="c" accid="f" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e27078" tstamp.ges="10496" pname="b" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e27100" tstamp.ges="10752" pname="c" accid="n" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e27122" tstamp.ges="11008" pname="a" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down" accid.ges="n"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e27142" tstamp.ges="11264" pname="c" accid="f" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e27166" tstamp.ges="11520" pname="b" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e27189" tstamp.ges="11776" pname="c" accid="n" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e27211" tstamp.ges="12032" pname="a" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down" accid.ges="n"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e27237" tstamp.ges="12288" pname="c" accid="f" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e27261" tstamp.ges="12544" pname="b" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e27288" tstamp.ges="12800" pname="d" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e27308" tstamp.ges="13056" pname="c" accid="n" oct="6" oct.ges="7" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e27330" tstamp.ges="13312" pname="b" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e27352" tstamp.ges="13568" pname="a" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="n"/>
                                        <note xml:id="d1e27372" tstamp.ges="13824" pname="a" accid="f" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e27397" tstamp.ges="14080" pname="g" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e27417" tstamp.ges="14336" pname="f" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="i1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e27437" tstamp.ges="14592" pname="d" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e27457" tstamp.ges="14848" pname="e" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e27479" tstamp.ges="15104" pname="c" oct="5" oct.ges="6" dur="16" dur.ges="256p" beam="t1" size="cue" stem.dir="down"/>
                                    </beam>
                                    <beam>
                                        <note xml:id="d1e27499" tstamp.ges="15360" pname="b" oct="4" oct.ges="5" dur="8" dur.ges="512p" beam="i1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e27526" tstamp.ges="15872" pname="a" oct="5" dur="8" dur.ges="512p" beam="m1" size="cue" stem.dir="down" accid.ges="f"/>
                                        <note xml:id="d1e27546" tstamp.ges="16384" pname="c" oct="5" dur="8" dur.ges="512p" beam="m1" size="cue" stem.dir="down"/>
                                        <note xml:id="d1e27564" tstamp.ges="16896" pname="d" oct="5" dur="8" dur.ges="512p" beam="t1" size="cue" stem.dir="down"/>
                                    </beam>
                                </layer>
                            </staff>
                            <staff n="2">
                                <layer n="1">
                                    <rest xml:id="d1e27588" tstamp.ges="0" dur="1" dur.ges="17408p"/>
                                </layer>
                            </staff>
                            <dynam label="direction" tstamp="1" tstamp.ges="0" place="below" staff="1">
                                <rend halign="left">p</rend>
                            </dynam>
                            <slur tstamp="1" tstamp.ges="0" startid="#d1e26136" curvedir="above" tstamp2="0m+34" endid="#d1e27564" staff="1"/>
                            <hairpin tstamp="1.2344" tstamp.ges="0" place="below" staff="1" form="cres" tstamp2="0m+16.5" endid="#d1e26811" opening="3"/>
                            <dynam label="direction" tstamp="13" tstamp.ges="6144" place="below" staff="1">cresc.</dynam>
                            <dynam label="direction" tstamp="17" tstamp.ges="8192" place="below" staff="1">
                                <rend halign="left">f</rend>
                            </dynam>
                            <hairpin tstamp="17.7344" tstamp.ges="8448" place="below" staff="1" form="dim" opening="3" tstamp2="0m+26" endid="#d1e27261"/>
                            <dynam label="direction" tstamp="21" tstamp.ges="10240" place="below" staff="1">dim.</dynam>
                            <dir tstamp="25" tstamp.ges="12288" place="below" staff="1">rallent. e smorz.</dir>
                        </measure>

                    </section>
                </score>
            </mdiv>
        </body>
    </music>
</mei>
craigsapp commented 6 years ago

If you want the music to be displayed at that size and width, then the only thing that is possible is to break the measure into two measures so that it renders on two lines:

screen shot 2018-05-27 at 8 21 10 am

Verovio currently will not automatically split barlines across system breaks (although @lpugin may have added some automatic line breaking for measureless mensural music somewhat recently). So the only way to currently deal with this problem is to add invisible barlines as shown in the MEI example below.

Is the time signature of 12/8 correct? The beaming of the notes do not match. There is also a likely conversion problem between MusicXML and MEI with regards to the whole-measure rest in the lower staff. It is encoded as a whole-note rest rather than a whole-measure rest, the first one being left justified with the notes like other rests and always being interpreted as having 4 quarter note duration, but the second one should be centered in the measure, and be of the duration of the measure.

In order to do a line break, there must be a measure boundary (a limitation of verovio, but still problematic in MEI). I added an invisible barline to indicate where the measure should be broken. I also converted the whole-measure rest into a series of quarter-note invisible rests (<space>s) which do not serve any direct function, but would allow you to insert invisible barlines in multiple locations to allow verovio to break the actual full measure wherever it wants (depending on the line length and notation size). Ideally the width of the invisible barlines should be 0 so that multiple barlines can be added without disturbing the spacing of the visible notes in such cases. In general I would prefer more space after the last note before an invisible barline at a system break.

Notice that if an invisible barline is inserted, then the @tstamps of items in the newly created measure following the barline will have to be adjusted for the new starting reference point.

Here is my encoding of the example, with the added invisible barline at the chosen breaking point, multiple spaces to allow easy moving of the breaking point, but no other invisible barlines, since that will disturb the spacing of the notes:

<?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-05-27T08:24:43" version="2.0.0-dev-67d18d5-dirty">
                    <name>Verovio</name>
                    <p>Transcoded from Humdrum</p>
                </application>
            </appInfo>
        </encodingDesc>
        <workDesc>
            <work>
                <titleStmt>
                    <title />
                </titleStmt>
            </work>
        </workDesc>
    </meiHead>
    <music>
        <body>
            <mdiv xml:id="mdiv-0000002058577278">
                <score xml:id="score-0000001106386709">
                    <scoreDef xml:id="scoredef-0000001835420615">
                        <staffGrp xml:id="staffgrp-0000001668684109" symbol="brace" barthru="true">
                            <staffDef xml:id="staffdef-0000000485829494" clef.shape="G" clef.line="2" key.sig="3f" meter.count="12" meter.unit="8" n="1" lines="5">
                                <label xml:id="label-0000001137828969" />
                            </staffDef>
                            <staffDef xml:id="staffdef-0000000018157489" clef.shape="F" clef.line="4" key.sig="3f" meter.count="12" meter.unit="8" n="2" lines="5" />
                        </staffGrp>
                    </scoreDef>
                    <section xml:id="section-0000001476444281">
                        <measure xml:id="measure-L1" right="invis" n="0">
                            <staff xml:id="staff-0000000718347940" n="1">
                                <layer xml:id="layer-L1F2N1" n="1">
                                    <beam xml:id="beam-L8F2-L11F2">
                                        <note xml:id="note-L8F2" dur="16" oct="6" pname="c" cue="true" stem.dir="down" accid="f" />
                                        <note xml:id="note-L9F2" dur="16" oct="5" pname="b" cue="true" stem.dir="down" accid.ges="f" />
                                        <note xml:id="note-L10F2" dur="16" oct="6" pname="c" cue="true" stem.dir="down" accid="n" />
                                        <note xml:id="note-L11F2" dur="16" oct="5" pname="a" cue="true" stem.dir="down" accid="n" />
                                    </beam>
                                    <beam xml:id="beam-L12F2-L15F2">
                                        <note xml:id="note-L12F2" dur="16" oct="6" pname="c" cue="true" stem.dir="down" accid="f" />
                                        <note xml:id="note-L13F2" dur="16" oct="5" pname="b" cue="true" accid.ges="f" />
                                        <note xml:id="note-L14F2" dur="16" oct="6" pname="c" cue="true" accid="n" />
                                        <note xml:id="note-L15F2" dur="16" oct="5" pname="a" cue="true" accid.ges="n" />
                                    </beam>
                                    <beam xml:id="beam-L16F2-L19F2">
                                        <note xml:id="note-L16F2" dur="16" oct="6" pname="c" cue="true" stem.dir="down" accid="f" />
                                        <note xml:id="note-L17F2" dur="16" oct="5" pname="b" cue="true" accid.ges="f" />
                                        <note xml:id="note-L18F2" dur="16" oct="6" pname="c" cue="true" accid="n" />
                                        <note xml:id="note-L19F2" dur="16" oct="5" pname="a" cue="true" accid.ges="n" />
                                    </beam>
                                    <beam xml:id="beam-L20F2-L23F2">
                                        <note xml:id="note-L20F2" dur="16" oct="6" pname="c" cue="true" stem.dir="down" accid="f" />
                                        <note xml:id="note-L21F2" dur="16" oct="5" pname="b" cue="true" accid.ges="f" />
                                        <note xml:id="note-L22F2" dur="16" oct="6" pname="c" cue="true" accid="n" />
                                        <note xml:id="note-L23F2" dur="16" oct="5" pname="a" cue="true" accid.ges="n" />
                                    </beam>
                                    <beam xml:id="beam-L24F2-L27F2">
                                        <note xml:id="note-L24F2" dur="16" oct="6" pname="c" cue="true" stem.dir="down" accid="f" />
                                        <note xml:id="note-L25F2" dur="16" oct="5" pname="b" cue="true" accid.ges="f" />
                                        <note xml:id="note-L26F2" dur="16" oct="6" pname="c" cue="true" accid="n" />
                                        <note xml:id="note-L27F2" dur="16" oct="5" pname="a" cue="true" accid.ges="n" />
                                    </beam>
                                    <beam xml:id="beam-L28F2-L31F2">
                                        <note xml:id="note-L28F2" dur="16" oct="6" pname="c" cue="true" stem.dir="down" accid="f" />
                                        <note xml:id="note-L29F2" dur="16" oct="5" pname="b" cue="true" accid.ges="f" />
                                        <note xml:id="note-L30F2" dur="16" oct="6" pname="c" cue="true" accid="n" />
                                        <note xml:id="note-L31F2" dur="16" oct="5" pname="a" cue="true" accid.ges="n" />
                                    </beam>
                                    <beam xml:id="beam-L32F2-L35F2">
                                        <note xml:id="note-L32F2" dur="16" oct="6" pname="c" cue="true" stem.dir="down" accid="f" />
                                        <note xml:id="note-L33F2" dur="16" oct="5" pname="b" cue="true" accid.ges="f" />
                                        <note xml:id="note-L34F2" dur="16" oct="6" pname="c" cue="true" accid="n" />
                                        <note xml:id="note-L35F2" dur="16" oct="5" pname="a" cue="true" accid.ges="n" />
                                    </beam>
                                    <beam xml:id="beam-L36F2-L39F2">
                                        <note xml:id="note-L36F2" dur="16" oct="6" pname="c" cue="true" stem.dir="down" accid="f" />
                                        <note xml:id="note-L37F2" dur="16" oct="5" pname="b" cue="true" accid.ges="f" />
                                        <note xml:id="note-L38F2" dur="16" oct="6" pname="c" cue="true" accid="n" />
                                        <note xml:id="note-L39F2" dur="16" oct="5" pname="a" cue="true" accid.ges="n" />
                                    </beam>
                                    <beam xml:id="beam-L40F2-L43F2">
                                        <note xml:id="note-L40F2" dur="16" oct="6" pname="c" cue="true" stem.dir="down" accid="f" />
                                        <note xml:id="note-L41F2" dur="16" oct="5" pname="b" cue="true" accid.ges="f" />
                                        <note xml:id="note-L42F2" dur="16" oct="6" pname="c" cue="true" accid="n" />
                                        <note xml:id="note-L43F2" dur="16" oct="5" pname="a" cue="true" accid.ges="n" />
                                    </beam>
                                    <beam xml:id="beam-L44F2-L47F2">
                                        <note xml:id="note-L44F2" dur="16" oct="6" pname="c" cue="true" stem.dir="down" accid="f" />
                                        <note xml:id="note-L45F2" dur="16" oct="5" pname="b" cue="true" accid.ges="f" />
                                        <note xml:id="note-L46F2" dur="16" oct="6" pname="c" cue="true" accid="n" />
                                        <note xml:id="note-L47F2" dur="16" oct="5" pname="a" cue="true" accid.ges="n" />
                                    </beam>
                                    <beam xml:id="beam-L48F2-L51F2">
                                        <note xml:id="note-L48F2" dur="16" oct="6" pname="c" cue="true" stem.dir="down" accid="f" />
                                        <note xml:id="note-L49F2" dur="16" oct="5" pname="b" cue="true" accid.ges="f" />
                                        <note xml:id="note-L50F2" dur="16" oct="6" pname="c" cue="true" accid="n" />
                                        <note xml:id="note-L51F2" dur="16" oct="5" pname="a" cue="true" accid.ges="n" />
                                    </beam>
                                    <beam xml:id="beam-L52F2-L55F2">
                                        <note xml:id="note-L52F2" dur="16" oct="6" pname="c" cue="true" stem.dir="down" accid="f" />
                                        <note xml:id="note-L53F2" dur="16" oct="5" pname="b" cue="true" accid.ges="f" />
                                        <note xml:id="note-L54F2" dur="16" oct="6" pname="c" cue="true" accid="n" />
                                        <note xml:id="note-L55F2" dur="16" oct="5" pname="a" cue="true" accid.ges="n" />
                                    </beam>
                                </layer>
                            </staff>
                            <staff xml:id="staff-0000001007885037" n="2">
                                <layer xml:id="layer-L1F1N1" n="1">
                                    <space xml:id="space-L8F1" dur="4" />
                                    <space xml:id="space-L12F1" dur="4" />
                                    <space xml:id="space-L16F1" dur="4" />
                                    <space xml:id="space-L20F1" dur="4" />
                                    <space xml:id="space-L24F1" dur="4" />
                                    <space xml:id="space-L28F1" dur="4" />
                                    <space xml:id="space-L32F1" dur="4" />
                                    <space xml:id="space-L36F1" dur="4" />
                                    <space xml:id="space-L40F1" dur="4" />
                                    <space xml:id="space-L44F1" dur="4" />
                                    <space xml:id="space-L48F1" dur="4" />
                                    <space xml:id="space-L52F1" dur="4" />
                                </layer>
                            </staff>
                            <slur xml:id="slur-L8F2-L73F2N1" staff="1" startid="#note-L8F2" endid="#note-L73F2" curvedir="above" />
                        </measure>
                        <measure xml:id="measure-L56">
                            <staff xml:id="staff-L56F2N1" n="1">
                                <layer xml:id="layer-L56F2N1" n="1">
                                    <beam xml:id="beam-L58F2-L61F2">
                                        <note xml:id="note-L58F2" dur="16" oct="6" pname="c" cue="true" stem.dir="down" accid="f" />
                                        <note xml:id="note-L59F2" dur="16" oct="5" pname="b" cue="true" accid.ges="f" />
                                        <note xml:id="note-L60F2" dur="16" oct="6" pname="d" cue="true" accid.ges="n" />
                                        <note xml:id="note-L61F2" dur="16" oct="6" pname="c" cue="true" accid="n" />
                                    </beam>
                                    <beam xml:id="beam-L62F2-L65F2">
                                        <note xml:id="note-L62F2" dur="16" oct="5" pname="b" cue="true" stem.dir="down" accid.ges="f" />
                                        <note xml:id="note-L63F2" dur="16" oct="5" pname="a" cue="true" accid.ges="n" />
                                        <note xml:id="note-L64F2" dur="16" oct="5" pname="a" cue="true" accid="f" />
                                        <note xml:id="note-L65F2" dur="16" oct="5" pname="g" cue="true" accid.ges="n" />
                                    </beam>
                                    <beam xml:id="beam-L66F2-L69F2">
                                        <note xml:id="note-L66F2" dur="16" oct="5" pname="f" cue="true" stem.dir="down" accid.ges="n" />
                                        <note xml:id="note-L67F2" dur="16" oct="5" pname="d" cue="true" accid.ges="n" />
                                        <note xml:id="note-L68F2" dur="16" oct="5" pname="e" cue="true" accid.ges="f" />
                                        <note xml:id="note-L69F2" dur="16" oct="5" pname="c" cue="true" accid.ges="n" />
                                    </beam>
                                    <beam xml:id="beam-L70F2-L73F2">
                                        <note xml:id="note-L70F2" dur="8" oct="4" pname="b" cue="true" stem.dir="down" accid.ges="f" />
                                        <note xml:id="note-L71F2" dur="8" oct="5" pname="a" cue="true" accid.ges="f" />
                                        <note xml:id="note-L72F2" dur="8" oct="5" pname="c" cue="true" accid.ges="n" />
                                        <note xml:id="note-L73F2" dur="8" oct="5" pname="d" cue="true" accid.ges="n" />
                                    </beam>
                                </layer>
                            </staff>
                            <staff xml:id="staff-L56F1N1" n="2">
                                <layer xml:id="layer-L56F1N1" n="1">
                                    <space xml:id="space-L58F1" dur="4" />
                                    <space xml:id="space-L62F1" dur="4" />
                                    <space xml:id="space-L66F1" dur="4" />
                                    <space xml:id="space-L70F1" dur="2" />
                                </layer>
                            </staff>
                            <dir xml:id="dir-L58F2" staff="1" tstamp="1.000000">rallent. e smorz.</dir>
                        </measure>
                    </section>
                </score>
            </mdiv>
        </body>
    </music>
</mei>

A related problem is that your data is using an older method for indicating cue-sized notes. The most recent way of doing that in MEI is with note@cue="true" rather than note@size="cue". This causes the notes to be printed in regular size with verovio (which is using the newest system for cue size). Converting to cue-sized notes in the notation will decrease the problem, since more notes can fit on a line of music.

In MEI, the whole-measure rest is actually a whole-meter rest, taking its duration from the prevailing time signature (which is 12/8 in this case). So to encode correctly in MEI, you would probably have to encode an invisible time signature for the measure (is that possible in MEI/verovio?) matching the duration of the notes in the top staff. And then switch back to the original time signature for music when it goes back to a proper metrical syntax. Alternately, the <mRest> can be given @dur.ges=28b to indicate the duration of 28 eighth notes (8th notes since the time signature is 12/8 (and more directly because staffDef@meter.unit="8" defined the units for b, which is probably being tweaked in MEI 4.0). I don't know if verovio processes mRest@dur.ges, but it should be implemented if it currently does not. Alternatively, the whole-measure rest may have been invisible in the original MusicXML source. If so, then it should have been converted into a <space>, where the duration is described similar to @dur.ges.

Verovio currently is forcing cue-sized notes upwards, which it should not; so ideally stem directions would not be required for this example (see issue https://github.com/rism-ch/verovio/issues/810).

Another side note is that @ppq="1024" in the scoreDef section is junk, as well as @dur.ges on notes/rests. These parameters comes from Sibelius's MusicXML exporter, and are not providing any information that cannot be extract from other data parameters (and can be extracted more correctly than the values in the Sibelius MusicXML export). It would be useful if the MusicXML-to-MEI did not preserve this information (examine what happens with triplet notes, for example).

Here is the Humdrum version of the example where I was doing trasformations:

**kern  **kern
*part2  *part1
*staff2 *staff1
*clefF4 *clefG2
*k[b-e-a-]  *k[b-e-a-]
*M12/8  *M12/8
*   *cue
4ryy    (>16ccc-\L
.   16bb-
.   16ccc
.   16aaJ
4ryy    16ccc-\L
.   16bb-
.   16ccc
.   16aaJ
4ryy    16ccc-\L
.   16bb-
.   16ccc
.   16aaJ
4ryy    16ccc-\L
.   16bb-
.   16ccc
.   16aaJ
4ryy    16ccc-\L
.   16bb-
.   16ccc
.   16aaJ
4ryy    16ccc-\L
.   16bb-
.   16ccc
.   16aaJ
4ryy    16ccc-\L
.   16bb-
.   16ccc
.   16aaJ
4ryy    16ccc-\L
.   16bb-
.   16ccc
.   16aaJ
4ryy    16ccc-\L
.   16bb-
.   16ccc
.   16aaJ
4ryy    16ccc-\L
.   16bb-
.   16ccc
.   16aaJ
4ryy    16ccc-\L
.   16bb-
.   16ccc
.   16aaJ
4ryy    16ccc-\L
.   16bb-
.   16ccc
.   16aaJ
=-  =-
!   !LO:TX:i:t=rallent. e smorz.
4ryy    16ccc-\L
.   16bb-
.   16ddd
.   16cccJ
4ryy    16bb-\L
.   16aa
.   16aa-
.   16ggJ
4ryy    16ff\L
.   16dd
.   16ee-
.   16ccJ
2ryy    8b-\L
.   8aa-
.   8cc
.   8ddJ)
=   =
*-  *-
!!!RDF**kern: > = above
CCInc commented 6 years ago

Is the time signature of 12/8 correct? The beaming of the notes do not match.

Yes, 12/8 is correct, and it seems that it isn't consistent with the beaming so I took a look at the original edition:

image

So it seems you're correct that I need to split that measure up with an invisible beam. The transcription I'm using already has an invisible beam between the fermata and the cue notes, I'll have to go in and add a split in the middle of those cues. I don't think there will be a good way to automate that, I'll just have to keep my eye out. Here's the same data rendered in Finale:

image

So even with finale understanding those are cues, it seems pretty tight to fit in, much less where verovio is rendering it as non-cues. On that note -

A related problem is that your data is using an older method for indicating cue-sized notes. The most recent way of doing that in MEI is with note@cue="true" rather than note@size="cue". This causes the notes to be printed in regular size with verovio (which is using the newest system for cue size). Converting to cue-sized notes in the notation will decrease the problem, since more notes can fit on a line of music.

I didn't know my cue style was outdated - perhaps we could add this to one of the 3->4 conversion functions? Would there be interest in that? I can probably write up that code. In my opinion, verovio should definitely accept the values I'm using in the interest of maintaining compatibility with MEI 3.

It is encoded as a whole-note rest rather than a whole-measure rest, the first one being left justified with the notes like other rests and always being interpreted as having 4 quarter note duration, but the second one should be centered in the measure, and be of the duration of the measure.

It seems that it is encoded correctly as a whole-measure rest in MusicXML. Is there no way to specify a whole measure rest in MEI (a "tacet" rest)? If not, that seems quite odd to me. MusicXML has an attribute to describe a full-measure rest without need for a duration. Do you think I should open an issue for this on the MEI page? Edit: I'm silly, it's just a <mRest> element, I just need to get the conversion correct for that.

Another side note is that @ppq="1024" in the scoreDef section is junk, as well as @dur.ges on notes/rests. These parameters comes from Sibelius's MusicXML exporter, and are not providing any information that cannot be extract from other data parameters (and can be extracted more correctly than the values in the Sibelius MusicXML export). It would be useful if the MusicXML-to-MEI did not preserve this information (examine what happens with triplet notes, for example).

Normally I would agree with that, but I have actually found use in the @dur.ges attribute - many mei:space durations can't actually conform to a proper combination of "dur" and "dot"s, so I have to use the PPQ and @dur.ges from those mei:space elements to render the score correctly.

        // Since spaces don't have to conform to durations like rests or notes do,
        // many spaces can't fit into a data_DURATION
        // so if the space has an alternative PPQ duration, use that instead
        if (this->Is(SPACE) && duration->HasDurPpq())
        {
            // only support scoreDef ppq for now
            if (doc)
            {
                if (doc->m_scoreDef.HasPpq())
                {
                    int ppq = doc->m_scoreDef.GetPpq();
                    double note_dur = ((double)duration->GetDurPpq() / (ppq * 4)) * DUR_MAX;
                    return note_dur;
                }
            }
        }

This is just my hacked together quick fix, but this is actually an issue that should be tackled by us at some point - I just am not looking forward to proper PPQ detection. We'll probably have to do a similar thing to key and time signatures where we modify the PPQ of the current staffdef as we go. So for me, keeping the dur.ges and ppq have some value right now.

At any rate, I'm still not sure what to do about the images I posted in the original issue :/

craigsapp commented 6 years ago

I didn't know my cue style was outdated - perhaps we could add this to one of the 3->4 conversion functions?

Yes, that would be useful in the 3->4 converter.

Edit: I'm silly, it's just a <mRest> element, I just need to get the conversion correct for that.

It is an <mRest>, but it will require a gestural duration I think, since the duration of the measure does not match that of the prevailing time signature.

Normally I would agree with that, but I have actually found use in the @dur.ges attribute - many mei:space durations can't actually conform to a proper combination of "dur" and "dot"s, so I have to use the PPQ and @dur.ges from those mei:space elements to render the score correctly.

What I do in such cases, is chop up a weird duration into smaller pieces that fit into @dur/ @dots:

https://github.com/rism-ch/verovio/blob/c8a9a02a00d2551f8ae44e57be9c81e992e891f7/src/iohumdrum.cpp#L5257-L5280

Your system should work for normal rhythms, but there will probably be a problem with tuplet spaces, since Sibelius always uses 1024 (or 2048) divisions for a quarter note. This prevents any non-power of two rhythm (such as a triplet eighth note) to be encoded properly in the @ppq data.

lpugin commented 6 years ago

Justification will need to be improved at some point. However, with dynamic rendering we wll still encounter cases where a measure does not fit the width of a system. Verovio is currently not able to split theses as @craigsapp pointed out.

Unless there are arguments against it I am closing this issue because improving justification is a general know issue.