lilypond-user
[Top][All Lists]
Advanced

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

Re: custom noteheads


From: Tao Cumplido
Subject: Re: custom noteheads
Date: Sun, 30 Nov 2008 01:06:37 +0100

Yes. Thanks Neil, you're my man. =)

It'd have taken me ages to figure out that I have to use grob-property and 
'duration-log.
But I already thought that ly:make-duration was wrong.

Now I see it it makes sense and it was no problem to insert another custom 
stencil for whole and half notes.

Well, Scheme is still too complex for me.


-------- Original-Nachricht --------
> Datum: Sat, 29 Nov 2008 16:17:30 +0000
> Von: "Neil Puttock" <address@hidden>
> An: "Tao Cumplido" <address@hidden>
> CC: address@hidden
> Betreff: Re: custom noteheads

> Hi Tao,
> 
> 2008/11/29 Tao Cumplido <address@hidden>:
> 
> > Generally I thought I could define a music-function that overrides the
> stencil of a NoteHead depending on the car of ly:make-duration. So if it's
> <=1 it'll place a custom stencil for half and whole notes and if it's >=2
> for filled notes.
> > I hope that makes sense. I just don't know how to do this in lily.
> 
> If you're overriding the NoteHead stencil, you can access the property
> 'duration-log, which will tell you the duration of the current note.
> Then you can use case to set the stencil conditionally:
> 
> parallelogram =
> #(lambda (grob)
>   ; get duration log of NoteHead object
>   (let* ((dur (ly:grob-property grob 'duration-log)))
>     (case dur
>       ; if dur = minim, return parallelogram stencil
>       ((2)
>         (ly:make-stencil (list 'embedded-ps
>             "gsave
>             currentpoint translate
>             newpath
>             0 0.25 moveto
>             1.3125 0.75 lineto
>             1.3125 -0.25 lineto
>             0 -0.75 lineto
>             closepath
>             fill
>             grestore" )
>           (cons 0 1.3125)
>           (cons 0 0)))
>       ; otherwise, set to default print function
>       (else (ly:note-head::print grob)))))
> 
> Regards,
> Neil

-- 
Sensationsangebot nur bis 30.11: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a




reply via email to

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