3.2.1 Hangzatos szólamok

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 is monophonic and 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:

\key g \major
<d g>4 <d fis> <d a'> <d g>

[image of music]

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 monophonic 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:

\key g \major
%    Voice "1"                  Voice "2"
<< { g4 fis8( g) a4 g }  \\  { d4 d d d }  >>

[image of music]

Notice how the stems of the second voice now point down.

Here’s another simple example:

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

[image of music]

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
<< {
  % Voice "1"
  r4 g g4. a8 |
  bes4 bes c bes |
  a2. r4 |
} \\ {
  % Voice "2"
  d,2 d4 g |
  g4 g g8( a) g4 |
  fis2. s4 |
} >>

[image of music]

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. In each of these contexts, the vertical direction of slurs, stems, ties, dynamics etc., is set appropriately.

\new Staff \relative c' {
  % Main voice
  c16 d e f
  %    Voice "1"     Voice "2"                 Voice "3"
  << { g4 f e } \\ { r8 e4 d c8~ } >>
  << { d2 e2 }  \\ { c8 b16 a b8 g~ g2 } \\ { s4 b4 c2 } >>
}

[image of music]

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 c' {
  % Main voice
  c16 d e f
  <<  % Bar 1
    {
      \voiceOneStyle
      g4 f e
    }
  \\
    {
      \voiceTwoStyle
      r8 e4 d c8~
    }
  >>
  <<  % Bar 2
     % Voice 1 continues
    { d2 e2 }
  \\
     % Voice 2 continues
    { c8 b16 a b8 g ~ g2 }
  \\
    {
      \voiceThreeStyle
      s4 b4 c2
    }
  >>
}

[image of music]

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 Objektumok láthatósága és színe and Változók felhasználása a finomhangoláshoz.

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 c' { 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 c' { noteA ... }
<<
  \relative c'' { < noteB noteC > ... }
\\
  \relative g' { noteD ... }
>>
\relative c' { 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.

[image of music]

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.

[image of music]

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 c'' {
  \key aes \major
  <<
    { c2 aes4. bes8 } \\ { aes2 f4 fes } \\ { <ees c>2 des2 }
  >>
  <c ees aes c>1
}

[image of music]

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 is done by simply adding another pair of \\.

\new Staff \relative c'' {
  \key aes \major
  <<  % Voice one
    { c2 aes4. bes8 }
  \\  % Voice two
    { aes2 f4 fes }
  \\  % Omit Voice three
  \\  % Voice four
    { <ees c>2 des2 }
  >>
  <c ees aes c>1
}

[image of music]

We see that this fixes the stem direction, but exposes a problem sometimes encountered with multiple voices – the stems of the notes in one voice can collide with the note heads in other voices. In laying out the notes, LilyPond allows the notes or chords from two voices to occupy the same vertical note column provided the stems are in opposite directions, but the notes from the third and fourth voices are displaced, if necessary, to avoid the note heads colliding. This usually works well, but in this example the notes of the lowest voice are clearly not well placed by default. 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 Egymást átfedő jelek javítása.

Lásd még

Notation Reference: Multiple voices.


Más nyelvek: English, česky, deutsch, español, français, italiano, 日本語, nederlands.
About automatic language selection.

LilyPond — Tankönyv v2.17.97 (development-branch).