lilypond-user
[Top][All Lists]
Advanced

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

Re: change custom notehead for different stem direction


From: Lukas-Fabian Moser
Subject: Re: change custom notehead for different stem direction
Date: Wed, 8 Sep 2021 10:32:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

Hi Orm,

  for flute pizzicato in contemporary music, it is quite common to use
a ">" as a notehead. With a stem down, the ">" should be changed to a
"<" as visible in the attached png.

I know how to change the notehead by overriding the NoteHead stencil
with an eps file, but can't find any information about automatically
changing the glyph depending on stem direction. Is that possible in
lilypond and does anybody have advice?

It's cumbersome to do this by hand each time stem direction is
changed.

Unfortunately you didn't provide a working example, hence my cumbersome and ugly choice of > or < for "note-heads".

\version "2.22.0"

\relative
{
  \override NoteHead.stencil = #ly:text-interface::print
  \override NoteHead.text =
  #(lambda (grob)
     (let*
      ((notecolumn (ly:grob-parent grob X))
       (stem (ly:grob-object notecolumn 'stem))
       (direction (ly:grob-property stem 'direction)))
      (markup #:general-align
              Y CENTER
              (if (positive? direction) ">" "<"))))
  c'4 d e f g a b c d e f
}

Of course, one might adapt the general logic to either use glyphs better suited than ">"/"<", or even conditionally rotate/mirror _any_ note-head depending on the direction. (One might use grob-transformer for that.)

Lukas




reply via email to

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