![]() |
GNU LilyPond-- -- |
||||||||||
|
A piano excerptOur eighth subject is a piece of piano music. The fragment in the
input file is a piano reduction of the G major Sinfonia by Giovanni
Battista Sammartini, composed around 1740. It's in the source
package under the name \version "1.7.6" \include "paper16.ly" viola = \notes \relative c' \context Voice = viola { <<c g' c>>4-\arpeggio \voiceTwo g'8. b,16 s1 s2. r4 g } oboes = \notes \relative c'' \context Voice = oboes { \voiceOne s4 g8. b,16 c8 r <<e' g>>8. <<f a>>16 \grace <<e g>>8-( <<d f>>4-) <<c e>>2 \times 2/3 { <<d f>>8 <<e g>> <<f a>> } < { \times 2/3 { a8 g c } c2 } \\ { f,8 e e2 } > \grace <<c, e>>8-( <<b d>>8.-)-\trill <<c e>>16 | [<<d f>>-( <<f a>>8.-)] <<b, d>>8 r [<<d f>>16-( <<f a>>8.-)] <<b, d>>8 r | [<<c e>>16-( <<e g>>8.-)] <<c e,>>8 } hoomPah = \repeat unfold 8 \notes \transpose c c { \translator Staff = down \stemUp c8 \translator Staff = up \stemDown c'8 } bassvoices = \notes \relative c' { c4 g8. b,16 \context Voice \hoomPah \translator Staff = down \stemBoth [c8 c'8] r4 <<g d'>> r4 < { r2 <<e c'>>4 <<c g'>>8 } \\ { g2-~ | g4 c8 } > } \score { \context PianoStaff \notes < \context Staff = up < \oboes \viola > \context Staff = down < \time 2/2 \clef bass \bassvoices > > \midi { } \paper { indent = 0.0 linewidth = 15.0 \cm } } %% new-chords-done %%
As you can see, this example features multiple voices on one staff. To make room for those voices, their notes should be stemmed in opposite directions. LilyPond includes the identifiers viola = \notes \relative c' \context Voice = viola {In this example you can see multiple parts on a staff. Each part is associated with one notation context. This notation context handles stems and dynamics (among other things). The type name of this context is Voice . For each part we have to make sure that there is
precisely one Voice context, so we give it a unique name
(`viola ').
<<c g' c>>4-\arpeggioThe delimiters << and >> enclose the pitches of a chord.
\arpeggio typesets an arpeggio sign (a wavy vertical line)
before the chord.
\voiceTwo We want the viola to have stems down, and have all the other
characteristics of a second voice. This is enforced using the
g'8. b,16Relative octaves work a little differently with chords. The starting point for the note following a chord is the first note of the chord. So the g gets an octave up quote: it is a fifth above the starting
note of the previous chord (the central C).
s1 s2. r4 s is a spacer rest. It does not print anything, but it does have
the duration of a rest. It is useful for filling up voices that
temporarily don't play. In this case, the viola doesn't come until one
and a half measure later.
oboes = \notes \relative c'' \context Voice = oboe {Now comes a part for two oboes. They play homophonically, so we print the notes as one voice that makes chords. Again, we insure that these notes are indeed processed by precisely one context with \context .
\voiceOne s4 g8. b,16 c8 r <<e' g>>8. <<f a>>16 The oboes should have stems up to keep them from interfering with
the staff-jumping bass figure. To do that, we use \grace <<e g>>-( <<d f>>4-) <<c e>>2 \grace introduces grace notes. It takes one argument, in this
case a chord. A slur is introduced starting from the \grace
ending on the following chord.
\times 2/3Tuplets are made with the \times keyword. It takes two
arguments: a fraction and a piece of music. The duration of the piece
of music is multiplied by the fraction. Triplets make notes occupy 2/3
of their notated duration, so in this case the fraction is 2/3.
{ <<d f>>8 <<e g>> <<f a>> }The piece of music to be `tripletted' is sequential music containing three chords. <At this point, the homophonic music splits into two rhythmically different parts. We can't use a sequence of chords to enter this, so we make a "chord of sequences" to do it. We start with the upper voice, which continues with upward stems: { \times 2/3 { a8 g c } c2 } \\The easiest way to enter multiple voices is demonstrated here. Separate the components of the voice (single notes or entire sequences) with \\ in a simultaneous music expression. The
\\ separators split first voice, second voice, third voice, and
so on.
As far as relative mode is concerned, the previous note is the
f,8 e e2 } >This ends the two-part section. \stemBoth \grace <<c, e>>8-( <<b d>>8.-\trill <<c e>>16 |
The bass has a little hoom-pah melody to demonstrate parts switching between staves. Since it is repetitive, we use repeats: hoomPah = \repeat unfold 8The unfolded repeat prints the notes in its argument as if they were written out in full eight times. \notes \transpose c' { Transposing can be done with The purpose of this no-op is to protect it from being interpreted as
relative notes. Relative mode can not be used together with
transposition, so \translator Staff = down \stemUp c8 \translator Staff = up \stemDown c'8 }Voices can switch between staves. Here you see two staff switching commands. The first one moves to the lower staff, the second one to the lower one. If you set the stem directions explicitly (using the identifiers \stemUp and \stemDown , the notes
can be beamed together (despite jumping between staffs).
bassvoices = \notes \relative c' { c4 g8. b,16 \autochange Staff \hoomPah \context Voice \translator Staff = downWe want the remaining part of this melody on the lower staff, so we do a manual staff switch here. \context Voice = reallyLow {\stemDown g2-~ | g4 c8 } >After skipping some lines, we see ~ . This mark makes ties. Note
that ties and slurs are different things. A tie can only connect two
note heads of the same pitch, whereas a slur can connect many notes
with one curve.
\context PianoStaffA special context is needed to get cross staff beaming right. This context is called PianoStaff .
\context Staff = bottom < \time 2/2 \clef bassThe bottom staff must have a different clef. indent = 0.0To make some more room on the line, the first (in this case the only) line is not indented. The line still looks very cramped, but that is due to the page layout of this document. |
||||||||||
Go back to index of LilyPond.
Please send GNU LilyPond questions and comments to lilypond-user@gnu.org. Please send comments on these web pages to (address unknown) Copyright (c) 1997--2002 Han-Wen Nienhuys and Jan Nieuwenhuizen. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. |
This page was built from LilyPond-1.7.14 (development-branch) by