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}.
110 @rlsr{Simultaneous notes}.
113 @node Chord repetition
114 @unnumberedsubsubsec Chord repetition
116 In order to save typing, a shortcut can be used to repeat the preceding
117 chord. The chord repetition symbol is @code{q}:
119 @lilypond[verbatim,quote,relative=2]
120 <a c e>1 q <f a c>2 q
123 As with regular chords, the chord repetition symbol can be used with
124 durations, articulations, markups, slurs, beams, etc. as only the
125 pitches of the previous chord are duplicated.
127 @lilypond[verbatim,quote,relative=2]
128 <a c e>1\p^"text" q2\<( q8)[-| q8.]\! q16-1-2-3 q8\prall
131 The chord repetition symbol always remembers the last instance of
132 a chord so it is possible to repeat the most recent chord even if
133 other non-chorded notes or rests have been added since.
135 @lilypond[verbatim,quote,relative=2]
139 However, the chord repetition symbol does not retain any dynamics,
140 articulation or ornamentation within, or attached to the previous chord.
142 @lilypond[verbatim,quote,relative=2]
143 <a-. c\prall e>1\sfz c4 q2 r8 q8
148 @ref{Chord notation},
149 @ref{Articulations and ornamentations}.
152 @file{ly/@/chord-repetition-init@/.ly}.
155 @node Simultaneous expressions
156 @unnumberedsubsubsec Simultaneous expressions
158 One or more music expressions enclosed in double angle brackets are
159 taken to be simultaneous. If the first expression begins with a
160 single note or if the whole simultaneous expression appears
161 explicitly within a single voice, the whole expression is placed on
162 a single staff; otherwise the elements of the simultaneous
163 expression are placed on separate staves.
165 The following examples show simultaneous expressions on one staff:
167 @lilypond[quote,verbatim,relative=2]
168 \new Voice { % explicit single voice
169 << { a4 b g2 } { d4 g c,2 } >>
173 @lilypond[quote,verbatim,relative=2]
175 a << { a4 b g } { d4 g c, } >>
178 This can be useful if the simultaneous sections have identical
179 rhythms, but attempts to attach notes with different durations
180 to the same stem will cause errors.
182 The following example shows how simultaneous expressions can
183 generate multiple staves implicitly:
185 @lilypond[quote,verbatim,relative=2]
186 % no single first note
187 << { a4 b g2 } { d4 g2 c,4 } >>
190 Here different rhythms cause no problems.
194 @unnumberedsubsubsec Clusters
199 @funindex \makeClusters
200 @funindex makeClusters
202 A cluster indicates a continuous range of pitches to be played.
203 They can be denoted as the envelope of a set of notes. They are
204 entered by applying the function @code{\makeClusters} to a sequence
207 @lilypond[quote,relative=2,verbatim]
208 \makeClusters { <g b>2 <c g'> }
211 Ordinary notes and clusters can be put together in the same staff,
212 even simultaneously. In such a case no attempt is made to
213 automatically avoid collisions between ordinary notes and clusters.
221 @rlsr{Simultaneous notes}.
224 @rinternals{ClusterSpanner},
225 @rinternals{ClusterSpannerBeacon},
226 @rinternals{Cluster_spanner_engraver}.
231 Clusters look good only if they span at least two chords; otherwise
232 they appear too narrow.
234 Clusters do not have a stem and cannot indicate durations by
235 themselves, but the length of the printed cluster is determined by
236 the durations of the defining chords. Separate clusters need a
237 separating rest between them.
239 Clusters do not produce MIDI output.
241 @node Multiple voices
242 @subsection Multiple voices
244 This section discusses simultaneous notes in multiple voices or
248 * Single-staff polyphony::
250 * Collision resolution::
251 * Automatic part combining::
252 * Writing music in parallel::
256 @node Single-staff polyphony
257 @unnumberedsubsubsec Single-staff polyphony
259 @cindex single-staff polyphony
260 @cindex polyphony, single-staff
262 @cindex lyrics assigned to one voice
266 @funindex \voiceOne ... \voiceFour
271 @strong{@i{Explicitly instantiating voices}}
273 The basic structure needed to achieve multiple independent
274 voices in a single staff is illustrated in the following example:
276 @lilypond[quote,relative=3,verbatim]
279 { \voiceOne r8 r16 g e8. f16 g8[ c,] f e16 d }
281 { \voiceTwo d16 c d8~ d16 b c8~ c16 b c8~ c16 b8. }
286 Here, voices are instantiated explicitly and are given names. The
287 @code{\voiceOne} ... @code{\voiceFour} commands set up the voices
288 so that first and third voices get stems up, second and fourth
289 voices get stems down, third and fourth voice note heads are
290 horizontally shifted, and rests in the respective voices are
291 automatically moved to avoid collisions. The @code{\oneVoice}
292 command returns all the voice settings to the neutral default
295 @strong{@i{Temporary polyphonic passages}}
297 A temporary polyphonic passage can be created with the following
301 << @{ \voiceOne ... @}
302 \new Voice @{ \voiceTwo ... @}
307 Here, the first expression within a temporary polyphonic passage is
308 placed into the @code{Voice} context which was in use immediately
309 before the polyphonic passage, and that same @code{Voice} context
310 continues after the temporary section. Other expressions within
311 the angle brackets are assigned to distinct temporary voices.
312 This allows lyrics to be assigned to one continuing voice before,
313 during and after a polyphonic section:
315 @lilypond[quote, verbatim, relative=2]
317 \new Voice = "melody" {
332 \new Lyrics \lyricsto "melody" {
339 Here, the @code{\voiceOne} and @code{\voiceTwo} commands are
340 required to define the settings of each voice.
342 @strong{@i{The double backslash construct}}
344 The @code{<< @{...@} \\ @{...@} >>} construct, where the two (or
345 more) expressions are separated by double backslashes, behaves
346 differently to the similar construct without the double backslashes:
347 @emph{all} the expressions within this construct are assigned
348 to new @code{Voice} contexts. These new @code{Voice} contexts
349 are created implicitly and are given the fixed names @code{"1"},
352 The first example could be typeset as follows:
354 @lilypond[quote,relative=3,verbatim]
356 { r8 r16 g e8. f16 g8[ c,] f e16 d }
358 { d16 c d8~ d16 b c8~ c16 b c8~ c16 b8. }
362 This syntax can be used where it does not matter that temporary
363 voices are created and then discarded. These implicitly created
364 voices are given the settings equivalent to the effect of the
365 @code{\voiceOne} ... @code{\voiceFour} commands, in the order in
366 which they appear in the code.
368 In the following example, the intermediate voice has stems up,
369 therefore we enter it in the third place, so it becomes voice
370 three, which has the stems up as desired. Spacer rests are
371 used to avoid printing doubled rests.
373 @lilypond[quote,relative=3,verbatim]
375 { r8 g g g g f16 ees f8 d }
377 { ees,8 r ees r d r d r }
379 { d'8 s c s bes s a s }
383 In all but the simplest works it is advisable to create explicit
384 @code{Voice} contexts as explained in @rlearning{Contexts and engravers} and
385 @rlearning{Explicitly instantiating voices}.
387 @strong{@i{Identical rhythms}}
389 In the special case that we want to typeset parallel pieces of music
390 that have the same rhythm, we can combine them into a single
391 @code{Voice} context, thus forming chords. To achieve this, enclose
392 them in a simple simultaneous music construct within an explicit voice:
394 @lilypond[quote,relative=2,verbatim]
396 { e4 f8 d e16 f g8 d4 }
397 { c4 d8 b c16 d e8 b4 }
401 This method leads to strange beamings and warnings if the pieces of
402 music do not have the same rhythm.
416 @rlearning{Voices contain music},
417 @rlearning{Explicitly instantiating voices}.
420 @ref{Percussion staves},
421 @ref{Invisible rests},
425 @rlsr{Simultaneous notes}.
429 @unnumberedsubsubsec Voice styles
432 @cindex styles, voice
433 @cindex coloring voices
434 @funindex \voiceOneStyle
435 @funindex \voiceTwoStyle
436 @funindex \voiceThreeStyle
437 @funindex \voiceFourStyle
438 @funindex \voiceNeutralStyle
440 Voices may be given distinct colors and shapes, allowing them to be
443 @lilypond[quote,relative=2,verbatim]
445 { \voiceOneStyle d4 c2 b4 }
447 { \voiceTwoStyle e,2 e }
449 { \voiceThreeStyle b2. c4 }
451 { \voiceFourStyle g'2 g }
455 The @code{\voiceNeutralStyle} command is used to revert to the
456 standard presentation.
460 @code{\voiceOneStyle},
461 @code{\voiceTwoStyle},
462 @code{\voiceThreeStyle},
463 @code{\voiceFourStyle},
464 @code{\voiceNeutralStyle}.
470 @rlearning{I'm hearing Voices},
471 @rlearning{Other sources of information}.
474 @rlsr{Simultaneous notes}.
477 @node Collision resolution
478 @unnumberedsubsubsec Collision resolution
480 @cindex merging notes
481 @cindex note collisions
484 @cindex multiple voices
485 @cindex voices, multiple
486 @cindex polyphonic music
487 @cindex shifting voices
488 @cindex voices, multiple
489 @cindex shift rest, automatic
498 @funindex \mergeDifferentlyDottedOn
499 @funindex mergeDifferentlyDottedOn
500 @funindex \mergeDifferentlyDottedOff
501 @funindex mergeDifferentlyDottedOff
502 @funindex \mergeDifferentlyHeadedOn
503 @funindex mergeDifferentlyHeadedOn
504 @funindex \mergeDifferentlyHeadedOff
505 @funindex mergeDifferentlyHeadedOff
507 The note heads of notes in different voices with the same pitch,
508 same note head and opposite stem direction are automatically
509 merged, but notes with different note heads or the same stem
510 direction are not. Rests opposite a stem in a different voice
511 are shifted vertically. The following example shows three
512 different circumstances, on beats 1 and 3 in bar 1 and beat 1
513 in bar 2, where the automatic merging fails.
515 @lilypond[quote,verbatim,relative=2]
531 Notes with different note heads may be merged, with the
532 exception of half-note heads and quarter-note heads, as shown
533 below. Here the note heads on beat 1 of bar 1 are now merged:
535 @lilypond[quote,verbatim,relative=2]
538 \mergeDifferentlyHeadedOn
552 Note heads with different dots as shown in beat 3 of bar 1 may be
555 @lilypond[quote,relative=2,verbatim]
558 \mergeDifferentlyHeadedOn
559 \mergeDifferentlyDottedOn
574 The half note and eighth note at the start of the second measure
575 are incorrectly merged because the automatic merge cannot
576 successfully complete the merge when three or more notes line up in
577 the same note column, and in this case the merged note head is
578 incorrect. To allow the merge to select the correct note head
579 a @code{\shift} must be applied to the note that should not be
580 merged. Here, @code{\shiftOn} is applied to move the top
581 @notation{g} out of the column, and @code{\mergeDifferentlyHeadedOn}
584 @lilypond[quote,relative=2,verbatim]
587 \mergeDifferentlyHeadedOn
588 \mergeDifferentlyDottedOn
603 The @code{\shiftOn}, @code{\shiftOnn}, and @code{\shiftOnnn}
604 commands specify the degree to which chords of the current voice
605 should be shifted. The outer voices (normally: voices one and
606 two) have @code{\shiftOff}, while the inner voices (three and
607 four) have @code{\shiftOn}. @code{\shiftOnn} and
608 @code{\shiftOnnn} define further shift levels.
610 Notes are only merged if they have opposing stem directions (as
611 they have, for example, in voices one and two by default or when
612 the stems are explicitly set in opposite directions).
616 @code{\mergeDifferentlyDottedOn},
617 @code{\mergeDifferentlyDottedOff},
618 @code{\mergeDifferentlyHeadedOn},
619 @code{\mergeDifferentlyHeadedOff}.
630 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
631 {additional-voices-to-avoid-collisions.ly}
633 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
634 {forcing-horizontal-shift-of-notes.ly}
642 @rlearning{Multiple notes at once},
643 @rlearning{Voices contain music},
644 @rlearning{Real music example}.
647 @rlsr{Simultaneous notes}.
650 @rinternals{NoteColumn},
651 @rinternals{NoteCollision},
652 @rinternals{RestCollision}.
658 @c TODO investigate! Sometimes it works, sometimes not. --FV
659 The requirements for successfully merging different note heads that
660 are at the same time differently dotted are not clear.
663 There is no support for chords where the same note occurs with
664 different accidentals in the same chord. In this case, it is
665 recommended to use enharmonic transcription, or to use special
666 cluster notation (see @ref{Clusters}).
669 @node Automatic part combining
670 @unnumberedsubsubsec Automatic part combining
672 @cindex automatic part combining
673 @cindex part combiner
674 @cindex combining parts
677 @funindex \partcombine
678 @funindex partcombine
680 Automatic part combining is used to merge two parts of music onto
681 a staff. It is aimed at typesetting orchestral scores. When the
682 two parts are identical for a period of time, only one is shown.
683 In places where the two parts differ, they are typeset as separate
684 voices, and stem directions are set automatically. Also, solo and
685 @notation{a due} parts are identified and marked by default.
687 The syntax for part combining is:
690 \partcombine @var{musicexpr1} @var{musicexpr2}
693 The following example demonstrates the basic functionality of the
694 part combiner: putting parts on one staff and setting stem
695 directions and polyphony. The same variables are used for the
696 independent parts and the combined staff.
698 @lilypond[quote,verbatim]
699 instrumentOne = \relative c' {
707 instrumentTwo = \relative g' {
716 \new Staff \instrumentOne
717 \new Staff \instrumentTwo
718 \new Staff \partcombine \instrumentOne \instrumentTwo
722 The notes in the third measure appear only once, although they were
723 specified in both parts. Stem, slur, and tie directions are set
724 automatically, depending whether there is a solo or unison. When
725 needed in polyphony situations, the first part (with context called
726 @code{one}) always gets up stems, while the second (called @code{two})
727 always gets down stems. In solo situations, the first and second
728 parts get marked with @q{Solo} and @q{Solo II}, respectively. The
729 unisono (@notation{a due}) parts are marked by default with the text
732 Both arguments to @code{\partcombine} will be interpreted as
733 @code{Voice} contexts. If using relative octaves,
734 @code{\relative} should be specified for both music expressions,
739 \relative @dots{} @var{musicexpr1}
740 \relative @dots{} @var{musicexpr2}
744 A @code{\relative} section that is outside of @code{\partcombine}
745 has no effect on the pitches of @var{musicexpr1} and
750 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
751 {combining-two-parts-on-the-same-staff.ly}
753 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
754 {changing-partcombine-texts.ly}
766 @rlsr{Simultaneous notes}.
769 @rinternals{PartCombineMusic},
775 @code{\partcombine} can only accept two voices.
777 When @code{printPartCombineTexts} is set, if the two voices play
778 the same notes on and off, the part combiner may typeset @code{a2}
779 more than once in a measure.
781 @code{\partcombine} cannot be inside @code{\times}.
783 @code{\partcombine} cannot be inside @code{\relative}.
785 Internally, the @code{\partcombine} interprets both arguments as
786 @code{Voice}s and decides when the parts can be combined. When they have
787 different durations they cannot be combined and are given the names
788 @code{one} and @code{two}. Consequently, if the arguments switch to
789 differently named @rinternals{Voice} contexts, the events in those will
790 be ignored. Likewise, partcombining isn't designed to work with lyrics;
791 when one of the voices is explicitly named in order to attach lyrics to
792 it, the partcombining stops working.
794 @code{\partcombine} only observes onset times of notes. It cannot
795 determine whether a previously started note is playing or not, leading
799 @node Writing music in parallel
800 @unnumberedsubsubsec Writing music in parallel
802 @cindex writing music in parallel
803 @cindex interleaved music
804 @cindex parallel music
805 @funindex \parallelMusic
806 @funindex parallelMusic
808 Music for multiple parts can be interleaved in input code. The
809 function @code{\parallelMusic} accepts a list with the names of a
810 number of variables to be created, and a musical expression. The
811 content of alternate measures from the expression become the value
812 of the respective variables, so you can use them afterwards to
815 @warning{Bar checks @code{|} must be used, and the measures must
816 be of the same length.}
818 @lilypond[quote,verbatim]
819 \parallelMusic #'(voiceA voiceB voiceC) {
821 r8 g'16 c'' e'' g' c'' e'' r8 g'16 c'' e'' g' c'' e'' |
822 r16 e'8.~ e'4 r16 e'8.~ e'4 |
826 r8 a'16 d'' f'' a' d'' f'' r8 a'16 d'' f'' a' d'' f'' |
827 r16 d'8.~ d'4 r16 d'8.~ d'4 |
832 \new Staff << \voiceA \\ \voiceB >>
833 \new Staff { \clef bass \voiceC }
837 Relative mode may be used. Note that the @code{\relative} command
838 is not used inside @code{\parallelMusic} itself. The notes are
839 relative to the preceding note in the voice, not to the previous
840 note in the input -- in other words, relative notes for
841 @code{voiceA} ignore the notes in @code{voiceB}.
843 @lilypond[quote,verbatim]
844 \parallelMusic #'(voiceA voiceB voiceC) {
846 r8 g16 c e g, c e r8 g,16 c e g, c e |
847 r16 e8.~ e4 r16 e8.~ e4 |
851 r8 a,16 d f a, d f r8 a,16 d f a, d f |
852 r16 d8.~ d4 r16 d8.~ d4 |
857 \new Staff << \relative c'' \voiceA \\ \relative c' \voiceB >>
858 \new Staff \relative c' { \clef bass \voiceC }
862 This works quite well for piano music. This example maps four
863 consecutive measures to four variables:
865 @lilypond[quote,verbatim]
871 \parallelMusic #'(voiceA voiceB voiceC voiceD) {
875 c16 d e fis d e fis g |
881 e16 fis g a fis g a b |
892 \relative c'' \voiceA
912 @rlearning{Organizing pieces with variables}.
915 @rlsr{Simultaneous notes}.