Hello Pondmates! In Lilypond we have this wonderful but weird sugar function `grob- transformer`. While this thing is nice it is also a bit awkward. For one thing it requires specification of *what* is transformed (for else it does not know that information. For another thing it adds a lot of scheme boilerplate, making score less transparent.
I’ve been thinking we could quite simply facilitate usuage by wrapping this in
a music function like this:
%%%
transform =
#(define-music-function (path proc)
(symbol-list? procedure?)
#{
\override #path =
#(grob-transformer (last path) proc)
#})
%%%
This will more or less mirror the interface of `\override path = callback` by
a `\transform path transformer`. This way we can nicely write something like
this:
%%%
{
\temporary\transform NoteHead.stencil
#(lambda (grob orig) (ly:stencil-in-color orig "red"))
\temporary\transform NoteHead.stencil
#(lambda (grob orig) (ly:stencil-scale orig 2 2))
4 4 4 4
}
%%%
which I think is much more concise than
%%%
{
\temporary\override NoteHead.stencil =
#(grob-transformer
'stencil
(lambda (grob orig) (ly:stencil-in-color orig "red")))
\temporary\override NoteHead.stencil =
#(grob-transformer
'stencil
(lambda (grob orig) (ly:stencil-scale orig 2 2)))
4 4 4 4
}
%%%
and would thus make using this feature more accessible and scores nicer to
look at.
So I would like to ask what is your take, and if we maybe should include such
an interface into Lilypond.
Cheers,
Tina
signature.asc
Description: This is a digitally signed message part.
