### 1.3 What symbols to engrave?

The formatting process in LilyPond 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 change to express the innovations of contemporary notation. Hence, it encompasses some 500 years of music. Its applications range from monophonic melodies to monstrous counterpoint for large orchestras.

How can we get a grip on such a many-headed beast, and force it into the confines of a computer program? We have broken 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. People that translate musical ideas to graphic symbols are called copyists or engravers, so by analogy, each plug-in is called `engraver`.

In the following example, we see how 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. In polyphonic notation, many voices can share a staff. Similarly, more Staff contexts can be put into a single Score context

Read comments on this page, or add one. This page is for LilyPond-2.2.2 (stable-branch).