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: Jean Abou Samra
Subject: Re: Note head as a custom image chosen according to note duration
Date: Thu, 24 Nov 2022 10:22:25 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0

Hello,

I'm adding back the list in copy, please always use "Reply to all"
to include the list so that everyone can participate.


Le 24/11/2022 à 00:06, Jean Faure a écrit :
Hi, thanks a lot for all the clarifications. However, I wasn't precise. I would indeed prefer that the choice of the EPS file be dependent only on the original note shape. Thus, duration-log would be much more convenient.

But I do not know how to apply Aaron's optimization. Could you help me once more and give me the code which ignores duration variations like dots, which do not affect the original note's shape?


You would use it like this:

\version "2.22.2"

customHead = {
  \once \override NoteHead.stencil = #ly:text-interface::print
  \once \override NoteHead.text =
    #(lambda (grob)
       #{
          \markup \general-align #Y #CENTER
              #(case (ly:grob-property grob 'duration-log)
                 ;; whole note:
                 ((0) #{ \markup \epsfile #X #2 "custom1.eps" #})
                 ;; half note:
                 ((1) #{ \markup \epsfile #X #3 "custom2.eps" #})
                 ;; quarter note and shorter:
                 ((2) #{ \markup \epsfile #X #4 "custom4.eps" #}))
       #})
}

{
  \customHead c'1
  \customHead c'2
  \customHead c'4
  \customHead c'8
}



Note that my original suggestion also ignored dots. The difference
is that this one also treats quarter notes and shorter notes the
same (there is a note head full of ink with a stem in all those cases).

(Valentin: I use text-interface and \markup so it is obvious
how to make further transformation, like \with-color or such.)

Best,
Jean


Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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