Next: , Previous: Basic polyphony, Up: Polyphony


6.3.4 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
     }

[image of music]

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
     }

[image of music]

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
     }

[image of music]

In some instances of complex polyphonic music, you may need additional voices to avoid collisions between notes. Additional voices are added by defining an identifier, as shown below:

     
     voiceFive = #(context-spec-music (make-voice-props-set 4) 'Voice)
     
     \relative c''' <<
       { \voiceOne g4 ~  \stemDown g32[ f( es d c b a b64 )g] } \\
       { \voiceThree  b4} \\
       { \voiceFive d,} \\
       { \voiceTwo g,}
     >>

[image of music]



Next: , Previous: Basic polyphony, Up: Polyphony

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

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

Other languages: French.