| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Singers need voices to sing, and so does LilyPond. The actual music for all instruments in a score is contained in Voices – the most fundamental of all LilyPond’s concepts.
| 3.2.1 I’m hearing Voices | ||
| 3.2.2 Explicitly instantiating voices | ||
| 3.2.3 Voices and vocals |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The lowest, most fundamental or innermost layers in a LilyPond score are called ‘Voice contexts’ or just ‘Voices’ for short. Voices are sometimes called ‘layers’ in other notation packages.
In fact, a Voice layer or context is the only one which can contain music. If a Voice context is not explicitly declared one is created automatically, as we saw at the beginning of this chapter. Some instruments such as an Oboe can play only one note at a time. Music written for such instruments requires just a single voice. Instruments which can play more than one note at a time like the piano will often require multiple voices to encode the different concurrent notes and rhythms they are capable of playing.
A single voice can contain many notes in a chord, of course, so when exactly are multiple voices needed? Look first at this example of four chords:
\relative { \key g \major <d' g>4 <d fis> <d a'> <d g> }
This can be expressed using just the single angle bracket chord
symbols, < … >, and for this just a single voice is
needed. But suppose the F-sharp were actually an eighth-note
followed by an eighth-note G, a passing note on the way to the A?
Now we have two notes which start at the same time but have
different durations: the quarter-note D and the eighth-note
F-sharp. How are these to be coded? They cannot be written as
a chord because all the notes in a chord must have the same
duration. And they cannot be written as two sequential notes
as they need to start at the same time. This is when two
voices are required.
Let us see how this is done in LilyPond input syntax.
The easiest way to enter fragments with more than one voice on a
staff is to enter each voice as a sequence (with { … }),
and combine them simultaneously with angle brackets, << … >>.
The fragments must also be separated with double backward slashes,
\\, to place them in separate voices. Without these, the
notes would be entered into a single voice, which would usually
cause errors. This technique is particularly suited to pieces of
music which are largely homophonic with occasional short sections
of polyphony.
Here’s how we split the chords above into two voices and add both the passing note and a slur:
\relative { \key g \major % Voice = "1" Voice = "2" << { g'4 fis8( g) a4 g } \\ { d4 d d d } >> }
Notice how the stems of the second voice now point down.
Here’s another simple example:
\relative { \key d \minor % Voice = "1" Voice = "2" << { r4 g' g4. a8 } \\ { d,2 d4 g } >> | << { bes4 bes c bes } \\ { g4 g g8( a) g4 } >> | << { a2. r4 } \\ { fis2. s4 } >> | }
It is not necessary to use a separate << \\ >> construct
for each bar. For music with few notes in each bar this layout
can help the legibility of the code, but if there are many
notes in each bar it may be better to split out each voice
separately, like this:
<< \key d \minor \relative { % Voice = "1" r4 g' g4. a8 | bes4 bes c bes | a2. r4 | } \\ \relative { % Voice = "2" d'2 d4 g | g4 g g8( a) g4 | fis2. s4 | } >>
This example has just two voices, but the same construct may be used to encode three or more voices by adding more back-slash separators.
The Voice contexts bear the names "1", "2", etc.
The first contexts set the outer voices, the highest
voice in context "1" and the lowest voice in context
"2". The inner voices go in contexts "3" and
"4". In each of these contexts, the vertical direction
of slurs, stems, ties, dynamics etc., is set appropriately.
\new Staff \relative { % Main voice c'16 d e f % Voice = "1" Voice = "2" Voice = "3" << { g4 f e } \\ { r8 e4 d c8~ } >> | << { d2 e } \\ { c8 b16 a b8 g~ 2 } \\ { s4 b c2 } >> | }
If you prefer entering the voices in a different order, like top
to bottom, you can specify the respective voice numbers in front
of one << … >> construct using the \voices
command, like
\new Staff \relative { % Main voice c'16 d e f % Voice = "1" Voice = "2" << { g4 f e } \\ { r8 e4 d c8~ } >> | \voices 1,3,2 % Voice = "1" Voice = "3" Voice = "2" << { d2 e } \\ { s4 b c2 } \\ { c8 b16 a b8 g~ 2 } >> | }
These voices are all separate from the main voice that contains
the notes just outside the << … >> construct. Let’s call
this the simultaneous construct. Slurs and ties may only
connect notes within the same voice, so slurs and ties cannot go
into or out of a simultaneous construct. Conversely,
parallel voices from separate simultaneous constructs on the same
staff are the same voice. Other voice-related properties also
carry across simultaneous constructs. Here is the same example,
with different colors and note heads for each voice. Note that
changes in one voice do not affect other voices, but they do
persist in the same voice later. Note also that tied notes may be
split across the same voices in two constructs, shown here in the
blue triangle voice.
\new Staff \relative { % Main voice c'16 d e f << % Bar 1 { \voiceOneStyle g4 f e } \\ { \voiceTwoStyle r8 e4 d c8~ } >> | << % Bar 2 % Voice 1 continues { d2 e } \\ % Voice 2 continues { c8 b16 a b8 g~ 2 } \\ { \voiceThreeStyle s4 b c2 } >> | }
The commands \voiceXXXStyle are mainly intended for use in
educational documents such as this one. They modify the color
of the note head, the stem and the beams, and the style of the
note head, so that the voices may be easily distinguished.
Voice one is set to red diamonds, voice two to blue triangles,
voice three to green crossed circles, and voice four (not used
here) to magenta crosses; \voiceNeutralStyle (also not
used here) reverts the style back to the default.
We shall see later how commands like these may be created by the
user.
See Visibility and color of objects and
Using variables for layout adjustments.
Polyphony does not change the relationship of notes within a
\relative block. Each note is still calculated relative to
the note immediately preceding it, or to the first note of the
preceding chord. So in
\relative { noteA << < noteB noteC > \\ noteD >> noteE }
|
noteB is relative to noteA
noteC is relative to noteB, not noteA;
noteD is relative to noteB, not noteA or
noteC;
noteE is relative to noteD, not noteA.
An alternative way, which may be clearer if the notes in the
voices are widely separated, is to place a \relative
command at the start of each voice:
\relative { noteA … }
<<
\relative { < noteB noteC > … }
\\
\relative { noteD … }
>>
\relative { noteE … }
|
Let us finally analyze the voices in a more complex piece of music. Here are the notes from the first two bars of the second of Chopin’s Deux Nocturnes, Op 32. This example will be used at later stages in this and the next chapter to illustrate several techniques for producing notation, so please ignore for now anything in the underlying code which looks mysterious and concentrate just on the music and the voices – the complications will all be explained in later sections.
The direction of the stems is often used to indicate the continuity of two simultaneous melodic lines. Here the stems of the highest notes are all pointing up and the stems of the lower notes are all pointing down. This is the first indication that more than one voice is required.
But the real need for multiple voices arises when notes which start at the same time have different durations. Look at the notes which start at beat three in the first bar. The A-flat is a dotted quarter note, the F is a quarter note and the D-flat is a half note. These cannot be written as a chord as all the notes in a chord must have the same duration. Neither can they be written as sequential notes, as they must start at the same time. This section of the bar requires three voices, and the normal practice would be to write the whole bar as three voices, as shown below, where we have used different note heads and colors for the three voices. Again, the code behind this example will be explained later, so ignore anything you do not understand.
Let us try to encode this music from scratch. As we
shall see, this encounters some difficulties. We begin as
we have learnt, using the << \\ >> construct to
enter the music of the first bar in three voices:
\new Staff \relative { \key aes \major << { c''2 aes4. bes8 } \\ { <ees, c>2 des } \\ { aes'2 f4 fes } >> | <c ees aes c>1 | }
The stem directions are automatically assigned with the
odd-numbered voices taking upward stems and the even-numbered
voices downward ones. The stems for voices 1 and 2 are right,
but the stems in voice 3 should go down in this particular piece
of music. We can correct this by skipping voice three
and placing the music in voice four. This could be done by simply
adding another pair of \\, but we use the \voices
command instead (which would also allow us to enter the voices in
different order if we preferred doing that):
\new Staff \relative { \key aes \major \voices 1,2,4 % Omit Voice three << % Voice one { c''2 aes4. bes8 } \\ % Voice two { <ees, c>2 des } \\ % Voice four { aes'2 f4 fes } >> | <c ees aes c>1 | }
We see that this fixes the stem direction, but the horizontal
placement of notes is not what we want. LilyPond shifts the
inner notes when they or their stems would collide with outer
voices, but this is not appropriate for piano music. In other
situations, the shifts LilyPond applies might fail to clear
the collisions. LilyPond provides several ways to adjust the
horizontal placing of notes. We are not quite ready yet to see
how to correct this, so we shall leave this problem until a
later section — see the force-hshift property in
Fixing overlapping notation.
Note: Lyrics, spanners (such as slurs, ties, hairpins etc.) cannot be created ‘across’ voices.
Notation Reference: (notation)Multiple voices section ‘Multiple voices’ in Notation Reference.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Voice contexts can also be created manually
inside a << >> block to create polyphonic music, using
\voiceOne … \voiceFour to indicate the required
directions of stems, slurs, etc. In longer scores this method
is clearer, as it permits the voices to be separated and to be
given more descriptive names.
Specifically, the construct << \\ >> which we used in
the previous section:
\new Staff {
\relative {
<< { e'4 f g a } \\ { c,4 d e f } >>
}
}
|
is equivalent to
\new Staff <<
\new Voice = "1" { \voiceOne \relative { e'4 f g a } }
\new Voice = "2" { \voiceTwo \relative { c'4 d e f } }
>>
|
Both of the above would produce
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. These commands also
generate a horizontal shift for each voice when this is required
to avoid clashes of note heads. The command \oneVoice
reverts the settings back to the normal values for a single voice.
Let us see in some simple examples exactly what effect
\oneVoice, \voiceOne and voiceTwo have on
markup, ties, slurs, and dynamics:
\relative { % Default behavior or behavior after \oneVoice c'4 d8~ 8 e4( f | g4 a) b-> c | }
\relative { \voiceOne c'4 d8~ 8 e4( f | g4 a) b-> c | \oneVoice c,4 d8~ 8 e4( f | g4 a) b-> c | }
\relative { \voiceTwo c'4 d8~ 8 e4( f | g4 a) b-> c | \oneVoice c,4 d8~ 8 e4( f | g4 a) b-> c | }
Now let’s look at four different ways to notate the same passage of polyphonic music, each of which is advantageous in different circumstances, using the example from the previous section.
An expression that appears directly inside a << >> belongs to the
main voice (but, note, not in a << \\ >> construct).
This is useful when extra voices appear while the main voice is playing.
Here is a more correct rendition of our example. The red diamond-shaped
notes demonstrate that the main melody is now in a single voice context,
permitting a phrasing slur to be drawn over them.
\new Staff \relative { \voiceOneStyle % This section is homophonic c'16^( d e f % Start simultaneous section of three voices << % Continue the main voice in parallel { g4 f e | d2 e) | } % Initiate second voice \new Voice { % Set stems, etc., down \voiceTwo r8 e4 d c8~ | 8 b16 a b8 g~ 2 | } % Initiate third voice \new Voice { % Set stems, etc, up \voiceThree s2. | s4 b c2 | } >> }
The \voices command can also be used for continuing a main
voice into the simultaneous construct:
\new Staff \relative { \new Voice = "main" { \voiceOneStyle % This section is homophonic c'16^( d e f % Start simultaneous section of three voices \voices "main",2,3 << % Continue the main voice in parallel { g4 f e | d2 e) | } % Initiate second voice \\ % Set stems, etc., down { r8 e4 d c8~ | 8 b16 a b8 g~ 2 | } \\ % Initiate third voice % Set stems, etc, up { s2. | s4 b c2 | } >> } }
More deeply nested polyphony constructs are possible, and if a voice appears only briefly this might be a more natural way to typeset the music:
\new Staff \relative { c'16^( d e f << { g4 f e | d2 e) | } \new Voice { \voiceTwo r8 e4 d c8~ | << { c8 b16 a b8 g~ 2 | } \new Voice { \voiceThree s4 b c2 | } >> } >> }
This method of nesting new voices briefly is useful when only small sections of the music are polyphonic, but when the whole staff is largely polyphonic it can be clearer to use multiple voices throughout, using spacing notes to step over sections where the voice is silent, as here:
\new Staff \relative << % Initiate first voice \new Voice { \voiceOne c'16^( d e f g4 f e | d2 e) | } % Initiate second voice \new Voice { % Set stems, etc, down \voiceTwo s4 r8 e4 d c8~ | 8 b16 a b8 g~ 2 | } % Initiate third voice \new Voice { % Set stems, etc, up \voiceThree s1 | s4 b c2 | } >>
Closely spaced notes in a chord, or notes occurring at the same time in different voices, are arranged in two, occasionally more, columns to prevent the note heads overlapping. These are called note columns. There are separate columns for each voice, and the currently specified voice-dependent shift is applied to the note column if there would otherwise be a collision. This can be seen in the example above. In bar 2 the C in voice two is shifted to the right relative to the D in voice one, and in the final chord the C in voice three is also shifted to the right relative to the other notes.
The \shiftOn, \shiftOnn, \shiftOnnn, and
\shiftOff commands specify the degree to which notes and
chords of the voice should be shifted if a collision
would otherwise occur. By default, the outer voices (normally
voices one and two) have \shiftOff specified, while the
inner voices (three and four) have \shiftOn specified.
When a shift is applied, voices one and three are shifted to
the right and voices two and four to the left.
\shiftOnn and \shiftOnnn define further shift
levels which may be specified temporarily to resolve collisions
in complex situations – see Real music example.
A note column can contain just one note (or chord) from a voice
with stems up and one note (or chord) from a voice with stems
down. If notes from two voices which have their stems in the
same direction are placed at the same position and both voices
have no shift or the same shift specified, the error message
“This voice needs a \voiceXx or \shiftXx setting”
will be produced.
Learning Manual: Moving objects.
Notation Reference: (notation)Multiple voices section ‘Multiple voices’ in Notation Reference.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Vocal music presents a special difficulty: we need to combine two expressions – notes and lyrics.
You have already seen the \addlyrics{} command, which
handles simple scores well. However, this technique is
quite limited. For more complex music, you must introduce the
lyrics in a Lyrics context using \new Lyrics and
explicitly link
the lyrics to the notes with \lyricsto{}, using the
name assigned to the Voice.
<< \new Voice = "one" { \relative { \autoBeamOff \time 2/4 c''4 b8. a16 | g4. f8 | e4 d | c2 | } } \new Lyrics \lyricsto "one" { No more let | sins and | sor -- rows | grow. | } >>
Note that the lyrics must be linked to a Voice context,
not a Staff context. This is a case where it is
necessary to create Staff and Voice contexts
explicitly.
The automatic beaming which LilyPond uses by default works well
for instrumental music, but not so well for music with lyrics,
where beaming is either not required at all or is used to indicate
melismata in the lyrics. In the example above we use the command
\autoBeamOff to turn off the automatic beaming.
Let us reuse the earlier example from Judas Maccabæus to
illustrate this more flexible technique. We first recast
it to use variables so the music and lyrics can be separated
from the staff structure. We also introduce a ChoirStaff
bracket. The lyrics themselves must be introduced with
\lyricmode to ensure they are interpreted as lyrics
rather than music.
global = { \key f \major \time 6/8 \partial 8 } SopOneMusic = \relative { c''8 | c8([ bes)] a a([ g)] f | f'4. b, | c4.~ 4 } SopOneLyrics = \lyricmode { Let | flee -- cy flocks the | hills a -- dorn, __ } SopTwoMusic = \relative { r8 | r4. r4 c'8 | a'8([ g)] f f([ e)] d | e8([ d)] c bes' } SopTwoLyrics = \lyricmode { Let | flee -- cy flocks the | hills a -- dorn, } \score { \new ChoirStaff << \new Staff << \new Voice = "SopOne" { \global \SopOneMusic } \new Lyrics \lyricsto "SopOne" { \SopOneLyrics } >> \new Staff << \new Voice = "SopTwo" { \global \SopTwoMusic } \new Lyrics \lyricsto "SopTwo" { \SopTwoLyrics } >> >> }
This is the basic structure of all vocal scores. More staves may be added as required, more voices may be added to the staves, more verses may be added to the lyrics, and the variables containing the music can easily be placed in separate files should they become too long.
Here is an example of the first line of a hymn with four verses, set for SATB. In this case the words for all four parts are the same. Note how we use variables to separate the music notation and words from the staff structure. See too how a variable, which we have chosen to call ‘keyTime’, is used to hold several commands for use within the two staves. In other examples this is often called ‘global’.
keyTime = { \key c \major \time 4/4 \partial 4 } SopMusic = \relative { c'4 | e4. e8 g4 g | a4 a g } AltoMusic = \relative { c'4 | c4. c8 e4 e | f4 f e } TenorMusic = \relative { e4 | g4. g8 c4. b8 | a8 b c d e4 } BassMusic = \relative { c4 | c4. c8 c4 c | f8 g a b c4 } VerseOne = \lyricmode { E -- | ter -- nal fa -- ther, | strong to save, } VerseTwo = \lyricmode { O | Christ, whose voice the | wa -- ters heard, } VerseThree = \lyricmode { O | Ho -- ly Spi -- rit, | who didst brood } VerseFour = \lyricmode { O | Tri -- ni -- ty of | love and pow'r } \score { \new ChoirStaff << \new Staff << \clef "treble" \new Voice = "Sop" { \voiceOne \keyTime \SopMusic } \new Voice = "Alto" { \voiceTwo \AltoMusic } \new Lyrics \lyricsto "Sop" { \VerseOne } \new Lyrics \lyricsto "Sop" { \VerseTwo } \new Lyrics \lyricsto "Sop" { \VerseThree } \new Lyrics \lyricsto "Sop" { \VerseFour } >> \new Staff << \clef "bass" \new Voice = "Tenor" { \voiceOne \keyTime \TenorMusic } \new Voice = "Bass" { \voiceTwo \BassMusic } >> >> }
Notation Reference: (notation)Vocal music section ‘Vocal music’ in Notation Reference.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by gub on July 13, 2020 using texi2html 1.82.
Other languages: català, česky, deutsch, español, français, magyar, italiano, 日本語, nederlands.
About automatic language selection.