Extending LilyPond: 2.3.2 Running a function on all layout objects

### 2.3.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:

- the layout object itself,
- the context where the layout object was created, and
- the context where `\applyOutput` is processed.

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
>     }

Más nyelvek: deutsch, español.

#### LilyPond — Extending