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. For details, see the Contributors'
7 Guide, node Updating translation committishes..
13 @node Simultaneous notes
14 @section Simultaneous notes
16 @lilypondfile[quote]{simultaneous-headword.ly}
18 Polyphony in music refers to having more than one voice occurring
19 in a piece of music. Polyphony in LilyPond refers to having more
20 than one voice on the same staff.
29 @subsection Single voice
31 This section discusses simultaneous notes inside the same voice.
36 * Simultaneous expressions::
42 @unnumberedsubsubsec Chorded notes
45 @cindex brackets, angle
51 A chord is formed by enclosing a set of pitches between @code{<}
52 and @code{>}. A chord may be followed by a duration just like simple
55 @lilypond[verbatim,quote,relative=2]
56 <a c e>1 <a c e>2 <f a c e>4 <a c>8. <g c e>16
59 Chords may also be followed by articulations, again just like simple
62 @lilypond[verbatim,quote,relative=2]
63 <a c e>1\fermata <a c e>2-> <f a c e>4\prall <a c>8.^| <g c e>16-.
66 The notes within the chord themselves can also be followed by articulation
69 @lilypond[verbatim,quote,relative=2]
70 <a c\prall e>1 <a-> c-^ e>2 <f-. a c-. e-.>4 <a-+ c-->8. <g\fermata c e\turn>16
73 However some notation, such as dynamics, hairpins and slurs must be
74 attached to the chord, rather than notes within the chord, otherwise
77 @lilypond[verbatim,quote,relative=2]
78 <a\f c( e>1 <a c) e>\f <a\< c e>( <a\! c e>) <a c e>\< <a c e> <a c e>\!
81 @cindex relative pitch, chords
82 @cindex chords, relative pitch
84 Relative mode can be used for pitches in chords. The first note of
85 each chord is always relative to the first note of the chord that
86 came before it, or in the case where no preceding chord exists, the
87 pitch of the last note that came before the chord. All remaining notes
88 in the chord are relative to the note that came before it
89 @emph{within the same chord}.
91 @lilypond[verbatim,quote,relative=2]
92 <a c e>1 <f a c> <a c e> <f' a c> <b, e b,>
95 For more information about chords, see @ref{Chord notation}.
102 @rlearning{Combining notes into chords}.
105 @ref{Chord notation},
106 @ref{Articulations and ornamentations},
107 @ref{Relative octave entry},
108 @ref{Multiple voices}.
111 @rlsr{Simultaneous notes}.
114 Chords containing more than two pitches within a staff space,
115 such as @samp{<e f! fis!>}, create overlapping noteheads.
116 Depending on the situation, better representations might involve
121 temporary use of @ref{Multiple voices},
122 @samp{<< f! \\ <e fis!> >>},
125 enharmonic transcription of one or more pitches,
133 @node Chord repetition
134 @unnumberedsubsubsec Chord repetition
136 In order to save typing, a shortcut can be used to repeat the preceding
137 chord. The chord repetition symbol is @code{q}:
139 @lilypond[verbatim,quote,relative=2]
140 <a c e>1 q <f a c>2 q
143 As with regular chords, the chord repetition symbol can be used with
144 durations, articulations, markups, slurs, beams, etc. as only the
145 pitches of the previous chord are duplicated.
147 @lilypond[verbatim,quote,relative=2]
148 <a c e>1\p^"text" q2\<( q8)[-| q8.]\! q16-1-2-3 q8\prall
151 The chord repetition symbol always remembers the last instance of
152 a chord so it is possible to repeat the most recent chord even if
153 other non-chorded notes or rests have been added since.
155 @lilypond[verbatim,quote,relative=2]
159 However, the chord repetition symbol does not retain any dynamics,
160 articulation or ornamentation within, or attached to the previous chord.
162 @lilypond[verbatim,quote,relative=2]
163 <a-. c\prall e>1\sfz c4 q2 r8 q8
168 @ref{Chord notation},
169 @ref{Articulations and ornamentations}.
172 @file{ly/chord-repetition-init.ly}.
175 @node Simultaneous expressions
176 @unnumberedsubsubsec Simultaneous expressions
178 One or more music expressions enclosed in double angle brackets are
179 taken to be simultaneous. If the first expression begins with a
180 single note or if the whole simultaneous expression appears
181 explicitly within a single voice, the whole expression is placed on
182 a single staff; otherwise the elements of the simultaneous
183 expression are placed on separate staves.
185 The following examples show simultaneous expressions on one staff:
187 @lilypond[quote,verbatim,relative=2]
188 \new Voice { % explicit single voice
189 << { a4 b g2 } { d4 g c,2 } >>
193 @lilypond[quote,verbatim,relative=2]
195 a << { a4 b g } { d4 g c, } >>
198 This can be useful if the simultaneous sections have identical
199 rhythms, but attempts to attach notes with different durations
200 to the same stem will cause errors.
202 The following example shows how simultaneous expressions can
203 generate multiple staves implicitly:
205 @lilypond[quote,verbatim,relative=2]
206 % no single first note
207 << { a4 b g2 } { d4 g2 c,4 } >>
210 Here different rhythms cause no problems.
214 @unnumberedsubsubsec Clusters
219 @funindex \makeClusters
220 @funindex makeClusters
222 A cluster indicates a continuous range of pitches to be played.
223 They can be denoted as the envelope of a set of notes. They are
224 entered by applying the function @code{\makeClusters} to a sequence
227 @lilypond[quote,relative=2,verbatim]
228 \makeClusters { <g b>2 <c g'> }
231 Ordinary notes and clusters can be put together in the same staff,
232 even simultaneously. In such a case no attempt is made to
233 automatically avoid collisions between ordinary notes and clusters.
241 @rlsr{Simultaneous notes}.
244 @rinternals{ClusterSpanner},
245 @rinternals{ClusterSpannerBeacon},
246 @rinternals{Cluster_spanner_engraver}.
251 Clusters look good only if they span at least two chords; otherwise
252 they appear too narrow.
254 Clusters do not have a stem and cannot indicate durations by
255 themselves, but the length of the printed cluster is determined by
256 the durations of the defining chords. Separate clusters need a
257 separating rest between them.
259 Clusters do not produce MIDI output.
261 @node Multiple voices
262 @subsection Multiple voices
264 This section discusses simultaneous notes in multiple voices or
268 * Single-staff polyphony::
270 * Collision resolution::
271 * Automatic part combining::
272 * Writing music in parallel::
276 @node Single-staff polyphony
277 @unnumberedsubsubsec Single-staff polyphony
279 @cindex single-staff polyphony
280 @cindex polyphony, single-staff
282 @cindex lyrics assigned to one voice
286 @funindex \voiceOne ... \voiceFour
291 @strong{@i{Explicitly instantiating voices}}
293 The basic structure needed to achieve multiple independent
294 voices in a single staff is illustrated in the following example:
296 @lilypond[quote,relative=3,verbatim]
299 { \voiceOne r8 r16 g e8. f16 g8[ c,] f e16 d }
301 { \voiceTwo d16 c d8~ d16 b c8~ c16 b c8~ c16 b8. }
306 Here, voices are instantiated explicitly and are given names. The
307 @code{\voiceOne} ... @code{\voiceFour} commands set up the voices
308 so that first and third voices get stems up, second and fourth
309 voices get stems down, third and fourth voice note heads are
310 horizontally shifted, and rests in the respective voices are
311 automatically moved to avoid collisions. The @code{\oneVoice}
312 command returns all the voice settings to the neutral default
315 @strong{@i{Temporary polyphonic passages}}
317 A temporary polyphonic passage can be created with the following
321 << @{ \voiceOne ... @}
322 \new Voice @{ \voiceTwo ... @}
327 Here, the first expression within a temporary polyphonic passage is
328 placed into the @code{Voice} context which was in use immediately
329 before the polyphonic passage, and that same @code{Voice} context
330 continues after the temporary section. Other expressions within
331 the angle brackets are assigned to distinct temporary voices.
332 This allows lyrics to be assigned to one continuing voice before,
333 during and after a polyphonic section:
335 @lilypond[quote, verbatim, relative=2]
337 \new Voice = "melody" {
352 \new Lyrics \lyricsto "melody" {
359 Here, the @code{\voiceOne} and @code{\voiceTwo} commands are
360 required to define the settings of each voice.
362 @strong{@i{The double backslash construct}}
364 The @code{<< @{...@} \\ @{...@} >>} construct, where the two (or
365 more) expressions are separated by double backslashes, behaves
366 differently to the similar construct without the double backslashes:
367 @emph{all} the expressions within this construct are assigned
368 to new @code{Voice} contexts. These new @code{Voice} contexts
369 are created implicitly and are given the fixed names @code{"1"},
372 The first example could be typeset as follows:
374 @lilypond[quote,relative=3,verbatim]
376 { r8 r16 g e8. f16 g8[ c,] f e16 d }
378 { d16 c d8~ d16 b c8~ c16 b c8~ c16 b8. }
382 This syntax can be used where it does not matter that temporary
383 voices are created and then discarded. These implicitly created
384 voices are given the settings equivalent to the effect of the
385 @code{\voiceOne} ... @code{\voiceFour} commands, in the order in
386 which they appear in the code.
388 In the following example, the intermediate voice has stems up,
389 therefore we enter it in the third place, so it becomes voice
390 three, which has the stems up as desired. Spacer rests are
391 used to avoid printing doubled rests.
393 @lilypond[quote,relative=3,verbatim]
395 { r8 g g g g f16 ees f8 d }
397 { ees,8 r ees r d r d r }
399 { d'8 s c s bes s a s }
403 In all but the simplest works it is advisable to create explicit
404 @code{Voice} contexts as explained in @rlearning{Contexts and engravers} and
405 @rlearning{Explicitly instantiating voices}.
407 @strong{@i{Voice order}}
409 When entering multiple voices in the input file, use the following
415 Voice 3: second highest
416 Voice 4: second lowest
417 Voice 5: third highest
418 Voice 6: third lowest
422 Though this may seem counterintuitive, it simplifies the automatic
423 layout process. Note that the odd-numbered voices are given
424 upstems, and the even-numbered voices are given downstems:
426 @lilypond[quote,verbatim]
429 { f''2 } % 1: highest
433 { d''2 } % 3: second-highest
435 { e'2 } % 4: second-lowest
437 { b'2 } % 5: third-highest
439 { g'2 } % 6: third-lowest
443 @strong{@i{Identical rhythms}}
445 In the special case that we want to typeset parallel pieces of music
446 that have the same rhythm, we can combine them into a single
447 @code{Voice} context, thus forming chords. To achieve this, enclose
448 them in a simple simultaneous music construct within an explicit voice:
450 @lilypond[quote,relative=2,verbatim]
452 { e4 f8 d e16 f g8 d4 }
453 { c4 d8 b c16 d e8 b4 }
457 This method leads to strange beamings and warnings if the pieces of
458 music do not have the same rhythm.
472 @rlearning{Voices contain music},
473 @rlearning{Explicitly instantiating voices}.
476 @ref{Percussion staves},
477 @ref{Invisible rests},
481 @rlsr{Simultaneous notes}.
485 @unnumberedsubsubsec Voice styles
488 @cindex styles, voice
489 @cindex coloring voices
490 @funindex \voiceOneStyle
491 @funindex \voiceTwoStyle
492 @funindex \voiceThreeStyle
493 @funindex \voiceFourStyle
494 @funindex \voiceNeutralStyle
496 Voices may be given distinct colors and shapes, allowing them to be
499 @lilypond[quote,relative=2,verbatim]
501 { \voiceOneStyle d4 c2 b4 }
503 { \voiceTwoStyle e,2 e }
505 { \voiceThreeStyle b2. c4 }
507 { \voiceFourStyle g'2 g }
511 The @code{\voiceNeutralStyle} command is used to revert to the
512 standard presentation.
516 @code{\voiceOneStyle},
517 @code{\voiceTwoStyle},
518 @code{\voiceThreeStyle},
519 @code{\voiceFourStyle},
520 @code{\voiceNeutralStyle}.
526 @rlearning{I'm hearing Voices},
527 @rlearning{Other sources of information}.
530 @rlsr{Simultaneous notes}.
533 @node Collision resolution
534 @unnumberedsubsubsec Collision resolution
536 @cindex merging notes
537 @cindex note collisions
540 @cindex multiple voices
541 @cindex voices, multiple
542 @cindex polyphonic music
543 @cindex shifting voices
544 @cindex voices, multiple
545 @cindex shift rest, automatic
554 @funindex \mergeDifferentlyDottedOn
555 @funindex mergeDifferentlyDottedOn
556 @funindex \mergeDifferentlyDottedOff
557 @funindex mergeDifferentlyDottedOff
558 @funindex \mergeDifferentlyHeadedOn
559 @funindex mergeDifferentlyHeadedOn
560 @funindex \mergeDifferentlyHeadedOff
561 @funindex mergeDifferentlyHeadedOff
563 The note heads of notes in different voices with the same pitch,
564 same note head and opposite stem direction are automatically
565 merged, but notes with different note heads or the same stem
566 direction are not. Rests opposite a stem in a different voice
567 are shifted vertically. The following example shows three
568 different circumstances, on beats 1 and 3 in bar 1 and beat 1
569 in bar 2, where the automatic merging fails.
571 @lilypond[quote,verbatim,relative=2]
587 Notes with different note heads may be merged, with the
588 exception of half-note heads and quarter-note heads, as shown
589 below. Here the note heads on beat 1 of bar 1 are now merged:
591 @lilypond[quote,verbatim,relative=2]
594 \mergeDifferentlyHeadedOn
608 Note heads with different dots as shown in beat 3 of bar 1 may be
611 @lilypond[quote,relative=2,verbatim]
614 \mergeDifferentlyHeadedOn
615 \mergeDifferentlyDottedOn
630 The half note and eighth note at the start of the second measure
631 are incorrectly merged because the automatic merge cannot
632 successfully complete the merge when three or more notes line up in
633 the same note column, and in this case the merged note head is
634 incorrect. To allow the merge to select the correct note head
635 a @code{\shift} must be applied to the note that should not be
636 merged. Here, @code{\shiftOn} is applied to move the top
637 @notation{g} out of the column, and @code{\mergeDifferentlyHeadedOn}
640 @lilypond[quote,relative=2,verbatim]
643 \mergeDifferentlyHeadedOn
644 \mergeDifferentlyDottedOn
659 The @code{\shiftOn} command allows (but does not force) the notes
660 in a voice to be shifted. When @code{\shiftOn} is applied to a
661 voice, a note or chord in that voice is shifted only if its stem
662 would otherwise collide with a stem from another voice, and only
663 if the colliding stems point in the same direction. The
664 @code{\shiftOff} command prevents this type of shifting from
667 By default, the outer voices (normally voices one and two) have
668 @code{\shiftOff} specified, while the inner voices (three and
669 above) have @code{\shiftOn} specified. When a shift is applied,
670 voices with upstems (odd-numbered voices) are shifted to the
671 right, and voices with downstems (even-numbered voices) are
674 Here is an example to help you visualize how an abbreviated
675 polyphonic expression would be expanded internally.
677 @warning{Note that with three or more voices, the vertical order
678 of voices in your input file should not be the same as the
679 vertical order of voices on the staff!}
681 @lilypond[quote,verbatim]
682 \new Staff \relative c'' {
689 { d'2 } % 3: upper middle
691 { b2 } % 4: lower middle
693 %% internal expansion of the above
695 \new Voice = "1" { \voiceOne \shiftOff f'2 }
696 \new Voice = "2" { \voiceTwo \shiftOff g,2 }
697 \new Voice = "3" { \voiceThree \shiftOn d'2 } % shifts right
698 \new Voice = "4" { \voiceFour \shiftOn b2 } % shifts left
703 Two additional commands, @code{\shiftOnn} and @code{\shiftOnnn}
704 provide further shift levels which may be specified temporarily to
705 resolve collisions in complex situations -- see
706 @rlearning{Real music example}.
708 Notes are only merged if they have opposing stem directions (as
709 they have, for example, in voices one and two by default or when
710 the stems are explicitly set in opposite directions).
714 @code{\mergeDifferentlyDottedOn},
715 @code{\mergeDifferentlyDottedOff},
716 @code{\mergeDifferentlyHeadedOn},
717 @code{\mergeDifferentlyHeadedOff}.
728 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
729 {additional-voices-to-avoid-collisions.ly}
731 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
732 {forcing-horizontal-shift-of-notes.ly}
740 @rlearning{Multiple notes at once},
741 @rlearning{Voices contain music},
742 @rlearning{Real music example}.
745 @rlsr{Simultaneous notes}.
748 @rinternals{NoteColumn},
749 @rinternals{NoteCollision},
750 @rinternals{RestCollision}.
755 @c TODO investigate! Sometimes it works, sometimes not. --FV
756 The requirements for successfully merging different note heads that
757 are at the same time differently dotted are not clear.
760 @node Automatic part combining
761 @unnumberedsubsubsec Automatic part combining
763 @cindex automatic part combining
764 @cindex part combiner
765 @cindex combining parts
768 @funindex \partcombine
769 @funindex partcombine
771 Automatic part combining is used to merge two parts of music onto
772 a staff. It is aimed at typesetting orchestral scores. When the
773 two parts are identical for a period of time, only one is shown.
774 In places where the two parts differ, they are typeset as separate
775 voices, and stem directions are set automatically. Also, solo and
776 @notation{a due} parts are identified and marked by default.
778 The syntax for part combining is:
781 \partcombine @var{musicexpr1} @var{musicexpr2}
784 The following example demonstrates the basic functionality of the
785 part combiner: putting parts on one staff and setting stem
786 directions and polyphony. The same variables are used for the
787 independent parts and the combined staff.
789 @lilypond[quote,verbatim]
790 instrumentOne = \relative c' {
798 instrumentTwo = \relative g' {
807 \new Staff \instrumentOne
808 \new Staff \instrumentTwo
809 \new Staff \partcombine \instrumentOne \instrumentTwo
813 The notes in the third measure appear only once, although they were
814 specified in both parts. Stem, slur, and tie directions are set
815 automatically, depending whether there is a solo or unison. When
816 needed in polyphony situations, the first part (with context called
817 @code{one}) always gets up stems, while the second (called @code{two})
818 always gets down stems. In solo situations, the first and second
819 parts get marked with @q{Solo} and @q{Solo II}, respectively. The
820 unisono (@notation{a due}) parts are marked by default with the text
823 Both arguments to @code{\partcombine} will be interpreted as
824 @code{Voice} contexts. If using relative octaves,
825 @code{\relative} should be specified for both music expressions,
830 \relative @dots{} @var{musicexpr1}
831 \relative @dots{} @var{musicexpr2}
835 A @code{\relative} section that is outside of @code{\partcombine}
836 has no effect on the pitches of @code{@var{musicexpr1}} and
837 @code{@var{musicexpr2}}.
841 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
842 {combining-two-parts-on-the-same-staff.ly}
844 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
845 {changing-partcombine-texts.ly}
857 @rlsr{Simultaneous notes}.
860 @rinternals{PartCombineMusic},
866 @code{\partcombine} can only accept two voices.
868 When @code{printPartCombineTexts} is set, if the two voices play
869 the same notes on and off, the part combiner may typeset @code{a2}
870 more than once in a measure.
872 @code{\partcombine} cannot be inside @code{\times}.
874 @code{\partcombine} cannot be inside @code{\relative}.
876 Internally, the @code{\partcombine} interprets both arguments as
877 @code{Voice}s and decides when the parts can be combined. When they have
878 different durations they cannot be combined and are given the names
879 @code{one} and @code{two}. Consequently, if the arguments switch to
880 differently named @rinternals{Voice} contexts, the events in those will
881 be ignored. Likewise, partcombining isn't designed to work with lyrics;
882 when one of the voices is explicitly named in order to attach lyrics to
883 it, the partcombining stops working.
885 @code{\partcombine} only observes onset times of notes. It cannot
886 determine whether a previously started note is playing or not, leading
890 @node Writing music in parallel
891 @unnumberedsubsubsec Writing music in parallel
893 @cindex writing music in parallel
894 @cindex interleaved music
895 @cindex parallel music
896 @funindex \parallelMusic
897 @funindex parallelMusic
899 Music for multiple parts can be interleaved in input code. The
900 function @code{\parallelMusic} accepts a list with the names of a
901 number of variables to be created, and a musical expression. The
902 content of alternate measures from the expression become the value
903 of the respective variables, so you can use them afterwards to
906 @warning{Bar checks @code{|} must be used, and the measures must
907 be of the same length.}
909 @lilypond[quote,verbatim]
910 \parallelMusic #'(voiceA voiceB voiceC) {
912 r8 g'16 c'' e'' g' c'' e'' r8 g'16 c'' e'' g' c'' e'' |
913 r16 e'8.~ e'4 r16 e'8.~ e'4 |
917 r8 a'16 d'' f'' a' d'' f'' r8 a'16 d'' f'' a' d'' f'' |
918 r16 d'8.~ d'4 r16 d'8.~ d'4 |
923 \new Staff << \voiceA \\ \voiceB >>
924 \new Staff { \clef bass \voiceC }
928 Relative mode may be used. Note that the @code{\relative} command
929 is not used inside @code{\parallelMusic} itself. The notes are
930 relative to the preceding note in the voice, not to the previous
931 note in the input -- in other words, relative notes for
932 @code{voiceA} ignore the notes in @code{voiceB}.
934 @lilypond[quote,verbatim]
935 \parallelMusic #'(voiceA voiceB voiceC) {
937 r8 g16 c e g, c e r8 g,16 c e g, c e |
938 r16 e8.~ e4 r16 e8.~ e4 |
942 r8 a,16 d f a, d f r8 a,16 d f a, d f |
943 r16 d8.~ d4 r16 d8.~ d4 |
948 \new Staff << \relative c'' \voiceA \\ \relative c' \voiceB >>
949 \new Staff \relative c' { \clef bass \voiceC }
953 This works quite well for piano music. This example maps four
954 consecutive measures to four variables:
956 @lilypond[quote,verbatim]
962 \parallelMusic #'(voiceA voiceB voiceC voiceD) {
966 c16 d e fis d e fis g |
972 e16 fis g a fis g a b |
983 \relative c'' \voiceA
1003 @rlearning{Organizing pieces with variables}.
1006 @rlsr{Simultaneous notes}.