Dear LilyPonders,

I don’t know if this has been discussed before (I tried to search for some 
threads, but it didn’t seem to cover this specific example…), but I have run 
into a curious case of Hairpin not being recognized as attached to a note when 
it is used in tandem with \tweak and \after, getting some warnings “Unattached 
CrescendoEvent” as well as “unterminated crescendo."

Here is a short code, in which the aim of the four examples is to change the 
color of the Hairpin to red. I have used \tweak and \after in different 
configurations:

%%% BEGIN %%%

\version "2.24.4"

{
 c'1 \tweak Hairpin.color #red   \<  c'1\f
}
{
 c'1 
 \tweak Hairpin.color #red 
 \< 
 \after 2. \! c'1 
}
{
\after 2. \!
 c'1 
 \tweak Hairpin.color #red %% comment/uncomment this line
 \< 
}
{
\once \override Hairpin.color = #red 
\after 2. \!  
c'1  \< 
}

%%% END %%%

...I have found it curious that when a note is sandwiched by \after and \tweak 
as in the third example, the Hairpin is not recognized as being attached to 
c’1. Rewriting it as the fourth example worked.

I ran into this situation as I was using my own flared hairpin that I brought 
to the attention of this thread several weeks ago 
(https://lists.gnu.org/archive/html/lilypond-user/2025-12/msg00215.html), which 
I was trying to use on a note that also had \after attached to it. 
Consequently, I had to come up with an alternative flared-hairpin code that 
uses the principle of the fourth example. (Werner, I have not yet followed 
through on creating an issue on GitLab on that (sorry!), but also I am glad I 
didn’t put up the code that doesn’t work in a case like this, frequency of 
which is probably higher than “rare.”)

I admit that while I have reread all the relevant documentation re: \tweak, 
\override, \once, \offset, etc., I might have missed some crucial point, or 
maybe I am relying on \tweak too much (!), but if there is a page/discussion 
thread I may have missed that covers this point, I’d be grateful if you can 
share. Otherwise, I thought to bring this to the community’s attention in the 
event someone else might benefit from it.

All the best,
Yoshi


-- -- --
Yoshiaki Onishi
https://github.com/yoshiakionishi/lilypond-snippets






Reply via email to