humdrum-tools / verovio-humdrum-viewer

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

Score with `kern2mens` not vertically in sync #654

Open WolfgangDrescher opened 2 years ago

WolfgangDrescher commented 2 years ago

As mentioned in https://github.com/rism-digital/verovio/issues/2690 I have a problem where the score is no longer vertically in sync when combined with kern2mens filter.

When I use !!!filter: kern2mens notes are not aligned vertically to each other. The beginnings of each "bar" are always in sync (green), but within a "bar" notes do not match above the other staffs (red). Is there a way to get this in sync?

Bildschirmfoto 2022-03-04 um 16 18 07

It seems to be especially problematic with tied notes. E.g. in the bassus in bar 5 (last bar in the screenshot).

You can find my example here: https://verovio.humdrum.org/?file=https://raw.githubusercontent.com/WolfgangDrescher/lassus-geistliche-psalmen/07acddbc759e9e7c7c396bb5bc4370add0752c71/kern/01-beatus-vir.krn&filter=kern2mens

craigsapp commented 2 years ago

You are adding the barlines by hand, I see (since they are not there by default):

Screen Shot 2022-03-05 at 12 27 55 AM

But of course the misalignment still needs to be figured out...

Here are two tips:

I have a method for giving a shorter URL when coming from Github (but the general URL method you use is fine):

https://verovio.humdrum.org/?github=WolfgangDrescher/lassus-geistliche-psalmen/kern/01-beatus-vir.krn&filter=kern2mens

(I probably have to fix it for cases when the primary branch is not master).

For Github links, I have automatic detection of the actual data from the webpage for a score:

https://verovio.humdrum.org/?file=https://github.com/WolfgangDrescher/lassus-geistliche-psalmen/blob/master/kern/01-beatus-vir.krn

And I added as a demo:

!!!verovio: evenNoteSpacing 1

which turns on the evenNoteSpacing option in verovio, making mensural music prettier. The 1 is optional. To unset it you have to first change it to 0 and then delete the line (such options are currently persistent, but I will make them reset whenever verovio is called so that such options will not apply to a new different).

craigsapp commented 2 years ago

The first measure is correctly aligned, but then after that the following measures are incorrect:

Screen Shot 2022-03-05 at 1 25 52 AM

Removing the first measure causes the second measure to align properly:

Screen Shot 2022-03-05 at 1 38 25 AM

And removing the second measure causes the third one to align properly:

Screen Shot 2022-03-05 at 1 39 11 AM

Removing the barline between the first and second measures causes the second measure to be aligned correctly:

Screen Shot 2022-03-05 at 1 50 47 AM

Converting and displaying MEI data, which seems correct:

Screen Shot 2022-03-05 at 2 06 37 AM

Removing one of the <barLine> elements (from bottom staff) yields correct alignment of the second measure:

Screen Shot 2022-03-05 at 2 08 19 AM

So it seems to be a bug in verovio related to internally promoting of <barlines> into <measures> (which is needed for allowing system breaks in mensural music).

Here is the Humdrum test data:

