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,ragged-right,line-width=16\cm]{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
71 <a-+ c-->8. <g\fermata c e\turn>16
74 However some notation, such as dynamics, hairpins and slurs must be
75 attached to the chord, rather than notes within the chord, otherwise
78 @lilypond[verbatim,quote,relative=2]
79 <a\f c( e>1 <a c) e>\f <a\< c e>( <a\! c e>)
80 <a c e>\< <a c e> <a c e>\!
84 @cindex placeholder events
86 A chord acts merely as a container for its notes, its articulations and
87 other attached elements. Consequently, a chord without notes inside
88 does not actually have a duration. Any attached articulations will
89 happen at the same musical time as the next following note or chord and
90 be combined with them (for more complex possibilities of combining such
91 elements, see @ref{Simultaneous expressions}):
93 @lilypond[verbatim,quote,relative=2]
95 <> ) \p \< -. -\markup \italic "sempre staccato"
96 \repeat unfold 4 { c4 e } c1\f
99 @cindex relative pitch, chords
100 @cindex chords, relative pitch
102 Relative mode can be used for pitches in chords. The first note of
103 each chord is always relative to the first note of the chord that
104 came before it, or in the case where no preceding chord exists, the
105 pitch of the last note that came before the chord. All remaining notes
106 in the chord are relative to the note that came before it
107 @emph{within the same chord}.
109 @lilypond[verbatim,quote,relative=2]
110 <a c e>1 <f a c> <a c e> <f' a c> <b, e b,>
113 For more information about chords, see @ref{Chord notation}.
120 @rlearning{Combining notes into chords}.
123 @ref{Chord notation},
124 @ref{Articulations and ornamentations},
125 @ref{Relative octave entry},
126 @ref{Multiple voices}.
129 @rlsr{Simultaneous notes}.
132 Chords containing more than two pitches within a staff space,
133 such as @samp{<e f! fis!>}, create overlapping noteheads.
134 Depending on the situation, better representations might involve
139 temporary use of @ref{Multiple voices},
140 @samp{<< f! \\ <e fis!> >>},
143 enharmonic transcription of one or more pitches,
152 @node Chord repetition
153 @unnumberedsubsubsec Chord repetition
155 @cindex Chord, repetition
156 @cindex repetition, using @code{q}
158 In order to save typing, a shortcut can be used to repeat the preceding
159 chord. The chord repetition symbol is @code{q}:
161 @lilypond[verbatim,quote,relative=2]
162 <a c e>1 q <f a c>2 q
165 As with regular chords, the chord repetition symbol can be used with
166 durations, articulations, markups, slurs, beams, etc. as only the
167 pitches of the previous chord are duplicated.
169 @lilypond[verbatim,quote,relative=2]
170 <a c e>1\p^"text" q2\<( q8)[-! q8.]\! q16-1-2-3 q8\prall
173 The chord repetition symbol always remembers the last instance of
174 a chord so it is possible to repeat the most recent chord even if
175 other non-chorded notes or rests have been added since.
177 @lilypond[verbatim,quote,relative=2]
178 <a c e>1 c'4 q2 r8 q8 |
182 However, the chord repetition symbol does not retain any dynamics,
183 articulation or ornamentation within, or attached to, the previous
186 @lilypond[verbatim,quote,relative=2]
187 <a-. c\prall e>1\sfz c'4 q2 r8 q8 |
191 To have some of them retained, the @code{\chordRepeats} function can be
192 be called explicitly with an extra argument specifying a list of
193 @var{event types} to keep unless events of that type are already
194 present on the @code{q} chord itself.
196 @lilypond[verbatim,quote]
198 \chordRepeats #'(articulation-event)
199 { <a-. c\prall e>1\sfz c'4 q2 r8 q8-. } |
204 Here using @code{\chordRepeats} inside of a @code{\relative} construction
205 produces unexpected results: once chord events have been expanded, they
206 are indistinguishable from having been entered as regular chords, making
207 @code{\relative} assign an octave based on their current context.
209 Since nested instances of @code{\relative} don't affect one another,
210 another @code{\relative} inside of @code{\chordRepeats} can be used for
211 establishing the octave relations before expanding the repeat chords.
212 In that case, the whole content of the inner @code{\relative} does not
213 affect the outer one; hence the different octave entry of the final note
216 @c Without \new Voice, implicit voice creation does the dumbest thing.
217 @lilypond[verbatim,quote]
220 \chordRepeats #'(articulation-event)
222 { <a-. c\prall e>1\sfz c'4 q2 r8 q8-. } |
227 Interactions with @code{\relative} occur only with explicit calls of
228 @code{\chordRepeats}: the implicit expansion at the start of typesetting
229 is done at a time where all instances of @code{\relative} have already
234 @ref{Chord notation},
235 @ref{Articulations and ornamentations}.
238 @file{ly/chord-repetition-init.ly}.
241 @node Simultaneous expressions
242 @unnumberedsubsubsec Simultaneous expressions
244 One or more music expressions enclosed in double angle brackets are
245 taken to be simultaneous. If the first expression begins with a
246 single note or if the whole simultaneous expression appears
247 explicitly within a single voice, the whole expression is placed on
248 a single staff; otherwise the elements of the simultaneous
249 expression are placed on separate staves.
251 The following examples show simultaneous expressions on one staff:
253 @lilypond[quote,verbatim,relative=2]
254 \new Voice { % explicit single voice
255 << { a4 b g2 } { d4 g c,2 } >>
259 @lilypond[quote,verbatim,relative=2]
261 a << { a4 b g } { d4 g c, } >>
264 This can be useful if the simultaneous sections have identical
265 rhythms, but attempts to attach notes with different durations to
266 the same stem will cause errors. Notes, articulations, and property
267 changes in a @emph{single} @samp{Voice} are collected and engraved in
270 @lilypond[quote,verbatim,relative=2]
271 <a c>4-. <>-. << c a >> << { c-. <c a> } { a s-. } >>
274 Multiple stems or beams or different note durations or properties at
275 the same musical time require the use of multiple voices.
277 The following example shows how simultaneous expressions can
278 generate multiple staves implicitly:
280 @lilypond[quote,verbatim,relative=2]
281 % no single first note
282 << { a4 b g2 } { d4 g2 c,4 } >>
285 Here different rhythms cause no problems because they are
286 interpreted in different voices.
288 @cindex collisions, clashing note columns
289 @cindex collisions, ignoring
292 If notes from two or more voices, with stems in the same direction, are
293 placed at the same position on the staff and have no shift (or have the
294 same shift specified), the message:
297 warning: ignoring too many clashing note columns
300 will appear during compilation. This message can be suppressed by:
303 \override NoteColumn.ignore-collision = ##t
306 However, this not only suppresses the warning but will prevent any
307 collision resolution whatsover and may have other unintended effects
308 (also see @emph{Known Issues} in @ref{Collision resolution}).
312 @unnumberedsubsubsec Clusters
317 @funindex \makeClusters
318 @funindex makeClusters
320 A cluster indicates a continuous range of pitches to be played.
321 They can be denoted as the envelope of a set of notes. They are
322 entered by applying the function @code{\makeClusters} to a sequence
325 @lilypond[quote,relative=2,verbatim]
326 \makeClusters { <g b>2 <c g'> }
329 Ordinary notes and clusters can be put together in the same staff,
330 even simultaneously. In such a case no attempt is made to
331 automatically avoid collisions between ordinary notes and clusters.
338 @rlsr{Simultaneous notes}.
341 @rinternals{ClusterSpanner},
342 @rinternals{ClusterSpannerBeacon},
343 @rinternals{Cluster_spanner_engraver}.
346 Clusters look good only if they span at least two chords; otherwise
347 they appear too narrow.
349 Clusters do not have a stem and cannot indicate durations by
350 themselves, but the length of the printed cluster is determined by
351 the durations of the defining chords. Separate clusters need a
352 separating rest between them.
354 Clusters do not produce MIDI output.
357 @node Multiple voices
358 @subsection Multiple voices
360 This section discusses simultaneous notes in multiple voices or
364 * Single-staff polyphony::
366 * Collision resolution::
367 * Automatic part combining::
368 * Writing music in parallel::
372 @node Single-staff polyphony
373 @unnumberedsubsubsec Single-staff polyphony
375 @cindex single-staff polyphony
376 @cindex polyphony, single-staff
378 @cindex lyrics assigned to one voice
382 @funindex \voiceOne ... \voiceFour
387 @subsubsubheading Explicitly instantiating voices
389 The basic structure needed to achieve multiple independent
390 voices in a single staff is illustrated in the following example:
392 @lilypond[quote,relative=3,verbatim]
395 { \voiceOne r8 r16 g e8. f16 g8[ c,] f e16 d }
397 { \voiceTwo d16 c d8~ d16 b c8~ c16 b c8~ c16 b8. }
402 Here, voices are instantiated explicitly and are given names. The
403 @code{\voiceOne} @dots{} @code{\voiceFour} commands set up the voices
404 so that first and third voices get stems up, second and fourth
405 voices get stems down, third and fourth voice note heads are
406 horizontally shifted, and rests in the respective voices are
407 automatically moved to avoid collisions. The @code{\oneVoice}
408 command returns all the voice settings to the neutral default
411 @subsubsubheading Temporary polyphonic passages
413 A temporary polyphonic passage can be created with the following
417 << @{ \voiceOne @dots{} @}
418 \new Voice @{ \voiceTwo @dots{} @}
423 Here, the first expression within a temporary polyphonic passage is
424 placed into the @code{Voice} context which was in use immediately
425 before the polyphonic passage, and that same @code{Voice} context
426 continues after the temporary section. Other expressions within
427 the angle brackets are assigned to distinct temporary voices.
428 This allows lyrics to be assigned to one continuing voice before,
429 during and after a polyphonic section:
431 @lilypond[quote, verbatim, relative=2]
433 \new Voice = "melody" {
448 \new Lyrics \lyricsto "melody" {
455 Here, the @code{\voiceOne} and @code{\voiceTwo} commands are
456 required to define the settings of each voice.
458 @subsubsubheading The double backslash construct
460 The @code{<< @{@dots{}@} \\ @{@dots{}@} >>} construct, where the two (or
461 more) expressions are separated by double backslashes, behaves
462 differently to the similar construct without the double backslashes:
463 @emph{all} the expressions within this construct are assigned
464 to new @code{Voice} contexts. These new @code{Voice} contexts
465 are created implicitly and are given the fixed names @code{"1"},
468 The first example could be typeset as follows:
470 @lilypond[quote,relative=3,verbatim]
472 { r8 r16 g e8. f16 g8[ c,] f e16 d }
474 { d16 c d8~ d16 b c8~ c16 b c8~ c16 b8. }
478 This syntax can be used where it does not matter that temporary
479 voices are created and then discarded. These implicitly created
480 voices are given the settings equivalent to the effect of the
481 @code{\voiceOne} @dots{} @code{\voiceFour} commands, in the order in
482 which they appear in the code.
484 In the following example, the intermediate voice has stems up,
485 therefore we enter it in the third place, so it becomes voice
486 three, which has the stems up as desired. Spacer rests are
487 used to avoid printing doubled rests.
489 @lilypond[quote,relative=3,verbatim]
491 { r8 g g g g f16 ees f8 d }
493 { ees,8 r ees r d r d r }
495 { d'8 s c s bes s a s }
499 In all but the simplest works it is advisable to create explicit
500 @code{Voice} contexts as explained in @rlearning{Contexts and engravers} and
501 @rlearning{Explicitly instantiating voices}.
503 @subsubsubheading Voice order
505 When entering multiple voices in the input file, use the following
511 Voice 3: second highest
512 Voice 4: second lowest
513 Voice 5: third highest
514 Voice 6: third lowest
518 Though this may seem counterintuitive, it simplifies the automatic
519 layout process. Note that the odd-numbered voices are given
520 upstems, and the even-numbered voices are given downstems:
522 @lilypond[quote,verbatim]
525 { f''2 } % 1: highest
529 { d''2 } % 3: second-highest
531 { e'2 } % 4: second-lowest
533 { b'2 } % 5: third-highest
535 { g'2 } % 6: third-lowest
539 @warning{Lyrics, spanners (such as slurs, ties, hairpins etc.) cannot be
540 created @q{across} voices.}
542 @subsubsubheading Identical rhythms
544 In the special case that we want to typeset parallel pieces of music
545 that have the same rhythm, we can combine them into a single
546 @code{Voice} context, thus forming chords. To achieve this, enclose
547 them in a simple simultaneous music construct within an explicit voice:
549 @lilypond[quote,relative=2,verbatim]
551 { e4 f8 d e16 f g8 d4 }
552 { c4 d8 b c16 d e8 b4 }
556 This method leads to strange beamings and warnings if the pieces of
557 music do not have the same rhythm.
570 @rlearning{Voices contain music},
571 @rlearning{Explicitly instantiating voices}.
574 @ref{Percussion staves},
575 @ref{Invisible rests},
579 @rlsr{Simultaneous notes}.
583 @unnumberedsubsubsec Voice styles
586 @cindex styles, voice
587 @cindex coloring voices
588 @funindex \voiceOneStyle
589 @funindex \voiceTwoStyle
590 @funindex \voiceThreeStyle
591 @funindex \voiceFourStyle
592 @funindex \voiceNeutralStyle
594 Voices may be given distinct colors and shapes, allowing them to be
597 @lilypond[quote,relative=2,verbatim]
599 { \voiceOneStyle d4 c2 b4 }
601 { \voiceTwoStyle e,2 e }
603 { \voiceThreeStyle b2. c4 }
605 { \voiceFourStyle g'2 g }
609 The @code{\voiceNeutralStyle} command is used to revert to the
610 standard presentation.
614 @code{\voiceOneStyle},
615 @code{\voiceTwoStyle},
616 @code{\voiceThreeStyle},
617 @code{\voiceFourStyle},
618 @code{\voiceNeutralStyle}.
623 @rlearning{I'm hearing Voices},
624 @rlearning{Other sources of information}.
627 @rlsr{Simultaneous notes}.
630 @node Collision resolution
631 @unnumberedsubsubsec Collision resolution
633 @cindex merging notes
634 @cindex note collisions
637 @cindex multiple voices
638 @cindex voices, multiple
639 @cindex polyphonic music
640 @cindex shifting voices
641 @cindex voices, multiple
642 @cindex shift rest, automatic
651 @funindex \mergeDifferentlyDottedOn
652 @funindex mergeDifferentlyDottedOn
653 @funindex \mergeDifferentlyDottedOff
654 @funindex mergeDifferentlyDottedOff
655 @funindex \mergeDifferentlyHeadedOn
656 @funindex mergeDifferentlyHeadedOn
657 @funindex \mergeDifferentlyHeadedOff
658 @funindex mergeDifferentlyHeadedOff
660 The note heads of notes in different voices with the same pitch,
661 same note head and opposite stem direction are automatically
662 merged, but notes with different note heads or the same stem
663 direction are not. Rests opposite a stem in a different voice
664 are shifted vertically. The following example shows three
665 different circumstances, on beats 1 and 3 in bar 1 and beat 1
666 in bar 2, where the automatic merging fails.
668 @lilypond[quote,verbatim,relative=2]
684 Notes with different note heads may be merged as shown
685 below. In this example the note heads on beat 1 of bar 1 are now merged:
687 @lilypond[quote,verbatim,relative=2]
690 \mergeDifferentlyHeadedOn
704 Quarter and half notes are not merged in this way, since it would be difficult
707 Note heads with different dots as shown in beat 3 of bar 1 may be
710 @lilypond[quote,relative=2,verbatim]
713 \mergeDifferentlyHeadedOn
714 \mergeDifferentlyDottedOn
728 The half note and eighth note at the start of the second measure
729 are incorrectly merged because the automatic merge cannot
730 successfully complete the merge when three or more notes line up in
731 the same note column, and in this case the merged note head is
732 incorrect. To allow the merge to select the correct note head
733 a @code{\shift} must be applied to the note that should not be
734 merged. Here, @code{\shiftOn} is applied to move the top
735 @notation{g} out of the column, and @code{\mergeDifferentlyHeadedOn}
738 @lilypond[quote,relative=2,verbatim]
741 \mergeDifferentlyHeadedOn
742 \mergeDifferentlyDottedOn
757 The @code{\shiftOn} command allows (but does not force) the notes
758 in a voice to be shifted. When @code{\shiftOn} is applied to a
759 voice, a note or chord in that voice is shifted only if its stem
760 would otherwise collide with a stem from another voice, and only
761 if the colliding stems point in the same direction. The
762 @code{\shiftOff} command prevents this type of shifting from
765 By default, the outer voices (normally voices one and two) have
766 @code{\shiftOff} specified, while the inner voices (three and
767 above) have @code{\shiftOn} specified. When a shift is applied,
768 voices with upstems (odd-numbered voices) are shifted to the
769 right, and voices with downstems (even-numbered voices) are
772 Here is an example to help you visualize how an abbreviated
773 polyphonic expression would be expanded internally.
775 @warning{Note that with three or more voices, the vertical order
776 of voices in your input file should not be the same as the
777 vertical order of voices on the staff!}
779 @lilypond[quote,verbatim]
780 \new Staff \relative c'' {
787 { d'2 } % 3: upper middle
789 { b2 } % 4: lower middle
791 %% internal expansion of the above
793 \new Voice = "1" { \voiceOne \shiftOff f'2 }
794 \new Voice = "2" { \voiceTwo \shiftOff g,2 }
795 \new Voice = "3" { \voiceThree \shiftOn d'2 } % shifts right
796 \new Voice = "4" { \voiceFour \shiftOn b2 } % shifts left
801 Two additional commands, @code{\shiftOnn} and @code{\shiftOnnn}
802 provide further shift levels which may be specified temporarily to
803 resolve collisions in complex situations -- see
804 @rlearning{Real music example}.
806 Notes are only merged if they have opposing stem directions (as
807 they have, for example, in voices one and two by default or when
808 the stems are explicitly set in opposite directions).
811 @code{\mergeDifferentlyDottedOn},
812 @code{\mergeDifferentlyDottedOff},
813 @code{\mergeDifferentlyHeadedOn},
814 @code{\mergeDifferentlyHeadedOff}.
823 @lilypondfile[verbatim,quote,texidoc,doctitle]
824 {additional-voices-to-avoid-collisions.ly}
826 @lilypondfile[verbatim,quote,texidoc,doctitle]
827 {forcing-horizontal-shift-of-notes.ly}
834 @rlearning{Multiple notes at once},
835 @rlearning{Voices contain music},
836 @rlearning{Real music example}.
839 @rlsr{Simultaneous notes}.
842 @rinternals{NoteColumn},
843 @rinternals{NoteCollision},
844 @rinternals{RestCollision}.
846 @cindex collisions, ignoring
849 Using @code{\override NoteColumn.ignore-collision = ##t} will cause
850 differently headed notes in different voices to merge incorrectly.
852 @lilypond[quote,relative=1,verbatim]
853 \mergeDifferentlyHeadedOn
854 << { c16 a' b a } \\ { c,2 } >>
855 \override NoteColumn.ignore-collision = ##t
856 << { c16 a' b a } \\ { c,2 } >>
861 @c TODO investigate! Sometimes it works, sometimes not. --FV
862 The requirements for successfully merging different note heads that
863 are at the same time differently dotted are not clear.
867 @node Automatic part combining
868 @unnumberedsubsubsec Automatic part combining
870 @cindex automatic part combining
871 @cindex part combiner
872 @cindex combining parts
875 @funindex \partcombine
876 @funindex partcombine
878 Automatic part combining is used to merge two separate parts of music
879 onto a single staff. This can be especially helpful when typesetting
880 orchestral scores. A single @code{Voice} is printed while the two parts
881 of music are the same, but in places where they differ, a second
882 @code{Voice} is printed. Stem directions are set up & down accordingly
883 while Solo and @notation{a due} parts are also identified and marked
886 The syntax for automatic part combining is:
889 \partcombine @var{musicexpr1} @var{musicexpr2}
892 The following example demonstrates the basic functionality, putting
893 parts on a single staff as polyphony and setting stem directions
894 accordingly. The same variables are used for the independent parts and
897 @lilypond[quote,verbatim]
898 instrumentOne = \relative c' {
906 instrumentTwo = \relative g' {
915 \new Staff \instrumentOne
916 \new Staff \instrumentTwo
917 \new Staff \partcombine \instrumentOne \instrumentTwo
921 Both parts have identical notes in the third measure, so only one
922 instance of the notes is printed. Stem, slur, and tie directions are
923 set automatically, depending on whether the parts are playing solo or in
924 unison. When needed in polyphony situations, the first part (with
925 context called @code{one}) gets @qq{up} stems, while the second (called
926 @code{two}) always gets @qq{down} stems. In solo situations, the first
927 and second parts get marked with @qq{Solo} and @qq{Solo II},
928 respectively. The unison (@notation{a due}) parts are marked with the
931 Both arguments to @code{\partcombine} will be interpreted as separate
932 @code{Voice} contexts, so if the music is being specified in relative
933 mode then @emph{both} parts must contain a @code{\relative} function,
938 \relative @dots{} @var{musicexpr1}
939 \relative @dots{} @var{musicexpr2}
943 A @code{\relative} section that encloses a @code{\partcombine} has no
944 effect on the pitches of @code{@var{musicexpr1}} or
945 @code{@var{musicexpr2}}.
947 @funindex \partcombineChords
948 @funindex partcombineChords
949 @funindex \partcombineApart
950 @funindex partcombineApart
951 @funindex \partcombineUnisono
952 @funindex partcombineUnisono
953 @funindex \partcombineSoloI
954 @funindex partcombineSoloI
955 @funindex \partcombineSoloII
956 @funindex partcombineSoloII
957 @funindex \partcombineAutomatic
958 @funindex partcombineAutomatic
960 In professional scores, voices are often kept apart from each other for
961 long passages of music even if some of the notes are the same in both
962 voices, and could just as easily be printed as unison. Combining notes
963 into a chord, or showing one voice as solo is, therefore, not ideal as
964 the @code{\partcombine} function considers each note separately. In this
965 case the @code{\partcombine} function can be overriden with the
968 Commands ending in @code{@dots{}Once} apply only to the next note in the
973 @code{\partcombineApart} and @code{\partcombineApartOnce} keep the
974 notes as two separate voices, even if they can be combined into a chord
978 @code{\partcombineChords} and @code{\partcombineChordsOnce} combine the
982 @code{\partcombineUnisono} and @code{\partcombineUnisonoOnce} combine
983 both voices as @qq{unison}.
986 @code{\partcombineSoloI} and @code{\partcombineSoloIOnce} print only
987 voice one, and mark it as a @qq{Solo}.
990 @code{\partcombineSoloII} or @code{\partcombineSoloIIOnce} print only
991 voice two and mark it as a @qq{Solo}.
994 @code{\partcombineAutomatic} and @code{\partcombineAutomaticOnce} end
995 the functions of the commands above, and revert back to the standard
996 @code{\partcombine} functionality.
999 @lilypond[quote,verbatim]
1000 instrumentOne = \relative c' {
1001 \partcombineApart c2^"apart" e |
1002 \partcombineAutomatic e2^"auto" e |
1003 \partcombineChords e'2^"chord" e |
1004 \partcombineAutomatic c2^"auto" c |
1005 \partcombineApart c2^"apart" \partcombineChordsOnce e^"chord once" |
1008 instrumentTwo = \relative c' {
1018 \new Staff { \instrumentOne }
1019 \new Staff { \instrumentTwo }
1020 \new Staff { \partcombine \instrumentOne \instrumentTwo }
1025 @subsubsubheading Using \partcombine with lyrics
1027 @cindex \partcombine and lyrics
1029 The @code{\partcombine} command is not designed to work with
1030 lyrics; if one of the voices is explicitly named in order to
1031 attach lyrics to it, the partcombiner will stop working. However,
1032 this effect can be achieved using a @code{NullVoice} context. See
1033 @ref{Polyphony with shared lyrics}.
1038 @lilypondfile[verbatim,quote,texidoc,doctitle]
1039 {combining-two-parts-on-the-same-staff.ly}
1041 @lilypondfile[verbatim,quote,texidoc,doctitle]
1042 {changing-partcombine-texts.ly}
1050 @ref{Writing parts}.
1053 @rlsr{Simultaneous notes}.
1055 Internals Reference:
1056 @rinternals{PartCombineMusic},
1060 All @code{\partcombine@dots{}} functions can only accept two voices.
1062 @code{\partcombine@dots{}} functions cannot be placed inside a @code{\tuplet}
1063 or @code{\relative} block.
1065 If @code{printPartCombineTexts} is set and the two voices play the same
1066 notes @qq{on and off}, in the same measure, the part combiner may
1067 typeset @code{a2} more than once in that measure.
1069 @code{\partcombine} only knows when a note starts in a @code{Voice}; it
1070 cannot, for example, remember if a note in one @code{Voice} has already
1071 started when combining notes that have just started in the other
1072 @code{Voice}. This can lead to a number of unexpected issues including
1073 @qq{Solo} or @qq{Unison} marks being printed incorrectly.
1075 @code{\partcombine} keeps all spanners (slurs, ties, hairpins etc.) in
1076 the same @code{Voice} so that if any such spanners start or end in a
1077 different @code{Voice}, they may not be printed properly or at all.
1079 If the @code{\partcombine} function cannot combine both music
1080 expressions (i.e. when both voices have different durations), it will
1081 give the voices, internally, its own custom names: @code{one} and
1082 @code{two} respectively. This means if there is any @qq{switch} to a
1083 differently named @code{Voice} context, the events in that differently
1084 named @code{Voice} will be ignored.
1086 Refer also to @emph{Known issues and warnings} when using
1087 @code{\partcombine} with tablature in @ref{Default tablatures} and the
1088 @emph{Note} in @ref{Automatic beams} when using automatic beaming.
1091 @node Writing music in parallel
1092 @unnumberedsubsubsec Writing music in parallel
1094 @cindex writing music in parallel
1095 @cindex interleaved music
1096 @cindex parallel music
1097 @funindex \parallelMusic
1098 @funindex parallelMusic
1100 Music for multiple parts can be interleaved in input code. The
1101 function @code{\parallelMusic} accepts a list with the names of a
1102 number of variables to be created, and a musical expression. The
1103 content of alternate measures from the expression become the value
1104 of the respective variables, so you can use them afterwards to
1107 @warning{Bar checks @code{|} must be used, and the measures must
1108 be of the same length.}
1110 @lilypond[quote,verbatim]
1111 \parallelMusic #'(voiceA voiceB voiceC) {
1113 r8 g'16 c'' e'' g' c'' e'' r8 g'16 c'' e'' g' c'' e'' |
1114 r16 e'8.~ e'4 r16 e'8.~ e'4 |
1118 r8 a'16 d'' f'' a' d'' f'' r8 a'16 d'' f'' a' d'' f'' |
1119 r16 d'8.~ d'4 r16 d'8.~ d'4 |
1124 \new Staff << \voiceA \\ \voiceB >>
1125 \new Staff { \clef bass \voiceC }
1129 Relative mode may be used. Note that the @code{\relative} command
1130 is not used inside @code{\parallelMusic} itself. The notes are
1131 relative to the preceding note in the voice, not to the previous
1132 note in the input -- in other words, relative notes for
1133 @code{voiceA} ignore the notes in @code{voiceB}.
1135 @lilypond[quote,verbatim]
1136 \parallelMusic #'(voiceA voiceB voiceC) {
1138 r8 g16 c e g, c e r8 g,16 c e g, c e |
1139 r16 e8.~ e4 r16 e8.~ e4 |
1143 r8 a,16 d f a, d f r8 a,16 d f a, d f |
1144 r16 d8.~ d4 r16 d8.~ d4 |
1149 \new Staff << \relative c'' \voiceA \\ \relative c' \voiceB >>
1150 \new Staff \relative c' { \clef bass \voiceC }
1154 This works quite well for piano music. This example maps four
1155 consecutive measures to four variables:
1157 @lilypond[quote,verbatim]
1163 \parallelMusic #'(voiceA voiceB voiceC voiceD) {
1167 c16 d e fis d e fis g |
1173 e16 fis g a fis g a b |
1184 \relative c'' \voiceA
1186 \relative c' \voiceB
1203 @rlearning{Organizing pieces with variables}.
1206 @rlsr{Simultaneous notes}.