[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: triangle noteheads
From: |
Thomas Morley |
Subject: |
Re: triangle noteheads |
Date: |
Mon, 9 Jun 2014 22:42:08 +0200 |
2014-06-09 21:01 GMT+02:00 Nick Didkovsky <address@hidden>:
> Dear Lilypond users,
>
> A brief followup question regarding this technique of assigning noteheads.
>
> I am using the notehead glyph technique to set noteheads, but have run into
> trouble trying to change noteheads within a chord.
> Continuing with the cowbell example code that Fredrik originally sent me
> below, the following does not set the notehead of 'g' in this chord to a
> triangle...
> < c e \cowbell g >
> ...all three notes show regular noteheads.
>
> If someone can illuminate how to set noteheads within a chord, I'd
> appreciate it!
>
> Best regards,
> Nick Didkovsky
>
>
> On 5/15/14 6:55 PM, Fredrik Wallberg wrote:
>>
>> Hi Nick,
>>
>> you'll find more noteheads here:
>> http://www.lilypond.org/doc/v2.19/Documentation/notation/the-feta-font#shape_002dnote-notehead-glyphs.
>>
>> This snippet by Victor Adan shows how to use them in a score:
>> http://lsr.di.unimi.it/LSR/Snippet?id=475.
>>
>> An example:
>>
>> cowbell = {
>> \once \override NoteHead.stencil = #ly:text-interface::print
>> \once \override NoteHead.text = #(markup #:musicglyph
>> "noteheads.d2doThin")
>> }
>>
>> {
>> \cowbell
>> c''4
>> }
>>
>> / Fredrik
Basically you need a tweak not an override to affect single NoteHeads
in a chord.
Though why not have all in one?
\version "2.18.0"
#(define (new-head type)
(lambda (grob)
(let* ((duration (ly:grob-property grob 'duration-log))
(head (format #f "noteheads.d~a~a" duration type))
(stil (ly:font-get-glyph
(ly:grob-default-font grob)
head)))
(if (ly:stencil-empty? stil)
(begin
(ly:warning "Unknown NoteHead: ~a, ignoring." head)
(ly:note-head::print grob))
stil))))
myHead =
#(define-music-function (parser location music)(ly:music?)
(if (music-is-of-type? music 'event-chord)
#{
\override NoteHead.stencil = #(new-head "doThin")
#music
#}
#{
\tweak NoteHead.stencil #(new-head "doThin")
#music
#}))
\relative c' {
\myHead
c2
\myHead
<c e g>4
<
c
\myHead
e
\myHead
\tweak duration-log #1
g
>4
}
HTH,
Harm
Though, Harm's Lilypedia is closed now for every request without
version and tiny, compilable example-code.