Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A 'barLine' in the 'corr' element messes up the rendering in Verovio #2026

Open
martha-thomae opened this issue Feb 1, 2021 · 7 comments
Open
Labels
enhancement mensural Issues related to mensural notation

Comments

@martha-thomae
Copy link
Contributor

There is an issue when a barline appears within a <corr> element.

For the Measuring Polyphony Project, we add dotted barlines to show the alignment of notes. For some reason, if a barline falls within a <corr> element, the alignment gets messed up (empty spaces are inserted or notes switch to another staff when rendering).

Here is an example of this (where empty spaces are inserted in rendering):

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/dev/mei-Mensural.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/dev/mei-Mensural.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></title>
            </titleStmt>
            <pubStmt></pubStmt>
        </fileDesc>
    </meiHead>
    <music>
        <body>
            <mdiv>
                <score>
                    <scoreDef midi.bpm="600">
                        <staffGrp symbol="bracket">
                            <staffDef n="1" lines="5" notationtype="mensural.black" xml:id="triplum" clef.shape="C" clef.line="3">
                                <label>triplum</label>
                                <mensur modusminor="2" tempus="3" prolatio="2"/>
                            </staffDef>
                            <staffDef n="2" lines="5" notationtype="mensural.black" xml:id="bassus" clef.shape="C" clef.line="3">
                                <label>bassus</label>
                                <mensur modusminor="2" tempus="3" prolatio="2"/>
                            </staffDef>
                        </staffGrp>
                    </scoreDef>
                    <section>
                        <staff n="1">
                            <layer n="1">
                                <note xml:id="m-1" dur="brevis" oct="4" pname="d" dur.quality="imperfecta" num="3" numbase="2"/>
                                <note xml:id="m-2" dur="semibrevis" oct="4" pname="d"/>
                                <dot xml:id="m-3" form="div"/>
                                <barLine form="dashed"/>
                                <note xml:id="m-4" dur="semibrevis" oct="4" pname="d"/>
                                <note xml:id="m-5" dur="semibrevis" oct="4" pname="d" dur.quality="altera" num="1" numbase="2"/>
                                <barLine form="dashed"/>
                                <note xml:id="m-6" dur="brevis" oct="4" pname="d" dur.quality="imperfecta" num="3" numbase="2"/>
                                <note xml:id="m-7" dur="semibrevis" oct="4" pname="d"/>
                                <barLine form="dashed"/>
                                <note xml:id="m-8" dur="brevis" oct="4" pname="d"/>
                                <barLine form="dashed"/>
                            </layer>
                        </staff>
                        <staff n="2">
                            <layer n="1">
                                <note xml:id="m-11" dur="brevis" oct="4" pname="c" dur.quality="imperfecta" num="3" numbase="2"/>
                                <choice>
                                    <corr>
                                        <note xml:id="m-12a" dur="semibrevis" oct="4" pname="c"/>
                                        <dot xml:id="m-12b" form="div"/>
                                        <barLine form="dashed"/> <!-- IF YOU TAKE OUT THIS, THE ALIGNMENT WILL WORK AGAIN -->
                                        <note xml:id="m-12c" dur="semibrevis" oct="4" pname="c"/>
                                    </corr>
                                    <sic>
                                        <note xml:id="m-12" dur="semibrevis" oct="4" pname="c"/>
                                    </sic>
                                </choice>
                                <choice>
                                    <corr>
                                        <note xml:id="m-13a" dur="semibrevis" oct="4" pname="c"/>
                                        <note xml:id="m-13b" dur="semibrevis" oct="4" pname="c"/>
                                    </corr>
                                    <sic>
                                        <note xml:id="m-13" dur="semibrevis" oct="4" pname="c"/>
                                    </sic>
                                </choice>
                                <barLine form="dashed"/>
                                <note xml:id="m-14" dur="brevis" oct="4" pname="c"/>
                                <barLine form="dashed"/>
                                <note xml:id="m-15" dur="brevis" oct="4" pname="c"/>
                                <barLine form="dashed"/>
                            </layer>
                        </staff>
                    </section>
                </score>
            </mdiv>
        </body>
    </music>
</mei>

This is how this file gets displayed in Verovio:
Screen Shot 2021-02-01 at 4 56 40 PM

If we remove the <barline> element from <corr> (see commented line), then the alignment gets fixed:
Screen Shot 2021-02-01 at 4 56 54 PM

@martha-thomae
Copy link
Contributor Author

