Next: Voice styles, Up: Multiple voices
The basic structure of code needed to achieve multiple, independent voices in a single staff is illustrated in the following example:
\new Staff << \new Voice = "first" { \voiceOne r8 r16 g e8. f16 g8[ c,] f e16 d } \new Voice= "second" { \voiceTwo d16 c d8~ d16 b c8~ c16 b c8~ c16 b8. } >>
Here, voices are instantiated explicitly and are given a name. The
\voiceOne
... \voiceFour
commands set up the voices so
that first and third voices get stems up, second and fourth voices get
stems down, third and fourth voice note heads are horizontally
shifted, and rests in the respective voices are automatically moved to
avoid collisions. Using the \oneVoice
command, all the voice
settings are put back to the neutral directions typical of a
single-voice passage.
We can make a voice to be in the same Voice
context before
and after a temporary polyphonic passage. For example, the following
construct keeps a voice alive throughout the polyphonic section. Said
voice is the first one inside of the two-voice section, and the extra
voice is the second one.
<< { \voiceOne ... } \new Voice { \voiceTwo ... } >> \oneVoice
Using the name given when created, this allows lyrics to be assigned to one consistent voice.
<< \new Voice = "melody" { a4 << { \voiceOne g f } \new Voice { \voiceTwo e d } >> \oneVoice e } \new Lyrics \lyricsto "melody" { This is my song. } >>
Here, the \voiceOne
and \voiceTwo
commands help to make clear what
settings does each voice receive.
The <<{...} \\ {...}>>
construction, where the two (or
more) voices are separated by double backslashes, can be used as a
simplified method to print multiple voices in a single staff. Our
first example could be typeset as follows:
<< { r8 r16 g e8. f16 g8[ c,] f e16 d } \\ { d16 c d8~ d16 b c8~ c16 b c8~ c16 b8. } >>
This syntax is simpler and can be used where it does not matter that
temporary voices are created and then discarded. These implicitly
created voices are given the settings equivalent to the effect of the
\voiceOne
... \voiceFour
commands, in the order in which
they appear in the code. In the following example, the intermediate
voice has stems up, therefore we enter it in the third place, so it
becomes voice three which has the stems up as desired.
<< { r8 g g g g f16 es f8 d } \\ { es,8 r es r d r d r } \\ { d'8 s c s bes s a s } >>
Spacer rests are often used to avoid too many rests, as seen in the example above.
In all but simplest works it is advisable to create explicit
Voice
contexts using the \new
and \context
commands as it is explained in Contexts and engravers and
Explicitly instantiating voices.
In the special case that we want to typeset parallel pieces of music
that have the same rhythm, we can combine them into a single
Voice
context, thus forming chords. To achieve this, enclose
them in a simple simultaneous music construction and make it to be an
explicit voice:
\new Voice << { e4 f8 d e16 f g8 d4 } { c4 d8 b c16 d e8 b4 } >>
This method leads to strange beamings and warnings if the pieces of music do not have the same rhythm.
\voiceOne
,
\voiceTwo
,
\voiceThree
,
\voiceFour
,
\oneVoice
.
Learning Manual: Voices contain music, Explicitly instantiating voices.
Notation Reference: Percussion staves, Invisible rests.
Snippets: Simultaneous notes.
Cette page documente LilyPond-2.11.58 (branche de développement).
Rapportez toute anomalie en français à lilypond-user-fr@gnu.org ou en anglais à http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs
Vos suggestions à propos de la documentation sont les bienvenues.
Autres langues : español.