too much spacing after trailing grace notes

• Jan 25, 2015 - 05:13
Type
Functional
Severity
S4 - Minor
Status
closed
Project

I am using two "16th after" grace notes to create the trailing two-note turn commonly found at the end of trills. However, adding these grace notes into a measure creates a large amount of space to the right of the last grace note:
grace notes after-actual.png
...whereas it should look more like this:
grace notes after-expected.png

This is easy to reproduce by recreating this measure in a blank score. I am using MuseScore nightly ff2b92c on Kubuntu 14.04 64-bit.


Comments

See #15022: Grace after notes wrongly aligned

Unfortunately, this is a known limitation of the implementation. It's based on placing the grace notes a fixed distance away from the main note, and it works if the system is full enough that not much measure stretching is required, but in sparser scores, you end up with a lot of extra space. Hopefully at some point this situation can be improved.

As I stumbled on a score where I needed several after-chord grace notes, I tried to improve the situation. My goal is not to arrive at the ultimate algorithm, accounting for all the possible interactions between score elements, but at least to achieve reasonable results in the general cases; some manual tweaking may be needed in complex cases or in very tight layouts.

Currently I'm at a point where the current layout as in:

NOT FOUND: 1

and in:

NOT FOUND: 2

is improved into:

NOT FOUND: 3

and

NOT FOUND: 4

The second example is particularly evident; in the first the change is small, as the layout was already quite dense.

I decided to move the graces slightly at the left of the 'next' score element after the chord, leaving a note-to-barline distance if the next element is not another chord or a min-gracenote-distance otherwise. This positions the graces quite near to the next chord, much like as they were before-chord graces belonging to the next chord.

To my eyes, it looks reasonable. As there is still some work to do, any advice or suggestion is welcome.

Thanks,

M.

Sure looks like an improvement to me! I'm curious, though - are you actually deferring layout of the grace notes until the layout of the next chord? That was what I was assuming the solution would have to be when I looked at this a while ago, but I wasn't up for making that sort of change. Hmm, or maybe the stretch routines could be made to keep grace notes after with the next chord; I assume the stretch is where the etxra space is coming from. But even if so, the first solution makes more sense.

Deferring. The current code for layout in `Chord::layoutPitched()` now only reserves into the 'right space' of the chord the minimum room needed for the after-chord graces; their actual positioning is in `Chord::layout2()`, which is called after all segments of the system are 'placed'.