**mens  **mens  **mens
*staff3 *staff2 *staff1
*Ivox   *Ivox   *Ivox
*I"Bassus   *I"Tenor    *I"Cantus
*clefC3 *clefC2 *clefG2
*M2/1   *M2/1   *M2/1
*k[]    *k[]    *k[]
*met(C|)    *met(C|)    *met(C|)
=1- =1- =1-
sir Sir sidd
sig .   Midd
.   .   Midd
=   =   =
Mig Sir sib
Mig .   .
Mie .   Micc
Mif .   Mia
=3  =3  =3
*-  *-  *-
Click to view MEI conversion ```xml </titleStmt> <pubStmt /> </fileDesc> <encodingDesc> <appInfo> <application isodate="2022-03-05T02:06:10" version="3.10.0-dev-8f3b9e0"> <name>Verovio</name> <p>Transcoded from Humdrum</p> </application> </appInfo> </encodingDesc> <workList> <work> <title /> </work> </workList> </meiHead> <music> <body> <mdiv xml:id="mthfjdy"> <score xml:id="spd0hnu"> <scoreDef xml:id="smlhged" midi.bpm="400.000000"> <staffGrp xml:id="szdnpod" symbol="bracket"> <staffDef xml:id="sqmbloz" n="1" notationtype="mensural.white" lines="5"> <label xml:id="label-L4F3">Cantus</label> <clef xml:id="clef-L5F3" shape="G" line="2" /> <keySig xml:id="keysig-L7F3" sig="0" /> <instrDef xml:id="i8ir96f" midi.instrnum="52" midi.instrname="Choir_Aahs" /> </staffDef> <staffDef xml:id="s15r9cx" n="2" notationtype="mensural.white" lines="5"> <label xml:id="label-L4F2">Tenor</label> <clef xml:id="clef-L5F2" shape="C" line="2" /> <keySig xml:id="keysig-L7F2" sig="0" /> <instrDef xml:id="ikdgrlp" midi.instrnum="52" midi.instrname="Choir_Aahs" /> </staffDef> <staffDef xml:id="serbcc9" n="3" notationtype="mensural.white" lines="5"> <label xml:id="label-L4F1">Bassus</label> <clef xml:id="clef-L5F1" shape="C" line="3" /> <keySig xml:id="keysig-L7F1" sig="0" /> <instrDef xml:id="iwbh7ij" midi.instrnum="52" midi.instrname="Choir_Aahs" /> </staffDef> </staffGrp> </scoreDef> <section xml:id="section-L1F1"> <staff xml:id="szbdh2g" n="1"> <layer xml:id="layer-L1F3N1" n="1"> <mensur xml:id="mensur-L8F3" prolatio="2" tempus="2" sign="C" slash="1" /> <note xml:id="note-L10F3" dur="semibrevis" oct="5" pname="d" /> <note xml:id="note-L11F3" dur="minima" oct="5" pname="d" /> <note xml:id="note-L12F3" dur="minima" oct="5" pname="d" /> <barLine xml:id="barline-L13F3" /> <note xml:id="note-L14F3" dur="semibrevis" oct="4" pname="b" /> <note xml:id="note-L16F3" dur="minima" oct="5" pname="c" /> <note xml:id="note-L17F3" dur="minima" oct="4" pname="a" /> <barLine xml:id="barline-L18F3" /> </layer> </staff> <staff xml:id="slqmqmo" n="2"> <layer xml:id="layer-L1F2N1" n="1"> <mensur xml:id="mensur-L8F2" prolatio="2" tempus="2" sign="C" slash="1" /> <rest xml:id="rest-L10F2" dur="brevis" /> <barLine xml:id="barline-L13F2" /> <rest xml:id="rest-L14F2" dur="brevis" /> <barLine xml:id="barline-L18F2" /> </layer> </staff> <staff xml:id="st6xcza" n="3"> <layer xml:id="layer-L1F1N1" n="1"> <mensur xml:id="mensur-L8F1" prolatio="2" tempus="2" sign="C" slash="1" /> <rest xml:id="rest-L10F1" dur="semibrevis" /> <note xml:id="note-L11F1" dur="semibrevis" oct="4" pname="g" /> <barLine xml:id="barline-L13F1" /> <note xml:id="note-L14F1" dur="minima" oct="4" pname="g" /> <note xml:id="note-L15F1" dur="minima" oct="4" pname="g" /> <note xml:id="note-L16F1" dur="minima" oct="4" pname="e" /> <note xml:id="note-L17F1" dur="minima" oct="4" pname="f" /> <barLine xml:id="barline-L18F1" /> </layer> </staff> </section> </score> </mdiv> </body> </music> </mei> ``` </details> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/WolfgangDrescher"><img src="https://avatars.githubusercontent.com/u/865594?v=4" />WolfgangDrescher</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <blockquote> <p>You are adding the barlines by hand, I see (since they are not there by default)</p> </blockquote> <p>Ah you mean the green ones in my screenshot. Yes I added them manually to show that the beginning of each bar is always in sync. Or did you mean <code>=2</code> etc. in humdrum? But I think this should be fine since I took pieces of the josquin-research-project as a template.</p> <p>Or is it more correct not to add bars with <code>=</code> in kern to keep it as close to the original source as possible and use something like the <code>mensural-to-measure</code> option instead? Although I could not get it running as wanted and I'm not even sure if this option is for this use case. But Verovio did not do line breaks without the bars anyway.</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> 2 years ago</strong> </div> <div class="markdown-body"> <blockquote> <p>But Verovio did not do line breaks without the bars anyway.</p> </blockquote> <p>Yes, Verovio will not try to do system breaks unless all parts have a <code><barLine></code> at the same time in mensural music. Internally, Verovio creates virtual <code><measures></code> for doing automatic system breaks.</p> <blockquote> <p>Ah you mean the green ones in my screenshot. Yes I added them manually to show that the beginning of each bar is always in sync. Or did you mean =2 etc. in humdrum? But I think this should be fine since I took pieces of the josquin-research-project as a template.</p> </blockquote> <p>It was the first case. It is interesting that the starting notes of each "measure" are aligned. When I see something like this:</p> <img width="141" alt="Screen Shot 2022-03-06 at 4 19 51 AM" src="https://user-images.githubusercontent.com/3487289/156922849-5f86f729-1d82-4c6c-881b-559cd644fb23.png"> <p>then I wonder if verovio is thinking that the whole note (semibreve) is perfect, since there are three minims (half-notes) being aligned with it in the other voice. We can see if @lpugin finds a problem with the encoding or in the source code for issue <a href="https://github.com/rism-digital/verovio/issues/2691">https://github.com/rism-digital/verovio/issues/2691</a>. The <code><mensur></code>:</p> <pre><code> <mensur xml:id="mensur-L8F3" modusmaior="2" modusminor="2" prolatio="2" tempus="2" sign="C" slash="1" /></code></pre> <p>has all of the divisions for each rhythmic level (all imperfect) which is implied by the Cut-C mensuration sign.</p> <hr /> <blockquote> <p>Or is it more correct not to add bars with = in kern to keep it as close to the original source as possible</p> </blockquote> <p>I would say that is bad to not add the barlines to the CMN versions of such scores. In the JRP scores, the barlines represent the breve cycle (which is close to the concept of meter and measures in CMN). And of course, verovio will not do system breaks without them, so you don't have a choice 😄 </p> <p>For a very diplomatic encoding you can hide the barlines (preserving their semantic meaning of the breve cycle in the data) with this shed filter:</p> <pre><code>!!!filter: shed -e "s/([^-]*)(?![\d-])/$1-/B"</code></pre> <p>(from issue <a href="https://github.com/humdrum-tools/verovio-humdrum-viewer/issues/564">https://github.com/humdrum-tools/verovio-humdrum-viewer/issues/564</a>)</p> <p>Also, to remove the barlines in Humdrum is easy (from the command-line, since I do not have a grep filter in VHV):</p> <pre><code>grep -v "^=" input.txt > output.txt</code></pre> <p>This will remove all of the lines starting with <code>=</code>, which means all barlines in Humdrum data.</p> <p>I have been meaning to create a tool called <code>rebar</code> (or <code>autobar</code>) which would automatically add barlines to a Humdrum scores that does not have it (or the measure barring needs to be changed to a different duration by deleting the old ones and then adding new ones).</p> <p>Another practical consideration is that it is easier to refer to a measure numbers rather than say the 15th note on the 23rd line of the music.</p> <hr /> <p>I see that <code>--mensural-to-measure</code> improves things:</p> <img width="870" alt="Screen Shot 2022-03-06 at 5 08 27 AM" src="https://user-images.githubusercontent.com/3487289/156924609-49fb0b59-a729-4f95-aeb8-ded42902fe86.png"> <p>But the alignment of the notes within the measure are still not right. </p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/WolfgangDrescher"><img src="https://avatars.githubusercontent.com/u/865594?v=4" />WolfgangDrescher</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>This issue can probably be closed since it seems to be fixed in <a href="https://github.com/rism-digital/verovio/issues/2691">https://github.com/rism-digital/verovio/issues/2691</a> (did not test it myself tough).</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> 2 years ago</strong> </div> <div class="markdown-body"> <p>I just compiled the fix for that issue. The alignment is much better, but there is still a problem with dotted notes. That is probably a problem with the <code>kern2mens</code> converter (I probably need to perfect the notes that are dotted).</p> <p>Current view:</p> <img width="1477" alt="Screen Shot 2022-03-16 at 4 13 15 PM" src="https://user-images.githubusercontent.com/3487289/158706574-d4259271-ce89-4a54-af14-e204f1f173eb.png"> <p>There is also a strange gap at the end of the first measure, but no alignment problem there.</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>