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}.
109 Clusters only look good if they span at least two chords; otherwise
110 they appear too narrow.
112 Clusters do not have a stem and can not indicate durations by
113 themselves. Separate clusters would need a separating rest between
116 @node Multiple voices
117 @subsection Multiple voices
120 * Collision resolution::
121 * Automatic part combining::
122 * Writing music in parallel::
125 @node Collision resolution
126 @subsubsection Collision resolution
128 @cindex merging notes
129 @cindex note collisions
135 @cindex shift rest, automatic
137 Note heads with equal durations are automatically merged, while
138 note heads with unequal durations are not merged. Rests opposite
139 a stem are shifted vertically.
141 @lilypond[quote,verbatim,relative=2]
157 Note heads with different note heads may be merged, with the exception
158 of half-note heads and quarter-note heads:
160 @lilypond[quote,verbatim,relative=2]
163 \override Staff.NoteCollision #'merge-differently-headed = ##t
177 Note heads with different dots may be merged:
179 @lilypond[quote,relative=2,verbatim]
182 \override Staff.NoteCollision #'merge-differently-headed = ##t
183 \override Staff.NoteCollision #'merge-differently-dotted = ##t
199 The collision on the second measure happens because
200 @code{merge-differently-headed} cannot successfully complete the merge
201 when three or more notes line up in the same column (in fact, you will
202 obtain a warning for this reason). To allow the merge to work
203 properly, apply a @code{\shift} to the note that should not be merged.
204 Here, @code{\shiftOn} is applied to move the top @code{g} out of the
205 column, and @code{merge-differently-headed} works properly.
207 @lilypond[quote,relative=2,verbatim]
210 \override Staff.NoteCollision #'merge-differently-headed = ##t
211 \override Staff.NoteCollision #'merge-differently-dotted = ##t
227 Notes are only merged if they have opposing stem directions (i.e., in
228 @code{Voice} 1 and 2).
230 @cindex multiple voices
231 @cindex polyphonic music
232 @cindex shifting voices
234 In some instances of complex polyphonic music, you may need
235 additional voices to avoid collisions between notes. Additional
236 voices are added by defining an variable, as shown below:
238 @lilypond[quote,verbatim]
239 voiceFive = #(context-spec-music (make-voice-props-set 4) 'Voice)
242 { \voiceOne g2. ~ \stemDown g32[ f( es d c b a b64) g] } \\
243 { \voiceThree b4 } \\
258 @funindex \voiceThree
263 @c undocumented?: --FV
264 @funindex \voiceNeutralStyle
265 @funindex \voiceOneStyle
266 @funindex \voiceTwoStyle
267 @funindex \voiceThreeStyle
268 @funindex \voiceFourStyle
284 @code{\shiftOff}: these commands specify the degree to which
285 chords of the current voice should be shifted. The outer voices
286 (normally: voices one and two) have @code{\shiftOff}, while the
287 inner voices (three and four) have @code{\shiftOn}.
288 @code{\shiftOnn} and @code{\shiftOnnn} define further shift
291 When LilyPond cannot cope, the @code{force-hshift} property of the
292 @code{NoteColumn} object and pitched rests can be used to
293 override typesetting decisions.
295 @lilypond[quote,verbatim,relative=1]
301 \once \override NoteColumn #'force-hshift = #1.7
313 @rlearning{Multiple notes at once},
314 @rlearning{Voices contain music},
315 @rlearning{Collisions of objects}.
318 @rlsr{Simultaneous notes}.
321 @rinternals{NoteColumn}.
322 The objects responsible for resolving collisions
324 @rinternals{NoteCollision} and
325 @rinternals{RestCollision}.
330 When using @code{merge-differently-headed} with an upstem eighth or a
331 shorter note, and a downstem half note, the eighth note stem gets a
332 slightly wrong offset because of the different width of the half note
335 @c investigate! Sometimes it works, sometimes not. --FV
336 It is not clear in which circumpstances you can succesfully merge
337 different note heads that are at the same time differently dotted.
339 There is no support for clusters where the same note occurs with
340 different accidentals in the same chord. In this case, it is
341 recommended to use enharmonic transcription, or to use special
342 cluster notation (see @ref{Clusters}).
345 @node Automatic part combining
346 @subsubsection Automatic part combining
348 @cindex automatic part combining
349 @cindex part combiner
350 @cindex combining parts
351 @funindex \partcombine
353 Automatic part combining is used to merge two parts of music onto a
354 staff. It is aimed at typesetting orchestral scores. When the two
355 parts are identical for a period of time, only one is shown. In
356 places where the two parts differ, they are typeset as separate
357 voices, and stem directions are set automatically. Also, solo and
358 @notation{a due} parts are identified and marked by default.
360 The syntax for part combining is:
363 \partcombine @var{musicexpr1} @var{musicexpr2}
366 The following example demonstrates the basic functionality of the part
367 combiner: putting parts on one staff and setting stem directions and
368 polyphony. The same variables are used for the independent
369 parts and the combined staff.
371 @lilypond[quote,verbatim]
372 instrumentOne = \relative c' {
380 instrumentTwo = \relative g' {
389 \new Staff \instrumentOne
390 \new Staff \instrumentTwo
391 \new Staff \partcombine \instrumentOne \instrumentTwo
395 The notes in the third measure appear only once, although they were
396 specified in both parts. Stem, slur, and tie directions are set
397 automatically, depending whether there is a solo or unison. When
398 needed in polyphony situations, the first part (with context called
399 @code{one}) always gets up stems, while the second (called @code{two})
400 always gets down stems. In solo situations, the parts get marked with
401 @q{Solo} and @q{Solo II}, respectively. The unisono (@notation{a due})
402 parts are marked by default with the text @qq{a2}.
404 Both arguments to @code{\partcombine} will be interpreted as
405 @code{Voice} contexts. If using relative octaves,
406 @code{\relative} should be specified for both music expressions,
411 \relative @dots{} @var{musicexpr1}
412 \relative @dots{} @var{musicexpr2}
416 A @code{\relative} section that is outside of @code{\partcombine}
417 has no effect on the pitches of @var{musicexpr1} and
422 Parts may be merged without printing text:
424 @lilypond[quote,verbatim]
426 \set Staff.printPartCombineTexts = ##f
428 \relative g' { g a( b) r }
429 \relative g' { g r4 r f }
433 The printed text may be changed:
435 @lilypond[quote,verbatim]
437 \set Score.soloText = #"girl"
438 \set Score.soloIIText = #"boy"
439 \set Score.aDueText = #"together"
441 \relative g' { g4 g r r a2 g }
442 \relative g' { r4 r a( b) a2 g }
457 @rlsr{Simultaneous notes}.
461 @rinternals{PartCombineMusic},
466 When @code{printPartCombineTexts} is set, if the two voices play
467 the same notes on and off, the part combiner may typeset @code{a2}
468 more than once in a measure.
470 @code{\partcombine} cannot be inside @code{\times}.
472 @code{\partcombine} cannot be inside @code{\relative}.
474 Internally, the @code{\partcombine} interprets both arguments as
475 @code{Voice}s named @code{one} and @code{two}, and then decides
476 when the parts can be combined. Consequently, if the arguments
477 switch to differently named @rinternals{Voice} contexts, the
478 events in those will be ignored.
480 @c IIRC in users list someone pointed out more issues. FV
482 @node Writing music in parallel
483 @subsubsection Writing music in parallel
485 @cindex Writing music in parallel
486 @cindex Interleaved music
487 @funindex parallelMusic
489 Music for multiple parts can be interleaved in input code. The
490 function @code{\parallelMusic} accepts a list with the names of a
491 number of variables to be created, and a musical expression. The
492 content of alternate measures from the expression become the value of
493 the respective variables, so you can use them afterwards to print the
496 @warning{Bar checks @code{|} must be used, and the measures must
497 be of the same length.}
499 @lilypond[quote,verbatim]
500 \parallelMusic #'(voiceA voiceB) {
502 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c'' e''] |
506 r8 a'16[ d''] f''[ a' d'' f''] r8 a'16[ d''] f''[ a' d'' f''] |
515 Relative mode may be used. Note that the @code{\relative} command
516 is not used inside @code{\parallelMusic} itself. The notes are
517 relative to the preceding note in the voice, not to the previous
518 note in the input -- in other words, relative notes for
519 @code{voiceA} ignore the notes in @code{voiceB}.
521 @lilypond[quote,verbatim]
522 \parallelMusic #'(voiceA voiceB) {
524 r8 g16 c e g, c e r8 g,16 c e g, c e |
528 r8 a,16 d f a, d f r8 a,16 d f a, d f |
532 \new Staff \relative c'' \voiceA
533 \new Staff \relative c' \voiceB
537 This works quite well for piano music. This example maps four
538 consecutive measures to four variables:
540 @lilypond[quote,verbatim]
546 \parallelMusic #'(voiceA voiceB voiceC voiceD) {
550 c16 d e fis d e fis g |
556 e16 fis g a fis g a b |
567 \relative c'' \voiceA \\
574 \relative c \voiceC \\
585 @rlearning{Organizing pieces with variables}
588 @rlsr{Simultaneous notes}.