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
29 This section discusses simultaneous notes inside the same voice.
38 @unnumberedsubsubsec Chorded notes
41 @cindex brackets, angle
46 A chord is formed by a enclosing a set of pitches between @code{<} and
47 @code{>}. A chord may be followed by a duration and/or a set of
48 articulations, just like simple notes:
50 @lilypond[verbatim,quote,relative=1]
51 <c e g>2 <c f a>4-> <e g c>-.
54 For more information about chords, see @ref{Chord notation}.
62 @rlearning{Combining notes into chords}.
68 @rlsr{Simultaneous notes}.
73 For some reason, music expressions like @code{<< @{ g8 e8 @} a4 >>}
74 that should automatically turn into chords, appear split in two
75 staves. To avoid this, use explicit chords instead as in
80 @unnumberedsubsubsec Parallel notes
83 Pieces of music having the same rhythm form chords when
84 combined in parallel into the same @code{Voice} context by enclosing
85 them into double angle brackets:
88 Parallel pieces of music can be combined into a single
89 @code{Voice} context, thus forming chords if they have the same
90 rhythm. To achieve this, enclose them in a simultaneous music
93 @lilypond[quote,relative=2,verbatim]
95 { e4 f8 d e16 f g8 d4 }
96 { c4 d8 b c16 d e8 b4 }
103 @rlearning{Voices contain music}.
106 @rlsr{Simultaneous notes}.
110 This method leads to strange beamings and warnings if the pieces of
111 music do not have the same rhythm.
114 @unnumberedsubsubsec Clusters
117 @funindex \makeClusters
119 A cluster indicates a continuous range of pitches to be played. They
120 can be denoted as the envelope of a set of notes. They are entered by
121 applying the function @code{\makeClusters} to a sequence of chords,
124 @lilypond[quote,relative=2,verbatim]
125 \makeClusters { <g b>2 <c g'> }
128 Ordinary notes and clusters can be put together in the same staff,
129 even simultaneously. In such a case no attempt is made to
130 automatically avoid collisions between ordinary notes and clusters.
138 @rlsr{Simultaneous notes}.
141 @rinternals{ClusterSpanner},
142 @rinternals{ClusterSpannerBeacon},
143 @rinternals{Cluster_spanner_engraver}.
147 Clusters look good only if they span at least two chords; otherwise
148 they appear too narrow.
150 Clusters do not have a stem and cannot indicate durations by
151 themselves. Separate clusters would need a separating rest between
154 @node Multiple voices
155 @subsection Multiple voices
157 This section discusses simultaneous notes in multiple voices or
161 * Collision resolution::
163 * Automatic part combining::
164 * Writing music in parallel::
167 @node Collision resolution
168 @unnumberedsubsubsec Collision resolution
170 @cindex merging notes
171 @cindex note collisions
177 @cindex shift rest, automatic
179 Note heads with equal durations are automatically merged, while
180 note heads with unequal durations are not merged. Rests opposite
181 a stem are shifted vertically.
183 @lilypond[quote,verbatim,relative=2]
199 Note heads with different note heads may be merged, with the
200 exception of half-note heads and quarter-note heads:
202 @lilypond[quote,verbatim,relative=2]
205 \mergeDifferentlyHeadedOn
219 Note heads with different dots may be merged:
221 @lilypond[quote,relative=2,verbatim]
224 \mergeDifferentlyHeadedOn
225 \mergeDifferentlyDottedOn
241 The collision on the second measure happens because
242 @code{merge-differently-headed} cannot successfully complete the
243 merge when three or more notes line up in the same column -- in
244 fact, you will obtain a warning for this reason. To allow the
245 merge to work properly, apply a @code{\shift} to the note that
246 should not be merged. Here, @code{\shiftOn} is applied to move
247 the top @code{g} out of the column, and
248 @code{merge-differently-headed} works properly.
250 @lilypond[quote,relative=2,verbatim]
253 \mergeDifferentlyHeadedOn
254 \mergeDifferentlyDottedOn
270 The @code{\shiftOn}, @code{\shiftOnn}, and @code{\shiftOnnn}
271 commands specify the degree to which chords of the current voice
272 should be shifted. The outer voices (normally: voices one and
273 two) have @code{\shiftOff}, while the inner voices (three and
274 four) have @code{\shiftOn}. @code{\shiftOnn} and
275 @code{\shiftOnnn} define further shift levels.
277 Notes are only merged if they have opposing stem directions (i.e., in
278 @code{Voice} 1 and 2).
281 @cindex multiple voices
282 @cindex polyphonic music
283 @cindex shifting voices
287 @funindex \mergeDifferentlyDottedOn
288 @code{\mergeDifferentlyDottedOn},
289 @funindex \mergeDifferentlyDottedOff
290 @code{\mergeDifferentlyDottedOff},
291 @funindex \mergeDifferentlyHeadedOn
292 @code{\mergeDifferentlyHeadedOn},
293 @funindex \mergeDifferentlyHeadedOff
294 @code{\mergeDifferentlyHeadedOff}.
302 @funindex \voiceThree
319 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
320 {additional-voices-to-avoid-collisions.ly}
322 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
323 {forcing-horizontal-shift-of-notes.ly}
331 @rlearning{Multiple notes at once},
332 @rlearning{Voices contain music},
333 @rlearning{Collisions of objects}.
336 @rlsr{Simultaneous notes}.
339 @rinternals{NoteColumn},
340 @rinternals{NoteCollision},
341 @rinternals{RestCollision}.
346 When using @code{merge-differently-headed} with an upstem eighth
347 or a shorter note, and a downstem half note, the eighth note stem
348 gets a slightly wrong offset because of the different width of the
349 half note head symbol.
351 @c investigate! Sometimes it works, sometimes not. --FV
352 It is not clear in which circumpstances you can succesfully merge
353 different note heads that are at the same time differently dotted.
355 There is no support for chords where the same note occurs with
356 different accidentals in the same chord. In this case, it is
357 recommended to use enharmonic transcription, or to use special
358 cluster notation (see @ref{Clusters}).
361 @unnumberedsubsubsec Voice styles
364 @cindex styles, voice
365 @cindex coloring voices
367 Voices may be given distinct colors and shapes, allowing them to be
370 @lilypond[quote,relative=2,verbatim]
390 @funindex \voiceOneStyle
391 @code{\voiceOneStyle},
392 @funindex \voiceTwoStyle
393 @code{\voiceTwoStyle},
394 @funindex \voiceThreeStyle
395 @code{\voiceThreeStyle},
396 @funindex \voiceFourStyle
397 @code{\voiceFourStyle},
398 @funindex \voiceNeutralStyle
399 @code{\voiceNeutralStyle}.
404 @rlearning{I'm hearing Voices}.
407 @rlsr{Simultaneous notes}.
409 @node Automatic part combining
410 @unnumberedsubsubsec Automatic part combining
412 @cindex automatic part combining
413 @cindex part combiner
414 @cindex combining parts
415 @funindex \partcombine
417 Automatic part combining is used to merge two parts of music onto
418 a staff. It is aimed at typesetting orchestral scores. When the
419 two parts are identical for a period of time, only one is shown.
420 In places where the two parts differ, they are typeset as separate
421 voices, and stem directions are set automatically. Also, solo and
422 @notation{a due} parts are identified and marked by default.
424 The syntax for part combining is:
427 \partcombine @var{musicexpr1} @var{musicexpr2}
430 The following example demonstrates the basic functionality of the
431 part combiner: putting parts on one staff and setting stem
432 directions and polyphony. The same variables are used for the
433 independent parts and the combined staff.
435 @lilypond[quote,verbatim]
436 instrumentOne = \relative c' {
444 instrumentTwo = \relative g' {
453 \new Staff \instrumentOne
454 \new Staff \instrumentTwo
455 \new Staff \partcombine \instrumentOne \instrumentTwo
459 The notes in the third measure appear only once, although they
460 were specified in both parts. Stem, slur, and tie directions are
461 set automatically, depending whether there is a solo or unison.
462 When needed in polyphony situations, the first part (with context
463 called @code{one}) always gets up stems, while the second (called
464 @code{two}) always gets down stems. In solo situations, the parts
465 get marked with @q{Solo} and @q{Solo II}, respectively. The
466 unisono (@notation{a due}) parts are marked by default with the
469 Both arguments to @code{\partcombine} will be interpreted as
470 @code{Voice} contexts. If using relative octaves,
471 @code{\relative} should be specified for both music expressions,
476 \relative @dots{} @var{musicexpr1}
477 \relative @dots{} @var{musicexpr2}
481 A @code{\relative} section that is outside of @code{\partcombine}
482 has no effect on the pitches of @var{musicexpr1} and
487 Parts may be merged without printing text:
489 @lilypond[quote,verbatim]
491 \set Staff.printPartCombineTexts = ##f
493 \relative g' { g a( b) r }
494 \relative g' { g r4 r f }
498 The printed text may be changed:
500 @lilypond[quote,verbatim]
502 \set Score.soloText = #"girl"
503 \set Score.soloIIText = #"boy"
504 \set Score.aDueText = #"together"
506 \relative g' { g4 g r r a2 g }
507 \relative g' { r4 r a( b) a2 g }
522 @rlsr{Simultaneous notes}.
526 @rinternals{PartCombineMusic},
531 When @code{printPartCombineTexts} is set, if the two voices play
532 the same notes on and off, the part combiner may typeset @code{a2}
533 more than once in a measure.
535 @code{\partcombine} cannot be inside @code{\times}.
537 @code{\partcombine} cannot be inside @code{\relative}.
539 Internally, the @code{\partcombine} interprets both arguments as
540 @code{Voice}s named @code{one} and @code{two}, and then decides
541 when the parts can be combined. Consequently, if the arguments
542 switch to differently named @rinternals{Voice} contexts, the
543 events in those will be ignored.
545 @c IIRC in users list someone pointed out more issues. TODO: lookup FV
547 @node Writing music in parallel
548 @unnumberedsubsubsec Writing music in parallel
550 @cindex Writing music in parallel
551 @cindex Interleaved music
552 @funindex parallelMusic
554 Music for multiple parts can be interleaved in input code. The
555 function @code{\parallelMusic} accepts a list with the names of a
556 number of variables to be created, and a musical expression. The
557 content of alternate measures from the expression become the value
558 of the respective variables, so you can use them afterwards to
561 @warning{Bar checks @code{|} must be used, and the measures must
562 be of the same length.}
564 @lilypond[quote,verbatim]
565 \parallelMusic #'(voiceA voiceB) {
567 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c'' e''] |
571 r8 a'16[ d''] f''[ a' d'' f''] r8 a'16[ d''] f''[ a' d'' f''] |
580 Relative mode may be used. Note that the @code{\relative} command
581 is not used inside @code{\parallelMusic} itself. The notes are
582 relative to the preceding note in the voice, not to the previous
583 note in the input -- in other words, relative notes for
584 @code{voiceA} ignore the notes in @code{voiceB}.
586 @lilypond[quote,verbatim]
587 \parallelMusic #'(voiceA voiceB) {
589 r8 g16 c e g, c e r8 g,16 c e g, c e |
593 r8 a,16 d f a, d f r8 a,16 d f a, d f |
597 \new Staff \relative c'' \voiceA
598 \new Staff \relative c' \voiceB
602 This works quite well for piano music. This example maps four
603 consecutive measures to four variables:
605 @lilypond[quote,verbatim]
611 \parallelMusic #'(voiceA voiceB voiceC voiceD) {
615 c16 d e fis d e fis g |
621 e16 fis g a fis g a b |
632 \relative c'' \voiceA
652 @rlearning{Organizing pieces with variables}.
655 @rlsr{Simultaneous notes}.