Here is another example. You can see in the rendition that we have extra space added in one voice (just like in the previous example), but we also have one of the notes switch to another staff (the last note of the bassus is showing now in the triplum):

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/dev/mei-Mensural.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/dev/mei-Mensural.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></title>
            </titleStmt>
            <pubStmt></pubStmt>
        </fileDesc>
    </meiHead>
    <music>
        <body>
            <mdiv>
                <score>
                    <scoreDef midi.bpm="600">
                        <staffGrp symbol="bracket">
                            <staffDef n="1" lines="5" notationtype="mensural.black" xml:id="triplum" clef.shape="C" clef.line="3">
                                <label>triplum</label>
                                <mensur modusminor="2" tempus="3" prolatio="2"/>
                            </staffDef>
                            <staffDef n="2" lines="5" notationtype="mensural.black" xml:id="bassus" clef.shape="C" clef.line="3">
                                <label>bassus</label>
                                <mensur modusminor="2" tempus="3" prolatio="2"/>
                            </staffDef>
                        </staffGrp>
                    </scoreDef>
                    <section>
                        <staff n="1">
                            <layer n="1">
                                <note xml:id="m-1" dur="brevis" oct="4" pname="f" dur.quality="imperfecta" num="3" numbase="2"/>
                                <choice>
                                    <corr>
                                        <note xml:id="m-2a" dur="semibrevis" oct="4" pname="f"/>
                                        <dot xml:id="m-2b" form="div"/>
                                        <barLine form="dashed"/> <!-- when you remove this barline, everything lines up again -->
                                    </corr>
                                    <sic>
                                        <note xml:id="m-2" dur="semibrevis" oct="4" pname="f"/>
                                    </sic>
                                </choice>
                                <note xml:id="m-3" dur="semibrevis" oct="4" pname="f"/>
                                <note xml:id="m-4" dur="semibrevis" oct="4" pname="f" dur.quality="altera" num="1" numbase="2"/>
                                <barLine form="dashed"/>
                                <note xml:id="m-5" dur="brevis" oct="4" pname="f" dur.quality="imperfecta" num="3" numbase="2"/>
                                <note xml:id="m-6" dur="semibrevis" oct="4" pname="f"/>
                                <barLine form="dashed"/>
                                <note xml:id="m-7" dur="brevis" oct="4" pname="f"/>
                                <barLine form="dashed"/>
                            </layer>
                        </staff>
                        <staff n="2">
                            <layer n="1">
                                <note xml:id="m-11" dur="brevis" oct="4" pname="c"/>
                                <barLine form="dashed"/>
                                <note xml:id="m-12" dur="semibrevis" oct="4" pname="c"/>
                                <note xml:id="m-13" dur="semibrevis" oct="4" pname="c" dur.quality="altera" num="1" numbase="2"/>
                                <barLine form="dashed"/>
                                <note xml:id="m-14" dur="brevis" oct="4" pname="c"/>
                                <barLine form="dashed"/>
                                <note xml:id="m-15" dur="brevis" oct="4" pname="c"/>
                                <barLine form="dashed"/>
                            </layer>
                        </staff>
                    </section>
                </score>
            </mdiv>
        </body>
    </music>
</mei>

This is how this example is rendering in Verovio now:
Screen Shot 2021-02-01 at 5 14 41 PM

If we remove that barline, the alignment fixes (no extra spaces, no switching of notes to other staff):
Screen Shot 2021-02-01 at 5 14 55 PM

@lpugin
Copy link
Contributor

lpugin commented Feb 2, 2021

Yes, this is unfortunately expected. To do the layout, Verovio needs to cuts the whole section into smaller chunks - basically invisible measures. As it stands, it relies on <barLine> elements to determine the possible cutting points depending on the size of the desired output. During the process, the barLine is converted into att.measure.log@right value. It can be converted back to a <barLine>.

Obviously, all this will not work with the <barLine> within editorial markup. It would require significant rethinking on how to do the layout with mensural music to make it work. One thing that can be done, though, is to exclude barlines within editorial markup as possible cutting point. Of course, depending on how frequent these are in your data this might remain very unsatisfactory. What do you think?

@lpugin lpugin added mensural Issues related to mensural notation enhancement labels Feb 2, 2021
@rettinghaus
Copy link
Contributor

rettinghaus commented Feb 2, 2021

I would think that having a barLine within a corr element wouldn't make much sense in mensural music anyway. I would put it after the choice and mark it with @resp and @type.

@martha-thomae
Copy link
Contributor Author

martha-thomae commented Feb 10, 2021

