[ << Common notation ] | [Top][Contents][Index] | [ Fundamental concepts >> ] |
[ < Simultaneous music expressions single staff ] | [ Up : Multiple notes at once ] | [ Staff groups > ] |
3.2.2 Multiple staves
LilyPond input files are constructed out of music expressions (see Music expressions explained). If the score begins with simultaneous music expressions, LilyPond creates multiples staves. However, it is easier to see what happens if we create each staff explicitly.
To print more than one staff, each piece of music that makes up a
staff is marked by adding \new Staff
before it. These
Staff
elements are then combined in parallel with <<
and >>
:
<< \new Staff { \clef treble c''4 } \new Staff { \clef bass c4 } >>
The command \new
introduces a ‘notation context’. A
notation context is an environment in which musical events (like
notes or \clef
commands) are interpreted. For simple
pieces, such notation contexts are created automatically. For
more complex pieces, it is best to mark contexts explicitly.
There are several types of contexts. Score
, Staff
,
and Voice
handle melodic notation, while Lyrics
sets
lyric texts and ChordNames
prints chord names.
In terms of syntax, prepending \new
to a music expression
creates a bigger music expression. In this way it resembles the
minus sign in mathematics. The formula (4+5) is an
expression, so -(4+5) is a bigger expression.
Time signatures entered in one staff affect all other staves by default. On the other hand, the key signature of one staff does not affect other staves. This different default behavior is because scores with transposing instruments are more common than polyrhythmic scores.
<< \new Staff { \clef treble \key d \major \time 3/4 c''4 } \new Staff { \clef bass c4 } >>
[ << Common notation ] | [Top][Contents][Index] | [ Fundamental concepts >> ] |
[ < Simultaneous music expressions single staff ] | [ Up : Multiple notes at once ] | [ Staff groups > ] |