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 in
13 a piece of music. Polyphony in LilyPond refers to having more than
14 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 names}.
47 @unnumberedsubsubsec Clusters
51 A cluster indicates a continuous range of pitches to be played. They
52 can be denoted as the envelope of a set of notes. They are entered by
53 applying the function @code{makeClusters} to a sequence of
55 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
56 \makeClusters { <c e > <b f'> }
59 Ordinary notes and clusters can be put together in the same staff,
60 even simultaneously. In such a case no attempt is made to
61 automatically avoid collisions between ordinary notes and clusters.
65 Program reference: @internalsref{ClusterSpanner},
66 @internalsref{ClusterSpannerBeacon},
67 @internalsref{Cluster_spanner_engraver}.
69 Examples: @lsr{contemporary,cluster@/.ly}.
73 Music expressions like @code{<< @{ g8 e8 @} a4 >>} are not printed
74 accurately. Use @code{<g a>8 <e a>8} instead.
79 @subsection Multiple voices
83 * Explicitly instantiating voices::
84 * Collision Resolution::
85 * Automatic part combining::
86 * Writing music in parallel::
90 @unnumberedsubsubsec Basic polyphony
94 The easiest way to enter fragments with more than one voice on a staff
95 is to enter each voice as a sequence (with @code{@{...@}}), and combine
96 them simultaneously, separating the voices with @code{\\}
100 @lilypond[quote,verbatim,fragment]
101 \new Staff \relative c' {
104 { g4 f e | d2 e2 } \\
105 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
111 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
112 voices are sometimes called @q{layers} in other notation packages}
114 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
115 each of these contexts, vertical direction of slurs, stems, etc., is set
118 These voices are all separate from the voice that contains the notes just
119 outside the @code{<< \\ >>} construct. This should be noted when making
120 changes at the voice level. This also means that slurs and ties cannot go
121 into or out of a @code{<< \\ >>} construct. Conversely, parallel voices
122 from separate @code{<< \\ >>} constructs on the same staff are the
123 same voice. Here is the same example, with different noteheads and
125 voice. Note that the change to the note-head style in the main voice does
127 the inside of the @code{<< \\ >>} constructs. Also, the change to the
129 voice in the first @code{<< \\ >>} construct is effective in the second
130 @code{<< \\ >>}, and the voice is tied across the two constructs.
132 @cindex note heads, styles
134 @lilypond[quote,verbatim,fragment]
135 \new Staff \relative c' {
136 \override NoteHead #'style = #'cross
137 \override NoteHead #'color = #red
141 { \override NoteHead #'style = #'triangle
142 \override NoteHead #'color = #blue
147 { c8 b16 a b8 g ~ g2 } \\
148 { \override NoteHead #'style = #'slash
149 \override NoteHead #'color = #green
155 Polyphony does not change the relationship of notes within a
156 @code{\relative @{ @}} block. Each note is calculated relative
157 to the note immediately preceding it.
160 \relative @{ noteA << noteB \\ noteC >> noteD @}
163 @code{noteC} is relative to @code{noteB}, not @code{noteA};
164 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
168 @node Explicitly instantiating voices
169 @unnumberedsubsubsec Explicitly instantiating voices
171 @internalsref{Voice} contexts can also be instantiated manually
172 inside a @code{<< >>} block to create polyphonic music, using
173 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
174 and a horizontal shift for each part.
178 << \upper \\ \lower >>
186 \new Voice = "1" @{ \voiceOne \upper @}
187 \new Voice = "2" @{ \voiceTwo \lower @}
191 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
192 articulations, text annotations, augmentation dots of dotted
193 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
194 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
195 make them point downwards.
196 The command @code{\oneVoice} will revert back to the normal setting.
198 An expression that appears directly inside a @code{<< >>} belongs to
199 the main voice. This is useful when extra voices appear while the main
200 voice is playing. Here is a more correct rendition of the example from
201 the previous section. The crossed colored noteheads demonstrate that the main
202 melody is now in a single voice context.
204 @lilypond[quote,ragged-right,verbatim]
205 \new Staff \relative c' {
206 \override NoteHead #'style = #'cross
207 \override NoteHead #'color = #red
212 \new Voice="1" { \voiceTwo
213 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
216 \new Voice { \voiceThree
225 The correct definition of the voices allows the melody to be slurred.
226 @lilypond[quote,ragged-right,verbatim]
227 \new Staff \relative c' {
232 \context Voice="1" { \voiceTwo
233 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
236 \new Voice { \voiceThree
245 Avoiding the @code{\\} separator also allows nesting polyphony
246 constructs, which in some case might be a more natural way to typeset
249 @lilypond[quote,ragged-right,verbatim]
250 \new Staff \relative c' {
255 \context Voice="1" { \voiceTwo
259 \new Voice { \voiceThree
271 In some instances of complex polyphonic music, you may need additional
272 voices to avoid collisions between notes. Additional voices are added
273 by defining an identifier, as shown below:
275 @lilypond[quote,verbatim,ragged-right,relative=2]
276 voiceFive = #(context-spec-music (make-voice-props-set 4) 'Voice)
279 { \voiceOne g4 ~ \stemDown g32[ f( es d c b a b64 )g] } \\
287 @node Collision Resolution
288 @unnumberedsubsubsec Collision Resolution
290 Normally, note heads with a different number of dots are not merged, but
291 when the object property @code{merge-differently-dotted} is set in
292 the @internalsref{NoteCollision} object, they are merged:
294 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
297 \override Staff.NoteCollision
298 #'merge-differently-dotted = ##t
300 } \\ { g8.[ f16] g8.[ f16] } >>
303 Similarly, you can merge half note heads with eighth notes, by setting
304 @code{merge-differently-headed}:
306 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
309 \override Staff.NoteCollision
310 #'merge-differently-headed = ##t
311 c8 c4. } \\ { c2 c2 } >>
315 @code{merge-differently-headed} and @code{merge-differently-dotted}
316 only apply to opposing stem directions (ie. Voice 1 & 2).
318 LilyPond also vertically shifts rests that are opposite of a stem,
321 @lilypond[quote,ragged-right,fragment,verbatim]
322 \new Voice << c''4 \\ r4 >>
325 If three or more notes line up in the same column,
326 @code{merge-differently-headed} cannot
327 successfully complete the merge of the two notes that should be merged.
328 To allow the merge to work properly, apply a @code{\shift} to the note that
329 should not be merged. In the first measure of following example,
330 @code{merge-differently-headed} does not work (the half-note head is
331 solid). In the second measure, @code{\shiftOn} is applied to move the
332 top @code{g} out of the column, and @code{merge-differently-headed}
335 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
336 \override Staff.NoteCollision #'merge-differently-headed = ##t
339 { \oneVoice d=''8 c8 r4 e,8 c'8 r4 } \\
340 { \voiceFour e,,2 e'2}
343 { d'=''2 \shiftOn g2 } \\
344 { \oneVoice d=''8 c8 r4 e,8 c'8 r4 } \\
345 { \voiceFour e,,2 e'2}
358 @funindex \voiceThree
370 @code{\shiftOff}: these commands specify the
371 degree to which chords of the current voice should be shifted.
372 The outer voices (normally: voice one and
373 two) have @code{\shiftOff}, while the inner voices (three and four)
374 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
375 further shift levels.
377 When LilyPond cannot cope, the @code{force-hshift}
378 property of the @internalsref{NoteColumn} object and pitched rests can
379 be used to override typesetting decisions.
381 @lilypond[quote,verbatim,ragged-right]
388 \once \override NoteColumn #'force-hshift = #1.7
396 Program reference: the objects responsible for resolving collisions are
397 @internalsref{NoteCollision} and @internalsref{RestCollision}.
402 When using @code{merge-differently-headed} with an upstem eighth or a
403 shorter note, and a downstem half note, the eighth note gets the wrong
406 There is no support for clusters where the same note occurs with
407 different accidentals in the same chord. In this case, it is
408 recommended to use enharmonic transcription, or to use special cluster
409 notation (see @ref{Clusters}).
412 @node Automatic part combining
413 @unnumberedsubsubsec Automatic part combining
414 @cindex automatic part combining
415 @cindex part combiner
417 Automatic part combining is used to merge two parts of music onto a
418 staff. It is aimed at typesetting orchestral scores. When the two
419 parts are identical for a period of time, only one is shown. In
420 places where the two parts differ, they are typeset as separate
421 voices, and stem directions are set automatically. Also, solo and
422 @emph{a due} parts are identified and can be marked.
424 The syntax for part combining is
427 \partcombine @var{musicexpr1} @var{musicexpr2}
431 The following example demonstrates the basic functionality of the part
432 combiner: putting parts on one staff, and setting stem directions and
435 @lilypond[quote,verbatim,ragged-right,fragment]
436 \new Staff \partcombine
437 \relative g' { g g a( b) c c r r }
438 \relative g' { g g r4 r e e g g }
441 The first @code{g} appears only once, although it was
442 specified twice (once in each part). Stem, slur, and tie directions are
443 set automatically, depending whether there is a solo or unisono. The
444 first part (with context called @code{one}) always gets up stems, and
445 @q{Solo}, while the second (called @code{two}) always gets down stems and
448 If you just want the merging parts, and not the textual markings, you
449 may set the property @code{printPartCombineTexts} to false
451 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
453 \set Staff.printPartCombineTexts = ##f
455 \relative g' { g a( b) r }
456 \relative g' { g r4 r f }
460 To change the text that is printed for solos or merging, you may
461 set the @code{soloText}, @code{soloIIText}, and @code{aDueText}
464 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
466 \set Score.soloText = #"ichi"
467 \set Score.soloIIText = #"ni"
468 \set Score.aDueText = #"tachi"
470 \relative g' { g4 g a( b) r }
471 \relative g' { g4 g r r f }
475 Both arguments to @code{\partcombine} will be interpreted as
476 @internalsref{Voice} contexts. If using relative octaves,
477 @code{\relative} should be specified for both music expressions, i.e.,
481 \relative @dots{} @var{musicexpr1}
482 \relative @dots{} @var{musicexpr2}
486 A @code{\relative} section that is outside of @code{\partcombine} has
487 no effect on the pitches of @var{musicexpr1} and @var{musicexpr2}.
491 Program reference: @internalsref{PartCombineMusic}.
495 When @code{printPartCombineTexts} is set, when the two voices play the
496 same notes on and off, the part combiner may typeset @code{a2} more
497 than once in a measure.
499 @code{\partcombine} cannot be inside @code{\times}.
501 @code{\partcombine} cannot be inside @code{\relative}.
503 Internally, the @code{\partcombine} interprets both arguments as
504 @code{Voice}s named @code{one} and @code{two}, and then decides when
505 the parts can be combined. Consequently, if the arguments switch to
506 differently named @internalsref{Voice} contexts, the events in those
510 @node Writing music in parallel
511 @unnumberedsubsubsec Writing music in parallel
513 @cindex Writing music in parallel
514 @cindex Interleaved music
516 Music for multiple parts can be interleaved
518 @lilypond[quote,fragment,verbatim]
519 \parallelMusic #'(voiceA voiceB) {
520 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c'' e''] |
522 r8 a'16[ d''] f''[ a' d'' f''] r8 a'16[ d''] f''[ a' d'' f''] |
526 \new Staff \new Voice \voiceA
527 \new Staff \new Voice \voiceB
531 This works quite well for piano music
533 @lilypond[quote,verbatim]
537 \parallelMusic #'(voiceA voiceB voiceC voiceD) {
539 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c''
542 r8 a16[ d'] f'[ a d' f'] r8 a16[ d'] f'[ a d' f'] |
546 a'8 b' c'' d'' e'' f'' g'' a'' |
548 c16 d e f d e f g e f g a f g a b |