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


Collision resolution

The note heads of notes in different voices with the same pitch, same note head and opposite stem direction are automatically merged, but notes with different note heads or the same stem direction are not. Rests opposite a stem in a different voice 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]

Notes 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 half note and eighth note at the start of the second measure are incorrectly merged because \mergeDifferentlyHeadedOn cannot successfully complete the merge when three or more notes line up in the same column, and in this case a warning is given. To allow the merge to work properly a \shift must be applied to the note that should not be merged. Here, \shiftOn is applied to move the top g out of the column, and \mergeDifferentlyHeadedOn then 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 (e.g. 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 following syntax can be used to override typesetting decisions. The units of measure 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.

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).

Other languages: français, español, deutsch.