verovio
verovio copied to clipboard
Automatic stem direction for notes on the middle line of a staff.
It is customary for notes on the middle line of a staff to point upwards when there are lyrics below the staff. This is because it helps avoid collision with the lyrics. In addition, some early editions will by default place the stem up even for instrumental parts.
It would be useful to enhance verovio to allow for notes without stem directions (in a single-layer cases) to have an up-stem assigned to notes on the middle staff line.
One useful feature would be to automatically place stems up when there are lyrics associated with the staff.
Another useful feature would be to allow the default direction for middle-line notes be always placed up for all staves in the music. Such as --middle-staff-line-stem-up
(or something shorter). This would be to handle older rendering style.
Here is an example of this rule described in the Dorico documentation:
https://steinberg.help/dorico/v2/en/dorico/topics/notation_reference/notation_reference_stems_direction_c.html
The default stem direction depends on the instrument type. By default, the stems of notes on the middle lines of staves point downwards on instrumental staves and upwards on vocal staves, to avoid lyrics.
There are more complicated case to consider (in the future, for example): if the default would be down (or up) for the middle note, but the melodic context suggests going in the opposite direction from the default, or stems of notes within a beat or half-bar are made consistent for the middle line with other notes:
Behind Bars, p. 14:

Is there a convention for stem direction on the middle line of a staff below the lyrics (for example in a hymnal where soprano and alto are above and tenor and bass are below)? Would it be middle line up on the staff above and middle line down on the staff below?
I don't see much of that style where text is placed above the staff, but it would be interesting to examine music in that format (preferably with music printed before the use of computers) to see if there is a consistent rule being applied for mid-line note stems. Also it will depend on spacing. If the score is tightly spaces on the page, then moving the text close to the staff as possible would tend to have the middle-staff note have stem up. For scores which have a lot of space, the rule is less necessary since more space can be given between the staff and the lyrics.
Here is a good example of an older-style convention for stem up on the middle line:

https://www.digitale-sammlungen.de/de/view/bsb11116252?page=87
Looking on IMSLP at various vocal pieces, I see lots of different styles, even being inconsistent within one piece, or across different pieces in the same volume:
https://vmirror.imslp.org/files/imglnks/usimg/8/89/IMSLP89226-PMLP182830-Vocal_enchantress_1783_2.pdf#page=1

This edition seems to be using a variation on the Behind Bars rule on page 14. In this case it seems that the stem direction of the middle-line note matches an adjacent note before or after if it is a step away. This edition also has the text far away from the staff, so it does not affect the readability of the lyrics in any case, and the stems of the middle-line note are shortend by 1vu from the normal length, which also helps to avoid the lyrics if they were close to the staff.
Here is a case where the middle-line note's stem mostly goes up:
https://vmirror.imslp.org/files/imglnks/usimg/f/f6/IMSLP286163-PMLP464569-covoca00lond.pdf#page=12

But measure 3 has the stems go down for some unknown reason. And the first measure of the third system has the stems up which is otherwise contrary to the page 14 rule (the next measure has C5 which is a step higher, but the stems are up).
Here is a relatively old edition (1897) that seems to use the modern rule of stems down, and does not use the page-14 rule:
https://vmirror.imslp.org/files/imglnks/usimg/c/c6/IMSLP393200-PMLP52859-HWolf_Blumengruss_NMZ_1897_1.pdf

Here is a funny case where the typesetter did not care that the notes are touching the lyrics (particularly note the stem merging with the l
in the lyrics:
https://vmirror.imslp.org/files/imglnks/usimg/8/8c/IMSLP505264-PMLP90430-songsballadsofwe00bari_0_1.pdf#page=56

Here is an example of using the stem-up rule:
https://vmirror.imslp.org/files/imglnks/usimg/b/b0/IMSLP75263-PMLP151063-naumann_lehrstunde_klopstock.pdf#page=10

But the last middle-line note has stem down (perhaps due to the page-14 rule).
Here is a mid-17th century edition where the middle-line note is consistently stem up (except the last note of the piece):
https://vmirror.imslp.org/files/imglnks/usimg/e/e1/IMSLP619907-PMLP995827-Ghizzolo_G.,Madrigali_et_arie_per_sonare_et_cantare-Libro_primo(1609)_.pdf#page=8

Which I will point out to @lpugin that this is the common style for Tasso music 😉