Extending LilyPond: 1.3.1 Displaying music expressions

### 1.3.1 Displaying music expressions

When writing a music function it is often instructive to inspect how a music expression is stored internally. This can be done with the music function `\displayMusic`

>     {
>       \displayMusic { c'4\f }
>     }

will display

>     (make-music
>       'SequentialMusic
>       'elements
>       (list (make-music
>               'EventChord
>               'elements
>               (list (make-music
>                       'NoteEvent
>                       'duration
>                       (ly:make-duration 2 0 1 1)
>                       'pitch
>                       (ly:make-pitch 0 0 0))
>                     (make-music
>                       'AbsoluteDynamicEvent
>                       'text
>                       "f")))))

By default, LilyPond will print these messages to the console along with all the other messages. To split up these messages and save the results of `\display{STUFF}`, redirect the output to a file.

>     lilypond file.ly >display.txt

With a bit of reformatting, the above information is easier to read,

>     (make-music 'SequentialMusic
>       'elements (list (make-music 'EventChord
>                         'elements (list (make-music 'NoteEvent
>                                           'duration (ly:make-duration 2 0 1 1)
>                                           'pitch (ly:make-pitch 0 0 0))
>                                         (make-music 'AbsoluteDynamicEvent
>                                           'text "f")))))

A `{ ... }` music sequence has the name `SequentialMusic`, and its inner expressions are stored as a list in its `'elements` property. A note is represented as an `EventChord` expression, containing a `NoteEvent` object (storing the duration and pitch properties) and any extra information (in this case, an `AbsoluteDynamicEvent` with a `"f"` text property.

Jiné jazyky: deutsch, español.

#### LilyPond — Extending