Extending LilyPond: 1.2.8 Internal music representation

### 1.2.8 Internal music representation

Internally, music is represented as a Scheme list. The list contains various elements that affect the printed output. Parsing is the process of converting music from the LilyPond input representation to the internal Scheme representation.

When a music expression is parsed, it is converted into a set of Scheme music objects. The defining property of a music object is that it takes up time. The time it takes up is called its duration. Durations are expressed as a rational number that measures the length of the music object in whole notes.

A music object has three kinds of types:

- music name: Each music expression has a name. For example, a note leads to a NoteEvent, and `\simultaneous` leads to a SimultaneousMusic. A list of all expressions available is in the Internals Reference manual, under Music expressions.
- ‘type’ or interface: Each music name has several ‘types’ or interfaces, for example, a note is an `event`, but it is also a `note-event`, a `rhythmic-event`, and a `melodic-event`. All classes of music are listed in the Internals Reference, under Music classes.
- C++ object: Each music object is represented by an object of the C++ class `Music`.

The actual information of a music expression is stored in properties. For example, a NoteEvent has `pitch` and `duration` properties that store the pitch and duration of that note. A list of all properties available can be found in the Internals Reference, under Music properties.

A compound music expression is a music object that contains other music objects in its properties. A list of objects can be stored in the `elements` property of a music object, or a single ‘child’ music object in the `element` property. For example, SequentialMusic has its children in `elements`, and GraceMusic has its single argument in `element`. The body of a repeat is stored in the `element` property of RepeatedMusic, and the alternatives in `elements`.

#### LilyPond — Extending v2.24.4 (stable-branch).