Re: Crescendo hairpin colliding with repeat bar line

Lukas-Fabian Moser <[email protected]>
Newsgroups gmane.comp.gnu.lilypond.general
Message-ID <[email protected]>
Hi,

Am 02.06.26 um 23:10 schrieb Werner LEMBERG:
>>>> Can anyone suggest a simple solution that stops the crescendo (and
>>>> decrescendo) haipins before the repeat bar line and works
>>>> globally? (I can manually adjust each hairpin, but I hope there is
>>>> some simpler solution).
> AFAICS this is a bug: The right side of the hairpin gets apparently
> aligned to the right side of the '|.:' compound barline, not taking
> into account the actual horizontal width of the compound bar line.

I'd agree that it would be nice if LilyPond would do this without us 
having to ask for it.

No idea whether this is reasonably documented (I'm exhausted from trying 
to understand the C++ source and too lazy to search the manual to boot), 
but there's a proper setting for this behaviour, namely 
Hairpin.endpoint-alignments. The default value is (LEFT . RIGHT): The 
left end of a hairpin is aligned to the LEFT edge of the bounding object 
on the left, the right end of a hairpin is aligned to the RIGHT edge of 
the bounding object on the right.

Now, by default, we have Hairpin.to-barline = ##t, which technically 
means the bounding object on the right is the BarLine grob. So, these 
facts together mean that the situation can be remedied locally by:

\once \override Hairpin.endpoint-alignments = #(cons LEFT LEFT)

I'm hesitant to advertise making this setting global in a score, since I 
expect this will change positioning of hairpins in a significant way. 
But what one could do is this:

\layout {
   \override Hairpin.endpoint-alignments =
   #(lambda (hairpin)
      (let ((right-bound (ly:spanner-bound hairpin RIGHT)))
        (if (and (grob::has-interface right-bound 'bar-line-interface)
                 (not (equal? (ly:grob-property right-bound 'glyph "|")
                              "|")))
            (cons LEFT LEFT)
            (cons LEFT RIGHT))))
}

This changes the alignment behaviour at the right end of all Hairpins 
that end at bar lines which are not "|".

Lukas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.