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,quote,relative=1]
48 <c e g>2 <c f a>4-> <e g c>-.
51 For more information about chords, see @ref{Chord notation}.
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,relative=2,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
138 Normally, equal note heads with the same number of dots are
139 automatically merged, but note heads with a different number of dots
140 are not. To merge differently dotted note heads, you can set the
141 @code{merge-differently-dotted} property of the
142 @rinternals{NoteCollision} object:
144 @lilypond[quote,verbatim,relative=2]
147 \override Staff.NoteCollision #'merge-differently-dotted = ##t
155 Similarly, you can merge half note heads with eighth notes, by
156 setting @code{merge-differently-headed}:
158 @lilypond[quote,relative=2,verbatim]
161 \override Staff.NoteCollision #'merge-differently-headed = ##t
170 Merging notes by setting @code{merge-differently-headed} and
171 @code{merge-differently-dotted} only works for opposing stem
172 directions (i.e., to @code{Voice}s 1 and 2).
174 @cindex shift rest, automatic
176 LilyPond also vertically shifts rests that are opposite of a stem, for
179 @lilypond[quote,verbatim]
185 If three or more notes line up in the same column,
186 @code{merge-differently-headed} cannot successfully complete the merge
187 of the two notes that should be merged. To allow the merge to work
188 properly, apply a @code{\shift} to the note that should not be merged.
189 In the first measure of following example,
190 @code{merge-differently-headed} does not work (the half-note head is
191 solid). In the second measure, @code{\shiftOn} is applied to move the
192 top @code{g} out of the column, and @code{merge-differently-headed}
195 @c IMO this uglyfies the typesetting. Look for a better example. FV
197 @lilypond[quote,verbatim,relative=2]
198 \override Staff.NoteCollision #'merge-differently-headed = ##t
201 { \oneVoice d=''8 c8 r4 e,8 c'8 r4 } \\
202 { \voiceFour e,,2 e'2}
205 { d'=''2 \shiftOn g2 } \\
206 { \oneVoice d=''8 c8 r4 e,8 c'8 r4 } \\
207 { \voiceFour e,,2 e'2}
211 @cindex multiple voices
212 @cindex polyphonic music
213 @cindex shifting voices
215 In some instances of complex polyphonic music, you may need
216 additional voices to avoid collisions between notes. Additional
217 voices are added by defining an variable, as shown below:
219 @lilypond[quote,verbatim]
220 voiceFive = #(context-spec-music (make-voice-props-set 4) 'Voice)
223 { \voiceOne g2. ~ \stemDown g32[ f( es d c b a b64) g] } \\
224 { \voiceThree b4 } \\
239 @funindex \voiceThree
244 @c undocumented?: --FV
245 @funindex \voiceNeutralStyle
246 @funindex \voiceOneStyle
247 @funindex \voiceTwoStyle
248 @funindex \voiceThreeStyle
249 @funindex \voiceFourStyle
265 @code{\shiftOff}: these commands specify the degree to which
266 chords of the current voice should be shifted. The outer voices
267 (normally: voices one and two) have @code{\shiftOff}, while the
268 inner voices (three and four) have @code{\shiftOn}.
269 @code{\shiftOnn} and @code{\shiftOnnn} define further shift
272 When LilyPond cannot cope, the @code{force-hshift} property of the
273 @rinternals{NoteColumn} object and pitched rests can be used to
274 override typesetting decisions.
276 @lilypond[quote,verbatim,relative=1]
282 \once \override NoteColumn #'force-hshift = #1.7
295 @rlearning{Multiple notes at once},
296 @rlearning{Voices contain music},
297 @rlearning{Collisions of objects}.
300 @rlsr{Simultaneous notes}.
303 @rinternals{NoteColumn}.
304 The objects responsible for resolving collisions
306 @rinternals{NoteCollision} and
307 @rinternals{RestCollision}.
312 When using @code{merge-differently-headed} with an upstem eighth or a
313 shorter note, and a downstem half note, the eighth note stem gets a
314 slightly wrong offset because of the different width of the half note
317 There is no support for clusters where the same note occurs with
318 different accidentals in the same chord. In this case, it is
319 recommended to use enharmonic transcription, or to use special
320 cluster notation (see @ref{Clusters}).
322 @node Automatic part combining
323 @subsubsection Automatic part combining
325 @cindex automatic part combining
326 @cindex part combiner
327 @cindex combining parts
328 @funindex \partcombine
330 Automatic part combining is used to merge two parts of music onto a
331 staff. It is aimed at typesetting orchestral scores. When the two
332 parts are identical for a period of time, only one is shown. In
333 places where the two parts differ, they are typeset as separate
334 voices, and stem directions are set automatically. Also, solo and
335 @notation{a due} parts are identified and marked by default.
337 The syntax for part combining is:
340 \partcombine @var{musicexpr1} @var{musicexpr2}
343 The following example demonstrates the basic functionality of the part
344 combiner: putting parts on one staff and setting stem directions and
345 polyphony. The same variables are used for the independent
346 parts and the combined staff.
348 @lilypond[quote,verbatim]
349 instrumentOne = \relative c' {
357 instrumentTwo = \relative g' {
366 \new Staff \instrumentOne
367 \new Staff \instrumentTwo
368 \new Staff \partcombine \instrumentOne \instrumentTwo
372 The notes in the third measure appear only once, although they were
373 specified in both parts. Stem, slur, and tie directions are set
374 automatically, depending whether there is a solo or unison. When
375 needed in polyphony situations, the first part (with context called
376 @code{one}) always gets up stems, while the second (called @code{two})
377 always gets down stems. In solo situations, the parts get marked with
378 @q{Solo} and @q{Solo II}, respectively. The unisono (@notation{a due})
379 parts are marked by default with the text @qq{a2}.
381 Both arguments to @code{\partcombine} will be interpreted as
382 @code{Voice} contexts. If using relative octaves,
383 @code{\relative} should be specified for both music expressions,
388 \relative @dots{} @var{musicexpr1}
389 \relative @dots{} @var{musicexpr2}
393 A @code{\relative} section that is outside of @code{\partcombine}
394 has no effect on the pitches of @var{musicexpr1} and
399 Parts may be merged without printing text:
401 @lilypond[quote,verbatim]
403 \set Staff.printPartCombineTexts = ##f
405 \relative g' { g a( b) r }
406 \relative g' { g r4 r f }
410 The printed text may be changed:
412 @lilypond[quote,verbatim]
414 \set Score.soloText = #"girl"
415 \set Score.soloIIText = #"boy"
416 \set Score.aDueText = #"together"
418 \relative g' { g4 g r r a2 g }
419 \relative g' { r4 r a( b) a2 g }
434 @rlsr{Simultaneous notes}.
438 @rinternals{PartCombineMusic},
443 When @code{printPartCombineTexts} is set, if the two voices play
444 the same notes on and off, the part combiner may typeset @code{a2}
445 more than once in a measure.
447 @code{\partcombine} cannot be inside @code{\times}.
449 @code{\partcombine} cannot be inside @code{\relative}.
451 Internally, the @code{\partcombine} interprets both arguments as
452 @code{Voice}s named @code{one} and @code{two}, and then decides
453 when the parts can be combined. Consequently, if the arguments
454 switch to differently named @rinternals{Voice} contexts, the
455 events in those will be ignored.
457 @c IIRC in users list someone pointed out more issues. FV
459 @node Writing music in parallel
460 @subsubsection Writing music in parallel
462 @cindex Writing music in parallel
463 @cindex Interleaved music
464 @funindex parallelMusic
466 Music for multiple parts can be interleaved in input code. The
467 function @code{\parallelMusic} accepts a list with the names of a
468 number of variables to be created, and a musical expression. The
469 content of alternate measures from the expression become the value of
470 the respective variables, so you can use them afterwards to print the
473 @warning{Bar checks @code{|} must be used, and the measures must
474 be of the same length.}
476 @lilypond[quote,verbatim]
477 \parallelMusic #'(voiceA voiceB) {
479 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c'' e''] |
483 r8 a'16[ d''] f''[ a' d'' f''] r8 a'16[ d''] f''[ a' d'' f''] |
492 Relative mode may be used. Note that the @code{\relative} command
493 is not used inside @code{\parallelMusic} itself. The notes are
494 relative to the preceding note in the voice, not to the previous
495 note in the input -- in other words, relative notes for
496 @code{voiceA} ignore the notes in @code{voiceB}.
498 @lilypond[quote,verbatim]
499 \parallelMusic #'(voiceA voiceB) {
501 r8 g16 c e g, c e r8 g,16 c e g, c e |
505 r8 a,16 d f a, d f r8 a,16 d f a, d f |
509 \new Staff \relative c'' \voiceA
510 \new Staff \relative c' \voiceB
514 This works quite well for piano music. This example maps four
515 consecutive measures to four variables:
517 @lilypond[quote,verbatim]
523 \parallelMusic #'(voiceA voiceB voiceC voiceD) {
527 c16 d e fis d e fis g |
533 e16 fis g a fis g a b |
544 \relative c'' \voiceA \\
551 \relative c \voiceC \\
563 @rlearning{Organizing pieces with variables}
566 @rlsr{Simultaneous notes}.