09.09.2013 Views

LilyPond Beginnershandleiding

LilyPond Beginnershandleiding

LilyPond Beginnershandleiding

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Hoofdstuk 3: Fundamentele concepten 60<br />

<br />

<br />

The input is rather sparse, but in the output, bar lines, accidentals, clef, and time signature<br />

have been added. When <strong>LilyPond</strong> interprets the input the musical information is parsed from left<br />

to right, similar to the way a performer reads the score. While reading the input, the program<br />

remembers where measure boundaries are, and which pitches require explicit accidentals. This<br />

information must be held on several levels. For example, an accidental affects only a single staff,<br />

while a bar line must be synchronized across the entire score.<br />

Within <strong>LilyPond</strong>, these rules and bits of information are grouped in Contexts. We have<br />

already introduced the Voice context. Others are the Staff and Score contexts. Contexts are<br />

hierarchical to reflect the hierarchical nature of a musical score. For example: a Staff context<br />

can contain many Voice contexts, and a Score context can contain many Staff contexts.<br />

Each context has the responsibility for enforcing some notation rules, creating some notation<br />

objects and maintaining the associated properties. For example, the Voice context may introduce<br />

an accidental and then the Staff context maintains the rule to show or suppress the accidental<br />

for the remainder of the measure.<br />

As another example, the synchronization of bar lines is, by default, handled in the Score<br />

context. However, in some music we may not want the bar lines to be synchronized – consider a<br />

polymetric score in 4/4 and 3/4 time. In such cases, we must modify the default settings of the<br />

Score and Staff contexts.<br />

For very simple scores, contexts are created implicitly, and you need not be aware of them.<br />

For larger pieces, such as anything with more than one staff, they must be created explicitly<br />

to make sure that you get as many staves as you need, and that they are in the correct order.<br />

For typesetting pieces with specialized notation, it is usual to modify existing, or even to define<br />

totally new, contexts.<br />

In addition to the Score, Staff and Voice contexts there are contexts which fit between the<br />

score and staff levels to control staff groups, such as the PianoStaff and ChoirStaff contexts.<br />

There are also alternative staff and voice contexts, and contexts for lyrics, percussion, fret boards,<br />

figured bass, etc.<br />

The names of all context types are formed from one or more words, each word being capitalized<br />

and joined immediately to the preceding word with no hyphen or underscore, e.g.,<br />

GregorianTranscriptionStaff.<br />

Zie ook<br />

Notation Reference: Sectie “Contexts explained” in Notatie-handleiding.<br />

3.3.2 Creating contexts<br />

In an input file a score block, introduced with a \score command, contains a single music expression<br />

and an associated output definition (either a \layout or a \midi block). The Score<br />

context is usually left to be created automatically when the interpretation of that music expression<br />

starts.<br />

For scores with only one voice and one staff, the Voice and Staff contexts may also be left<br />

to be created automatically, but for more complex scores it is necessary to create them by hand.<br />

The simplest command that does this is \new. It is prepended to a music expression, for example

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!