lilypond-user
[Top][All Lists]
Advanced

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

Re: Function for multiple tweaks


From: David Kastrup
Subject: Re: Function for multiple tweaks
Date: Thu, 24 Jan 2019 13:10:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Andrew Bernard <address@hidden> writes:

> I have many chords where a note is a harmonic. I use the following for the
> note inside the chord:
>
>   \tweak NoteHead.stencil  #ly:text-interface::print
>   \tweak NoteHead.font-size #1
>   \tweak NoteHead.text #(markup #:musicglyph "noteheads.s0mi")
>
> How can I make this into what I am tempted to call a macro (I know that is
> not lilypond terminology)?
>
> I have always been confused about the dash '-' used with tweak, and when to
> use it and when not to.

When in doubt, always when tweaking a post-event (which gets written
after a note).  It tells LilyPond that the context of the expression is,
well, a post-event.  Sometimes LilyPond can figure it out on its own
depending on what the expression is used for, sometimes it doesn't
matter.  But relying on either just makes your code less readable to you
and others.

> But my question is how to make this set of commands some osrt of
> function so I can just say \harmonicNote for example.
>
> Doing this does not work:
>
> harmonicNote = {
>   \tweak NoteHead.stencil  #ly:text-interface::print
>   \tweak NoteHead.font-size #1
>   \tweak NoteHead.text #(markup #:musicglyph "noteheads.s0mi")
> }
>
> I am aware this is Dumb Question of the week, but something is stopping me
> seeing the answer.

Do not ever use { } except for enclosing sequential music or markup
lists.  Braces have meaning.  With reasonably recent 2.19, you could
just write

harmonicNote =
  -\tweak NoteHead.stencil  #ly:text-interface::print
  -\tweak NoteHead.font-size #1
  -\tweak NoteHead.text #(markup #:musicglyph "noteheads.s0mi")
  \etc

Verbatim.

-- 
David Kastrup



reply via email to

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