lilypond-user
[Top][All Lists]
Advanced

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

Re: Guitar notation - scheme function for slurs with markup


From: Stefan E. Mueller
Subject: Re: Guitar notation - scheme function for slurs with markup
Date: Sun, 29 May 2022 22:42:46 +0200 (CEST)

Hi Lukas,

many thanks for your quick answer. Obviously, things are more complex
than I thought.

Both of your solutions work for the problem, I tend to be more inclined
towards the second one. But I still have to understand better what is going
on here.

I am not sure yet what the difference between a scheme-function and a
music-function is (the second example seems to work whichever definition
is chosen). The "-" dash in my case added an (unwanted) accentuation to
the first note, I get the slur with the markup without the accent only if
I remove it (not sure what it is supposed to do - manual says it is a required
named direction indicator, but in my version 2.22.1 it doesn't work like that).

I thought the function-constructs were merely doing variable
substitutions, but it seems there is more to this. Because now I have the
problem how to describe several hammer-ons in a row with a function, like
this:

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

Ideally, I'd like to be able to write this like

e''8 \ho f''8 \ho g''8

(with the corresponding closing brackets also provided by the function,
but it may be that this is not possible).

        Stefan


--
Stefan E. Mueller

stefan.e.mueller@gmx.de

On Sun, 29 May 2022, Lukas-Fabian Moser wrote:

Hi Stefan,

please try to always give a compilable examle, otherwise people have to
collect your ideas from your mail bit by bit :).

You could use an event-function; these are made for postfix use (i.e. after
the respective note):

\version "2.22"

ho = #(define-event-function
       (spacing)
       (number?)
       #{
         -^(^\markup {\halign #spacing ho}
       #})

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

Note that I had to escape the -1.5 with #, this is expected for negative
numbers.

With this solution, the "spacing" parameter cannot be made optional. This can
be achieved by going back to music functions and putting the (optional)
spacing first:

\version "2.22"

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

\new Staff {
  e''8 \ho #-2.5 f''8 a'')
}

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

Here, I have used the "empty chord trick": <> is an empty chord that doesn't
take up time; any slurs and articulations attached to this chord will be
attached to the first bit of music coming after it.

I hope I didn't miss important parts of your question in my hurry :-).

Lukas





reply via email to

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