Next: Adding articulation marks to notes, Previous: Music expressions explained, Up: Tutorial
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
>>
, as demonstrated here
<< \new Staff { \clef treble c'' } \new Staff { \clef bass c } >>
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. This ensures that each fragment
gets its own stave.
There are several types of contexts. Staff
, Voice
and
Score
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.
We can now typeset a melody with two staves
\relative << \new Staff { \time 3/4 \clef treble e'2 d4 c2 b4 a8[ a] b[ b] g[ g] a2. } \new Staff { \clef bass c,,2 e4 g2. f4 e d c2. } >>
For more information on contexts see the description in Interpretation contexts.
This page is for LilyPond-2.10.5 (stable-branch).
Other languages: French.
Using automatic language selection.