What symbols to engrave? (Essay on automated music engraving)

#### What symbols to engrave?

The formatting process decides where to place symbols. However, this can only be done once it is decided what symbols should be printed – in other words, what notation to use.

Common music notation is a system of recording music that has evolved over the past 1000 years. The form that is now in common use dates from the early Renaissance. Although the basic form (i.e., note heads on a 5-line staff) has not changed, the details still evolve to express the innovations of contemporary notation. Hence, common music notation encompasses some 500 years of music. Its applications range from monophonic melodies to monstrous counterpoints for a large orchestra.

How can we get a grip on such a seven-headed beast, and force it into the confines of a computer program? Our solution is to break up the problem of notation (as opposed to engraving, i.e., typography) into digestible and programmable chunks: every type of symbol is handled by a separate module, a so-called plug-in. Each plug-in is completely modular and independent, so each can be developed and improved separately. Such plug-ins are called `engraver`s, by analogy with craftsmen who translate musical ideas to graphic symbols.

In the following example, we start out with a plug-in for note heads, the `Note_heads_engraver`.

Then a `Staff_symbol_engraver` adds the staff,

the `Clef_engraver` defines a reference point for the staff,

and the `Stem_engraver` adds stems.

The `Stem_engraver` is notified of any note head coming along. Every time one (or more, for a chord) note head is seen, a stem object is created and connected to the note head. By adding engravers for beams, slurs, accents, accidentals, bar lines, time signature, and key signature, we get a complete piece of notation.

This system works well for monophonic music, but what about polyphony? In polyphonic notation, many voices can share a staff.

In this situation, the accidentals and staff are shared, but the stems, slurs, beams, etc., are private to each voice. Hence, engravers should be grouped. The engravers for note heads, stems, slurs, etc., go into a group called ‘Voice context’, while the engravers for key, accidental, bar, etc., go into a group called ‘Staff context’. In the case of polyphony, a single Staff context contains more than one Voice context. Similarly, multiple Staff contexts can be put into a single Score context. The Score context is the top level notation context.

#### See also

Internals Reference: Contexts.

#### Essay on automated music engraving v2.26.0 (stable-branch).

- 1 Music engraving
  - 1.1 The LilyPond story
  - 1.2 Engraving details
    - Music fonts
    - Optical spacing
    - Ledger lines
    - Optical sizing
    - Why work so hard?
  - 1.3 Automated engraving
    - Beauty contests
    - Improvement by benchmarking
    - Getting things right
  - 1.4 Building software
    - Music representation
    - What symbols to engrave?
    - Flexible architecture
  - 1.5 Putting LilyPond to work
  - 1.6 Engraved examples (BWV 861)
- 2 Literature list
  - 2.1 Short literature list
  - 2.2 Long literature list
- Appendix A GNU Free Documentation License
- Appendix B Index