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
120 temporary use of @ref{Multiple voices},
121 @samp{<< f! \\ <e fis!> >>},
124 enharmonic transcription of one or more pitches,
132 @node Chord repetition
133 @unnumberedsubsubsec Chord repetition
135 In order to save typing, a shortcut can be used to repeat the preceding
136 chord. The chord repetition symbol is @code{q}:
138 @lilypond[verbatim,quote,relative=2]
139 <a c e>1 q <f a c>2 q
142 As with regular chords, the chord repetition symbol can be used with
143 durations, articulations, markups, slurs, beams, etc. as only the
144 pitches of the previous chord are duplicated.
146 @lilypond[verbatim,quote,relative=2]
147 <a c e>1\p^"text" q2\<( q8)[-| q8.]\! q16-1-2-3 q8\prall
150 The chord repetition symbol always remembers the last instance of
151 a chord so it is possible to repeat the most recent chord even if
152 other non-chorded notes or rests have been added since.
154 @lilypond[verbatim,quote,relative=2]
158 However, the chord repetition symbol does not retain any dynamics,
159 articulation or ornamentation within, or attached to the previous chord.
161 @lilypond[verbatim,quote,relative=2]
162 <a-. c\prall e>1\sfz c4 q2 r8 q8
167 @ref{Chord notation},
168 @ref{Articulations and ornamentations}.
171 @file{ly/chord-repetition-init.ly}.
174 @node Simultaneous expressions
175 @unnumberedsubsubsec Simultaneous expressions
177 One or more music expressions enclosed in double angle brackets are
178 taken to be simultaneous. If the first expression begins with a
179 single note or if the whole simultaneous expression appears
180 explicitly within a single voice, the whole expression is placed on
181 a single staff; otherwise the elements of the simultaneous
182 expression are placed on separate staves.
184 The following examples show simultaneous expressions on one staff:
186 @lilypond[quote,verbatim,relative=2]
187 \new Voice { % explicit single voice
188 << { a4 b g2 } { d4 g c,2 } >>
192 @lilypond[quote,verbatim,relative=2]
194 a << { a4 b g } { d4 g c, } >>
197 This can be useful if the simultaneous sections have identical
198 rhythms, but attempts to attach notes with different durations
199 to the same stem will cause errors.
201 The following example shows how simultaneous expressions can
202 generate multiple staves implicitly:
204 @lilypond[quote,verbatim,relative=2]
205 % no single first note
206 << { a4 b g2 } { d4 g2 c,4 } >>
209 Here different rhythms cause no problems.
213 @unnumberedsubsubsec Clusters
218 @funindex \makeClusters
219 @funindex makeClusters
221 A cluster indicates a continuous range of pitches to be played.
222 They can be denoted as the envelope of a set of notes. They are
223 entered by applying the function @code{\makeClusters} to a sequence
226 @lilypond[quote,relative=2,verbatim]
227 \makeClusters { <g b>2 <c g'> }
230 Ordinary notes and clusters can be put together in the same staff,
231 even simultaneously. In such a case no attempt is made to
232 automatically avoid collisions between ordinary notes and clusters.
240 @rlsr{Simultaneous notes}.
243 @rinternals{ClusterSpanner},
244 @rinternals{ClusterSpannerBeacon},
245 @rinternals{Cluster_spanner_engraver}.
250 Clusters look good only if they span at least two chords; otherwise
251 they appear too narrow.
253 Clusters do not have a stem and cannot indicate durations by
254 themselves, but the length of the printed cluster is determined by
255 the durations of the defining chords. Separate clusters need a
256 separating rest between them.
258 Clusters do not produce MIDI output.
260 @node Multiple voices
261 @subsection Multiple voices
263 This section discusses simultaneous notes in multiple voices or
267 * Single-staff polyphony::
269 * Collision resolution::
270 * Automatic part combining::
271 * Writing music in parallel::
275 @node Single-staff polyphony
276 @unnumberedsubsubsec Single-staff polyphony
278 @cindex single-staff polyphony
279 @cindex polyphony, single-staff
281 @cindex lyrics assigned to one voice
285 @funindex \voiceOne ... \voiceFour
290 @strong{@i{Explicitly instantiating voices}}
292 The basic structure needed to achieve multiple independent
293 voices in a single staff is illustrated in the following example:
295 @lilypond[quote,relative=3,verbatim]
298 { \voiceOne r8 r16 g e8. f16 g8[ c,] f e16 d }
300 { \voiceTwo d16 c d8~ d16 b c8~ c16 b c8~ c16 b8. }
305 Here, voices are instantiated explicitly and are given names. The
306 @code{\voiceOne} ... @code{\voiceFour} commands set up the voices
307 so that first and third voices get stems up, second and fourth
308 voices get stems down, third and fourth voice note heads are
309 horizontally shifted, and rests in the respective voices are
310 automatically moved to avoid collisions. The @code{\oneVoice}
311 command returns all the voice settings to the neutral default
314 @strong{@i{Temporary polyphonic passages}}
316 A temporary polyphonic passage can be created with the following
320 << @{ \voiceOne ... @}
321 \new Voice @{ \voiceTwo ... @}
326 Here, the first expression within a temporary polyphonic passage is
327 placed into the @code{Voice} context which was in use immediately
328 before the polyphonic passage, and that same @code{Voice} context
329 continues after the temporary section. Other expressions within
330 the angle brackets are assigned to distinct temporary voices.
331 This allows lyrics to be assigned to one continuing voice before,
332 during and after a polyphonic section:
334 @lilypond[quote, verbatim, relative=2]
336 \new Voice = "melody" {
351 \new Lyrics \lyricsto "melody" {
358 Here, the @code{\voiceOne} and @code{\voiceTwo} commands are
359 required to define the settings of each voice.
361 @strong{@i{The double backslash construct}}
363 The @code{<< @{...@} \\ @{...@} >>} construct, where the two (or
364 more) expressions are separated by double backslashes, behaves
365 differently to the similar construct without the double backslashes:
366 @emph{all} the expressions within this construct are assigned
367 to new @code{Voice} contexts. These new @code{Voice} contexts
368 are created implicitly and are given the fixed names @code{"1"},
371 The first example could be typeset as follows:
373 @lilypond[quote,relative=3,verbatim]
375 { r8 r16 g e8. f16 g8[ c,] f e16 d }
377 { d16 c d8~ d16 b c8~ c16 b c8~ c16 b8. }
381 This syntax can be used where it does not matter that temporary
382 voices are created and then discarded. These implicitly created
383 voices are given the settings equivalent to the effect of the
384 @code{\voiceOne} ... @code{\voiceFour} commands, in the order in
385 which they appear in the code.
387 In the following example, the intermediate voice has stems up,
388 therefore we enter it in the third place, so it becomes voice
389 three, which has the stems up as desired. Spacer rests are
390 used to avoid printing doubled rests.
392 @lilypond[quote,relative=3,verbatim]
394 { r8 g g g g f16 ees f8 d }
396 { ees,8 r ees r d r d r }
398 { d'8 s c s bes s a s }
402 In all but the simplest works it is advisable to create explicit
403 @code{Voice} contexts as explained in @rlearning{Contexts and engravers} and
404 @rlearning{Explicitly instantiating voices}.
406 @strong{@i{Voice order}}
408 When entering multiple voices in the input file, use the following
414 Voice 3: second highest
415 Voice 4: second lowest
416 Voice 5: third highest
417 Voice 6: third lowest
421 Though this may seem counterintuitive, it simplifies the automatic
422 layout process. Note that the odd-numbered voices are given
423 upstems, and the even-numbered voices are given downstems:
425 @lilypond[quote,verbatim]
428 { f''2 } % 1: highest
432 { d''2 } % 3: second-highest
434 { e'2 } % 4: second-lowest
436 { b'2 } % 5: third-highest
438 { g'2 } % 6: third-lowest
442 @strong{@i{Identical rhythms}}
444 In the special case that we want to typeset parallel pieces of music
445 that have the same rhythm, we can combine them into a single
446 @code{Voice} context, thus forming chords. To achieve this, enclose
447 them in a simple simultaneous music construct within an explicit voice:
449 @lilypond[quote,relative=2,verbatim]
451 { e4 f8 d e16 f g8 d4 }
452 { c4 d8 b c16 d e8 b4 }
456 This method leads to strange beamings and warnings if the pieces of
457 music do not have the same rhythm.
471 @rlearning{Voices contain music},
472 @rlearning{Explicitly instantiating voices}.
475 @ref{Percussion staves},
476 @ref{Invisible rests},
480 @rlsr{Simultaneous notes}.
484 @unnumberedsubsubsec Voice styles
487 @cindex styles, voice
488 @cindex coloring voices
489 @funindex \voiceOneStyle
490 @funindex \voiceTwoStyle
491 @funindex \voiceThreeStyle
492 @funindex \voiceFourStyle
493 @funindex \voiceNeutralStyle
495 Voices may be given distinct colors and shapes, allowing them to be
498 @lilypond[quote,relative=2,verbatim]
500 { \voiceOneStyle d4 c2 b4 }
502 { \voiceTwoStyle e,2 e }
504 { \voiceThreeStyle b2. c4 }
506 { \voiceFourStyle g'2 g }
510 The @code{\voiceNeutralStyle} command is used to revert to the
511 standard presentation.
515 @code{\voiceOneStyle},
516 @code{\voiceTwoStyle},
517 @code{\voiceThreeStyle},
518 @code{\voiceFourStyle},
519 @code{\voiceNeutralStyle}.
525 @rlearning{I'm hearing Voices},
526 @rlearning{Other sources of information}.
529 @rlsr{Simultaneous notes}.
532 @node Collision resolution
533 @unnumberedsubsubsec Collision resolution
535 @cindex merging notes
536 @cindex note collisions
539 @cindex multiple voices
540 @cindex voices, multiple
541 @cindex polyphonic music
542 @cindex shifting voices
543 @cindex voices, multiple
544 @cindex shift rest, automatic
553 @funindex \mergeDifferentlyDottedOn
554 @funindex mergeDifferentlyDottedOn
555 @funindex \mergeDifferentlyDottedOff
556 @funindex mergeDifferentlyDottedOff
557 @funindex \mergeDifferentlyHeadedOn
558 @funindex mergeDifferentlyHeadedOn
559 @funindex \mergeDifferentlyHeadedOff
560 @funindex mergeDifferentlyHeadedOff
562 The note heads of notes in different voices with the same pitch,
563 same note head and opposite stem direction are automatically
564 merged, but notes with different note heads or the same stem
565 direction are not. Rests opposite a stem in a different voice
566 are shifted vertically. The following example shows three
567 different circumstances, on beats 1 and 3 in bar 1 and beat 1
568 in bar 2, where the automatic merging fails.
570 @lilypond[quote,verbatim,relative=2]
586 Notes with different note heads may be merged, with the
587 exception of half-note heads and quarter-note heads, as shown
588 below. Here the note heads on beat 1 of bar 1 are now merged:
590 @lilypond[quote,verbatim,relative=2]
593 \mergeDifferentlyHeadedOn
607 Note heads with different dots as shown in beat 3 of bar 1 may be
610 @lilypond[quote,relative=2,verbatim]
613 \mergeDifferentlyHeadedOn
614 \mergeDifferentlyDottedOn
629 The half note and eighth note at the start of the second measure
630 are incorrectly merged because the automatic merge cannot
631 successfully complete the merge when three or more notes line up in
632 the same note column, and in this case the merged note head is
633 incorrect. To allow the merge to select the correct note head
634 a @code{\shift} must be applied to the note that should not be
635 merged. Here, @code{\shiftOn} is applied to move the top
636 @notation{g} out of the column, and @code{\mergeDifferentlyHeadedOn}
639 @lilypond[quote,relative=2,verbatim]
642 \mergeDifferentlyHeadedOn
643 \mergeDifferentlyDottedOn
658 The @code{\shiftOn} command allows (but does not force) the notes
659 in a voice to be shifted. When @code{\shiftOn} is applied to a
660 voice, a note or chord in that voice is shifted only if its stem
661 would otherwise collide with a stem from another voice, and only
662 if the colliding stems point in the same direction. The
663 @code{\shiftOff} command prevents this type of shifting from
666 By default, the outer voices (normally voices one and two) have
667 @code{\shiftOff} specified, while the inner voices (three and
668 above) have @code{\shiftOn} specified. When a shift is applied,
669 voices with upstems (odd-numbered voices) are shifted to the
670 right, and voices with downstems (even-numbered voices) are
673 Here is an example to help you visualize how an abbreviated
674 polyphonic expression would be expanded internally.
676 @warning{Note that with three or more voices, the vertical order
677 of voices in your input file should not be the same as the
678 vertical order of voices on the staff!}
680 @lilypond[quote,verbatim]
681 \new Staff \relative c'' {
688 { d'2 } % 3: upper middle
690 { b2 } % 4: lower middle
692 %% internal expansion of the above
694 \new Voice = "1" { \voiceOne \shiftOff f'2 }
695 \new Voice = "2" { \voiceTwo \shiftOff g,2 }
696 \new Voice = "3" { \voiceThree \shiftOn d'2 } % shifts right
697 \new Voice = "4" { \voiceFour \shiftOn b2 } % shifts left
702 Two additional commands, @code{\shiftOnn} and @code{\shiftOnnn}
703 provide further shift levels which may be specified temporarily to
704 resolve collisions in complex situations -- see
705 @rlearning{Real music example}.
707 Notes are only merged if they have opposing stem directions (as
708 they have, for example, in voices one and two by default or when
709 the stems are explicitly set in opposite directions).
713 @code{\mergeDifferentlyDottedOn},
714 @code{\mergeDifferentlyDottedOff},
715 @code{\mergeDifferentlyHeadedOn},
716 @code{\mergeDifferentlyHeadedOff}.
727 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
728 {additional-voices-to-avoid-collisions.ly}
730 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
731 {forcing-horizontal-shift-of-notes.ly}
739 @rlearning{Multiple notes at once},
740 @rlearning{Voices contain music},
741 @rlearning{Real music example}.
744 @rlsr{Simultaneous notes}.
747 @rinternals{NoteColumn},
748 @rinternals{NoteCollision},
749 @rinternals{RestCollision}.
754 @c TODO investigate! Sometimes it works, sometimes not. --FV
755 The requirements for successfully merging different note heads that
756 are at the same time differently dotted are not clear.
759 @node Automatic part combining
760 @unnumberedsubsubsec Automatic part combining
762 @cindex automatic part combining
763 @cindex part combiner
764 @cindex combining parts
767 @funindex \partcombine
768 @funindex partcombine
770 Automatic part combining is used to merge two parts of music onto
771 a staff. It is aimed at typesetting orchestral scores. When the
772 two parts are identical for a period of time, only one is shown.
773 In places where the two parts differ, they are typeset as separate
774 voices, and stem directions are set automatically. Also, solo and
775 @notation{a due} parts are identified and marked by default.
777 The syntax for part combining is:
780 \partcombine @var{musicexpr1} @var{musicexpr2}
783 The following example demonstrates the basic functionality of the
784 part combiner: putting parts on one staff and setting stem
785 directions and polyphony. The same variables are used for the
786 independent parts and the combined staff.
788 @lilypond[quote,verbatim]
789 instrumentOne = \relative c' {
797 instrumentTwo = \relative g' {
806 \new Staff \instrumentOne
807 \new Staff \instrumentTwo
808 \new Staff \partcombine \instrumentOne \instrumentTwo
812 The notes in the third measure appear only once, although they were
813 specified in both parts. Stem, slur, and tie directions are set
814 automatically, depending whether there is a solo or unison. When
815 needed in polyphony situations, the first part (with context called
816 @code{one}) always gets up stems, while the second (called @code{two})
817 always gets down stems. In solo situations, the first and second
818 parts get marked with @q{Solo} and @q{Solo II}, respectively. The
819 unisono (@notation{a due}) parts are marked by default with the text
822 Both arguments to @code{\partcombine} will be interpreted as
823 @code{Voice} contexts. If using relative octaves,
824 @code{\relative} should be specified for both music expressions,
829 \relative @dots{} @var{musicexpr1}
830 \relative @dots{} @var{musicexpr2}
834 A @code{\relative} section that is outside of @code{\partcombine}
835 has no effect on the pitches of @code{@var{musicexpr1}} and
836 @code{@var{musicexpr2}}.
840 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
841 {combining-two-parts-on-the-same-staff.ly}
843 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
844 {changing-partcombine-texts.ly}
856 @rlsr{Simultaneous notes}.
859 @rinternals{PartCombineMusic},
865 @code{\partcombine} can only accept two voices.
867 When @code{printPartCombineTexts} is set, if the two voices play
868 the same notes on and off, the part combiner may typeset @code{a2}
869 more than once in a measure.
871 @code{\partcombine} cannot be inside @code{\times}.
873 @code{\partcombine} cannot be inside @code{\relative}.
875 Internally, the @code{\partcombine} interprets both arguments as
876 @code{Voice}s and decides when the parts can be combined. When they have
877 different durations they cannot be combined and are given the names
878 @code{one} and @code{two}. Consequently, if the arguments switch to
879 differently named @rinternals{Voice} contexts, the events in those will
880 be ignored. Likewise, partcombining isn't designed to work with lyrics;
881 when one of the voices is explicitly named in order to attach lyrics to
882 it, the partcombining stops working.
884 @code{\partcombine} only observes onset times of notes. It cannot
885 determine whether a previously started note is playing or not, leading
889 @node Writing music in parallel
890 @unnumberedsubsubsec Writing music in parallel
892 @cindex writing music in parallel
893 @cindex interleaved music
894 @cindex parallel music
895 @funindex \parallelMusic
896 @funindex parallelMusic
898 Music for multiple parts can be interleaved in input code. The
899 function @code{\parallelMusic} accepts a list with the names of a
900 number of variables to be created, and a musical expression. The
901 content of alternate measures from the expression become the value
902 of the respective variables, so you can use them afterwards to
905 @warning{Bar checks @code{|} must be used, and the measures must
906 be of the same length.}
908 @lilypond[quote,verbatim]
909 \parallelMusic #'(voiceA voiceB voiceC) {
911 r8 g'16 c'' e'' g' c'' e'' r8 g'16 c'' e'' g' c'' e'' |
912 r16 e'8.~ e'4 r16 e'8.~ e'4 |
916 r8 a'16 d'' f'' a' d'' f'' r8 a'16 d'' f'' a' d'' f'' |
917 r16 d'8.~ d'4 r16 d'8.~ d'4 |
922 \new Staff << \voiceA \\ \voiceB >>
923 \new Staff { \clef bass \voiceC }
927 Relative mode may be used. Note that the @code{\relative} command
928 is not used inside @code{\parallelMusic} itself. The notes are
929 relative to the preceding note in the voice, not to the previous
930 note in the input -- in other words, relative notes for
931 @code{voiceA} ignore the notes in @code{voiceB}.
933 @lilypond[quote,verbatim]
934 \parallelMusic #'(voiceA voiceB voiceC) {
936 r8 g16 c e g, c e r8 g,16 c e g, c e |
937 r16 e8.~ e4 r16 e8.~ e4 |
941 r8 a,16 d f a, d f r8 a,16 d f a, d f |
942 r16 d8.~ d4 r16 d8.~ d4 |
947 \new Staff << \relative c'' \voiceA \\ \relative c' \voiceB >>
948 \new Staff \relative c' { \clef bass \voiceC }
952 This works quite well for piano music. This example maps four
953 consecutive measures to four variables:
955 @lilypond[quote,verbatim]
961 \parallelMusic #'(voiceA voiceB voiceC voiceD) {
965 c16 d e fis d e fis g |
971 e16 fis g a fis g a b |
982 \relative c'' \voiceA
1002 @rlearning{Organizing pieces with variables}.
1005 @rlsr{Simultaneous notes}.