Next: , Previous: Voice styles, Up: Multiple voices


Collision resolution

Note heads with equal durations are automatically merged, while note heads with unequal durations are not merged. Rests opposite a stem are shifted vertically.

     
     <<
       {
         c8 d e d c d c4
         g'2 fis
       } \\ {
         c2 c8. b16 c4
         e,2 r
       } \\ {
         \oneVoice
         s1
         e8 a b c d2
       }
     >>

[image of music]

Note heads with different note heads may be merged, with the exception of half-note heads and quarter-note heads:

     
     <<
       {
         \mergeDifferentlyHeadedOn
         c8 d e d c d c4
         g'2 fis
       } \\ {
         c2 c8. b16 c4
         e,2 r
       } \\ {
         \oneVoice
         s1
         e8 a b c d2
       }
     >>

[image of music]

Note heads with different dots may be merged:

     
     <<
       {
         \mergeDifferentlyHeadedOn
         \mergeDifferentlyDottedOn
         c8 d e d c d c4
         g'2 fis
       } \\ {
         c2 c8. b16 c4
         e,2 r
       } \\ {
         \oneVoice
         s1
         e8 a b c d2
       }
     >>

[image of music]

The collision on the second measure happens because \mergeDifferentlyHeadedOn cannot successfully complete the merge when three or more notes line up in the same column – in fact, you will obtain a warning for this reason. To allow the merge to work properly, apply a \shift to the note that should not be merged. Here, \shiftOn is applied to move the top g out of the column, and \mergeDifferentlyHeadedOn works properly.

     
     <<
       {
         \mergeDifferentlyHeadedOn
         \mergeDifferentlyDottedOn
         c8 d e d c d c4
         \shiftOn
         g'2 fis
       } \\ {
         c2 c8. b16 c4
         e,2 r
       } \\ {
         \oneVoice
         s1
         e8 a b c d2
       }
     
     >>

[image of music]

The \shiftOn, \shiftOnn, and \shiftOnnn commands specify the degree to which chords of the current voice should be shifted. The outer voices (normally: voices one and two) have \shiftOff, while the inner voices (three and four) have \shiftOn. \shiftOnn and \shiftOnnn define further shift levels.

Notes are only merged if they have opposing stem directions (i.e., in Voice 1 and 2).

Predefined commands

\mergeDifferentlyDottedOn, \mergeDifferentlyDottedOff, \mergeDifferentlyHeadedOn, \mergeDifferentlyHeadedOff.

\shiftOn, \shiftOnn, \shiftOnnn, \shiftOff.

Selected Snippets

Additional voices to avoid collisions

In some instances of complex polyphonic music, additional voices are necessary to prevent collisions between notes. If more than four parallel voices are needed, additional voices can be added by defining a variable using the Scheme function context-spec-music.

     
     voiceFive = #(context-spec-music (make-voice-props-set 4) 'Voice)
     \relative c'' {
       \time 3/4 \key d \minor \partial 2
       <<
         { \voiceOne
           a4. a8
           e'4 e4. e8
           f4 d4. c8
         } \\ {
           \voiceThree
           f,2
           bes4 a2
           a4 s2
         } \\ {
           \voiceFive
           s2
           g4 g2
           f4 f2
         } \\ {
           \voiceTwo
           d2
           d4 cis2
           d4 bes2
         }
       >>
     }

[image of music]

Forcing horizontal shift of notes

When the typesetting engine cannot cope, the force-hshift property of the NoteColumn object can be used to override typesetting decisions. The measure units used here are staff spaces.

     
     \relative c' <<
       {
         <d g>2 <d g>
       }
       \\
       { <b f'>2
         \once \override NoteColumn #'force-hshift = #1.7
         <b f'>2
       }
     >>

[image of music]

See also

Music Glossary: polyphony.

Learning Manual: Multiple notes at once, Voices contain music, Collisions of objects.

Snippets: Simultaneous notes.

Internals Reference: NoteColumn, NoteCollision, RestCollision.

Known issues and warnings

When using \mergeDifferentlyHeadedOn with an upstem eighth or a shorter note, and a downstem half note, the eighth note stem gets a slightly wrong offset because of the different width of the half note head symbol.

The requirements for successfully merging different note heads that are at the same time differently dotted are not clear.

There is no support for chords where the same note occurs with different accidentals in the same chord. In this case, it is recommended to use enharmonic transcription, or to use special cluster notation (see Clusters).

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, deutsch.