Let’s take a look at what’s happening here:

if we add
\override Score.SpacingSpanner.common-shortest-duration =
#(grob-transformer 'common-shortest-duration
                   (lambda (grob orig) (display orig) (newline) orig))

at the beginning we will have the value of common-shortest duration ouput. For 
1-1 this is 1/32, for 1-4 this is 1/8. To understand why this is happening you 
need to understand how Lilypond calculates the common-shortest duration. 
Basically Lilypond takes the smallest duration for each measure, and then 
counts for each one how many measures have it as smallest duration. Then 
Lilypond simply finds the duration with the highest count and returns the 
minimum of that one and base-shortest duration.

Now this algorithm is kind of unstable. In your case you have many measures 
with 1/8th notes as shortest duration and many measures with 1/32nd notes as 
shortest duration. So if you have slightly more measures of the first type you 
will get the dense result, if you have slightly more of the second type you 
get the wide result.

So in some sense this is "working as intended", it is just that the algorithm 
for common-shortest-duration is probably not optimal. It might be better to 
take some sort of weighted average, which would be much more stable in such 
situations. I’ll do some experimenting for this.

Cheers,
Valentin

Am Freitag, 18. März 2022, 10:39:10 CET schrieb Richard Shann:
> Attached are two scores which have quite similar music in them but
> LilyPond typesets one them with about twice as much horizontal space as
> the other.
> The documentation gives an overview of the algorithm for horizontal
> spacing but eyeballing this music I can't see any shortest-note
> differences that could trigger this.
> Any idea what might be going on?
> 
> Richard Shann

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to