<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- header_tag --> <html lang="en"> <head> <title>Explicitly instantiating voices - GNU LilyPond Learning Manual</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="description" content="GNU LilyPond Learning Manual"> <meta name="generator" content="makeinfo 4.11"> <link title="Top" rel="start" href="index.de.html#Top"> <link rel="up" href="Voices-contain-music.de.html#Voices-contain-music" title="Voices contain music"> <link rel="prev" href="I_0027m-hearing-Voices.de.html#I_0027m-hearing-Voices" title="I'm hearing Voices"> <link rel="next" href="Voices-and-vocals.de.html#Voices-and-vocals" title="Voices and vocals"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- Copyright (C) 1999--2007 by the authors Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections. A copy of the license is included in the section entitled ``GNU Free Documentation License''. --> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } hr { border:0; height:1; color: #000000; background-color: #000000; } /* hr { border: none; height: 1px; color: #666666; background-color: #666666; } body { border-left: 1px solid #666666; border-right: 1px solid #666666; color: #332d28; margin-right: auto; margin-left: auto; width: 60em; list-style-type: square; font-family: Arial,Helvetica,sans-serif; padding-right: 1em; padding-left: 1em; } a { border-bottom: 1px dashed #344242; text-decoration: none; color: #344242; } a:link { text-decoration: none; } a:visited { border-bottom: 1px dashed #666666; color: #666666; } a:active { border-bottom: 1px solid #00cccc; color: #00cccc; } a:hover { border-bottom: 1px solid #1d7b85; color: #1d7b85; } blockquote { border: 1px solid #cccccc; padding: 3px; width: 40em; } .node { border-left: 1px solid #666666; margin: -0.5em 0px 1em; padding: 2px 1px 0px; font-style: italic; } .node a { border: none; text-decoration: underline; font-style: normal; font-weight: bold; } .verbatim { font-family: "Courier New",Courier,monospace; } .unnumberedsubsubsec { font-size: large; color: #1d7b85; } .subsubheading { font-size: large; color: #3b220d; } .contents { border: 1px dashed #339999; margin: 3px 2em; list-style-type: square; padding-right: 1em; width: 40em; background-color: #fcfff9; } .contents a { border-bottom: 1px dashed #423d34; text-decoration: none; color: #423d34; } .contents a:visited { border-bottom: 1px dashed #666666; color: #666666; } .contents a:active { border-bottom: 1px solid #f0d86d; color: #f0d86d; } .contents a:hover { border-bottom: 1px solid #3b220d; color: #3b220d; } .menu { border-left: 1px dashed #339999; margin: 3px 2em 1em; list-style-type: square; padding-left: 1.4em; width: 40em; } .unnumbered { } h2 { font-size: x-large; color: #1d7b85; } */ --></style> </head> <BODY BGCOLOR=WHITE TEXT=BLACK> <div class="node"> <p> <a name="Explicitly-instantiating-voices"></a> Next: <a rel="next" accesskey="n" href="Voices-and-vocals.de.html#Voices-and-vocals">Voices and vocals</a>, Previous: <a rel="previous" accesskey="p" href="I_0027m-hearing-Voices.de.html#I_0027m-hearing-Voices">I'm hearing Voices</a>, Up: <a rel="up" accesskey="u" href="Voices-contain-music.de.html#Voices-contain-music">Voices contain music</a> <hr> </div> <h4 class="subsection">3.2.2 Explicitly instantiating voices</h4> <p><a name="index-g_t_005cvoiceOne-234"></a><a name="index-g_t_005cvoiceOne-235"></a> <a name="index-g_t_005cvoiceTwo-236"></a><a name="index-g_t_005cvoiceTwo-237"></a> <a name="index-g_t_005cvoiceThree-238"></a><a name="index-g_t_005cvoiceThree-239"></a> <a name="index-g_t_005cvoiceFour-240"></a><a name="index-g_t_005cvoiceFour-241"></a> <a name="index-g_t_005coneVoice-242"></a><a name="index-g_t_005coneVoice-243"></a> <a name="index-g_t_005cnew-Voice-244"></a><a name="index-g_t_005cnew-Voice-245"></a> <a name="index-Voice-contexts_002c-creating-246"></a> Voice contexts can also be created manually inside a <code><< >></code> block to create polyphonic music, using <code>\voiceOne</code> ... <code>\voiceFour</code> 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. <p>Specifically, the construct <code><< \\ >></code> which we used in the previous section: <pre class="example">\new Staff { \relative c' { << { e4 f g a } \\ { c,4 d e f } >> } } </pre> <p class="noindent">is equivalent to <pre class="example">\new Staff << \new Voice = "1" { \voiceOne \relative c' { e4 f g a } } \new Voice = "2" { \voiceTwo \relative c' { c4 d e f } } >> </pre> <p>Both of the above would produce <!-- The following example should not display the code --> <blockquote> <p> <a href="../4c/lily-357bed7c.ly"> <img align="middle" border="0" src="../4c/lily-357bed7c.png" alt="[image of music]"> </a> </p> </blockquote> <p>The <code>\voiceXXX</code> commands set the direction of stems, slurs, ties, articulations, text annotations, augmentation dots of dotted notes, and fingerings. <code>\voiceOne</code> and <code>\voiceThree</code> make these objects point upwards, while <code>\voiceTwo</code> and <code>\voiceFour</code> 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 <code>\oneVoice</code> reverts the settings back to the normal values for a single voice. <p>Let us see in some simple examples exactly what effect <code>\oneVoice</code>, <code>\voiceOne</code> and <code>voiceTwo</code> have on markup, ties, slurs, and dynamics: <blockquote> <pre class="verbatim"> \relative c'{ % Default behavior or behavior after \oneVoice c d8 ~ d e4 ( f g a ) b-> c } </pre> <p> <a href="../d0/lily-38f79816.ly"> <img align="middle" border="0" src="../d0/lily-38f79816.png" alt="[image of music]"> </a> </p> </blockquote> <blockquote> <pre class="verbatim"> \relative c'{ \voiceOne c d8 ~ d e4 ( f g a ) b-> c \oneVoice c, d8 ~ d e4 ( f g a ) b-> c } </pre> <p> <a href="../c0/lily-ed92322e.ly"> <img align="middle" border="0" src="../c0/lily-ed92322e.png" alt="[image of music]"> </a> </p> </blockquote> <blockquote> <pre class="verbatim"> \relative c'{ \voiceTwo c d8 ~ d e4 ( f g a ) b-> c \oneVoice c, d8 ~ d e4 ( f g a ) b-> c } </pre> <p> <a href="../b3/lily-b1317453.ly"> <img align="middle" border="0" src="../b3/lily-b1317453.png" alt="[image of music]"> </a> </p> </blockquote> <p>Now let's look at three 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. <p>An expression that appears directly inside a <code><< >></code> belongs to the main voice (but, note, <strong>not</strong> in a <code><< \\ >></code> 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. <blockquote> <pre class="verbatim"> \new Staff \relative c' { \voiceOneStyle % The following notes are monophonic c16^( d e f % Start simultaneous section of three voices << % Continue the main voice in parallel { g4 f e | d2 e2) } % Initiate second voice \new Voice { % Set stems, etc, down \voiceTwo r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2 } % Initiate third voice \new Voice { % Set stems, etc, up \voiceThree s2. | s4 b4 c2 } >> } </pre> <p> <a href="../c9/lily-fed6d0c5.ly"> <img align="middle" border="0" src="../c9/lily-fed6d0c5.png" alt="[image of music]"> </a> </p> </blockquote> <p><a name="index-nesting-music-expressions-247"></a><a name="index-nesting-simultaneous-constructs-248"></a> <a name="index-voices_002c-temporary-249"></a><a name="index-voices_002c-nesting-250"></a> 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: <blockquote> <pre class="verbatim"> \new Staff \relative c' { c16^( d e f << { g4 f e | d2 e2) } \new Voice { \voiceTwo r8 e4 d c8 ~ | << {c8 b16 a b8 g ~ g2} \new Voice { \voiceThree s4 b4 c2 } >> } >> } </pre> <p> <a href="../21/lily-065b5e9e.ly"> <img align="middle" border="0" src="../21/lily-065b5e9e.png" alt="[image of music]"> </a> </p> </blockquote> <p><a name="index-spacing-notes-251"></a> 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: <blockquote> <pre class="verbatim"> \new Staff \relative c' << % Initiate first voice \new Voice { \voiceOne c16^( d e f g4 f e | d2 e2) | } % Initiate second voice \new Voice { % Set stems, etc, down \voiceTwo s4 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2 | } % Initiate third voice \new Voice { % Set stems, etc, up \voiceThree s1 | s4 b4 c2 | } >> </pre> <p> <a href="../e5/lily-cc0a9f56.ly"> <img align="middle" border="0" src="../e5/lily-cc0a9f56.png" alt="[image of music]"> </a> </p> </blockquote> <h5 class="subsubheading">Note columns</h5> <p><a name="index-note-column-252"></a><a name="index-shift-commands-253"></a><a name="index-g_t_005cshiftOff-254"></a><a name="index-g_t_005cshiftOff-255"></a> <a name="index-g_t_005cshiftOn-256"></a><a name="index-g_t_005cshiftOn-257"></a> <a name="index-g_t_005cshiftOnn-258"></a><a name="index-g_t_005cshiftOnn-259"></a> <a name="index-g_t_005cshiftOnnn-260"></a><a name="index-g_t_005cshiftOnnn-261"></a> <p>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. <p>The <code>\shiftOn</code>, <code>\shiftOnn</code>, <code>\shiftOnnn</code>, and <code>\shiftOff</code> 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 <code>\shiftOff</code> specified, while the inner voices (three and four) have <code>\shiftOn</code> specified. When a shift is applied, Voices one and three are shifted to the right and voices two and four to the left. <p><code>\shiftOnn</code> and <code>\shiftOnnn</code> define further shift levels which may be specified temporarily to resolve collisions in complex situations – see <a href="Real-music-example.de.html#Real-music-example">Real music example</a>. <p>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 “Too many clashing note columns” will be produced. <p class="noindent"> <h5 class="subsubheading">See also</h5> <p class="indent"> <p>Notation Reference: <a name="index-Multiple-voices-262"></a><a href="../lilypond/Multiple-voices.de.html#Multiple-voices">Multiple voices</a>. <!-- footer_tag --><br><hr> <div class="node"> <p> Next: <a rel="next" accesskey="n" href="Voices-and-vocals.de.html#Voices-and-vocals">Voices and vocals</a>, Previous: <a rel="previous" accesskey="p" href="I_0027m-hearing-Voices.de.html#I_0027m-hearing-Voices">I'm hearing Voices</a>, Up: <a rel="up" accesskey="u" href="Voices-contain-music.de.html#Voices-contain-music">Voices contain music</a> </div> <div style="background-color: #e8ffe8; padding: 2; border: #c0ffc0 1px solid;"> <p> <font size="-1"> Diese Seite ist für LilyPond-2.11.57 (Entwicklungszweig). <br> <address> Fehler bitte an <a href="http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs">http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs</a> melden. </address> <br> Ihre <a href="http://lilypond.org/web/devel/participating/documentation-adding">Vorschläge für die Dokumentation</a> sind willkommen. </font> </p> </div> <P> Andere Sprachen: <a href="Explicitly-instantiating-voices.fr.html">français</a>, <a href="Explicitly-instantiating-voices.es.html">español</a>. <BR> </P> </BODY></html>