Printing sheet music consists of two non-trivial tasks. First, one has to master music notation: the science of knowing which symbols to use for what. Second, one has to master music engraving: the art of placing symbols such that the result looks pleasing.
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 (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 monstruous 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? Our solution is to make a strict distinction between notation, what symbols to use, and engraving, where to put them. Anything related to the second question is considered "engraving" (i.e. typography).
For tackling the first problem, notation, we have broken up the
problem into digestible (and programmable) chunks: every type of
symbol is handled by a separate program module, a so-called plug-in.
Each plug-in are completely modular and independent, so each can be
developed and improved separately. When put together, the plug-ins
can solve the music notation program in cooperation. People that put
graphics to musical ideas are called copyists or engravers, so by
analogy, each plug-in is also engraver
.
In the following example, we see how we start out with a note head 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 heads is seen, a stem
object is created, and attached 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 head, 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.
This page is for LilyPond-2.0.1 (stable-branch).