2.6.2 Running a function on all layout objects

The most versatile way of tuning an object is \applyOutput which works by inserting an event into the specified context ( ApplyOutputEvent). Its syntax is

\applyOutput context proc

where proc is a Scheme function, taking three arguments.

When interpreted, the function proc is called for every layout object found in the context context at the current time step, with the following arguments:

In addition, the cause of the layout object, i.e., the music expression or object that was responsible for creating it, is in the object property cause. For example, for a note head, this is a NoteHead event, and for a stem object, this is a Stem object.

Here is a function to use for \applyOutput; it blanks note-heads on the center-line and next to it:

#(define (blanker grob grob-origin context)
   (if (and (memq 'note-head-interface (ly:grob-interfaces grob))
            (< (abs (ly:grob-property grob 'staff-position)) 2))
       (set! (ly:grob-property grob 'transparent) #t)))

\relative c' {
  a'4 e8 <<\applyOutput #'Voice #blanker a c d>> b2
}

[image of music]


他の言語: deutsch, español, français
About automatic language selection.

LilyPond — Extending

inserted by FC2 system