On Wed, Jul 20, 2016 at 3:49 PM, David Nalesnik
<[email protected]> wrote:

>
> On Wed, Jul 20, 2016 at 10:05 AM, Mojca Miklavec
> <[email protected]> wrote:

>>
>> I would be super happy if there was a way to enter the input
>> information only once because repeating it twice is calling for
>> errors. But also because \startPush and \stopPush could then do
>> different things inside the main melody.
>>
>> The "\new Voice" could ignore the \startPush/\stopPush directives (or
>> do something special with them) and "\new Dynamics" could ignore
>> typesetting the actual musical notes. I don't know how much tweaking
>> of LilyPond internals would be needed to achieve that though.
>
> In this case, I believe you'd need to write another engraver.  It
> would listen for the push and pull events and do something different,
> like create the downbows or color notes.  No problem at all.

Just to demonstrate how you could make an engraver to create different
behavior, I wrote one to color note heads red.

Add this definition to accordion.ily:

accordionRedPushEngraver =
#(lambda (context)
   (let ((push? #f))
     (make-engraver
      (listeners ((accordion-push-span-event engraver event)
                  (if (= START (ly:event-property event 'span-direction))
                      (set! push? #t)
                      (set! push? #f))))
      (acknowledgers
       ((note-head-interface engraver grob source-engraver)
        (if push?
            (set! (ly:grob-property grob 'color) red)))))))

Then add the engraver in example.ly like this:

\new PianoStaff <<
  \new Staff <<
    \new Voice = "melody" \with { \consists \accordionRedPushEngraver } {
      \melody
    }

[snip]


Adding Scripts (downbows) looks a bit harder, but I suppose it could be done.

David N

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to