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::
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?
32 * TODO another example of extending templates::
35 @node Soprano and cello
36 @unnumberedsubsec Soprano and cello
38 Start off with the template that seems closest to what you want to end
39 up with. Let's say that you want to write something for soprano and
40 cello. In this case, we would start with @q{Notes and lyrics} (for the
45 melody = \relative c' @{
63 \new Lyrics \lyricsto "one" \text
70 Now we want to add a cello part. Let's look at the @q{Notes only} example:
74 melody = \relative c' @{
89 We don't need two @code{\version} commands. We'll need the @code{melody}
90 section. We don't want two @code{\score} sections -- if we had two
91 @code{\score}s, we'd get the two parts separately. We want them together,
92 as a duet. Within the @code{\score} section, we don't need two
93 @code{\layout} or @code{\midi}.
95 If we simply cut and paste the @code{melody} section, we would end up with
96 two @code{melody} sections. So let's rename them. We'll call the section
97 for the soprano @code{sopranoMusic} and the section for the cello
98 @code{celloMusic}. While we're doing this, let's rename @code{text}
99 to be @code{sopranoLyrics}. Remember to rename both instances of all
100 these names -- both the initial definition (the
101 @code{melody = relative c' @{ } part) and the name's use (in the
102 @code{\score} section).
104 While we're doing this, let's change the cello part's staff -- celli
105 normally use bass clef. We'll also give the cello some different
110 sopranoMusic = \relative c' @{
118 sopranoLyrics = \lyricmode @{
122 celloMusic = \relative c @{
132 \new Voice = "one" @{
136 \new Lyrics \lyricsto "one" \sopranoLyrics
143 This is looking promising, but the cello part won't appear in the
144 score -- we haven't used it in the @code{\score} section. If we
145 want the cello part to appear under the soprano part, we need to add
148 \new Staff \celloMusic
152 underneath the soprano stuff. We also need to add @code{<<} and
153 @code{>>} around the music -- that tells LilyPond that there's
154 more than one thing (in this case, @code{Staff}) happening at once. The
155 @code{\score} looks like this now
161 \new Voice = "one" @{
165 \new Lyrics \lyricsto "one" \sopranoLyrics
167 \new Staff \celloMusic
175 This looks a bit messy; the indentation is messed up now. That is
176 easily fixed. Here's the complete soprano and cello template.
178 @lilypond[quote,verbatim,ragged-right]
180 sopranoMusic = \relative c' {
188 sopranoLyrics = \lyricmode {
192 celloMusic = \relative c {
207 \new Lyrics \lyricsto "one" \sopranoLyrics
209 \new Staff \celloMusic
217 @node TODO another example of extending templates
218 @unnumberedsubsec TODO another example of extending templates
220 TODO: somebody else fill this in. You guys like vocal stuff,
221 right? Get to it. :) -gp
225 @node Scores and parts
226 @section Scores and parts
228 TODO: this is really old stuff from the really old tutorial.
229 Rewrite, fix, etc. -gp
231 In orchestral music, all notes are printed twice. Once in a part for
232 the musicians, and once in a full score for the conductor. Variables can
233 be used to avoid double work. The music is entered once, and stored in
234 a variable. The contents of that variable is then used to generate
235 both the part and the full score.
237 It is convenient to define the notes in a special file. For example,
238 suppose that the file @file{horn-music.ly} contains the following part
239 of a horn/@/bassoon duo
242 hornNotes = \relative c @{
249 Then, an individual part is made by putting the following in a file
252 \include "horn-music.ly"
254 instrument = "Horn in F"
258 \transpose f c' \hornNotes
265 \include "horn-music.ly"
269 substitutes the contents of @file{horn-music.ly} at this position in
270 the file, so @code{hornNotes} is defined afterwards. The command
271 @code{\transpose f@tie{}c'} indicates that the argument, being
272 @code{\hornNotes}, should be transposed by a fifth upwards. Sounding
273 @samp{f} is denoted by notated @code{c'}, which corresponds with the
274 tuning of a normal French Horn in@tie{}F. The transposition can be seen
275 in the following output
277 @lilypond[quote,ragged-right]
278 \transpose f c' \relative c {
284 In ensemble pieces, one of the voices often does not play for many
285 measures. This is denoted by a special rest, the multi-measure
286 rest. It is entered with a capital @samp{R} followed by a duration
287 (@code{1}@tie{}for a whole note, @code{2}@tie{}for a half note,
288 etc.). By multiplying the
289 duration, longer rests can be constructed. For example, this rest
290 takes 3@tie{}measures in 2/4 time
296 When printing the part, multi-rests
297 must be condensed. This is done by setting a run-time variable
300 \set Score.skipBars = ##t
304 This command sets the property @code{skipBars} in the
305 @code{Score} context to true (@code{##t}). Prepending the rest and
306 this option to the music above, leads to the following result
308 @lilypond[quote,ragged-right]
309 \transpose f c' \relative c {
311 \set Score.skipBars = ##t
318 The score is made by combining all of the music together. Assuming
319 that the other voice is in @code{bassoonNotes} in the file
320 @file{bassoon-music.ly}, a score is made with
323 \include "bassoon-music.ly"
324 \include "horn-music.ly"
327 \new Staff \hornNotes
328 \new Staff \bassoonNotes
335 @lilypond[quote,ragged-right]
343 r4 d,8 f | gis4 c | b bes |
344 a8 e f4 | g d | gis f