lilypond-user
[Top][All Lists]
Advanced

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

Re: Note head as a custom image chosen according to note duration


From: Aaron Hill
Subject: Re: Note head as a custom image chosen according to note duration
Date: Mon, 21 Nov 2022 15:31:25 -0800

On 2022-11-21 3:13 pm, Valentin Petzel wrote:
The duration of the NoteHead is not in fact a property of the grob, but of the music event that leads to creation of the grob, accessible from the grob by the "cause"-property. Thus
Jean uses

(ly:event-property (event-cause grob) 'duration)

to get the duration of the note head and then uses different markups for different values.

But NoteHead has a duration-log property ready to go:

%%%%
\version "2.22.0"

\layout {
  \override Voice.NoteHead.stencil =
  #(grob-transformer 'stencil
    (lambda (grob orig)
      (grob-interpret-markup grob  #{
        \markup
        \with-dimensions-from \stencil $orig
        \overlay {
          \raise #1.25
          #(number->string
            (ly:grob-property grob 'duration-log))
          \stencil $orig
        }
      #})))
}
{ 1 2 4. 8 }
%%%%


-- Aaron Hill

Attachment: duration-log.cropped.png
Description: PNG image


reply via email to

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