1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond-learning.tely
4 @node Fundamental concepts
5 @chapter Fundamental concepts
8 * How LilyPond files work::
9 * Voices contain music::
10 * TODO new sec fundamental::
11 * Extending the templates::
16 @node How LilyPond files work
17 @section How LilyPond files work
19 The LilyPond input format is quite free-form, giving experienced
20 users a lot of flexibility to structure their files however they
21 wish. However, this flexibility can make things confusing for new
22 users. This section will explain some of this structure, but may
23 gloss over some details in favor of simplicity. For a complete
24 description of the input format, see @ruser{File structure}.
27 * Introduction to the LilyPond file structure::
28 * Score is a (single) compound musical expression::
29 * Nesting Music Expressions::
32 @node Introduction to the LilyPond file structure
33 @subsection Introduction to the LilyPond file structure
35 A basic example of a lilypond input file is
40 @var{...compound music expression...} % all the music goes here!
48 There are many variations of this basic pattern, but this
49 example serves as a useful starting place.
51 At this point, you may be confused, since you have never seen a
52 @code{\score@{@}} before. This is because LilyPond automatically
53 adds the extra commands when you give it simple input. LilyPond
54 treats input like this:
63 as shorthand for this:
74 In other words, if the input contains a single music expression,
75 LilyPond will interpret the file as though the music expression
76 was wrapped up inside a @code{\score@{@}}.
80 A @code{\score} must begin with a compound music expression.
81 Remember that a music expression could be anything from a single
87 @var{...insert the whole score of a Wagner opera in here...}
93 Since everything is inside @code{@{ ... @}}, it counts
94 as one music expression.
96 As we saw previously, the @code{\score} can contain other things,
109 Some people put some of those commands outside the @code{\score}
110 block -- for example, @code{\header} is often placed above the
111 @code{\score}. That's just another shorthand that LilyPond
118 Another great shorthand is the ability to define variables. All
119 the templates use this
122 melody = \relative c' @{
131 When LilyPond looks at this file, it takes the value of
132 @code{melody} (everything after the equals sign) and inserts it
133 whenever it sees @code{\melody}. There's nothing special about
134 the names -- it could be @code{melody}, @code{global},
135 @code{pianorighthand}, or @code{foofoobarbaz}. You can use
136 whatever variable names you want as along as they contain just
137 alphabetic characters. For more details, see
138 @ruser{Saving typing with variables and functions}.
143 For a complete definition of the input format, see @ruser{File
147 @node Score is a (single) compound musical expression
148 @subsection Score is a (single) compound musical expression
150 @cindex Compound music expression
151 @cindex Music expression, compound
153 We saw the general organization of LilyPond input files in the
154 previous section, @ref{How LilyPond files work}. But we seemed to
155 skip over the most important part: how do we figure out what to
156 write after @code{\score}?
158 We didn't skip over it at all. The big mystery is simply that
159 there @emph{is} no mystery. This line explains it all:
162 @emph{A @code{\score} must begin with a compound music expression.}
166 You may find it useful to review @ref{Music expressions
167 explained}. In that section, we saw how to build big music
168 expressions from small pieces -- we started from notes, then
169 chords, etc. Now we're going to start from a big music expression
170 and work our way down.
174 @{ % this brace begins the overall compound music expression
176 @var{...insert the whole score of a Wagner opera in here...}
178 @} % this brace ends the overall compound music expression
183 A whole Wagner opera would easily double the length of this
184 manual, so let's just add a singer and piano. We don't need a
185 @code{GrandStaff} for this ensemble, so we shall remove it. We
186 @emph{do} need a singer and a piano, though.
192 \new Staff = "singer" <<
194 \new PianoStaff = piano <<
202 Remember that we use @code{<<} and @code{>>} to show simultaneous
203 music. And we definitely want to show the vocal part and piano
204 part at the same time, not one after the other!
210 \new Staff = "singer" <<
211 \new Voice = "vocal" @{ @}
213 \new Lyrics \lyricsto vocal \new Lyrics @{ @}
214 \new PianoStaff = "piano" <<
215 \new Staff = "upper" @{ @}
216 \new Staff = "lower" @{ @}
224 Now we have a lot more details. We have the singer's staff: it
225 contains a @code{Voice} (in LilyPond, this term refers to a set of
226 notes, not necessarily vocal notes -- for example, a violin
227 generally plays one voice) and some lyrics. We also have a piano
228 staff: it contains an upper staff (right hand) and a lower staff
231 At this stage, we could start filling in notes. Inside the curly
232 braces next to @code{\new Voice = vocal}, we could start writing
240 But if we did that, the @code{\score} section would get pretty
241 long, and it would be harder to understand what was happening. So
242 let's use variables instead.
252 \new Staff = "singer" <<
253 \new Voice = "vocal" @{ \melody @}
255 \new Lyrics \lyricsto vocal \new Lyrics @{ \text @}
256 \new PianoStaff = "piano" <<
257 \new Staff = "upper" @{ \upper @}
258 \new Staff = "lower" @{ \lower @}
267 Remember that you can use almost any name you like as long
268 as it contains just alphabetic characters. The exact
269 limitations on variable names are detailed in @ruser{File
272 When writing (or reading) a @code{\score} section, just take it
273 slowly and carefully. Start with the outer layer, then work on
274 each smaller layer. It also really helps to be strict with
275 indentation -- make sure that each item on the same layer starts
276 on the same horizontal position in your text editor.
279 @node Nesting Music Expressions
280 @subsection Nesting Music Expressions
282 New staves do not have to all be declared at the beginning;
283 they may be introduced temporarily at any point. This is
284 particularly useful for creating ossia sections
285 (see @rglos{ossia}). Here's a simple example showing how
286 to introduce a new staff temporarily for the duration of
289 @lilypond[verbatim,quote,ragged-right]
305 The ossia section may be placed above the staff
308 @lilypond[verbatim,quote,ragged-right]
316 alignAboveContext = "main" }
324 Ossia are often written without clef and without
325 time signature and are usually in a smaller font.
326 These require commands which
327 have not yet been introduced. See ...
328 TODO Add ref to tweaks section where this example should
329 be placed and explained.
331 @lilypond[verbatim,quote,ragged-right]
332 \new Staff = "main" {
336 << % Start main and ossia in parallel
337 { r8 f c c } % Main music
338 \new Staff \with { % Start ossia staff
339 \remove "Clef_engraver"
340 \remove "Time_signature_engraver"
341 % Reduce size of notes and staff
343 \override StaffSymbol #'staff-space = #(magstep -2)
344 alignAboveContext = "main" % Place above main staff
346 { s8 f f c } % Ossia music
347 >> % End parallel music
356 @node Voices contain music
357 @section Voices contain music
359 Singers need voices to sing, and so does LilyPond.
360 The actual music for all instruments in a score
361 is contained in Voices - the most fundamental
362 of all LilyPond's concepts.
365 * I'm hearing Voices::
366 * Explicitly instantiating voices::
367 * Voices and vocals::
370 @node I'm hearing Voices
371 @subsection I'm hearing Voices
375 @cindex Voice context
377 The lowest, most fundamental or innermost layers in a LilyPond
378 score are called Voices. Voices are sometimes
379 called @q{layers} in other notation packages. In LilyPond they
380 are called @q{Voice contexts}.
382 In fact, a Voice layer or context is the only one which can
383 contain music. If a Voice context is not explicitly declared
384 one is created automatically. Some instruments such as an
385 Oboe can play only one note at a time and music written for
386 such instruments is monophonic and requires just a single
387 voice. Instruments which can play more than one note at a
388 time like the piano will often require multiple voices to
389 encode the different concurent notes and rhythms they are
392 A single voice can contain many notes in a chord, of course,
393 so when exactly are multiple voices needed?
394 Let us analyse a short piece of music to see how many voices
395 are required. Here are the notes from the first two bars
396 of the second of Chopin's Deux Nocturnes, Op 32.
398 @c The following should appear as music without code
399 @lilypond[quote,ragged-right]
400 \new Staff \relative c'' {
408 \once \override NoteColumn #'force-hshift = #0 <ees c>2
409 \once \override NoteColumn #'force-hshift = #0.5 des2 }
415 The direction of the stems is often used to indicate the
416 continuity of two simultaneous melodic lines. Here the
417 stems of the highest notes are all pointing up and the
418 stems of the lower notes are all pointing down.
419 This is the first indication that more than one voice
422 But the real need for multiple voices arises when notes
423 which start at the same time have different durations.
424 Look at the notes which start at beat three in the first
425 bar. The a-flat is a dotted quarter note, the f is a
426 quarter note and the d-flat is a half note. These
427 cannot be written as a chord as all the notes in a chord
428 must have the same duration. Neither can they be written
429 as sequential notes, as they must start at the same time.
430 This section of the bar requires three voices, and the
431 normal practice would be to write the whole bar as three
432 voices, as shown here, where we have coloured the three
435 @c The following should appear as music without code
436 @lilypond[quote,ragged-right]
437 \new Staff \relative c'' {
441 \override NoteHead #'color = #red
442 \override Stem #'color = #red
445 \override NoteHead #'color = #blue
446 \override Stem #'color = #blue
449 \override NoteHead #'color = #green
450 \override Stem #'color = #green
451 \once \override NoteColumn #'force-hshift = #0 <ees c>2
452 \once \override NoteColumn #'force-hshift = #0.5 des2 }
458 Let us see how this is done.
462 The easiest way to enter fragments with more than one voice on a
463 staff is to enter each voice as a sequence (with @code{@{...@}}),
464 and combine them simultaneously with angle brackets, @code{<<...>>}.
465 The fragments must also be separated with double backward slashes,
466 @code{\\}, to place them in separate voices. Without these, the
467 notes would be entered into a single voice, which would usually
468 cause errors. This technique is particularly suited to pieces of
469 music which are largely monophonic with occasional short sections
470 of polyphony. Here's a simple example:
472 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
474 % Voice "1" Voice "2"
475 << { r4 g g4. a8 } \\ { d,2 d4 g } >> |
476 << { bes4 bes c bes } \\ { g4 g g8( a) g4 } >> |
477 << { a2. r4 } \\ { fis2. s4 } >>
480 This example has just two voices, but the same contruct may be
481 used to encode three or more voices by adding more back-slash
484 The Voice contexts bear the names @code{"1"}, @code{"2"}, etc.
485 In each of these contexts, vertical direction of slurs, stems, ties,
486 dynamics etc., is set appropriately.
488 @lilypond[quote,verbatim,fragment]
489 \new Staff \relative c' {
492 % Voice "1" Voice "2" Voice "3"
493 << { g4 f e } \\ { r8 e4 d c8 ~ } >> |
494 << { d2 e2 } \\ { c8 b16 a b8 g ~ g2 } \\ { s4 b4 c2 } >> |
498 These voices are all separate from the main voice that contains
499 the notes just outside the @code{<< \\ >>} construct. Let's call
500 this the @emph{simultaneous construct}. Slurs and ties may only
501 connect notes within the same voice, so slurs and ties cannot go
502 into or out of a simultaneous construct. construct. Conversely,
503 parallel voices from separate simultaneous constructs on the same
504 staff are the same voice. Other voice- related properties also
505 carry across simultaneous constructs. Here is the same example,
506 with different colors and noteheads for each voice. Note that
507 changes in one Voice do not affect other voices, but they do
508 persist in the same Voice later. Note also that tied notes may be
509 split across the same voices in two constructs, shown here in the
512 @lilypond[quote,verbatim]
513 \new Staff \relative c' {
523 { c8 b16 a b8 g ~ g2 } \\
530 Polyphony does not change the relationship of notes within a
531 @code{\relative @{ @}} block. Each note is calculated relative to
532 the note immediately preceding it, or to the first note of the
536 \relative @{ noteA << <noteB noteC> \\ noteD >> noteE @}
539 @code{noteB} is relative to @code{noteA}
540 @code{noteC} is relative to @code{noteB}, not @code{noteA};
541 @code{noteD} is relative to @code{noteB}, not @code{noteA} or
543 @code{noteE} is relative to @code{noteD}, not @code{noteA}
545 We are now in a position to return to the first example from
546 the Chopin Nocturne to see how this might be encoded. As we
547 shall see, this encounters some difficulties. We begin as
548 we have learnt, using the @code{<< \\ >>} construct to
549 enter the music of the first bar in three voices:
551 @lilypond[quote,verbatim,fragment,ragged-right]
552 \new Staff \relative c'' {
555 { c2 aes4. bes8 } \\ { aes2 f4 fes } \\ { <ees c>2 des2 }
566 The stem directions are automatically assigned with the
567 odd-numbered voices taking upward stems and the even-numbered
568 voices downward ones. The stems for voices 1 and 2 are right,
569 but the stems in voice 3 should go down in this particular piece
570 of music. We can correct this
571 by telling LilyPond that this third voice is really a fourth
572 voice, with stems going down, using the @code{\voiceFour}
573 command. There are also corresponding @code{\voiceOne},
574 @code{\voiceTwo} and @code{voiceThree} commands.
575 This result in the following:
577 @lilypond[quote,verbatim,fragment,ragged-right]
578 \new Staff \relative c'' {
583 { \voiceFour <ees c>2 des2 }
590 and exposes a problem commonly encountered with multiple
591 voices: the stems of notes can collide with noteheads
592 in other voices. In laying out the notes, LilyPond allows the
593 notes or chords from two voices to occupy the same vertical
594 note column provided the stems are in opposite directions, but
595 the notes from a third voice are displaced to avoid the stems
596 colliding. This often works well, but in this example the
597 notes of the third voice are clearly not well placed by default.
598 LilyPond provides several ways to adjust the horizontal placing
599 of notes. We are not quite ready yet to see how to correct this,
600 so we shall leave this problem until a later section (see ... )
602 FIXME: Move the following words and example into Tweaks or
603 somewhere more suitable, leaving just a ref here. -td
605 Ways or correcting horizontal placings are described fully
606 in the Notation Reference.
607 We introduce just one here, the @code{force-hshift} property of
608 @code{NoteColumn}. The lower two notes of the first chord (i.e,
609 those in the third voice) should not be shifted away from the
610 note column of the higher two notes. To correct this we set
611 @code{force-hshift} of these notes to zero.
612 The lower note of the second chord is best placed just to the
613 right of the higher notes. We achieve this by setting
614 @code{force-hshift} of this note to 0.5, ie half a notehead's
615 width to the right of the note column of the higher notes.
617 Here's the final result:
619 @lilypond[quote,verbatim,fragment,ragged-right]
620 \new Staff \relative c'' {
626 \once \override NoteColumn #'force-hshift = #0 <ees c>2
627 \once \override NoteColumn #'force-hshift = #0.5 des2
634 @node Explicitly instantiating voices
635 @subsection Explicitly instantiating voices
637 Voice contexts can also be created manually
638 inside a @code{<< >>} block to create polyphonic music, using
639 @code{\voiceOne}, up to @code{\voiceFour} to automatically assign
640 the directions of stems, slurs, etc.
642 Specifically, the construct @code{<< \\ >>} which we used in
643 the previous section:
646 << \upper \\ \lower >>
650 where @code{upper} and @code{lower} are user-defined variables
651 containing the music for the two voices, is equivalent to
655 \new Voice = "1" @{ \voiceOne \upper @}
656 \new Voice = "2" @{ \voiceTwo \lower @}
660 The @code{\voiceXXX} commands set the direction of stems, slurs,
661 ties, articulations, text annotations, augmentation dots of dotted
662 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree}
663 make these objects point upwards, while @code{\voiceTwo} and
664 @code{\voiceFour} make them point downwards. These commands also
665 generate a horizontal shift for each voice when this is required
666 to avoid clashes of note heads. The command @code{\oneVoice}
667 reverts the settings back to the normal values for a single voice.
669 An expression that appears directly inside a @code{<< >>} belongs
670 to the main voice. This is useful when extra voices appear while
671 the main voice is playing. Here is a more correct rendition of
672 the example from the previous section. The red diamond-shaped
673 notes demonstrate that the main melody is now in a single
674 voice context, permitting a phrasing slur to be drawn over them.
676 @lilypond[quote,ragged-right,verbatim]
677 \new Staff \relative c' {
679 c16^( d e f % These notes are monophonic
680 << % Start simultaneous section of three voices
681 { g4 f e | d2 e2) } % Continue the main voice in parallel
682 \new Voice { % Initiate second voice
683 \voiceTwo % Set stems, etc, down
684 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
686 \new Voice { % Initiate third voice
687 \voiceThree % Set stems, etc, up
694 @cindex nesting music expressions
695 @cindex nesting simultaneous constructs
697 More deeply nested polyphony constructs are possible, and if a
698 voice appears only briefly this might be a more natural way to
701 @lilypond[quote,ragged-right,verbatim]
702 \new Staff \relative c' {
722 This method of nesting new voices briefly is useful
723 when only small sections of the music
724 are polyphonic, but when the whole staff is largely polyphonic
725 it can be clearer to use multiple voices throughout, using
726 spacing notes to step over sections where the voice is silent,
729 @lilypond[quote,ragged-right,verbatim]
730 \new Staff \relative c' <<
731 \new Voice { % Initiate first voice
733 c16^( d e f g4 f e | d2 e2) |
735 \new Voice { % Initiate second voice
736 \voiceTwo % set stems, etc down
737 s4 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2 |
739 \new Voice { % Initiate third voice
740 \voiceThree % set stems, etc up
748 @node Voices and vocals
749 @subsection Voices and vocals
751 Vocal music presents a special difficulty: we need to combine two
752 expressions -- notes and lyrics.
754 You have already seen the @code{\lyricsAdd@{@}} command, which
755 handles simple cases for you. However, this technique is
756 very limited. For most music, you must explicitly link the lyrics
757 to the notes with @code{\lyricsto@{@}}, using the name assigned
760 @lilypond[quote,verbatim,fragment]
762 \new Voice = "one" \relative c'' {
765 c4 b8. a16 g4. f8 e4 d c2
767 \new Lyrics \lyricsto "one" {
768 No more let sins and sor -- rows grow.
773 Let us reuse the earlier example from Judas Maccabæus to
774 illustrate this more flexible technique. We first recast
775 it to use variables so the music and lyrics can be separated
776 from the staff structure. We also introduce a choirstaff
777 bracket. The lyrics themselves must be introduced with
778 @code{\lyricmode} to ensure they are interpreted as lyrics
781 @lilypond[quote,verbatim]
782 global = { \time 6/8 \partial 8 \key f \major}
783 SopOneMusic = \relative c'' {
784 c8 | c([ bes)] a a([ g)] f | f'4. b, | c4.~ c4 }
785 SopTwoMusic = \relative c' {
786 r8 | r4. r4 c8 | a'([ g)] f f([ e)] d | e([ d)] c bes' }
787 SopOneLyrics = \lyricmode {
788 Let | flee -- cy flocks the | hills a -- dorn, __ }
789 SopTwoLyrics = \lyricmode {
790 Let | flee -- cy flocks the | hills a -- dorn, }
795 \new Voice = "SopOne" {
799 \new Lyrics \lyricsto "SopOne" {
804 \new Voice = "SopTwo" {
807 \new Lyrics \lyricsto "SopTwo" {
815 This is the basic structure of all vocal scores. More staves may
816 be added as required, more voices may be added to the staves,
817 more verses may be added to the lyrics,
818 and the variables containing the music can easily be placed
819 in separate files should they become too long.
821 Here is a final example of the first line of a hymn with four
822 verses, set for SATB. In this case the words for all four
825 @lilypond[quote,verbatim]
826 global = { \time 4/4 \partial 4 \key c \major}
827 SopMusic = \relative c' { c4 | e4. e8 g4 g | a a g }
828 AltoMusic = \relative c' { c4 | c4. c8 e4 e | f f e }
829 TenorMusic = \relative c { e4 | g4. g8 c4. b8 | a8 b c d e4 }
830 BassMusic = \relative c { c4 | c4. c8 c4 c | f8 g a b c4 }
831 VerseOne = \lyricmode {
832 E -- | ter -- nal fa -- ther, | strong to save, }
833 VerseTwo = \lyricmode {
834 O | Christ, whose voice the | wa -- ters heard, }
835 VerseThree = \lyricmode {
836 O | Ho -- ly Spi -- rit, | who didst brood }
837 VerseFour = \lyricmode {
838 O | Tri -- ni -- ty of | love and pow'r }
844 \new Voice = "Sop" { \voiceOne \global \SopMusic }
845 \new Voice = "Alto" { \voiceTwo \AltoMusic }
846 \new Lyrics \lyricsto "Sop" { \VerseOne }
847 \new Lyrics \lyricsto "Sop" { \VerseTwo }
848 \new Lyrics \lyricsto "Sop" { \VerseThree }
849 \new Lyrics \lyricsto "Sop" { \VerseFour }
853 \new Voice = "Tenor" { \voiceOne \TenorMusic }
854 \new Voice = "Bass" { \voiceTwo \BassMusic }
860 @node TODO new sec fundamental
861 @section TODO new sec fundamental
867 * On the un-nestedness of brackets and ties::
870 @c my name start sucking the more docs I write. -gp
871 @node On the un-nestedness of brackets and ties
872 @subsection On the un-nestedness of brackets and ties
874 Different kinds of brackets and ties may be mixed freely,
876 TODO: improve this example
878 @lilypond[quote,verbatim,fragment,ragged-right]
880 r16[ g16 \times 2/3 {r16 e'8] }
881 g16( a \times 2/3 {b d e') }
882 g8[( a \times 2/3 {b d') e'~]}
883 \times 4/5 {e'32\( a b d' e'} a'4.\)
887 TODO... add more info? Fluff up the first sentence?
890 @node Extending the templates
891 @section Extending the templates
893 You've read the tutorial, you know how to write music. But how can you
894 get the staves that you want? The templates are ok, but what if you
895 want something that isn't covered?
898 * Soprano and cello::
899 * TODO another example of extending templates::
902 @node Soprano and cello
903 @subsection Soprano and cello
905 Start off with the template that seems closest to what you want to end
906 up with. Let's say that you want to write something for soprano and
907 cello. In this case, we would start with @q{Notes and lyrics} (for the
912 melody = \relative c' @{
926 \new Voice = "one" @{
930 \new Lyrics \lyricsto "one" \text
937 Now we want to add a cello part. Let's look at the @q{Notes only} example:
941 melody = \relative c' @{
956 We don't need two @code{\version} commands. We'll need the @code{melody}
957 section. We don't want two @code{\score} sections -- if we had two
958 @code{\score}s, we'd get the two parts separately. We want them together,
959 as a duet. Within the @code{\score} section, we don't need two
960 @code{\layout} or @code{\midi}.
962 If we simply cut and paste the @code{melody} section, we would end up with
963 two @code{melody} sections. So let's rename them. We'll call the section
964 for the soprano @code{sopranoMusic} and the section for the cello
965 @code{celloMusic}. While we're doing this, let's rename @code{text}
966 to be @code{sopranoLyrics}. Remember to rename both instances of all
967 these names -- both the initial definition (the
968 @code{melody = relative c' @{ } part) and the name's use (in the
969 @code{\score} section).
971 While we're doing this, let's change the cello part's staff -- celli
972 normally use bass clef. We'll also give the cello some different
977 sopranoMusic = \relative c' @{
985 sopranoLyrics = \lyricmode @{
989 celloMusic = \relative c @{
999 \new Voice = "one" @{
1003 \new Lyrics \lyricsto "one" \sopranoLyrics
1010 This is looking promising, but the cello part won't appear in the
1011 score -- we haven't used it in the @code{\score} section. If we
1012 want the cello part to appear under the soprano part, we need to add
1015 \new Staff \celloMusic
1019 underneath the soprano stuff. We also need to add @code{<<} and
1020 @code{>>} around the music -- that tells LilyPond that there's
1021 more than one thing (in this case, @code{Staff}) happening at once. The
1022 @code{\score} looks like this now
1028 \new Voice = "one" @{
1032 \new Lyrics \lyricsto "one" \sopranoLyrics
1034 \new Staff \celloMusic
1042 This looks a bit messy; the indentation is messed up now. That is
1043 easily fixed. Here's the complete soprano and cello template.
1045 @lilypond[quote,verbatim,ragged-right]
1047 sopranoMusic = \relative c' {
1055 sopranoLyrics = \lyricmode {
1059 celloMusic = \relative c {
1070 \new Voice = "one" {
1074 \new Lyrics \lyricsto "one" \sopranoLyrics
1076 \new Staff \celloMusic
1084 @node TODO another example of extending templates
1085 @subsection TODO another example of extending templates
1087 TODO: somebody else fill this in. You guys like vocal stuff,
1088 right? Get to it. :) -gp
1092 @node Scores and parts
1093 @section Scores and parts
1095 TODO: this is really old stuff from the really old tutorial.
1096 Rewrite, fix, etc. Or maybe delete entirely. -gp
1098 In orchestral music, all notes are printed twice. Once in a part for
1099 the musicians, and once in a full score for the conductor. Variables can
1100 be used to avoid double work. The music is entered once, and stored in
1101 a variable. The contents of that variable is then used to generate
1102 both the part and the full score.
1104 It is convenient to define the notes in a special file. For example,
1105 suppose that the file @file{horn-music.ly} contains the following part
1106 of a horn/@/bassoon duo
1109 hornNotes = \relative c @{
1116 Then, an individual part is made by putting the following in a file
1119 \include "horn-music.ly"
1121 instrument = "Horn in F"
1125 \transpose f c' \hornNotes
1132 \include "horn-music.ly"
1136 substitutes the contents of @file{horn-music.ly} at this position in
1137 the file, so @code{hornNotes} is defined afterwards. The command
1138 @code{\transpose f@tie{}c'} indicates that the argument, being
1139 @code{\hornNotes}, should be transposed by a fifth upwards. Sounding
1140 @code{f} is denoted by notated @code{c'}, which corresponds with the
1141 tuning of a normal French Horn in@tie{}F. The transposition can be seen
1142 in the following output
1144 @lilypond[quote,ragged-right]
1145 \transpose f c' \relative c {
1151 In ensemble pieces, one of the voices often does not play for many
1152 measures. This is denoted by a special rest, the multi-measure
1153 rest. It is entered with a capital @code{R} followed by a duration
1154 (@code{1}@tie{}for a whole note, @code{2}@tie{}for a half note,
1155 etc.). By multiplying the
1156 duration, longer rests can be constructed. For example, this rest
1157 takes 3@tie{}measures in 2/4 time
1163 When printing the part, multi-rests
1164 must be condensed. This is done by setting a run-time variable
1167 \set Score.skipBars = ##t
1171 This command sets the property @code{skipBars} in the
1172 @code{Score} context to true (@code{##t}). Prepending the rest and
1173 this option to the music above, leads to the following result
1175 @lilypond[quote,ragged-right]
1176 \transpose f c' \relative c {
1178 \set Score.skipBars = ##t
1185 The score is made by combining all of the music together. Assuming
1186 that the other voice is in @code{bassoonNotes} in the file
1187 @file{bassoon-music.ly}, a score is made with
1190 \include "bassoon-music.ly"
1191 \include "horn-music.ly"
1194 \new Staff \hornNotes
1195 \new Staff \bassoonNotes
1202 @lilypond[quote,ragged-right]
1210 r4 d,8 f | gis4 c | b bes |
1211 a8 e f4 | g d | gis f