1 @c -*- coding: utf-8; mode: texinfo; -*-
3 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5 When revising a translation, copy the HEAD committish of the
6 version that you are working on. See TRANSLATION for details.
9 @node Simultaneous notes
10 @section Simultaneous notes
12 Polyphony in music refers to having more than one voice occurring
13 in a piece of music. Polyphony in LilyPond refers to having more
14 than one voice on the same staff.
23 @subsection Single voice
31 @unnumberedsubsubsec Chords
35 A chord is formed by a enclosing a set of pitches between @code{<}
36 and @code{>}. A chord may be followed by a duration, and a set of
37 articulations, just like simple notes
39 @lilypond[verbatim,ragged-right,fragment,quote,relative=1]
43 For more information about chords, see @ref{Introducing chord
48 @unnumberedsubsubsec Clusters
52 A cluster indicates a continuous range of pitches to be played.
53 They can be denoted as the envelope of a set of notes. They are
54 entered by applying the function @code{makeClusters} to a sequence
57 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
58 \makeClusters { <c e > <b f'> }
61 Ordinary notes and clusters can be put together in the same staff,
62 even simultaneously. In such a case no attempt is made to
63 automatically avoid collisions between ordinary notes and
68 Program reference: @internalsref{ClusterSpanner},
69 @internalsref{ClusterSpannerBeacon},
70 @internalsref{Cluster_spanner_engraver}.
72 Examples: @lsr{contemporary,cluster@/.ly}.
76 Music expressions like @code{<< @{ g8 e8 @} a4 >>} are not printed
77 accurately. Use @code{<g a>8 <e a>8} instead.
82 @subsection Multiple voices
86 * Explicitly instantiating voices::
87 * Collision Resolution::
88 * Automatic part combining::
89 * Writing music in parallel::
93 @unnumberedsubsubsec Basic polyphony
97 The easiest way to enter fragments with more than one voice on a
98 staff is to enter each voice as a sequence (with @code{@{...@}}),
99 and combine them simultaneously, separating the voices with
104 @lilypond[quote,verbatim,fragment]
105 \new Staff \relative c' {
108 { g4 f e | d2 e2 } \\
109 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
117 The separator causes @internalsref{Voice}
118 contexts@footnote{Polyphonic voices are sometimes
119 called @q{layers} in other notation packages} to be instantiated.
120 They bear the names @code{"1"}, @code{"2"}, etc. In each of these
121 contexts, vertical direction of slurs, stems, etc., is set
124 These voices are all separate from the voice that contains the
125 notes just outside the @code{<< \\ >>} construct. This should be
126 noted when making changes at the voice level. This also means
127 that slurs and ties cannot go into or out of a @code{<< \\ >>}
128 construct. Conversely, parallel voices from separate @code{<< \\
129 >>} constructs on the same staff are the same voice. Here is the
130 same example, with different noteheads and colors for each voice.
131 Note that the change to the note-head style in the main voice does
132 not affect the inside of the @code{<< \\ >>} constructs. Also,
133 the change to the second voice in the first @code{<< \\ >>}
134 construct is effective in the second @code{<< \\ >>}, and the
135 voice is tied across the two constructs.
137 @cindex note heads, styles
139 @lilypond[quote,verbatim,fragment]
140 \new Staff \relative c' {
141 \override NoteHead #'style = #'cross
142 \override NoteHead #'color = #red
146 { \override NoteHead #'style = #'triangle
147 \override NoteHead #'color = #blue
152 { c8 b16 a b8 g ~ g2 } \\
153 { \override NoteHead #'style = #'slash
154 \override NoteHead #'color = #green
160 Polyphony does not change the relationship of notes within a
161 @code{\relative @{ @}} block. Each note is calculated relative to
162 the note immediately preceding it.
165 \relative @{ noteA << noteB \\ noteC >> noteD @}
168 @code{noteC} is relative to @code{noteB}, not @code{noteA};
169 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
173 @node Explicitly instantiating voices
174 @unnumberedsubsubsec Explicitly instantiating voices
176 @internalsref{Voice} contexts can also be instantiated manually
177 inside a @code{<< >>} block to create polyphonic music, using
178 @code{\voiceOne}, up to @code{\voiceFour} to assign stem
179 directions and a horizontal shift for each part.
183 << \upper \\ \lower >>
191 \new Voice = "1" @{ \voiceOne \upper @}
192 \new Voice = "2" @{ \voiceTwo \lower @}
196 The @code{\voiceXXX} commands set the direction of stems, slurs,
197 ties, articulations, text annotations, augmentation dots of dotted
198 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree}
199 make these objects point upwards, while @code{\voiceTwo} and
200 @code{\voiceFour} make them point downwards. The command
201 @code{\oneVoice} will revert back to the normal setting.
203 An expression that appears directly inside a @code{<< >>} belongs
204 to the main voice. This is useful when extra voices appear while
205 the main voice is playing. Here is a more correct rendition of
206 the example from the previous section. The crossed colored
207 noteheads demonstrate that the main melody is now in a single
210 @lilypond[quote,ragged-right,verbatim]
211 \new Staff \relative c' {
212 \override NoteHead #'style = #'cross
213 \override NoteHead #'color = #red
218 \new Voice="1" { \voiceTwo
219 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
222 \new Voice { \voiceThree
231 The correct definition of the voices allows the melody to be
234 @lilypond[quote,ragged-right,verbatim]
235 \new Staff \relative c' {
240 \context Voice="1" { \voiceTwo
241 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
244 \new Voice { \voiceThree
253 Avoiding the @code{\\} separator also allows nesting polyphony
254 constructs, which in some case might be a more natural way to
257 @lilypond[quote,ragged-right,verbatim]
258 \new Staff \relative c' {
263 \context Voice="1" { \voiceTwo
267 \new Voice { \voiceThree
279 In some instances of complex polyphonic music, you may need
280 additional voices to avoid collisions between notes. Additional
281 voices are added by defining an identifier, as shown below:
283 @lilypond[quote,verbatim,ragged-right,relative=2]
284 voiceFive = #(context-spec-music (make-voice-props-set 4) 'Voice)
287 { \voiceOne g4 ~ \stemDown g32[ f( es d c b a b64 )g] } \\
295 @node Collision Resolution
296 @unnumberedsubsubsec Collision Resolution
298 Normally, note heads with a different number of dots are not
299 merged, but when the object property
300 @code{merge-differently-dotted} is set in the
301 @internalsref{NoteCollision} object, they are merged:
303 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
306 \override Staff.NoteCollision
307 #'merge-differently-dotted = ##t
309 } \\ { g8.[ f16] g8.[ f16] } >>
312 Similarly, you can merge half note heads with eighth notes, by
313 setting @code{merge-differently-headed}:
315 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
318 \override Staff.NoteCollision
319 #'merge-differently-headed = ##t
320 c8 c4. } \\ { c2 c2 } >>
324 @code{merge-differently-headed} and
325 @code{merge-differently-dotted} only apply to opposing stem
326 directions (ie. Voice 1 & 2).
328 LilyPond also vertically shifts rests that are opposite of a stem,
331 @lilypond[quote,ragged-right,fragment,verbatim]
332 \new Voice << c''4 \\ r4 >>
335 If three or more notes line up in the same column,
336 @code{merge-differently-headed} cannot successfully complete the
337 merge of the two notes that should be merged. To allow the merge
338 to work properly, apply a @code{\shift} to the note that should
339 not be merged. In the first measure of following example,
340 @code{merge-differently-headed} does not work (the half-note head
341 is solid). In the second measure, @code{\shiftOn} is applied to
342 move the top @code{g} out of the column, and
343 @code{merge-differently-headed} works properly.
345 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
346 \override Staff.NoteCollision #'merge-differently-headed = ##t
349 { \oneVoice d=''8 c8 r4 e,8 c'8 r4 } \\
350 { \voiceFour e,,2 e'2}
353 { d'=''2 \shiftOn g2 } \\
354 { \oneVoice d=''8 c8 r4 e,8 c'8 r4 } \\
355 { \voiceFour e,,2 e'2}
368 @funindex \voiceThree
380 @code{\shiftOff}: these commands specify the degree to which
381 chords of the current voice should be shifted. The outer voices
382 (normally: voice one and two) have @code{\shiftOff}, while the
383 inner voices (three and four) have @code{\shiftOn}.
384 @code{\shiftOnn} and @code{\shiftOnnn} define further shift
387 When LilyPond cannot cope, the @code{force-hshift} property of the
388 @internalsref{NoteColumn} object and pitched rests can be used to
389 override typesetting decisions.
391 @lilypond[quote,verbatim,ragged-right]
398 \once \override NoteColumn #'force-hshift = #1.7
406 Program reference: the objects responsible for resolving
407 collisions are @internalsref{NoteCollision} and
408 @internalsref{RestCollision}.
413 When using @code{merge-differently-headed} with an upstem eighth
414 or a shorter note, and a downstem half note, the eighth note gets
417 There is no support for clusters where the same note occurs with
418 different accidentals in the same chord. In this case, it is
419 recommended to use enharmonic transcription, or to use special
420 cluster notation (see @ref{Clusters}).
423 @node Automatic part combining
424 @unnumberedsubsubsec Automatic part combining
425 @cindex automatic part combining
426 @cindex part combiner
428 Automatic part combining is used to merge two parts of music onto
429 a staff. It is aimed at typesetting orchestral scores. When the
430 two parts are identical for a period of time, only one is shown.
431 In places where the two parts differ, they are typeset as separate
432 voices, and stem directions are set automatically. Also, solo and
433 @emph{a due} parts are identified and can be marked.
435 The syntax for part combining is
438 \partcombine @var{musicexpr1} @var{musicexpr2}
442 The following example demonstrates the basic functionality of the
443 part combiner: putting parts on one staff, and setting stem
444 directions and polyphony
446 @lilypond[quote,verbatim,ragged-right,fragment]
447 \new Staff \partcombine
448 \relative g' { g g a( b) c c r r }
449 \relative g' { g g r4 r e e g g }
452 The first @code{g} appears only once, although it was specified
453 twice (once in each part). Stem, slur, and tie directions are set
454 automatically, depending whether there is a solo or unisono. The
455 first part (with context called @code{one}) always gets up stems,
456 and @q{Solo}, while the second (called @code{two}) always gets
457 down stems and @q{Solo II}.
459 If you just want the merging parts, and not the textual markings,
460 you may set the property @code{printPartCombineTexts} to false
462 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
464 \set Staff.printPartCombineTexts = ##f
466 \relative g' { g a( b) r }
467 \relative g' { g r4 r f }
471 To change the text that is printed for solos or merging, you may
472 set the @code{soloText}, @code{soloIIText}, and @code{aDueText}
475 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
477 \set Score.soloText = #"ichi"
478 \set Score.soloIIText = #"ni"
479 \set Score.aDueText = #"tachi"
481 \relative g' { g4 g a( b) r }
482 \relative g' { g4 g r r f }
486 Both arguments to @code{\partcombine} will be interpreted as
487 @internalsref{Voice} contexts. If using relative octaves,
488 @code{\relative} should be specified for both music expressions,
493 \relative @dots{} @var{musicexpr1}
494 \relative @dots{} @var{musicexpr2}
498 A @code{\relative} section that is outside of @code{\partcombine}
499 has no effect on the pitches of @var{musicexpr1} and
504 Program reference: @internalsref{PartCombineMusic}.
508 When @code{printPartCombineTexts} is set, when the two voices play
509 the same notes on and off, the part combiner may typeset @code{a2}
510 more than once in a measure.
512 @code{\partcombine} cannot be inside @code{\times}.
514 @code{\partcombine} cannot be inside @code{\relative}.
516 Internally, the @code{\partcombine} interprets both arguments as
517 @code{Voice}s named @code{one} and @code{two}, and then decides
518 when the parts can be combined. Consequently, if the arguments
519 switch to differently named @internalsref{Voice} contexts, the
520 events in those will be ignored.
523 @node Writing music in parallel
524 @unnumberedsubsubsec Writing music in parallel
526 @cindex Writing music in parallel
527 @cindex Interleaved music
529 Music for multiple parts can be interleaved
531 @lilypond[quote,fragment,verbatim]
532 \parallelMusic #'(voiceA voiceB) {
533 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c'' e''] |
535 r8 a'16[ d''] f''[ a' d'' f''] r8 a'16[ d''] f''[ a' d'' f''] |
539 \new Staff \new Voice \voiceA
540 \new Staff \new Voice \voiceB
544 This works quite well for piano music
546 @c It would be nice if the first bar fit onto one 66-char line.
547 @c Maybe simplify the example? -gp
548 @lilypond[quote,verbatim]
552 \parallelMusic #'(voiceA voiceB voiceC voiceD) {
554 r8 g'16[ c''] e''[ g' c'' e'']
555 r8 g'16[ c''] e''[ g' c'' e''] |
558 r8 a16[ d'] f'[ a d' f']
559 r8 a16[ d'] f'[ a d' f'] |
564 a'8 b' c'' d'' e'' f'' g'' a'' |
566 c16 d e f d e f g e f g a f g a b |