Yes, this is unfortunately expected. To do the layout, Verovio needs to cuts the whole section into smaller chunks - basically invisible measures. As it stands, it relies on <barLine> elements to determine the possible cutting points depending on the size of the desired output. During the process, the barLine is converted into att.measure.log@right value. It can be converted back to a <barLine>.

I see.

Obviously, all this will not work with the <barLine> within editorial markup. It would require significant rethinking on how to do the layout with mensural music to make it work. One thing that can be done, though, is to exclude barlines within editorial markup as possible cutting point. Of course, depending on how frequent these are in your data this might remain very unsatisfactory. What do you think?

To solve at least some of the situations, when possible, I am moving the barline outside of the <corr> to follow the <choice> element. However, this solution is not applicable to all scenarios (it only works if the <barLine> is the last element in <corr>). If there are notes preceding and following the <barLine> within <corr>, then we cannot move the barline out.

I think that the solution you propose, @lpugin, will work: excluding barlines within editorial markup as possible cutting point. I think that this situation—having a dotted barline falling within a corr element—won't happen very often, so this proposed solution might be enough.

I am including @karend27 in this discussion. What do you think about the "dotted barline falling within corr" situation? do you think it can happen often? (considering I am moving it out when it is the last thing in the corr)

@martha-thomae
Copy link
Contributor Author

I would think that having a barLine within a corr element wouldn't make much sense in mensural music anyway.

Well, you are right that it doesn't make sense if you are adding barlines as an editorial correction. However, we are not adding them with that idea in mind (thinking that the scribe forgot to add one), we are adding them to show groups of notes and facilitate the visualization of the note alignment in the different voices.

The idea is that we have a scored-up version of the voices of a mensural piece and we are using barlines to visualize the alignment, to facilitate locating the place where the voices are not lined up correctly due to a missing dot of division, missing notes, etc. The issue is that if we add those missing notes, sometimes the barline (used only as an aid to visualize the voice alignment) falls between the corrected notes (and that is why it ends up inside the <corr> element).

I would put it after the choice and mark it with @resp and @type.

Would this affect the place where the barline is rendered? We want them to be rendered in the right place to show the note groupings.

Looking back to the first example I presented:

106523209-c4933180-64ae-11eb-84bd-dbb1e5f7d864

<staff n="2">
    <layer n="1">
        <note xml:id="m-11" dur="brevis" oct="4" pname="c" dur.quality="imperfecta" num="3" numbase="2"/>
        <choice>
            <corr>
                <note xml:id="m-12a" dur="semibrevis" oct="4" pname="c"/>
                <dot xml:id="m-12b" form="div"/>
                <barLine form="dashed"/> <!-- IF YOU TAKE OUT THIS, THE ALIGNMENT WILL WORK AGAIN -->
                <note xml:id="m-12c" dur="semibrevis" oct="4" pname="c"/>
            </corr>
            <sic>
                <note xml:id="m-12" dur="semibrevis" oct="4" pname="c"/>
            </sic>
        </choice>
        <choice>
            <corr>
                <note xml:id="m-13a" dur="semibrevis" oct="4" pname="c"/>
                <note xml:id="m-13b" dur="semibrevis" oct="4" pname="c"/>
            </corr>
            <sic>
                <note xml:id="m-13" dur="semibrevis" oct="4" pname="c"/>
            </sic>
        </choice>
        <barLine form="dashed"/>
        <note xml:id="m-14" dur="brevis" oct="4" pname="c"/>
        <barLine form="dashed"/>
        <note xml:id="m-15" dur="brevis" oct="4" pname="c"/>
        <barLine form="dashed"/>
    </layer>
</staff>

Here the breve is perfect, we want to bar the piece by the breve to show the perfect groups of semibreves and facilitate observing if the barlines in all voices do line up (to facilitate finding out where a note was given the wrong duration by the scoring-up algorithm). In this example, we want the barline to be rendered just after that dot of division in the bassus. So, if the barline appears in a different place, that is an issue.

I was trying to follow your proposed solution (adding the barline after <choice>), but it seems that the barline is rendered in the wrong place and, therefore, is not useful anymore for the purpose of just evaluating the alignment.

Screen Shot 2021-02-10 at 12 03 38 PM

Do you have other proposals that I can test? Thanks, @rettinghaus.

@karend27
Copy link

@martha-thomae @lpugin Thanks - yes I agree that this probably would not occur that often (or at least there wouldn't be several measures in a row ending within a single correction) so I think this proposed solution will work.

@lpugin
Copy link
Contributor

lpugin commented Nov 12, 2024

Fixed with #3852

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement mensural Issues related to mensural notation
Projects
None yet
Development

No branches or pull requests

4 participants