]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/putting.itely
Small formatting stuff.
[lilypond.git] / Documentation / user / putting.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond-learning.tely
3 @ignore
4     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5
6     When revising a translation, copy the HEAD committish of the
7     version that you are working on.  See TRANSLATION for details.
8 @end ignore
9
10 @node Putting it all together
11 @chapter Putting it all together
12
13 This chapter discusses general LilyPond concepts and how to
14 create @code{\score} blocks.
15
16
17 @menu
18 * Extending the templates::     
19 * An orchestral part::          
20 @end menu
21
22
23 @node Extending the templates
24 @section Extending the templates
25
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?
29
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
33 soprano part).
34
35 @example
36 \version "2.11.23"
37 melody = \relative c' @{
38   \clef treble
39   \key c \major
40   \time 4/4
41
42   a4 b c d
43 @}
44
45 text = \lyricmode @{
46   Aaa Bee Cee Dee
47 @}
48
49 \score@{
50   <<
51     \new Voice = "one" @{
52       \autoBeamOff
53       \melody
54     @}
55     \new Lyrics \lyricsto "one" \text
56   >>
57   \layout @{ @}
58   \midi @{ @}
59 @}
60 @end example
61
62 Now we want to add a cello part.  Let's look at the @q{Notes only} example:
63
64 @example
65 \version "2.11.23"
66 melody = \relative c' @{
67   \clef treble
68   \key c \major
69   \time 4/4
70
71   a4 b c d
72 @}
73
74 \score @{
75 \new Staff \melody
76 \layout @{ @}
77 \midi @{ @}
78 @}
79 @end example
80
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}.
86
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).
95
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
98 notes.
99
100 @example
101 \version "2.11.23"
102 sopranoMusic = \relative c' @{
103   \clef treble
104   \key c \major
105   \time 4/4
106
107   a4 b c d
108 @}
109
110 sopranoLyrics = \lyricmode @{
111   Aaa Bee Cee Dee
112 @}
113
114 celloMusic = \relative c @{
115   \clef bass
116   \key c \major
117   \time 4/4
118
119   d4 g fis8 e d4
120 @}
121
122 \score@{
123   <<
124     \new Voice = "one" @{
125       \autoBeamOff
126       \sopranoMusic
127     @}
128     \new Lyrics \lyricsto "one" \sopranoLyrics
129   >>
130   \layout @{ @}
131   \midi @{ @}
132 @}
133 @end example
134
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
138
139 @example
140 \new Staff \celloMusic
141 @end example
142
143 @noindent
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
148
149 @example
150 \score@{
151   <<
152     <<
153       \new Voice = "one" @{
154         \autoBeamOff
155         \sopranoMusic
156       @}
157       \new Lyrics \lyricsto "one" \sopranoLyrics
158     >>
159     \new Staff \celloMusic
160   >>
161   \layout @{ @}
162   \midi @{ @}
163 @}
164 @end example
165
166 @noindent
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.
169
170 @lilypond[quote,verbatim,ragged-right]
171 \version "2.11.23"
172 sopranoMusic = \relative c' {
173   \clef treble
174   \key c \major
175   \time 4/4
176
177   a4 b c d
178 }
179
180 sopranoLyrics = \lyricmode {
181   Aaa Bee Cee Dee
182 }
183
184 celloMusic = \relative c {
185   \clef bass
186   \key c \major
187   \time 4/4
188
189   d4 g fis8 e d4
190 }
191
192 \score{
193   <<
194     <<
195       \new Voice = "one" {
196         \autoBeamOff
197         \sopranoMusic
198       }
199       \new Lyrics \lyricsto "one" \sopranoLyrics
200     >>
201     \new Staff \celloMusic
202   >>
203   \layout { }
204   \midi { }
205 }
206 @end lilypond
207
208
209
210
211
212 @node An orchestral part
213 @section An orchestral part
214
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.
220
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
224
225 @example
226 hornNotes = \relative c @{
227   \time 2/4
228   r4 f8 a cis4 f e d
229 @}
230 @end example
231
232 @noindent
233 Then, an individual part is made by putting the following in a file
234
235 @example
236 \include "horn-music.ly"
237 \header @{
238   instrument = "Horn in F"
239 @}
240
241 @{
242  \transpose f c' \hornNotes
243 @}
244 @end example
245
246 The line
247
248 @example
249 \include "horn-music.ly"
250 @end example
251
252 @noindent
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
260
261 @lilypond[quote,ragged-right]
262 \transpose f c' \relative c {
263   \time 2/4
264   r4 f8 a cis4 f e d
265 }
266 @end lilypond
267
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
275
276 @example
277 R2*3
278 @end example
279
280 When printing the part, multi-rests
281 must be condensed.  This is done by setting a run-time variable
282
283 @example
284 \set Score.skipBars = ##t
285 @end example
286
287 @noindent
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
291
292 @lilypond[quote,ragged-right]
293 \transpose f c' \relative c {
294   \time 2/4
295   \set Score.skipBars = ##t
296   R2*3
297   r4 f8 a cis4 f e d
298 }
299 @end lilypond
300
301
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
305
306 @example
307 \include "bassoon-music.ly"
308 \include "horn-music.ly"
309
310 <<
311   \new Staff \hornNotes
312   \new Staff \bassoonNotes
313 >>
314 @end example
315
316 @noindent
317 leading to
318
319 @lilypond[quote,ragged-right]
320 \relative c <<
321   \new Staff {
322     \time 2/4 R2*3
323     r4 f8 a cis4 f e d
324   }
325   \new Staff {
326     \clef bass
327     r4 d,8 f | gis4 c | b bes |
328     a8 e f4 | g d | gis f
329   }
330 >>
331 @end lilypond
332
333 More in-depth information on preparing parts and scores can be found
334 in the notation manual; see @ruser{Orchestral music}.
335
336 Setting run-time variables (@q{properties}) is discussed in
337 @ruser{Changing context properties on the fly}.
338
339
340