[icon]

GNU LilyPond

-- --

What is LilyPond
Home
Examples
Templates
Download
GNU/Linux binaries
Windows binaries
Source code
Documentation
Tutorial
Manual
Glossary
Index

Support
Mailing lists
Search
WikiWiki

External sites
lilypond.org/stable
lilypond.org/development
savannah.gnu.org
ftp.lilypond.org
Mutopia
Other music online

Polyphony

The easiest way to enter such fragments with more than one voice on a staff is to split chords using the separator \\. You can use it for small, short-lived voices (make a chord of voices) or for single chords:

     \context Voice = VA \relative c'' {
      c4 < { f d e  } \\ { b c2 } > c4 < g' \\ b, \\  f \\ d >
     }
     
[picture of music]

The separator causes Voice contexts to be instantiated, bearing the names "1", "2", etc.

Sometimes, it is necessary to instantiate these contexts by hand: For Instantiate a separate Voice context for each part, and use \voiceOne, up to \voiceFour to assign a stem directions and horizontal shift for each part.

     \relative c''
     \context Staff < \context Voice = VA { \voiceOne cis2 b  }
       \context Voice = VB { \voiceThree b4 ais ~ ais4 gis4 }
       \context Voice = VC { \voiceTwo fis4~  fis4 f ~ f  } >
     
[picture of music]

The identifiers \voiceOne to \voiceFour set directions ties, slurs and stems, and set shift directions.

If you want more than four voices, you can also manually set horizontal shifts and stem directions, as is shown in the following example:

       \context Staff \notes\relative c''<
            \context Voice=one {
            \shiftOff \stemUp e4
            }
            \context Voice=two {
               \shiftOn \stemUp cis
            }
            \context Voice=three {
              \shiftOnn \stemUp ais
            }
            \context Voice=four {
               \shiftOnnn \stemUp fis
            }
       >
     
[picture of music]

Normally, note heads with a different number of dots are not merged, but if you set the object property merge-differently-dotted, they are:

     \context Voice < {
          g'8 g'8
          \property Staff.NoteCollision \override
             #'merge-differently-dotted = ##t
          g'8 g'8
       } \\ { [g'8. f16] [g'8. f'16] }
       >
     
[picture of music]

Similarly, you can merge half note heads with eighth notes, by setting merge-differently-headed:

     \context Voice < {
         c8 c4.
         \property Staff.NoteCollision
           \override #'merge-differently-headed = ##t
         c8 c4. } \\ { c2 c2 } >
     
[picture of music]

LilyPond also vertically shifts rests that are opposite of a stem.

     \context Voice < c''4 \\  r4 >
     
[picture of music]

See also NoteCollision and RestCollision

BUGS

Resolving collisions is a very intricate subject, and LilyPond only handles a few situations. When it can not cope, you are advised to use force-hshift of the NoteColumn object and pitched rests to override typesetting decisions.

Go back to index of LilyPond.

Please send GNU LilyPond questions and comments to lilypond-user@gnu.org.

Please send comments on these web pages to (address unknown)

Copyright (c) 1997--2002 Han-Wen Nienhuys and Jan Nieuwenhuizen.

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.


This page was built from LilyPond-1.7.14 (development-branch) by

Buchan Milne <(address unknown)>, Thu Mar 6 21:11:35 2003 CET.