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.
11 @node Simultaneous notes
12 @section Simultaneous notes
14 @lilypondfile[quote]{simultaneous-headword.ly}
16 Polyphony in music refers to having more than one voice occurring
17 in a piece of music. Polyphony in LilyPond refers to having more
18 than one voice on the same staff.
27 @subsection Single voice
35 @subsubsection Chorded notes
38 @cindex brackets, angle
43 A chord is formed by a enclosing a set of pitches between @code{<} and
44 @code{>}. A chord may be followed by a duration and/or a set of
45 articulations, just like simple notes:
47 @lilypond[verbatim,ragged-right,fragment,quote,relative=1]
48 <c e g>2 <c f a>4-> <e g c>-.
51 For more information about chords, see @ref{Modern chords}.
59 @rlearning{Combining notes into chords}.
65 @rlsr{Simultaneous notes}.
69 For some reason, music expressions like @code{<< @{ g8 e8 @} a4 >>}
70 that should automatically turn into chords, appear splitted in two
71 staves. To avoid this, use explicit chords instead as in
76 @subsubsection Clusters
79 @funindex \makeClusters
81 A cluster indicates a continuous range of pitches to be played. They
82 can be denoted as the envelope of a set of notes. They are entered by
83 applying the function @code{\makeClusters} to a sequence of chords,
86 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
87 \makeClusters { <g b>2 <c g'> }
90 Ordinary notes and clusters can be put together in the same staff,
91 even simultaneously. In such a case no attempt is made to
92 automatically avoid collisions between ordinary notes and clusters.
100 @rlsr{Simultaneous notes}.
103 @rinternals{ClusterSpanner},
104 @rinternals{ClusterSpannerBeacon},
105 @rinternals{Cluster_spanner_engraver}.
107 @c Examples: @rlsr{contemporary,cluster@/.ly}.
111 Clusters only look good if they span at least two chords; otherwise
112 they appear too narrow.
114 Clusters do not have a stem and can not indicate durations by
115 themselves. Separate clusters would need a separating rest between
118 @node Multiple voices
119 @subsection Multiple voices
122 * Collision resolution::
123 * Automatic part combining::
124 * Writing music in parallel::
127 @node Collision resolution
128 @subsubsection Collision resolution
130 @cindex merging notes
131 @cindex note collisions
133 Normally, note heads with a different number of dots are not
134 merged, but when the object property
135 @code{merge-differently-dotted} is set in the
136 @rinternals{NoteCollision} object, they are merged:
138 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
141 \override Staff.NoteCollision
142 #'merge-differently-dotted = ##t
144 } \\ { g8.[ f16] g8.[ f16] } >>
147 Similarly, you can merge half note heads with eighth notes, by
148 setting @code{merge-differently-headed}:
150 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
153 \override Staff.NoteCollision
154 #'merge-differently-headed = ##t
155 c8 c4. } \\ { c2 c2 } >>
159 @code{merge-differently-headed} and
160 @code{merge-differently-dotted} only apply to opposing stem
161 directions (i.e. Voice 1 & 2).
163 LilyPond also vertically shifts rests that are opposite of a stem,
166 @lilypond[quote,ragged-right,fragment,verbatim]
167 \new Voice << c''4 \\ r4 >>
172 If three or more notes line up in the same column,
173 @code{merge-differently-headed} cannot successfully complete the
174 merge of the two notes that should be merged. To allow the merge
175 to work properly, apply a @code{\shift} to the note that should
176 not be merged. In the first measure of following example,
177 @code{merge-differently-headed} does not work (the half-note head
178 is solid). In the second measure, @code{\shiftOn} is applied to
179 move the top @code{g} out of the column, and
180 @code{merge-differently-headed} works properly.
182 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
183 \override Staff.NoteCollision #'merge-differently-headed = ##t
186 { \oneVoice d=''8 c8 r4 e,8 c'8 r4 } \\
187 { \voiceFour e,,2 e'2}
190 { d'=''2 \shiftOn g2 } \\
191 { \oneVoice d=''8 c8 r4 e,8 c'8 r4 } \\
192 { \voiceFour e,,2 e'2}
196 @cindex multiple voices
197 @cindex polyphonic music
198 @cindex shifting voices
200 In some instances of complex polyphonic music, you may need
201 additional voices to avoid collisions between notes. Additional
202 voices are added by defining an variable, as shown below:
204 @lilypond[quote,verbatim,ragged-right]
205 voiceFive = #(context-spec-music (make-voice-props-set 4) 'Voice)
208 { \voiceOne g4 ~ \stemDown g32[ f( es d c b a b64 )g] } \\
225 @funindex \voiceThree
230 @funindex \voiceNeutralStyle
231 @funindex \voiceOneStyle
232 @funindex \voiceTwoStyle
233 @funindex \voiceThreeStyle
234 @funindex \voiceFourStyle
250 @code{\shiftOff}: these commands specify the degree to which
251 chords of the current voice should be shifted. The outer voices
252 (normally: voice one and two) have @code{\shiftOff}, while the
253 inner voices (three and four) have @code{\shiftOn}.
254 @code{\shiftOnn} and @code{\shiftOnnn} define further shift
257 When LilyPond cannot cope, the @code{force-hshift} property of the
258 @rinternals{NoteColumn} object and pitched rests can be used to
259 override typesetting decisions.
261 @lilypond[quote,verbatim,ragged-right]
268 \once \override NoteColumn #'force-hshift = #1.7
277 @rlsr{Simultaneous notes}.
279 Internals Reference: the objects responsible for resolving collisions
281 @rinternals{NoteCollision} and
282 @rinternals{RestCollision}.
287 When using @code{merge-differently-headed} with an upstem eighth
288 or a shorter note, and a downstem half note, the eighth note gets
291 There is no support for clusters where the same note occurs with
292 different accidentals in the same chord. In this case, it is
293 recommended to use enharmonic transcription, or to use special
294 cluster notation (see @ref{Clusters}).
296 @node Automatic part combining
297 @subsubsection Automatic part combining
299 @cindex automatic part combining
300 @cindex part combiner
301 @cindex combining parts
302 @funindex \partcombine
304 Automatic part combining is used to merge two parts of music onto a
305 staff. It is aimed at typesetting orchestral scores. When the two
306 parts are identical for a period of time, only one is shown. In
307 places where the two parts differ, they are typeset as separate
308 voices, and stem directions are set automatically. Also, solo and
309 @notation{a due} parts are identified and marked by default.
311 The syntax for part combining is:
314 \partcombine @var{musicexpr1} @var{musicexpr2}
317 The following example demonstrates the basic functionality of the part
318 combiner: putting parts on one staff and setting stem directions and
319 polyphony. The same variables are used for the independent
320 parts and the combined staff.
322 @lilypond[quote,verbatim,ragged-right]
323 instrumentOne = \relative c' {
331 instrumentTwo = \relative g' {
340 \new Staff \instrumentOne
341 \new Staff \instrumentTwo
342 \new Staff \partcombine \instrumentOne \instrumentTwo
346 The notes in the third measure appear only once, although they were
347 specified in both parts. Stem, slur, and tie directions are set
348 automatically, depending whether there is a solo or unison. When
349 needed in polyphony situations, the first part (with context called
350 @code{one}) always gets up stems, while the second (called @code{two})
351 always gets down stems. In solo situations, the parts get marked with
352 @q{Solo} and @q{Solo II}, respectively. The unisono (@notation{a due})
353 parts are marked by default with the text @qq{a2}.
355 Both arguments to @code{\partcombine} will be interpreted as
356 @code{Voice} contexts. If using relative octaves,
357 @code{\relative} should be specified for both music expressions,
362 \relative @dots{} @var{musicexpr1}
363 \relative @dots{} @var{musicexpr2}
367 A @code{\relative} section that is outside of @code{\partcombine}
368 has no effect on the pitches of @var{musicexpr1} and
373 Parts may be merged without printing text:
375 @lilypond[quote,verbatim,ragged-right]
377 \set Staff.printPartCombineTexts = ##f
379 \relative g' { g a( b) r }
380 \relative g' { g r4 r f }
384 The printed text may be changed:
386 @lilypond[quote,verbatim,ragged-right]
388 \set Score.soloText = #"girl"
389 \set Score.soloIIText = #"boy"
390 \set Score.aDueText = #"together"
392 \relative g' { g4 g r r a2 g }
393 \relative g' { r4 r a( b) a2 g }
408 @rlsr{Simultaneous notes}.
412 @rinternals{PartCombineMusic},
417 When @code{printPartCombineTexts} is set, if the two voices play
418 the same notes on and off, the part combiner may typeset @code{a2}
419 more than once in a measure.
421 @code{\partcombine} cannot be inside @code{\times}.
423 @code{\partcombine} cannot be inside @code{\relative}.
425 Internally, the @code{\partcombine} interprets both arguments as
426 @code{Voice}s named @code{one} and @code{two}, and then decides
427 when the parts can be combined. Consequently, if the arguments
428 switch to differently named @rinternals{Voice} contexts, the
429 events in those will be ignored.
431 @c IIRC in users list someone pointed out more issues. FV
433 @node Writing music in parallel
434 @subsubsection Writing music in parallel
436 @cindex Writing music in parallel
437 @cindex Interleaved music
438 @funindex parallelMusic
440 Music for multiple parts can be interleaved in input code. The
441 function @code{\parallelMusic} accepts a list with the names of a
442 number of variables to be created, and a musical expression. The
443 content of alternate measures from the expression become the value of
444 the respective variables, so you can use them afterwards to print the
447 @warning{Bar checks @code{|} must be used, and the measures must
448 be of the same length.}
450 @lilypond[quote,fragment,verbatim]
451 \parallelMusic #'(voiceA voiceB) {
453 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c'' e''] |
457 r8 a'16[ d''] f''[ a' d'' f''] r8 a'16[ d''] f''[ a' d'' f''] |
466 Relative mode may be used. Note that the @code{\relative} command
467 is not used inside @code{\parallelMusic} itself. The notes are
468 relative to the preceding note in the voice, not to the previous
469 note in the input -- in other words, relative notes for
470 @code{voiceA} ignore the notes in @code{voiceB}.
472 @lilypond[quote,fragment,verbatim]
473 \parallelMusic #'(voiceA voiceB) {
475 r8 g16 c e g, c e r8 g,16 c e g, c e |
479 r8 a,16 d f a, d f r8 a,16 d f a, d f |
483 \new Staff \relative c'' \voiceA
484 \new Staff \relative c' \voiceB
488 This works quite well for piano music. This example maps four
489 consecutive measures to four variables:
491 @lilypond[quote,verbatim]
497 \parallelMusic #'(voiceA voiceB voiceC voiceD) {
501 c16 d e fis d e fis g |
507 e16 fis g a fis g a b |
518 \relative c'' \voiceA \\
525 \relative c \voiceC \\
537 @rlearning{Organizing pieces with variables}
540 @rlsr{Simultaneous notes}.