Next: , Previous: Collision resolution, Up: Multiple voices


Automatic part combining

Automatic part combining is used to merge two parts of music onto a staff. It is aimed at typesetting orchestral scores. When the two parts are identical for a period of time, only one is shown. In places where the two parts differ, they are typeset as separate voices, and stem directions are set automatically. Also, solo and a due parts are identified and marked by default.

The syntax for part combining is:

\partcombine musicexpr1 musicexpr2

The following example demonstrates the basic functionality of the part combiner: putting parts on one staff and setting stem directions and polyphony. The same variables are used for the independent parts and the combined staff.

     
     instrumentOne = \relative c' {
       c4 d e f
       R1
       d'4 c b a
       b4 g2 f4
       e1
     }
     
     instrumentTwo = \relative g' {
       R1
       g4 a b c
       d c b a
       g f( e) d
       e1
     }
     
     <<
       \new Staff \instrumentOne
       \new Staff \instrumentTwo
       \new Staff \partcombine \instrumentOne \instrumentTwo
     >>

[image of music]

The notes in the third measure appear only once, although they were specified in both parts. Stem, slur, and tie directions are set automatically, depending whether there is a solo or unison. When needed in polyphony situations, the first part (with context called one) always gets up stems, while the second (called two) always gets down stems. In solo situations, the first and second parts get marked with ‘Solo’ and ‘Solo II’, respectively. The unisono (a due) parts are marked by default with the text “a2”.

Both arguments to \partcombine will be interpreted as Voice contexts. If using relative octaves, \relative should be specified for both music expressions, i.e.,

\partcombine
  \relative ... musicexpr1
  \relative ... musicexpr2

A \relative section that is outside of \partcombine has no effect on the pitches of musicexpr1 and musicexpr2.

Selected Snippets

Combining two parts on the same staff

The part combiner tool ( \partcombine command ) allows the combination of several different parts on the same staff. Text directions such as "solo" or "a2" are added by default; to remove them, simply set the property printPartCombineTexts to "false". For vocal scores (hymns), there is no need to add "solo"/"a2" texts, so they should be switched off. However, it might be better not to use it if there are any solos, as they won't be indicated. In such cases, standard polyphonic notation may be preferable.

This snippet presents the three ways two parts can be printed on a same staff: standard polyphony, \partcombine without texts, and \partcombine with texts.

     
     musicUp = \relative c'' {
       \time 4/4
       a4 c4.( g8) a4 |
       g4 e' g,( a8 b) |
       c b a2.
     }
     
     musicDown = \relative c'' {
       g4 e4.( d8) c4 |
       r2 g'4( f8 e) |
       d2 \stemDown a
     }
     
     \score {
       <<
         <<
         \new Staff {
           \set Staff.instrumentName = "Standard polyphony  "
           << \musicUp \\ \musicDown >>
         }
         \new Staff \with { printPartCombineTexts = ##f } {
           \set Staff.instrumentName = "PartCombine without texts  "
           \partcombine \musicUp \musicDown
         }
         \new Staff {
           \set Staff.instrumentName = "PartCombine with texts  "
           \partcombine \musicUp \musicDown
         }
         >>
       >>
       \layout {
         indent = 6.0\cm
         \context {
           \Score
           \override SystemStartBar #'collapse-height = #30
         }
       }
     }

[image of music]

Changing partcombine texts

When using the automatic part combining feature, the printed text for the solo and unison sections may be changed:

     
     \new Staff <<
       \set Staff.soloText = #"girl"
       \set Staff.soloIIText = #"boy"
       \set Staff.aDueText = #"together"
       \partcombine
         \relative c'' {
           g4 g r r
           a2 g
         }
         \relative c'' {
           r4 r a( b)
           a2 g
         }
     >>

[image of music]

See also

Music Glossary: a due, part.

Notation Reference: Writing parts.

Snippets: Simultaneous notes.

Internals Reference: PartCombineMusic, Voice.

Known issues and warnings

When printPartCombineTexts is set, if the two voices play the same notes on and off, the part combiner may typeset a2 more than once in a measure.

\partcombine cannot be inside \times.

\partcombine cannot be inside \relative.

Internally, the \partcombine interprets both arguments as Voices named one and two, and then decides when the parts can be combined. Consequently, if the arguments switch to differently named Voice contexts, the events in those will be ignored.

This page is for LilyPond-2.11.58 (development-branch).

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.

Your suggestions for the documentation are welcome.

Other languages: français, español.