Voice misalignment under special circumstances

• Sep 27, 2019 - 07:51

Here's the scenario:
With a grand-staff (harp for instance, especially since this style of notation occurs often with that instrument)

Have three voices two on lower staff with one cross-staffing upward, and one on first voice on the treble. The treble clef will have half notes, the cross-staff 8th notes, and the bottom voice will be a whole tone.

What happens is that the cross staffed notes will be misaligned with the half notes above it. This only happens when there's a whole note involved down below


2.) If there were half notes instead down below, it works just fine, i.e.:

3.) Here the problem becomes more pronounced in the misalignment if the desire is to have these share the same voice and show only one note head (the stems are terribly aligned for this purpose upon the default outcome):

4.) otherwise, they work fine with e.g. half notes below:

The work around so far is to move the first 8th note over with a chord-offset about +0.3spacing, but offsetting the whole note in anyway does nothing to fix the issue, but it seems that this should all be automatic and not require such a customization...

How would this be fixed or described for someone to fix it not as a customized workaround but as a code fix? It might be easy, but it might be complicated related to the layout algorithms...

P.S., If the 8th notes here were in the second voice of the upper staff, the algorithm works just fine! So based upon how MS currently is, apparently it does matter from which staff one crosses over. Maybe there's a reason for this that's not being understood? Here's a gif showing a quick Exchange Voices 1-2 at the bottom to demonstrate that it fixes it. It's almost humorous to watch the misalignment occur and leave again:



There is special code to try to align notes of different widths by their centers rather than left-aligning them (whole notes are noticeably wider than other notes, and half notes are also slightly wider than the rest). I'm not really convinced this is necessary, but there was some discussion about this back in the day and this was decided on as most desirable. Anyhow, sometimes this code leads to unexpected effects, like this. I guess the centering code isn't working in an ideal way working with cross-staff notation. That's how I'd put it in a bug report - cross-staff notes are not correctly centered with whole notes on the source staff.

Luckily, there are actually is a better and much simpler workaround here (that also points to where this might need to be solved in the code, I think). The centering algorithm only kicks in for notes with opposite stem directions. If they have the same direction, we align them to their stems. What's happening here is that at the moment we need to decide on this centering, we don't know the stem direction of the cross-staff note (that doesn't get determined until later), but we are assuming based on the voice allocation that it will be up (and that's why the voice exchange alters the result).

So, the trick here is simple - select the whole note, click "X" to force its stem in the opposite direction! Even though there is of course no stem, the algorithm will now make the opposite determination regarding centering.

It's actually more complicated than that, but anyhow, try it, it works on this example at least.

Do you still have an unanswered question? Please log in first to post your question.