<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- header_tag --> <html lang="en"> <head> <title>Real music example - 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="Collisions-of-objects.de.html#Collisions-of-objects" title="Collisions of objects"> <link rel="prev" href="Fixing-overlapping-notation.de.html#Fixing-overlapping-notation" title="Fixing overlapping notation"> <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="Real-music-example"></a> Previous: <a rel="previous" accesskey="p" href="Fixing-overlapping-notation.de.html#Fixing-overlapping-notation">Fixing overlapping notation</a>, Up: <a rel="up" accesskey="u" href="Collisions-of-objects.de.html#Collisions-of-objects">Collisions of objects</a> <hr> </div> <h4 class="subsection">4.5.3 Real music example</h4> <p>We end this section on Tweaks by showing the steps to be taken to deal with a tricky example which needs several tweaks to produce the desired output. The example has been deliberately chosen to illustrate the use of the Notation Reference to resolve unusual problems with notation. It is not representative of more usual engraving process, so please do not let these difficulties put you off! Fortunately, difficulties like these are not very common! <p>The example is from Chopin's Première Ballade, Op. 23, bars 6 to 9, the transition from the opening Lento to Moderato. Here, first, is what we want the output to look like, but to avoid over-complicating the example too much we have left out the dynamics, fingering and pedalling. <!-- The following should appear as music without code --> <blockquote> <p> <a href="../1f/lily-5338b47c.ly"> <img align="middle" border="0" src="../1f/lily-5338b47c.png" alt="[image of music]"> </a> </p> </blockquote> <p>We note first that the right hand part in the third bar requires four voices. These are the five beamed eighth notes, the tied C, the half-note D which is merged with the eighth note D, and the dotted quarter note F-sharp, which is also merged with the eighth note at the same pitch. Everything else is in a single voice, so the easiest way is to introduce these four voices temporarily at the time they are needed. If you have forgotten how to do this, look at <a href="I_0027m-hearing-Voices.de.html#I_0027m-hearing-Voices">I'm hearing Voices</a>. Let us begin by entering the notes as two variables and setting up the staff structure in a score block, and see what LilyPond produces by default: <blockquote> <pre class="verbatim"> rhMusic = \relative c'' { r2 c4. g8 | bes1~ | \time 6/4 bes2. r8 % Start polyphonic section of four voices << {c,8 d fis bes a | } \\ {c,8~ c2 | } \\ {s8 d2 | } \\ {s4 fis4. | } >> g2. } lhMusic = \relative c' { r2 <c g ees>2 | <d g, d>1 | r2. d,,4 r4 r | r4 } \score { \new PianoStaff << \new Staff = "RH" << \key g \minor \rhMusic >> \new Staff = "LH" << \key g \minor \clef "bass" \lhMusic >> >> } </pre> <p> <a href="../17/lily-f23024a0.ly"> <img align="middle" border="0" src="../17/lily-f23024a0.png" alt="[image of music]"> </a> </p> </blockquote> <p>All the notes are right, but the appearance is far from satisfactory. The tie clashes with the change in time signature, the beaming in the third bar is wrong, the notes are not merged together, and several notation elements are missing. Let's first deal with the easier things. We can correct the beaming by inserting a beam manually, and we can easily add the left hand slur and the right hand phrasing slur, since these were all covered in the Tutorial. Doing this gives: <blockquote> <pre class="verbatim"> rhMusic = \relative c'' { r2 c4.\( g8 | bes1~ | \time 6/4 bes2. r8 % Start polyphonic section of four voices << {c,8[ d fis bes a] | } \\ {c,8~ c2 | } \\ {s8 d2 | } \\ {s4 fis4. | } >> g2.\) } lhMusic = \relative c' { r2 <c g ees>2( | <d g, d>1) | r2. d,,4 r4 r | r4 } \score { \new PianoStaff << \new Staff = "RH" << \key g \minor \rhMusic >> \new Staff = "LH" << \key g \minor \clef "bass" \lhMusic >> >> } </pre> <p> <a href="../ee/lily-8e9a4e42.ly"> <img align="middle" border="0" src="../ee/lily-8e9a4e42.png" alt="[image of music]"> </a> </p> </blockquote> <p>The first bar is now correct. The second bar contains an arpeggio and is terminated by a double bar line. How do we do these, as they have not been mentioned in this Learning Manual? This is where we need to turn to the Notation Reference. Looking up ‘arpeggio’ and ‘bar line’ in the index quickly shows us that an arpeggio is produced by appending <code>\arpeggio</code> to a chord, and a double bar line is produced by the <code>\bar "||"</code> command. That's easily done. We next need to correct the collision of the tie with the time signature. This is best done by moving the tie upwards. Moving objects was covered earlier in <a href="Moving-objects.de.html#Moving-objects">Moving objects</a>, which says that objects positioned relative to the staff can be moved by overriding their <code>staff-position</code> property, which is specified in half staff spaces relative to the center line of the staff. So the following override placed just before the first tied note would move the tie up to 3.5 half staff spaces above the center line: <p><code>\once \override Tie #'staff-position = #3.5</code> <p>This completes bar two, giving: <blockquote> <pre class="verbatim"> rhMusic = \relative c'' { r2 c4.\( g8 | \once \override Tie #'staff-position = #3.5 bes1~ | \bar "||" \time 6/4 bes2. r8 % Start polyphonic section of four voices << {c,8[ d fis bes a] | } \\ {c,8~ c2 | } \\ {s8 d2 | } \\ {s4 fis4. | } >> g2.\) } lhMusic = \relative c' { r2 <c g ees>2( | <d g, d>1)\arpeggio | r2. d,,4 r4 r | r4 } \score { \new PianoStaff << \new Staff = "RH" << \key g \minor \rhMusic >> \new Staff = "LH" << \key g \minor \clef "bass" \lhMusic >> >> } </pre> <p> <a href="../8a/lily-ee0cb1eb.ly"> <img align="middle" border="0" src="../8a/lily-ee0cb1eb.png" alt="[image of music]"> </a> </p> </blockquote> <p>On to bar three and the start of the Moderato section. The tutorial showed how to add embolded text with the <code>\markup</code> command, so adding ‘Moderato’ in bold is easy. But how do we merge notes in different voices together? This is where we need to turn to the Notation Reference for help. A search for “merge” in the Notation Reference index quickly leads us to the commands for merging differently headed and differently dotted notes in <a name="index-Collision-resolution-429"></a><a href="../lilypond/Collision-resolution.de.html#Collision-resolution">Collision resolution</a>. In our example we need to merge both types of note for the duration of the polyphonic section in bar 3, so using the information we find in the Notation Reference we add <pre class="example">\mergeDifferentlyHeadedOn \mergeDifferentlyDottedOn </pre> <p class="noindent">to the start of that section and <pre class="example">\mergeDifferentlyHeadedOff \mergeDifferentlyDottedOff </pre> <p class="noindent">to the end, giving: <blockquote> <pre class="verbatim"> rhMusic = \relative c'' { r2 c4.\( g8 | \once \override Tie #'staff-position = #3.5 bes1~ | \bar "||" \time 6/4 bes2.^\markup {\bold "Moderato"} r8 \mergeDifferentlyHeadedOn \mergeDifferentlyDottedOn % Start polyphonic section of four voices << {c,8[ d fis bes a] | } \\ {c,8~ c2 | } \\ {s8 d2 | } \\ {s4 fis4. | } >> \mergeDifferentlyHeadedOff \mergeDifferentlyDottedOff g2.\) } lhMusic = \relative c' { r2 <c g ees>2( | <d g, d>1)\arpeggio | r2. d,,4 r4 r | r4 } \score { \new PianoStaff << \new Staff = "RH" << \key g \minor \rhMusic >> \new Staff = "LH" << \key g \minor \clef "bass" \lhMusic >> >> } </pre> <p> <a href="../fd/lily-aaa30e47.ly"> <img align="middle" border="0" src="../fd/lily-aaa30e47.png" alt="[image of music]"> </a> </p> </blockquote> <p>These overrides have merged the two F-sharp notes, but not the two on D. Why not? The answer is there in the same section in the Notation Reference – notes being merged must have stems in opposite directions and two notes cannot be merged successfully if there is a third note in the same note column. Here the two D's both have upward stems and there is a third note – the C. We know how to change the stem direction using <code>\stemDown</code>, and the Notation Reference also says how to move the C – apply a shift using one of the <code>\shift</code> commands. But which one? The C is in voice two which has shift off, and the two D's are in voices one and three, which have shift off and shift on, respectively. So we have to shift the C a further level still using <code>\shiftOnn</code> to avoid it interfering with the two D's. Applying these changes gives: <blockquote> <pre class="verbatim"> rhMusic = \relative c'' { r2 c4.\( g8 | \once \override Tie #'staff-position = #3.5 bes1~ | \bar "||" \time 6/4 bes2.^\markup {\bold "Moderato"} r8 \mergeDifferentlyHeadedOn \mergeDifferentlyDottedOn % Start polyphonic section of four voices << {c,8[ d fis bes a] | } \\ % Move the c2 out of the main note column so the merge will work {c,8~ \shiftOnn c2 | } \\ % Stem on the d2 must be down to permit merging {s8 \stemDown d2 | } \\ {s4 fis4. | } >> \mergeDifferentlyHeadedOff \mergeDifferentlyDottedOff g2.\) } lhMusic = \relative c' { r2 <c g ees>2( | <d g, d>1)\arpeggio | r2. d,,4 r4 r | r4 } \score { \new PianoStaff << \new Staff = "RH" << \key g \minor \rhMusic >> \new Staff = "LH" << \key g \minor \clef "bass" \lhMusic >> >> } </pre> <p> <a href="../88/lily-a5bd4e5f.ly"> <img align="middle" border="0" src="../88/lily-a5bd4e5f.png" alt="[image of music]"> </a> </p> </blockquote> <p>Nearly there. Only two problems remain: The downward stem on the merged D should not be there, and the C would be better positioned to the right of the D's. We know how to do both of these from the earlier tweaks: we make the stem transparent, and move the C with the <code>force-hshift</code> property. Here's the final result: <blockquote> <pre class="verbatim"> rhMusic = \relative c'' { r2 c4.\( g8 | \once \override Tie #'staff-position = #3.5 bes1~ | \bar "||" \time 6/4 bes2.^\markup {\bold "Moderato"} r8 \mergeDifferentlyHeadedOn \mergeDifferentlyDottedOn << {c,8[ d fis bes a] | } \\ % Reposition the c2 to the right of the merged note {c,8~ \once \override NoteColumn #'force-hshift = #1.0 % Move the c2 out of the main note column so the merge will work \shiftOnn c2} \\ % Stem on the d2 must be down to permit merging {s8 \stemDown \once \override Stem #'transparent = ##t d2} \\ {s4 fis4.} >> \mergeDifferentlyHeadedOff \mergeDifferentlyDottedOff g2.\) } lhMusic = \relative c' { r2 <c g ees>2( | <d g, d>1)\arpeggio | r2. d,,4 r4 r | r4 } \score { \new PianoStaff << \new Staff = "RH" << \key g \minor \rhMusic >> \new Staff = "LH" << \key g \minor \clef "bass" \lhMusic >> >> } </pre> <p> <a href="../2c/lily-5be0ce9c.ly"> <img align="middle" border="0" src="../2c/lily-5be0ce9c.png" alt="[image of music]"> </a> </p> </blockquote> <!-- footer_tag --><br><hr> <div class="node"> <p> Previous: <a rel="previous" accesskey="p" href="Fixing-overlapping-notation.de.html#Fixing-overlapping-notation">Fixing overlapping notation</a>, Up: <a rel="up" accesskey="u" href="Collisions-of-objects.de.html#Collisions-of-objects">Collisions of objects</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="Real-music-example.es.html">español</a>. <BR> </P> </BODY></html>