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
683 stars 185 forks source link

Unwanted horizontal shift with section @restart at system beginnings #2710

Closed wergo closed 2 years ago

wergo commented 2 years ago

Following the wonderful implementation of section @restart in #2316 (Verovio 3.6), I have adapted the encoding of Beethoven WoO64.

When a section @restart occurs at a system beginning, the staff is unexpectedly shifted sideways so that it looses contact with the staff group line and brace (starting of Var. I and Var II.). When it occurs in the middle of a system, everything works fine (Var. III).

Example encoding: https://github.com/trompamusic-encodings/Beethoven_WoO64_BreitkopfHaertel/blob/master/Beethoven_WoO64-Breitkopf.mei

This unwanted behavior started with Verovio 3.7 and is still so (screenshot from Verovio comparison page with {"breaks": "encoded"} as additional option):

Bildschirmfoto 2022-03-14 um 10 22 44

Verovio 3.6 handles this correctly:

Bildschirmfoto 2022-03-14 um 10 24 29

There have been some activity on this, probably related to this regression: #2487, #2549, #2598.

Same effect is visible also in the test-suite example: https://www.verovio.org/test-suite.xhtml?cat=section https://github.com/rism-digital/verovio.org/edit/gh-pages/_tests/section/section_001.mei

craigsapp commented 2 years ago

Also, Cautionary key and time signatures at the end of the previous variation should not be needed? This seems quite ugly and redundant:

Screen Shot 2022-03-14 at 2 54 28 AM
wergo commented 2 years ago

This is true, these would not be necessary in this example. Are there example where those cautionary signatures are needed?

lpugin commented 2 years ago

Inspired by this (ugly) example https://github.com/rism-digital/verovio/issues/1262#issue-550300604 😃

lpugin commented 2 years ago

(cautionary key and time signature will be shown only if given in the <scoreDef>. If they are not changing, there is no reason to repeat them)

craigsapp commented 2 years ago

Inspired by this (ugly) example https://github.com/rism-digital/verovio/issues/1262#issue-550300604 😃

Yes very ugly 😉 although I notice that the cautionary common-time meter sign is not needed.

(cautionary key and time signature will be shown only if given in the . If they are not changing, there is no reason to repeat them)

What are you implying by this? (Common-time being shown?)


It would be useful to have a verovio option to suppress cautionary accidentals/clefs/time signatures at such boundaries between sections, since this could be a style thing.

JRP uses a different layout for similar multi-section works, where there is a system break, and then an indentation plus repeat of instrument names as well as a restatement of all key/time/meter signatures regardless of if they have changed (which would be controlled by a new staff/system def).

https://josquin.stanford.edu/cgi-bin/jrp?a=notationEditText&f=Jos0602a

Screen Shot 2022-03-14 at 9 24 32 AM

In verovio, I currently do not do a linebreak (but maybe I will try the style of the Beethoven variations):

https://verovio.humdrum.org/?file=https://raw.githubusercontent.com/josquin-research-project/Jos/master/Jos0602a-Missa_Lhomme_arme_sexti_toni-Kyrie.krn

N.B.: A Mass usually consists of 5 "movements": kyrie, gloria, credo, sanctus, and agnus dei. The kyrie (almost) always has three sections: Kyrie I, Christe, and Kyrie II.

So related to all of this, I can think of adding two feature requests:

lpugin commented 2 years ago

If there is a section restart but the time signature and the key signature remain the same as before, you should not put them in the scoreDef (because there is no change):

<score>
   <scoreDef>
      <staffGrp>
         <staffGrp bar.thru="true" symbol="brace" n="1">
            <label>Thema</label>
            <instrDef midi.channel="0" midi.instrnum="0" midi.volume="78.00%" />
            <staffDef n="1" lines="5" ppq="24">
               <clef shape="G" line="2" />
               <keySig sig="1f" />
               <meterSig count="4" sym="common" unit="4" />
            </staffDef>
            <staffDef n="2" lines="5" ppq="24">
               <clef shape="F" line="4" />
               <keySig sig="1f" />
               <meterSig count="4" sym="common" unit="4" />
            </staffDef>
         </staffGrp>
      </staffGrp>
   </scoreDef>
   <section>
      ...
   </section>
   <section restart="true" label="var-I">
      <scoreDef>
         <staffGrp>
            <staffGrp n="1">
               <label>Var I</label>
               <staffDef n="1" lines="5" />
               <staffDef n="2" lines="5" />
               <grpSym symbol="brace" />
            </staffGrp>
         </staffGrp>
      </scoreDef>
      ...
   </section>
</score>
image
rettinghaus commented 2 years ago

I would recognize the Kyrie as "one movement consisting of three movements". So encode it like

<mdiv label="Kyrie">
  <mdiv label="Kyrie I" />
  <mdiv label="Christe" />
  <mdiv label="Kyrie II" />
</mdiv>
craigsapp commented 2 years ago

Perhaps, but it is also close to the idea of theme and variations, which is being encoded as section@restart="true".

Multiple mdivs are now allowed in verovio? And nested mdivs as you are suggesting as well? That encoding method is closer to the rendering style that is wanted for JRP masses rather than the section@restart="true" current style (but I think either one would work).

wergo commented 2 years ago

Thanks @DavidBauer1984 a lot for fixing this so quickly! Works great.

wergo commented 2 years ago

Multiple mdivs are now allowed in verovio?

This is probably a new issue to start.

@craigsapp Multiple mdivs are supported by Verovio since #2347. However, as far as I understood, a new mdiv would always start with a new system/line, so the WoO64 example above with the inside-system break at Var. III would not work.

I don't know about multiple hierarchical mdivs. Have they been used in encodings already?

craigsapp commented 2 years ago

a new mdiv would always start with a new system/line, so the WoO64 example above with the inside-system break at Var. III would not work.

That is probably why @rettinghaus suggested it, as JRP prefers to break the system at a new section (but that is partly related to not having the Var. III style breaks which should also work (but I am wondering what happens when the number of staves changes at the break).

lpugin commented 2 years ago

@wergo

I don't know about multiple hierarchical mdivs

That should work already.

@craigsapp

but I am wondering what happens when the number of staves changes at the break.

That will not work with a section restart. You should have distinct mdivs for that. Each mdiv (actually each score) will be rendered in a distinct system, including with --breaks none. See https://www.verovio.org/test-suite.xhtml?cat=mdiv