[ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
[ < Clusters ] | [ Up : Simultaneous notes ] | [ Single-staff polyphony > ] |
1.5.2 Multiple voices
This section discusses simultaneous notes in multiple voices or multiple staves.
Single-staff polyphony | ||
Voice styles | ||
Collision resolution | ||
Automatic part combining | ||
Writing music in parallel |
[ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
[ < Multiple voices ] | [ Up : Multiple voices ] | [ Voice styles > ] |
Single-staff polyphony
Explicitly instantiating voices
The basic structure 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 names. 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. The \oneVoice
command returns all the voice settings to the neutral default
directions.
Temporary polyphonic passages
A temporary polyphonic passage can be created with the following construct:
<< { \voiceOne ... } \new Voice { \voiceTwo ... } >> \oneVoice
Here, the first expression within a temporary polyphonic passage is
placed into the Voice
context which was in use immediately
before the polyphonic passage, and that same Voice
context
continues after the temporary section. Other expressions within
the angle brackets are assigned to distinct temporary voices.
This allows lyrics to be assigned to one continuing voice before,
during and after a polyphonic section:
<< \new Voice = "melody" { a4 << { \voiceOne g f } \new Voice { \voiceTwo d2 } >> \oneVoice e4 } \new Lyrics \lyricsto "melody" { This is my song. } >>
Here, the \voiceOne
and \voiceTwo
commands are
required to define the settings of each voice.
The double backslash construct
The << {...} \\ {...} >>
construct, where the two (or
more) expressions are separated by double backslashes, behaves
differently to the similar construct without the double backslashes:
all the expressions within this contruct are assigned
to new Voice
contexts. These new Voice
contexts
are created implicitly and are given the fixed names "1"
,
"2"
, etc.
The 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 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. Spacer rests are used to avoid printing doubled rests.
<< { r8 g g g g f16 ees f8 d } \\ { ees,8 r ees r d r d r } \\ { d'8 s c s bes s a s } >>
In all but the simplest works it is advisable to create explicit
Voice
contexts as explained in
Contexts and engravers and
Explicitly instantiating voices.
Identical rhythms
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 construct within 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.
Predefined commands
\voiceOne
,
\voiceTwo
,
\voiceThree
,
\voiceFour
,
\oneVoice
.
See also
Learning Manual: Voices contain music, Explicitly instantiating voices.
Notation Reference: Percussion staves, Invisible rests.
Snippets: Simultaneous notes.
[ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
[ < Single-staff polyphony ] | [ Up : Multiple voices ] | [ Collision resolution > ] |
Voice styles
Voices may be given distinct colors and shapes, allowing them to be easily identified:
<< { \voiceOneStyle d4 c2 b4 } \\ { \voiceTwoStyle e,2 e } \\ { \voiceThreeStyle b2. c4 } \\ { \voiceFourStyle g'2 g } >>
The \voiceNeutralstyle
command is used to revert to the
standard presentation.
Predefined commands
\voiceOneStyle
,
\voiceTwoStyle
,
\voiceThreeStyle
,
\voiceFourStyle
,
\voiceNeutralStyle
.
See also
Learning Manual: I'm hearing Voices, Other sources of information.
Snippets: Simultaneous notes.
[ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
[ < Voice styles ] | [ Up : Multiple voices ] | [ Automatic part combining > ] |
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 } >>
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 } >>
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 } >>
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 } >>
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 } >> }
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 } >>
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).
[ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
[ < Collision resolution ] | [ Up : Multiple voices ] | [ Writing music in parallel > ] |
Automatic part combining
Automatic part combining is used to merge two parts of music onto a staff. It is aimed at typesetting orchestral scores. When the two parts are identical for a period of time, only one is shown. In places where the two parts differ, they are typeset as separate voices, and stem directions are set automatically. Also, solo and a due parts are identified and marked by default.
The syntax for part combining is:
\partcombine musicexpr1 musicexpr2
The following example demonstrates the basic functionality of the part combiner: putting parts on one staff and setting stem directions and polyphony. The same variables are used for the independent parts and the combined staff.
instrumentOne = \relative c' { c4 d e f R1 d'4 c b a b4 g2 f4 e1 } instrumentTwo = \relative g' { R1 g4 a b c d c b a g f( e) d e1 } << \new Staff \instrumentOne \new Staff \instrumentTwo \new Staff \partcombine \instrumentOne \instrumentTwo >>
The notes in the third measure appear only once, although they were
specified in both parts. Stem, slur, and tie directions are set
automatically, depending whether there is a solo or unison. When
needed in polyphony situations, the first part (with context called
one
) always gets up stems, while the second (called two
)
always gets down stems. In solo situations, the first and second
parts get marked with ‘Solo’ and ‘Solo II’, respectively. The
unisono (a due) parts are marked by default with the text
“a2”.
Both arguments to \partcombine
will be interpreted as
Voice
contexts. If using relative octaves,
\relative
should be specified for both music expressions,
i.e.,
\partcombine \relative … musicexpr1 \relative … musicexpr2
A \relative
section that is outside of \partcombine
has no effect on the pitches of musicexpr1 and
musicexpr2.
Selected Snippets
Combining two parts on the same staff
The part combiner tool ( \partcombine
command ) allows the
combination of several different parts on the same staff. Text
directions such as "solo" or "a2" are added by default; to remove
them, simply set the property printPartCombineTexts
to
"false". For vocal scores (hymns), there is no need to add
"solo"/"a2" texts, so they should be switched off. However, it
might be better not to use it if there are any solos, as they won’t be
indicated. In such cases, standard polyphonic notation may be
preferable.
This snippet presents the three ways two parts can be printed on a same
staff: standard polyphony, \partcombine
without texts, and
\partcombine
with texts.
musicUp = \relative c'' { \time 4/4 a4 c4.( g8) a4 | g4 e' g,( a8 b) | c b a2. } musicDown = \relative c'' { g4 e4.( d8) c4 | r2 g'4( f8 e) | d2 \stemDown a } \score { << << \new Staff { \set Staff.instrumentName = "Standard polyphony " << \musicUp \\ \musicDown >> } \new Staff \with { printPartCombineTexts = ##f } { \set Staff.instrumentName = "PartCombine without texts " \partcombine \musicUp \musicDown } \new Staff { \set Staff.instrumentName = "PartCombine with texts " \partcombine \musicUp \musicDown } >> >> \layout { indent = 6.0\cm \context { \Score \override SystemStartBar #'collapse-height = #30 } } }
Changing partcombine texts
When using the automatic part combining feature, the printed text for the solo and unison sections may be changed:
\new Staff << \set Staff.soloText = #"girl" \set Staff.soloIIText = #"boy" \set Staff.aDueText = #"together" \partcombine \relative c'' { g4 g r r a2 g } \relative c'' { r4 r a( b) a2 g } >>
See also
Notation Reference: Writing parts.
Snippets: Simultaneous notes.
Internals Reference: PartCombineMusic, Voice.
Known issues and warnings
\partcombine
can only accept two voices.
When printPartCombineTexts
is set, if the two voices play
the same notes on and off, the part combiner may typeset a2
more than once in a measure.
\partcombine
cannot be inside \times
.
\partcombine
cannot be inside \relative
.
Internally, the \partcombine
interprets both arguments as
Voice
s and decides when the parts can be combined. When they have
different durations they cannot be combined and are given the names
one
and two
. Consequently, if the arguments switch to
differently named
Voice contexts, the events in those will
be ignored. Likewise, partcombining isn’t designed to work with lyrics;
when one of the voices is explicitly named in order to attach lyrics to
it, the partcombining stops working.
\partcombine
only observes onset times of notes. It cannot
determine whether a previously started note is playing or not, leading
to various problems.
[ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
[ < Automatic part combining ] | [ Up : Multiple voices ] | [ Staff notation > ] |
Writing music in parallel
Music for multiple parts can be interleaved in input code. The
function \parallelMusic
accepts a list with the names of a
number of variables to be created, and a musical expression. The
content of alternate measures from the expression become the value
of the respective variables, so you can use them afterwards to
print the music.
Note: Bar checks |
\parallelMusic #'(voiceA voiceB voiceC) { % Bar 1 r8 g'16 c'' e'' g' c'' e'' r8 g'16 c'' e'' g' c'' e'' | r16 e'8.~ e'4 r16 e'8.~ e'4 | c'2 c'2 | % Bar 2 r8 a'16 d'' f'' a' d'' f'' r8 a'16 d'' f'' a' d'' f'' | r16 d'8.~ d'4 r16 d'8.~ d'4 | c'2 c'2 | } \new StaffGroup << \new Staff << \voiceA \\ \voiceB >> \new Staff { \clef bass \voiceC } >>
Relative mode may be used. Note that the \relative
command
is not used inside \parallelMusic
itself. The notes are
relative to the preceding note in the voice, not to the previous
note in the input – in other words, relative notes for
voiceA
ignore the notes in voiceB
.
\parallelMusic #'(voiceA voiceB voiceC) { % Bar 1 r8 g16 c e g, c e r8 g,16 c e g, c e | r16 e8.~ e4 r16 e8.~ e4 | c2 c | % Bar 2 r8 a,16 d f a, d f r8 a,16 d f a, d f | r16 d8.~ d4 r16 d8.~ d4 | c2 c | } \new StaffGroup << \new Staff << \relative c'' \voiceA \\ \relative c' \voiceB >> \new Staff \relative c' { \clef bass \voiceC } >>
This works quite well for piano music. This example maps four consecutive measures to four variables:
global = { \key g \major \time 2/4 } \parallelMusic #'(voiceA voiceB voiceC voiceD) { % Bar 1 a8 b c d | d4 e | c16 d e fis d e fis g | a4 a | % Bar 2 e8 fis g a | fis4 g | e16 fis g a fis g a b | a4 a | % Bar 3 ... } \score { \new PianoStaff << \new Staff { \global << \relative c'' \voiceA \\ \relative c' \voiceB >> } \new Staff { \global \clef bass << \relative c \voiceC \\ \relative c \voiceD >> } >> }
See also
Learning Manual: Organizing pieces with variables.
Snippets: Simultaneous notes.
[ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
[ < Automatic part combining ] | [ Up : Multiple voices ] | [ Staff notation > ] |