Explicitly instantiating voices - GNU LilyPond
Description: GNU LilyPond

Next: Collision Resolution, Previous: Basic polyphony, Up: Polyphony

#### 6.6.2 Explicitly instantiating voices

Voice contexts can also be instantiated manually inside a `<< >>` block to create polyphonic music, using `\voiceOne`, up to `\voiceFour` to assign stem directions and a horizontal shift for each part.

Specifically,

    << \upper \\ \lower >>

is equivalent to

    <<
      \new Voice = "1" { \voiceOne \upper }
      \new Voice = "2" { \voiceTwo \lower }
    >>

The `\voiceXXX` commands set the direction of stems, slurs, ties, articulations, text annotations, augmentation dots of dotted notes, and fingerings. `\voiceOne` and `\voiceThree` make these objects point upwards, while `\voiceTwo` and `\voiceFour` make them point downwards. The command `\oneVoice` will revert back to the normal setting.

An expression that appears directly inside a `<< >>` belongs to the main voice. This is useful when extra voices appear while the main voice is playing. Here is a more correct rendition of the example from the previous section. The crossed noteheads demonstrate that the main melody is now in a single voice context.

>          \new Staff \relative c' {
>            \override NoteHead #'style = #'cross
>            c16 d e f
>            \voiceOne
>            <<
>              { g4 f e | d2 e2 }
>              \new Voice="1" { \voiceTwo
>                r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
>                \oneVoice
>              }
>              \new Voice { \voiceThree
>                s2. | s4 b4 c2
>                \oneVoice
>              }
>            >>
>            \oneVoice
>          }

The correct definition of the voices allows the melody to be slurred.

>          \new Staff \relative c' {
>            c16^( d e f
>            \voiceOne
>            <<
>              { g4 f e | d2 e2) }
>              \context Voice="1" { \voiceTwo
>                r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
>                \oneVoice
>              }
>              \new Voice { \voiceThree
>                s2. s4 b4 c2
>                \oneVoice
>              }
>            >>
>            \oneVoice
>          }

Avoiding the `\\` separator also allows nesting polyphony constructs, which in some case might be a more natural way to typeset the music.

>          \new Staff \relative c' {
>            c16^( d e f
>            \voiceOne
>            <<
>              { g4 f e | d2 e2) }
>              \context Voice="1" { \voiceTwo
>                r8 e4 d c8 ~ |
>                <<
>                  {c8 b16 a b8 g ~ g2}
>                  \new Voice { \voiceThree
>                    s4 b4 c2
>                    \oneVoice
>                  }
>                >>
>              \oneVoice
>              }
>            >>
>            \oneVoice
>          }

This page is for LilyPond-2.8.8 (stable-branch).

Other languages: English.
Using automatic language selection.