lilypond-essay: What symbols to engrave?

 
 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’.
 
      [image src="" alt="[image of music]" text="image of music"]
 
 Then a ‘Staff_symbol_engraver’ adds the staff,
 
      [image src="" alt="[image of music]" text="image of music"]
 
 the ‘Clef_engraver’ defines a reference point for the staff,
 
      [image src="" alt="[image of music]" text="image of music"]
 
 and the ‘Stem_engraver’ adds stems.
 
      [image src="" alt="[image of music]" text="image of music"]
 
 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.
 
      [image src="" alt="[image of music]" text="image of music"]
 
    This system works well for monophonic music, but what about
 polyphony?  In polyphonic notation, many voices can share a staff.
 
      [image src="" alt="[image of music]" text="image of music"]
 
    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.
 
      [image src="" alt="[image of music]" text="image of music"]
 
 
 See also
 ........
 
    Internals Reference: See(lilypond-internals)Contexts.