lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Guitar notation - scheme function for slurs with markup


From: Stefan E. Mueller
Subject: Guitar notation - scheme function for slurs with markup
Date: Sun, 29 May 2022 20:09:28 +0200 (CEST)

When notating guitar music, I use a slur with a markup to indicate
hammer-ons, pull-offs, slides or bendings, like in this example:

\new Staff {
e''8^(^\markup {\halign #-1.5 ho} f''8)
}

I'd like to define a scheme function for the slur and markup, such that I
can write

\new Staff {
e''8 \ho f''8
}

I tried

ho = #(define-scheme-function
       (music spacing)
       (ly:music? number?)
       #{
         {^(^\markup {\halign #-1.5 ho} $music )}
       #})

But this only displays the note and the markup text "ho", but not the
slur. Maybe I need to escape the many special characters, but my trials
did not work.

I'd also like to pass a second parameter "spacing" to horizontally
align the markup text on the slur. But if I substitute the "-1.5" in the
function with "$spacing", I get an "error: syntax error, unexpected REAL" when
I do

\new Staff {
e''8 \ho f''8 -1.5
}

By the way, would it be possible to have this second parameter optional,
e.g. to fall back to a default value in case it is
not given?).

I have just started to work with functions in Lilypond, and it maybe that
there are better solutions to this problem than using a scheme function,
but I am obviously struggling to get it working.

Any hint would be very much appreciated,

        Stefan

--
Stefan E. Mueller

stefan.e.mueller@gmx.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]