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