]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/notation/simultaneous.itely
Doc: NR - Chord Repetition - examples and wording
[lilypond.git] / Documentation / notation / simultaneous.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @ignore
3     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
4
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..
8 @end ignore
9
10 @c \version "2.12.0"
11
12
13 @node Simultaneous notes
14 @section Simultaneous notes
15
16 @lilypondfile[quote]{simultaneous-headword.ly}
17
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.
21
22 @menu
23 * Single voice::
24 * Multiple voices::
25 @end menu
26
27
28 @node Single voice
29 @subsection Single voice
30
31 This section discusses simultaneous notes inside the same voice.
32
33 @menu
34 * Chorded notes::
35 * Chord repetition::
36 * Simultaneous expressions::
37 * Clusters::
38 @end menu
39
40
41 @node Chorded notes
42 @unnumberedsubsubsec Chorded notes
43
44 @cindex chords
45 @cindex brackets, angle
46 @cindex angle brackets
47 @cindex relative pitch in chords
48
49 @funindex <
50 @funindex >
51 @funindex <...>
52
53 A chord is formed by enclosing a set of pitches between @code{<}
54 and @code{>}.  A chord may be followed by a duration and/or a set
55 of articulations, just like simple notes:
56
57 @lilypond[verbatim,quote,relative=1]
58 <c e g>2 <c f a>4-> <e g c>-.
59 @end lilypond
60
61 Relative mode can be used for pitches in chords. The octave of each
62 pitch is chosen using the preceding pitch as a reference except in
63 the case of the first pitch in a chord: the reference for the first
64 pitch is the @emph{first} pitch of the preceding chord.
65
66 For more information about chords, see @ref{Chord notation}.
67
68 @seealso
69 Music Glossary:
70 @rglos{chord}.
71
72 Learning Manual:
73 @rlearning{Combining notes into chords}.
74
75 Notation Reference:
76 @ref{Chord notation}.
77
78 Snippets:
79 @rlsr{Simultaneous notes}.
80
81
82 @node Chord repetition
83 @unnumberedsubsubsec Chord repetition
84
85 In order to save typing, a shortcut can be used to repeat the preceding
86 chord.  The chord repetition symbol is @code{q}:
87
88 @lilypond[verbatim,quote,relative=1]
89 <c e g>4 q q q
90 @end lilypond
91
92 As with regular chords, the chord repetition symbol can be used with
93 durations, articulations, markups, slurs, beams, etc. as only the
94 pitches of the previous chord are duplicated.
95
96 @lilypond[verbatim,quote,relative=1]
97 <c e g>4\p q^"text"( q8)[-| q8.] q16-1-2-3
98 @end lilypond
99
100 The chord repetition symbol always remembers the last instance of
101 a chord so it is possible to repeat the most recent chord even if
102 other non-chorded notes or rests have been added since.
103
104 @lilypond[verbatim,quote,relative=1]
105 <c e g>8 c'4 q r8 q
106 @end lilypond
107
108 @seealso
109 Installed Files:
110 @file{ly/@/chord-repetition-init@/.ly}.
111
112
113 @node Simultaneous expressions
114 @unnumberedsubsubsec Simultaneous expressions
115
116 One or more music expressions enclosed in double angle brackets are
117 taken to be simultaneous.  If the first expression begins with a
118 single note or if the whole simultaneous expression appears
119 explicitly within a single voice, the whole expression is placed on
120 a single staff; otherwise the elements of the simultaneous
121 expression are placed on separate staves.
122
123 The following examples show simultaneous expressions on one staff:
124
125 @lilypond[quote,verbatim,relative=2]
126 \new Voice {  % explicit single voice
127   << { a4 b g2 } { d4 g c,2 } >>
128 }
129 @end lilypond
130
131 @lilypond[quote,verbatim,relative=2]
132 % single first note
133 a << { a4 b g } { d4 g c, } >>
134 @end lilypond
135
136 This can be useful if the simultaneous sections have identical
137 rhythms, but attempts to attach notes with different durations
138 to the same stem will cause errors.
139
140 The following example shows how simultaneous expressions can
141 generate multiple staves implicitly:
142
143 @lilypond[quote,verbatim,relative=2]
144 % no single first note
145 << { a4 b g2 } { d4 g2 c,4 } >>
146 @end lilypond
147
148 Here different rhythms cause no problems.
149
150
151 @node Clusters
152 @unnumberedsubsubsec Clusters
153
154 @cindex cluster
155 @cindex note cluster
156
157 @funindex \makeClusters
158 @funindex makeClusters
159
160 A cluster indicates a continuous range of pitches to be played.
161 They can be denoted as the envelope of a set of notes.  They are
162 entered by applying the function @code{\makeClusters} to a sequence
163 of chords, e.g.,
164
165 @lilypond[quote,relative=2,verbatim]
166 \makeClusters { <g b>2 <c g'> }
167 @end lilypond
168
169 Ordinary notes and clusters can be put together in the same staff,
170 even simultaneously.  In such a case no attempt is made to
171 automatically avoid collisions between ordinary notes and clusters.
172
173
174 @seealso
175 Music Glossary:
176 @rglos{cluster}.
177
178 Snippets:
179 @rlsr{Simultaneous notes}.
180
181 Internals Reference:
182 @rinternals{ClusterSpanner},
183 @rinternals{ClusterSpannerBeacon},
184 @rinternals{Cluster_spanner_engraver}.
185
186
187 @knownissues
188
189 Clusters look good only if they span at least two chords; otherwise
190 they appear too narrow.
191
192 Clusters do not have a stem and cannot indicate durations by
193 themselves, but the length of the printed cluster is determined by
194 the durations of the defining chords.  Separate clusters need a
195 separating rest between them.
196
197 Clusters do not produce MIDI output.
198
199 @node Multiple voices
200 @subsection Multiple voices
201
202 This section discusses simultaneous notes in multiple voices or
203 multiple staves.
204
205 @menu
206 * Single-staff polyphony::
207 * Voice styles::
208 * Collision resolution::
209 * Automatic part combining::
210 * Writing music in parallel::
211 @end menu
212
213
214 @node Single-staff polyphony
215 @unnumberedsubsubsec Single-staff polyphony
216
217 @cindex single-staff polyphony
218 @cindex polyphony, single-staff
219 @cindex voice
220 @cindex lyrics assigned to one voice
221
222 @funindex \voiceOne
223 @funindex voiceOne
224 @funindex \voiceOne ... \voiceFour
225 @funindex Voice
226 @funindex \oneVoice
227 @funindex oneVoice
228
229 @strong{@i{Explicitly instantiating voices}}
230
231 The basic structure needed to achieve multiple independent
232 voices in a single staff is illustrated in the following example:
233
234 @lilypond[quote,relative=3,verbatim]
235 \new Staff <<
236   \new Voice = "first"
237     { \voiceOne r8 r16 g e8. f16 g8[ c,] f e16 d }
238   \new Voice= "second"
239     { \voiceTwo d16 c d8~ d16 b c8~ c16 b c8~ c16 b8. }
240 >>
241 @end lilypond
242
243 @noindent
244 Here, voices are instantiated explicitly and are given names. The
245 @code{\voiceOne} ... @code{\voiceFour} commands set up the voices
246 so that first and third voices get stems up, second and fourth
247 voices get stems down, third and fourth voice note heads are
248 horizontally shifted, and rests in the respective voices are
249 automatically moved to avoid collisions.  The @code{\oneVoice}
250 command returns all the voice settings to the neutral default
251 directions.
252
253 @strong{@i{Temporary polyphonic passages}}
254
255 A temporary polyphonic passage can be created with the following
256 construct:
257
258 @example
259 << @{ \voiceOne ... @}
260   \new Voice @{ \voiceTwo ... @}
261 >> \oneVoice
262 @end example
263
264 @noindent
265 Here, the first expression within a temporary polyphonic passage is
266 placed into the @code{Voice} context which was in use immediately
267 before the polyphonic passage, and that same @code{Voice} context
268 continues after the temporary section.  Other expressions within
269 the angle brackets are assigned to distinct temporary voices.
270 This allows lyrics to be assigned to one continuing voice before,
271 during and after a polyphonic section:
272
273 @lilypond[quote, verbatim, relative=2]
274 <<
275   \new Voice = "melody" {
276     a4
277     <<
278       {
279         \voiceOne
280         g f
281       }
282       \new Voice {
283         \voiceTwo
284         d2
285       }
286     >>
287     \oneVoice
288     e4
289   }
290   \new Lyrics \lyricsto "melody" {
291   This is my song.
292   }
293 >>
294 @end lilypond
295
296 @noindent
297 Here, the @code{\voiceOne} and @code{\voiceTwo} commands are
298 required to define the settings of each voice.
299
300 @strong{@i{The double backslash construct}}
301
302 The @code{<< @{...@} \\ @{...@} >>} construct, where the two (or
303 more) expressions are separated by double backslashes, behaves
304 differently to the similar construct without the double backslashes:
305 @emph{all} the expressions within this contruct are assigned
306 to new @code{Voice} contexts.  These new @code{Voice} contexts
307 are created implicitly and are given the fixed names @code{"1"},
308 @code{"2"}, etc.
309
310 The first example could be typeset as follows:
311
312 @lilypond[quote,relative=3,verbatim]
313 <<
314   { r8 r16 g e8. f16 g8[ c,] f e16 d }
315   \\
316   { d16 c d8~ d16 b c8~ c16 b c8~ c16 b8. }
317 >>
318 @end lilypond
319
320 This syntax can be used where it does not matter that temporary
321 voices are created and then discarded.  These implicitly created
322 voices are given the settings equivalent to the effect of the
323 @code{\voiceOne} ... @code{\voiceFour} commands, in the order in
324 which they appear in the code.
325
326 In the following example, the intermediate voice has stems up,
327 therefore we enter it in the third place, so it becomes voice
328 three, which has the stems up as desired.  Spacer rests are
329 used to avoid printing doubled rests.
330
331 @lilypond[quote,relative=3,verbatim]
332 <<
333   { r8 g g  g g f16 ees f8 d }
334   \\
335   { ees,8 r ees r d r d r }
336   \\
337   { d'8 s c s bes s a s }
338 >>
339 @end lilypond
340
341 In all but the simplest works it is advisable to create explicit
342 @code{Voice} contexts as explained in @rlearning{Contexts and engravers} and
343 @rlearning{Explicitly instantiating voices}.
344
345 @strong{@i{Identical rhythms}}
346
347 In the special case that we want to typeset parallel pieces of music
348 that have the same rhythm, we can combine them into a single
349 @code{Voice} context, thus forming chords.  To achieve this, enclose
350 them in a simple simultaneous music construct within an explicit voice:
351
352 @lilypond[quote,relative=2,verbatim]
353 \new Voice <<
354   { e4 f8 d e16 f g8 d4 }
355   { c4 d8 b c16 d e8 b4 }
356 >>
357 @end lilypond
358
359 This method leads to strange beamings and warnings if the pieces of
360 music do not have the same rhythm.
361
362
363 @predefined
364 @code{\voiceOne},
365 @code{\voiceTwo},
366 @code{\voiceThree},
367 @code{\voiceFour},
368 @code{\oneVoice}.
369 @endpredefined
370
371
372 @seealso
373 Learning Manual:
374 @rlearning{Voices contain music},
375 @rlearning{Explicitly instantiating voices}.
376
377 Notation Reference:
378 @ref{Percussion staves},
379 @ref{Invisible rests},
380 @ref{Stems}.
381
382 Snippets:
383 @rlsr{Simultaneous notes}.
384
385
386 @node Voice styles
387 @unnumberedsubsubsec Voice styles
388
389 @cindex voice styles
390 @cindex styles, voice
391 @cindex coloring voices
392 @funindex \voiceOneStyle
393 @funindex \voiceTwoStyle
394 @funindex \voiceThreeStyle
395 @funindex \voiceFourStyle
396 @funindex \voiceNeutralStyle
397
398 Voices may be given distinct colors and shapes, allowing them to be
399 easily identified:
400
401 @lilypond[quote,relative=2,verbatim]
402 <<
403   { \voiceOneStyle d4 c2 b4 }
404   \\
405   { \voiceTwoStyle e,2 e }
406   \\
407   { \voiceThreeStyle b2. c4 }
408   \\
409   { \voiceFourStyle g'2 g }
410 >>
411 @end lilypond
412
413 The @code{\voiceNeutralStyle} command is used to revert to the
414 standard presentation.
415
416
417 @predefined
418 @code{\voiceOneStyle},
419 @code{\voiceTwoStyle},
420 @code{\voiceThreeStyle},
421 @code{\voiceFourStyle},
422 @code{\voiceNeutralStyle}.
423 @endpredefined
424
425
426 @seealso
427 Learning Manual:
428 @rlearning{I'm hearing Voices},
429 @rlearning{Other sources of information}.
430
431 Snippets:
432 @rlsr{Simultaneous notes}.
433
434
435 @node Collision resolution
436 @unnumberedsubsubsec Collision resolution
437
438 @cindex merging notes
439 @cindex note collisions
440 @cindex collisions
441 @cindex shift note
442 @cindex multiple voices
443 @cindex voices, multiple
444 @cindex polyphonic music
445 @cindex shifting voices
446 @cindex voices, multiple
447 @cindex shift rest, automatic
448 @funindex \shiftOn
449 @funindex shiftOn
450 @funindex \shiftOnn
451 @funindex shiftOnn
452 @funindex \shiftOnnn
453 @funindex shiftOnnn
454 @funindex \shiftOff
455 @funindex shiftOff
456 @funindex \mergeDifferentlyDottedOn
457 @funindex mergeDifferentlyDottedOn
458 @funindex \mergeDifferentlyDottedOff
459 @funindex mergeDifferentlyDottedOff
460 @funindex \mergeDifferentlyHeadedOn
461 @funindex mergeDifferentlyHeadedOn
462 @funindex \mergeDifferentlyHeadedOff
463 @funindex mergeDifferentlyHeadedOff
464
465 The note heads of notes in different voices with the same pitch,
466 same note head and opposite stem direction are automatically
467 merged, but notes with different note heads or the same stem
468 direction are not.  Rests opposite a stem in a different voice
469 are shifted vertically.  The following example shows three
470 different circumstances, on beats 1 and 3 in bar 1 and beat 1
471 in bar 2, where the automatic merging fails.
472
473 @lilypond[quote,verbatim,relative=2]
474 <<
475   {
476     c8 d e d c d c4
477     g'2 fis
478   } \\ {
479     c2 c8. b16 c4
480     e,2 r
481   } \\ {
482     \oneVoice
483     s1
484     e8 a b c d2
485   }
486 >>
487 @end lilypond
488
489 Notes with different note heads may be merged, with the
490 exception of half-note heads and quarter-note heads, as shown
491 below.  Here the note heads on beat 1 of bar 1 are now merged:
492
493 @lilypond[quote,verbatim,relative=2]
494 <<
495   {
496     \mergeDifferentlyHeadedOn
497     c8 d e d c d c4
498     g'2 fis
499   } \\ {
500     c2 c8. b16 c4
501     e,2 r
502   } \\ {
503     \oneVoice
504     s1
505     e8 a b c d2
506   }
507 >>
508 @end lilypond
509
510 Note heads with different dots as shown in beat 2 of bar 1 may be
511 also be merged:
512
513 @lilypond[quote,relative=2,verbatim]
514 <<
515   {
516     \mergeDifferentlyHeadedOn
517     \mergeDifferentlyDottedOn
518     c8 d e d c d c4
519     g'2 fis
520   } \\ {
521     c2 c8. b16 c4
522     e,2 r
523   } \\ {
524     \oneVoice
525     s1
526     e8 a b c d2
527   }
528 >>
529 @end lilypond
530
531
532 The half note and eighth note at the start of the second measure
533 are incorrectly merged because the automatic merge cannot
534 successfully complete the merge when three or more notes line up in
535 the same note column, and in this case the merged note head is
536 incorrect.  To allow the merge to select the correct note head
537 a @code{\shift} must be applied to the note that should not be
538 merged.  Here, @code{\shiftOn} is applied to move the top
539 @notation{g} out of the column, and @code{\mergeDifferentlyHeadedOn}
540 then works properly.
541
542 @lilypond[quote,relative=2,verbatim]
543 <<
544   {
545     \mergeDifferentlyHeadedOn
546     \mergeDifferentlyDottedOn
547     c8 d e d c d c4
548     \shiftOn
549     g'2 fis
550   } \\ {
551     c2 c8. b16 c4
552     e,2 r
553   } \\ {
554     \oneVoice
555     s1
556     e8 a b c d2
557   }
558
559 >>
560 @end lilypond
561
562 The @code{\shiftOn}, @code{\shiftOnn}, and @code{\shiftOnnn}
563 commands specify the degree to which chords of the current voice
564 should be shifted.  The outer voices (normally: voices one and
565 two) have @code{\shiftOff}, while the inner voices (three and
566 four) have @code{\shiftOn}.  @code{\shiftOnn} and
567 @code{\shiftOnnn} define further shift levels.
568
569 Notes are only merged if they have opposing stem directions (as
570 they have, for example, in voices one and two by default or when
571 the stems are explicitly set in opposite directions).
572
573
574 @predefined
575 @code{\mergeDifferentlyDottedOn},
576 @code{\mergeDifferentlyDottedOff},
577 @code{\mergeDifferentlyHeadedOn},
578 @code{\mergeDifferentlyHeadedOff}.
579
580 @code{\shiftOn},
581 @code{\shiftOnn},
582 @code{\shiftOnnn},
583 @code{\shiftOff}.
584 @endpredefined
585
586
587 @snippets
588
589 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
590 {additional-voices-to-avoid-collisions.ly}
591
592 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
593 {forcing-horizontal-shift-of-notes.ly}
594
595
596 @seealso
597 Music Glossary:
598 @rglos{polyphony}.
599
600 Learning Manual:
601 @rlearning{Multiple notes at once},
602 @rlearning{Voices contain music},
603 @rlearning{Real music example}.
604
605 Snippets:
606 @rlsr{Simultaneous notes}.
607
608 Internals Reference:
609 @rinternals{NoteColumn},
610 @rinternals{NoteCollision},
611 @rinternals{RestCollision}.
612
613
614 @knownissues
615
616 @ignore
617 @c TODO investigate! Sometimes it works, sometimes not. --FV
618 The requirements for successfully merging different note heads that
619 are at the same time differently dotted are not clear.
620 @end ignore
621
622 There is no support for chords where the same note occurs with
623 different accidentals in the same chord.  In this case, it is
624 recommended to use enharmonic transcription, or to use special
625 cluster notation (see @ref{Clusters}).
626
627
628 @node Automatic part combining
629 @unnumberedsubsubsec Automatic part combining
630
631 @cindex automatic part combining
632 @cindex part combiner
633 @cindex combining parts
634 @cindex a due part
635 @cindex solo part
636 @funindex \partcombine
637 @funindex partcombine
638
639 Automatic part combining is used to merge two parts of music onto
640 a staff.  It is aimed at typesetting orchestral scores.  When the
641 two parts are identical for a period of time, only one is shown.
642 In places where the two parts differ, they are typeset as separate
643 voices, and stem directions are set automatically.  Also, solo and
644 @notation{a due} parts are identified and marked by default.
645
646 The syntax for part combining is:
647
648 @example
649 \partcombine @var{musicexpr1} @var{musicexpr2}
650 @end example
651
652 The following example demonstrates the basic functionality of the
653 part combiner: putting parts on one staff and setting stem
654 directions and polyphony.  The same variables are used for the
655 independent parts and the combined staff.
656
657 @lilypond[quote,verbatim]
658 instrumentOne = \relative c' {
659   c4 d e f
660   R1
661   d'4 c b a
662   b4 g2 f4
663   e1
664 }
665
666 instrumentTwo = \relative g' {
667   R1
668   g4 a b c
669   d c b a
670   g f( e) d
671   e1
672 }
673
674 <<
675   \new Staff \instrumentOne
676   \new Staff \instrumentTwo
677   \new Staff \partcombine \instrumentOne \instrumentTwo
678 >>
679 @end lilypond
680
681 The notes in the third measure appear only once, although they were
682 specified in both parts.  Stem, slur, and tie directions are set
683 automatically, depending whether there is a solo or unison.  When
684 needed in polyphony situations, the first part (with context called
685 @code{one}) always gets up stems, while the second (called @code{two})
686 always gets down stems.  In solo situations, the first and second
687 parts get marked with @q{Solo} and @q{Solo II}, respectively.  The
688 unisono (@notation{a due}) parts are marked by default with the text
689 @qq{a2}.
690
691 Both arguments to @code{\partcombine} will be interpreted as
692 @code{Voice} contexts.  If using relative octaves,
693 @code{\relative} should be specified for both music expressions,
694 i.e.,
695
696 @example
697 \partcombine
698   \relative @dots{} @var{musicexpr1}
699   \relative @dots{} @var{musicexpr2}
700 @end example
701
702 @noindent
703 A @code{\relative} section that is outside of @code{\partcombine}
704 has no effect on the pitches of @var{musicexpr1} and
705 @var{musicexpr2}.
706
707 @snippets
708
709 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
710 {combining-two-parts-on-the-same-staff.ly}
711
712 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
713 {changing-partcombine-texts.ly}
714
715
716 @seealso
717 Music Glossary:
718 @rglos{a due},
719 @rglos{part}.
720
721 Notation Reference:
722 @ref{Writing parts}.
723
724 Snippets:
725 @rlsr{Simultaneous notes}.
726
727 Internals Reference:
728 @rinternals{PartCombineMusic},
729 @rinternals{Voice}.
730
731
732 @knownissues
733
734 @code{\partcombine} can only accept two voices.
735
736 When @code{printPartCombineTexts} is set, if the two voices play
737 the same notes on and off, the part combiner may typeset @code{a2}
738 more than once in a measure.
739
740 @code{\partcombine} cannot be inside @code{\times}.
741
742 @code{\partcombine} cannot be inside @code{\relative}.
743
744 Internally, the @code{\partcombine} interprets both arguments as
745 @code{Voice}s and decides when the parts can be combined.  When they have
746 different durations they cannot be combined and are given the names
747 @code{one} and @code{two}.  Consequently, if the arguments switch to
748 differently named @rinternals{Voice} contexts, the events in those will
749 be ignored.  Likewise, partcombining isn't designed to work with lyrics;
750 when one of the voices is explicitly named in order to attach lyrics to
751 it, the partcombining stops working.
752
753 @code{\partcombine} only observes onset times of notes. It cannot
754 determine whether a previously started note is playing or not, leading
755 to various problems.
756
757
758 @node Writing music in parallel
759 @unnumberedsubsubsec Writing music in parallel
760
761 @cindex writing music in parallel
762 @cindex interleaved music
763 @cindex parallel music
764 @funindex \parallelMusic
765 @funindex parallelMusic
766
767 Music for multiple parts can be interleaved in input code.  The
768 function @code{\parallelMusic} accepts a list with the names of a
769 number of variables to be created, and a musical expression.  The
770 content of alternate measures from the expression become the value
771 of the respective variables, so you can use them afterwards to
772 print the music.
773
774 @warning{Bar checks @code{|} must be used, and the measures must
775 be of the same length.}
776
777 @lilypond[quote,verbatim]
778 \parallelMusic #'(voiceA voiceB voiceC) {
779   % Bar 1
780   r8 g'16 c'' e'' g' c'' e'' r8 g'16 c'' e'' g' c'' e'' |
781   r16 e'8.~   e'4            r16 e'8.~   e'4            |
782   c'2                        c'2                        |
783
784   % Bar 2
785   r8 a'16 d'' f'' a' d'' f'' r8 a'16 d'' f'' a' d'' f'' |
786   r16 d'8.~   d'4            r16 d'8.~   d'4            |
787   c'2                        c'2                        |
788
789 }
790 \new StaffGroup <<
791   \new Staff << \voiceA \\ \voiceB >>
792   \new Staff { \clef bass \voiceC }
793 >>
794 @end lilypond
795
796 Relative mode may be used.  Note that the @code{\relative} command
797 is not used inside @code{\parallelMusic} itself.  The notes are
798 relative to the preceding note in the voice, not to the previous
799 note in the input -- in other words, relative notes for
800 @code{voiceA} ignore the notes in @code{voiceB}.
801
802 @lilypond[quote,verbatim]
803 \parallelMusic #'(voiceA voiceB voiceC) {
804   % Bar 1
805   r8 g16 c e g, c e r8 g,16 c e g, c e  |
806   r16 e8.~ e4       r16 e8.~  e4        |
807   c2                c                   |
808
809   % Bar 2
810   r8 a,16 d f a, d f r8 a,16 d f a, d f |
811   r16 d8.~  d4       r16 d8.~  d4       |
812   c2                 c                  |
813
814  }
815 \new StaffGroup <<
816   \new Staff << \relative c'' \voiceA \\ \relative c' \voiceB >>
817   \new Staff \relative c' { \clef bass \voiceC }
818 >>
819 @end lilypond
820
821 This works quite well for piano music.  This example maps four
822 consecutive measures to four variables:
823
824 @lilypond[quote,verbatim]
825 global = {
826   \key g \major
827   \time 2/4
828 }
829
830 \parallelMusic #'(voiceA voiceB voiceC voiceD) {
831   % Bar 1
832   a8    b     c   d     |
833   d4          e         |
834   c16 d e fis d e fis g |
835   a4          a         |
836
837   % Bar 2
838   e8      fis  g     a   |
839   fis4         g         |
840   e16 fis g  a fis g a b |
841   a4           a         |
842
843   % Bar 3 ...
844 }
845
846 \score {
847   \new PianoStaff <<
848      \new Staff {
849        \global
850        <<
851          \relative c'' \voiceA
852          \\
853          \relative c'  \voiceB
854        >>
855      }
856      \new Staff {
857        \global \clef bass
858        <<
859          \relative c \voiceC
860          \\
861          \relative c \voiceD
862        >>
863      }
864   >>
865 }
866 @end lilypond
867
868
869 @seealso
870 Learning Manual:
871 @rlearning{Organizing pieces with variables}.
872
873 Snippets:
874 @rlsr{Simultaneous notes}.