1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond-learning.tely
4 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
6 When revising a translation, copy the HEAD committish of the
7 version that you are working on. See TRANSLATION for details.
10 @node Putting it all together
11 @chapter Putting it all together
13 This chapter discusses general LilyPond concepts and how to
14 create @code{\score} blocks.
18 * Extending the templates::
19 * An orchestral part::
23 @node Extending the templates
24 @section Extending the templates
26 You've read the tutorial, you know how to write music. But how can you
27 get the staves that you want? The templates are ok, but what if you
28 want something that isn't covered?
30 Start off with the template that seems closest to what you want to end
31 up with. Let's say that you want to write something for soprano and
32 cello. In this case, we would start with @q{Notes and lyrics} (for the
37 melody = \relative c' @{
55 \new Lyrics \lyricsto "one" \text
62 Now we want to add a cello part. Let's look at the @q{Notes only} example:
66 melody = \relative c' @{
81 We don't need two @code{\version} commands. We'll need the @code{melody}
82 section. We don't want two @code{\score} sections -- if we had two
83 @code{\score}s, we'd get the two parts separately. We want them together,
84 as a duet. Within the @code{\score} section, we don't need two
85 @code{\layout} or @code{\midi}.
87 If we simply cut and paste the @code{melody} section, we would end up with
88 two @code{melody} sections. So let's rename them. We'll call the section
89 for the soprano @code{sopranoMusic} and the section for the cello
90 @code{celloMusic}. While we're doing this, let's rename @code{text}
91 to be @code{sopranoLyrics}. Remember to rename both instances of all
92 these names -- both the initial definition (the
93 @code{melody = relative c' @{ } part) and the name's use (in the
94 @code{\score} section).
96 While we're doing this, let's change the cello part's staff -- celli
97 normally use bass clef. We'll also give the cello some different
102 sopranoMusic = \relative c' @{
110 sopranoLyrics = \lyricmode @{
114 celloMusic = \relative c @{
124 \new Voice = "one" @{
128 \new Lyrics \lyricsto "one" \sopranoLyrics
135 This is looking promising, but the cello part won't appear in the
136 score -- we haven't used it in the @code{\score} section. If we
137 want the cello part to appear under the soprano part, we need to add
140 \new Staff \celloMusic
144 underneath the soprano stuff. We also need to add @code{<<} and
145 @code{>>} around the music -- that tells LilyPond that there's
146 more than one thing (in this case, @code{Staff}) happening at once. The
147 @code{\score} looks like this now
153 \new Voice = "one" @{
157 \new Lyrics \lyricsto "one" \sopranoLyrics
159 \new Staff \celloMusic
167 This looks a bit messy; the indentation is messed up now. That is
168 easily fixed. Here's the complete soprano and cello template.
170 @lilypond[quote,verbatim,ragged-right]
172 sopranoMusic = \relative c' {
180 sopranoLyrics = \lyricmode {
184 celloMusic = \relative c {
199 \new Lyrics \lyricsto "one" \sopranoLyrics
201 \new Staff \celloMusic
212 @node An orchestral part
213 @section An orchestral part
215 In orchestral music, all notes are printed twice. Once in a part for
216 the musicians, and once in a full score for the conductor. Identifiers can
217 be used to avoid double work. The music is entered once, and stored in
218 a variable. The contents of that variable is then used to generate
219 both the part and the full score.
221 It is convenient to define the notes in a special file. For example,
222 suppose that the file @file{horn-music.ly} contains the following part
223 of a horn/@/bassoon duo
226 hornNotes = \relative c @{
233 Then, an individual part is made by putting the following in a file
236 \include "horn-music.ly"
238 instrument = "Horn in F"
242 \transpose f c' \hornNotes
249 \include "horn-music.ly"
253 substitutes the contents of @file{horn-music.ly} at this position in
254 the file, so @code{hornNotes} is defined afterwards. The command
255 @code{\transpose f@tie{}c'} indicates that the argument, being
256 @code{\hornNotes}, should be transposed by a fifth upwards. Sounding
257 @samp{f} is denoted by notated @code{c'}, which corresponds with the
258 tuning of a normal French Horn in@tie{}F. The transposition can be seen
259 in the following output
261 @lilypond[quote,ragged-right]
262 \transpose f c' \relative c {
268 In ensemble pieces, one of the voices often does not play for many
269 measures. This is denoted by a special rest, the multi-measure
270 rest. It is entered with a capital @samp{R} followed by a duration
271 (@code{1}@tie{}for a whole note, @code{2}@tie{}for a half note,
272 etc.). By multiplying the
273 duration, longer rests can be constructed. For example, this rest
274 takes 3@tie{}measures in 2/4 time
280 When printing the part, multi-rests
281 must be condensed. This is done by setting a run-time variable
284 \set Score.skipBars = ##t
288 This command sets the property @code{skipBars} in the
289 @code{Score} context to true (@code{##t}). Prepending the rest and
290 this option to the music above, leads to the following result
292 @lilypond[quote,ragged-right]
293 \transpose f c' \relative c {
295 \set Score.skipBars = ##t
302 The score is made by combining all of the music together. Assuming
303 that the other voice is in @code{bassoonNotes} in the file
304 @file{bassoon-music.ly}, a score is made with
307 \include "bassoon-music.ly"
308 \include "horn-music.ly"
311 \new Staff \hornNotes
312 \new Staff \bassoonNotes
319 @lilypond[quote,ragged-right]
327 r4 d,8 f | gis4 c | b bes |
328 a8 e f4 | g d | gis f
333 More in-depth information on preparing parts and scores can be found
334 in the notation manual; see @ruser{Orchestral music}.
336 Setting run-time variables (@q{properties}) is discussed in
337 @ruser{Changing context properties on the fly}.