Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > 3a7b4dfc766af1222d90c7f03a0844e6 > files > 10237

lilypond-doc-2.11.57-1mdv2009.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- header_tag -->
<html lang="en">
<head>
<title>Rhythms - LilyPond snippets</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="LilyPond snippets">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Pitches.html#Pitches" title="Pitches">
<link rel="next" href="Expressive-marks.html#Expressive-marks" title="Expressive marks">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<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="Rhythms"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Expressive-marks.html#Expressive-marks">Expressive marks</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Pitches.html#Pitches">Pitches</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>

<h2 class="unnumbered">Rhythms</h2>

<p>These snippets illustrate the Notation Reference,
section <a href="../../../Documentation/user/lilypond/Rhythms.html#Rhythms">Rhythms</a>.

   <p><a name="adding-beams,-slurs,-ties-etc.-when-using-tuplet-and-non-tuplet-rythms..ly"></a>

<h3 class="unnumberedsec">Adding beams, slurs, ties etc. when using tuplet and non-tuplet rythms.</h3>

<p>LilyPond syntax can involve many unusual placements for parentheses,
brackets etc., which might sometimes have to be interleaved. For
example, when entering a manual beam, the left square bracket has to be
placed after the starting note and its duration, not before. Similarly,
the right square bracket should directly follow the note which is to be
at the end of the requested beaming, even if this note happens to be
inside a tuplet section. This snippet demonstrates how to combine
manual beaming, manual slurs, ties and phrasing slurs with tuplet
sections (enclosed within curly braces).

<pre class="verbatim">
{
  r16[ g16 \times 2/3 { r16 e'8] }
  g16( a \times 2/3 { b d e') }
  g8[( a \times 2/3 { b d') e']~ }
  \time 2/4
  \times 4/5 { e'32\( a b d' e' } a'4.\)
}
</pre>
<p>
 <a href="../bb/lily-e9acede9.ly">
  <img align="middle"
    border="0" src="../bb/lily-e9acede9.png" alt="[image of music]">
 </a>
</p>

   <p><a name="adding-drum-parts.ly"></a>

<h3 class="unnumberedsec">Adding drum parts</h3>

<p>Using the powerful pre-configured tools such as the <code>\drummode</code>
function and the <code>DrumStaff</code> context, inputting drum parts is
quite easy: drums are placed at their own staff positions (with a
special clef symbol) and have note heads according to the drum. 
Attaching an extra symbol to the drum or restricting the number of
lines is possible.

<pre class="verbatim">
drh = \drummode { cymc4.^"crash" hhc16^"h.h." hh hhc8 hho hhc8 hh16 hh hhc4 r4 r2 }
drl = \drummode { bd4 sn8 bd bd4 &lt;&lt; bd ss >>  bd8 tommh tommh bd toml toml bd tomfh16 tomfh }
timb = \drummode { timh4 ssh timl8 ssh r timh r4 ssh8 timl r4 cb8 cb }

\score {
  &lt;&lt;
    \new DrumStaff \with {
      drumStyleTable = #timbales-style
      \override StaffSymbol #'line-count = #2
      \override BarLine #'bar-size = #2
    } &lt;&lt;
      \set Staff.instrumentName = #"timbales"
      \timb
    >>
    \new DrumStaff &lt;&lt;
      \set Staff.instrumentName = #"drums"
      \new DrumVoice { \stemUp \drh }
      \new DrumVoice { \stemDown \drl }
    >>
  >>
  \layout { }
  \midi {
    \context {
      \Score
      tempoWholesPerMinute = #(ly:make-moment 120 4)
    }
  }
}
</pre>
<p>
 <a href="../2e/lily-5b0f4aab.ly">
  <img align="middle"
    border="0" src="../2e/lily-5b0f4aab.png" alt="[image of music]">
 </a>
</p>

   <p><a name="automatic-beam-subdivisions.ly"></a>

<h3 class="unnumberedsec">Automatic beam subdivisions</h3>

<p>Beams can be subdivided automatically.  By setting the property
<code>subdivideBeams</code>, beams are subdivided at beat positions (as
specified in <code>beatLength</code>).

<pre class="verbatim">
\score {
  \new Staff \relative c'' {
    &lt;&lt; {
      \voiceOne
      \set subdivideBeams = ##t
      b32[ a g f c' b a g b^"subdivide beams" a g f c' b a g]
      \oneVoice
    }
    \new Voice {
      \voiceTwo
      b32_"default"[ a g f c' b a g b a g f c' b a g]
    } >>
    \set beatLength = #(ly:make-moment 1 8)
    b32^"beatLength 1 8"[ a g f c' b a g]
    \set beatLength = #(ly:make-moment 1 16)
    b32^"beatLength 1 16"[ a g f c' b a g]
  }
}

</pre>
<p>
 <a href="../51/lily-143fd117.ly">
  <img align="middle"
    border="0" src="../51/lily-143fd117.png" alt="[image of music]">
 </a>
</p>

   <p><a name="automatic-beams-two-per-two-in-4-4-or-2-2-time-signature.ly"></a>

<h3 class="unnumberedsec">Automatic beams two per two in 4/4 or 2/2 time signature</h3>

<p>In a simple time signature of 2/2 or 4/4, 8th notes are beamed by
default as two sets of four.

   <p>Using a macro which overrides the autobeaming behavior, this snippet
changes the beaming to quarter note beats.

<pre class="verbatim">
% Automatic beams two per two in 4/4 or 2/2 time signature
%              _____
% Default     | | | |
%              _   _
% Required    | | | |

% macro for beamed two per two in 2/2 and 4/4 time signature
qBeam = {
  #(override-auto-beam-setting '(end 1 8 * *) 1 4 'Staff)
  #(override-auto-beam-setting '(end 1 8 * *) 2 4 'Staff)
  #(override-auto-beam-setting '(end 1 8 * *) 3 4 'Staff)
}

\score {
  &lt;&lt;
    \new Staff \relative c'' {
      \time 4/4
      g8^\markup { without the macro } g g g g g g g
      g8 g g g4 g8 g g
    }
    %Use the macro
    \new Staff \relative c'' {
      \time 4/4
      \qBeam
      g8^\markup { with the macro } g g g g g g g
      g8 g g g4 g8 g g
    }
  >>
  \layout {
    \context {
      \Staff
      \override TimeSignature #'style = #'()
    }
  }
}
</pre>
<p>
 <a href="../82/lily-68049e60.ly">
  <img align="middle"
    border="0" src="../82/lily-68049e60.png" alt="[image of music]">
 </a>
</p>

   <p><a name="beams-across-line-breaks.ly"></a>

<h3 class="unnumberedsec">Beams across line breaks</h3>

<p>By default, beams can't be printed across line breaks.  This behavior
can be overridden by setting the <code>breakable</code> property.

<pre class="verbatim">
\layout { ragged-right = ##t }
\relative c'' {
  \override Score.Beam #'breakable = ##t
  \time 3/16
  c16[ d e \break
  f16] r r 
}
</pre>
<p>
 <a href="../2e/lily-842aad5d.ly">
  <img align="middle"
    border="0" src="../2e/lily-842aad5d.png" alt="[image of music]">
 </a>
</p>

   <p><a name="changing-form-of-multi--measure-rests.ly"></a>

<h3 class="unnumberedsec">Changing form of multi-measure rests</h3>

<p>If there are ten or fewer measures of rests, a series of longa
and breve rests (called in German "Kirchenpausen" - church rests)
is printed within the staff; otherwise a simple line is shown. 
This default number of ten may be changed by overriding the
<code>expand-limit</code> property:

<pre class="verbatim">
\relative c'' {
  \compressFullBarRests
  R1*2 | R1*5 | R1*9
  \override MultiMeasureRest #'expand-limit = 3
  R1*2 | R1*5 | R1*9
}
</pre>
<p>
 <a href="../08/lily-6df2a91f.ly">
  <img align="middle"
    border="0" src="../08/lily-6df2a91f.png" alt="[image of music]">
 </a>
</p>

   <p><a name="changing-text-and-spanner-styles-for-text-dynamics.ly"></a>

<h3 class="unnumberedsec">Changing text and spanner styles for text dynamics</h3>

<p>The text used for crescendos and decrescendos can be
changed by modifying the context properties <code>crescendoText</code>
and <code>decrescendoText</code>.  The style of the spanner line can
be changed by modifying the <code>'style</code> property of
<code>DynamicTextSpanner</code>.  The default value is
<code>'hairpin</code>, and other possible values include
<code>'line</code>, <code>'dashed-line</code>, and
<code>'dotted-line</code>:

<pre class="verbatim">
\relative c'' {
  \set crescendoText = \markup { \italic { cresc. poco } }
  \set crescendoSpanner = #'text
  \override DynamicTextSpanner #'style = #'dotted-line
  a2\&lt; a
  a2 a
  a2 a
  a2 a\mf
}
</pre>
<p>
 <a href="../ab/lily-453c0505.ly">
  <img align="middle"
    border="0" src="../ab/lily-453c0505.png" alt="[image of music]">
 </a>
</p>

   <p><a name="changing-the-tuplet-number.ly"></a>

<h3 class="unnumberedsec">Changing the tuplet number</h3>

<p>By default, only the numerator of the tuplet number is printed over the
tuplet bracket, i.e., the denominator of the argument to the
<code>\times</code> command. Alternatively, num:den of the tuplet number may
be printed, or the tuplet number may be suppressed altogether.

<pre class="verbatim">
\relative c'' {
  \times 2/3 { c8 c c } \times 2/3 { c8 c c }
  \override TupletNumber #'text = #tuplet-number::calc-fraction-text
  \times 2/3 { c8 c c }
  \override TupletNumber #'stencil = ##f
  \times 2/3 { c8 c c }
}
</pre>
<p>
 <a href="../88/lily-e19f06cf.ly">
  <img align="middle"
    border="0" src="../88/lily-e19f06cf.png" alt="[image of music]">
 </a>
</p>

   <p><a name="changing-time-signatures-inside-a-polymetric-section-using-scaledurations.ly"></a>

<h3 class="unnumberedsec">Changing time signatures inside a polymetric section using <code>\scaleDurations</code></h3>

<p>The <code>measureLength</code> property, together with
<code>measurePosition</code>, determines when a bar line is needed.  However,
when using <code>\scaleDurations</code>, the scaling of durations makes it
difficult to change time signatures.  In this case, <code>measureLength</code>
should be set manually, using the <code>ly:make-moment</code> callback.  The
second argument must be the same as the second argument of
<code>\scaleDurations</code>.
<pre class="verbatim">
\layout {
  \context {
    \Score
    \remove "Timing_translator"
    \remove "Default_bar_line_engraver"
  }
  \context {
    \Staff
    \consists "Timing_translator"
    \consists "Default_bar_line_engraver"
  }
}

&lt;&lt;
  \new Staff {
    \scaleDurations #'(8 . 5) {
      \time 6/8
      \set Timing.measureLength = #(ly:make-moment 3 5)
      b8 b b b b b
      \time 2/4
      \set Timing.measureLength = #(ly:make-moment 2 5)
      b4 b
    }
  }
  \new Staff {
    \clef bass
    \time 2/4
    c2 d e f
  }
>>
</pre>
<p>
 <a href="../9e/lily-7717a836.ly">
  <img align="middle"
    border="0" src="../9e/lily-7717a836.png" alt="[image of music]">
 </a>
</p>

   <p><a name="chant-or-psalms-notation.ly"></a>

<h3 class="unnumberedsec">Chant or psalms notation</h3>

<p>This form of notation is used for the chant of the Psalms, where verses
aren't always the same length.

<pre class="verbatim">
stemOn = { \override Staff.Stem #'transparent = ##f }
stemOff = { \override Staff.Stem #'transparent = ##t }

\score {
  \new Staff \with { \remove "Time_signature_engraver" }
  {
    \key g \minor
    \set Score.timing = ##f
    \stemOff a'\breve bes'4 g'4
    \stemOn a'2 \bar "||"
    \stemOff a'\breve g'4 a'4
    \stemOn f'2 \bar "||"
    \stemOff a'\breve^\markup { \italic flexe }
    \stemOn g'2 \bar "||"
  }
}
</pre>
<p>
 <a href="../36/lily-43a8112c.ly">
  <img align="middle"
    border="0" src="../36/lily-43a8112c.png" alt="[image of music]">
 </a>
</p>

   <p><a name="compound-time-signatures.ly"></a>

<h3 class="unnumberedsec">Compound time signatures</h3>

<p>Odd 20th century time signatures (such as "5/8") can often be played
as compound time signatures (e.g. "3/8 + 2/8"), which combine two or
more inequal metrics. LilyPond can make such music quite easy to read
and play, by explicitly printing the compound time signatures and
adapting the automatic beaming behavior. (Graphic measure grouping
indications can also be added; see the appropriate snippet in this
database.)

<pre class="verbatim">
#(define (compound-time one two num)
  (markup #:override '(baseline-skip . 0) #:number
   (#:line ((#:column (one num)) #:vcenter "+" (#:column (two num))))
  ))

\relative {  
  \override Staff.TimeSignature #'stencil = #ly:text-interface::print
  \override Staff.TimeSignature #'text = #(compound-time "2" "3" "8")
  \time 5/8
  #(override-auto-beam-setting '(end 1 8 5 8) 1 4)
  c8 d e fis gis
  c8 fis, gis e d
  c8 d e4 gis8
}
</pre>
<p>
 <a href="../cb/lily-64039b33.ly">
  <img align="middle"
    border="0" src="../cb/lily-64039b33.png" alt="[image of music]">
 </a>
</p>

   <p><a name="conducting-signs,-measure-grouping-signs.ly"></a>

<h3 class="unnumberedsec">Conducting signs, measure grouping signs</h3>

<p>The Scheme function <code>set-time-signature</code>, in combination with the
<code>Measure_grouping_engraver</code>, creates measure grouping signs. Such
signs ease reading rhythmically complex modern music. In the following
example, the 9/8 measure is subdivided into 2, 2, 2 and 3 beats. This
is passed to <code>set-time-signature</code> as the third argument <code>(2 2
2 3)</code>.

<pre class="verbatim">
\score {
  \relative c'' {
    #(set-time-signature 9 8 '(2 2 2 3))
    #(revert-auto-beam-setting '(end * * 9 8) 3 8)
    #(override-auto-beam-setting '(end 1 8 9 8) 1 4)
    #(override-auto-beam-setting '(end 1 8 9 8) 2 4)
    #(override-auto-beam-setting '(end 1 8 9 8) 3 4)
    g8 g d d g g a( bes g) |
    #(set-time-signature 5 8 '(3 2))
    a4. g4
  }
  \layout {
    \context {
      \Staff
      \consists "Measure_grouping_engraver"
    }
  }
}
</pre>
<p>
 <a href="../3a/lily-bad1fe7d.ly">
  <img align="middle"
    border="0" src="../3a/lily-bad1fe7d.png" alt="[image of music]">
 </a>
</p>

   <p><a name="controlling-tuplet-bracket-visibility.ly"></a>

<h3 class="unnumberedsec">Controlling tuplet bracket visibility</h3>

<p>The default behavior of tuplet-bracket visibility is to print a bracket
unless there is a beam of the same length as the tuplet. To control the
visibility of tuplet brackets, set the property <code>TupletBracket
#'bracket-visibility</code> to either <code>##t</code> (always print a bracket),
<code>##f</code> (never print a bracket) or <code>#'if-no-beam</code> (only print a
bracket if there is no beam).

<pre class="verbatim">
mus = \relative c'' {
  \times 2/3 { c16[ d e } f8]
  \times 2/3 { c8 d e }
  \times 2/3 { c4 d e }
}

\new Voice \relative c'{
  &lt;&lt; \mus s4^"default" >>
  \override TupletBracket #'bracket-visibility = #'if-no-beam
  &lt;&lt; \mus s4^"'if-no-beam" >>
  \override TupletBracket #'bracket-visibility = ##t
  &lt;&lt; \mus s4^"#t" >>
  \override TupletBracket #'bracket-visibility = ##f
  &lt;&lt; \mus s4^"#f" >>
} 

</pre>
<p>
 <a href="../08/lily-6e556f99.ly">
  <img align="middle"
    border="0" src="../08/lily-6e556f99.png" alt="[image of music]">
 </a>
</p>

   <p><a name="engraving-ties-manually.ly"></a>

<h3 class="unnumberedsec">Engraving ties manually</h3>

<p>Ties may be engraved manually by changing the <code>tie-configuration</code>
property of the <code>TieColumn</code> object. The first number indicates the
distance from the center of the staff in staff-spaces, and the second
number indicates the direction (1 = up, -1 = down).

<pre class="verbatim">
\relative c' {
  &lt;c e g>2 ~ &lt;c e g>
  \override TieColumn #'tie-configuration =
    #'((0.0 . 1) (-2.0 . 1) (-4.0 . 1))
  &lt;c e g> ~ &lt;c e g>
}
</pre>
<p>
 <a href="../44/lily-6cba5093.ly">
  <img align="middle"
    border="0" src="../44/lily-6cba5093.png" alt="[image of music]">
 </a>
</p>

   <p><a name="entering-several-tuplets-using-only-one--times-command.ly"></a>

<h3 class="unnumberedsec">Entering several tuplets using only one \times command</h3>

<p>The property <code>tupletSpannerDuration</code> sets how long each of the
tuplets contained within the brackets after <code>\times</code> should last. 
Many consecutive tuplets can then be placed within a single
<code>\times</code> expression, thus saving typing.

   <p>In the example, two triplets are shown, while <code>\times</code> was
entered only once.

   <p>For more information about <code>make-moment</code>, see "Time
administration".

<pre class="verbatim">
\relative c' {
  \time 2/4
  \set tupletSpannerDuration = #(ly:make-moment 1 4)
  \times 2/3 { c8 c c c c c }
}
</pre>
<p>
 <a href="../68/lily-5f869ce6.ly">
  <img align="middle"
    border="0" src="../68/lily-5f869ce6.png" alt="[image of music]">
 </a>
</p>

   <p><a name="forcing-rehearsal-marks-to-start-from-a-given-letter-or-number.ly"></a>

<h3 class="unnumberedsec">Forcing rehearsal marks to start from a given letter or number</h3>

<p>This snippet demonstrates how to obtain automatic ordered rehearsal
marks, but from the letter or number you want.

<pre class="verbatim">
\relative c''{
  c1 \mark \default
  c1 \mark \default
  c1 \mark \default
  c1 \mark #14
  c1 \mark \default
  c1 \mark \default
  c1 \mark \default
  c1 \mark \default
  \break
  \set Score.markFormatter = #format-mark-numbers
  c1 \mark #1
  c1 \mark \default
  c1 \mark \default
  c1 \mark \default
  c1 \mark #14
  c1 \mark \default
  c1 \mark \default
  c1 \mark \default
  c1 \mark \default
}
</pre>
<p>
 <a href="../dc/lily-0a6e504d.ly">
  <img align="middle"
    border="0" src="../dc/lily-0a6e504d.png" alt="[image of music]">
 </a>
</p>

   <p><a name="heavily-customized-polymetric-time-signatures.ly"></a>

<h3 class="unnumberedsec">Heavily customized polymetric time signatures</h3>

<p>Though the polymetric time signature shown was not the most essential
item here, it has been included to show the beat of this piece (which
is the template of a real Balkan song!).

<pre class="verbatim">
#(define (set-time-signature one two three four five six seven eight nine ten
          eleven num)
          (markup #:override '(baseline-skip . 0) #:number
          (#:line ((#:column (one num)) #:vcenter "+" (#:column (two num))
          #:vcenter "+" (#:column (three num)) #:vcenter "+" (#:column (four num))
          #:vcenter "+" (#:column (five num)) #:vcenter "+" (#:column (six num))
          #:vcenter "+" (#:column (seven num)) #:vcenter "+" (#:column (eight num))
          #:vcenter "+" (#:column (nine num)) #:vcenter "+" (#:column (ten num))
          #:vcenter "+" (#:column (eleven num))))
          ))


melody = \relative c'' {
  \set Staff.instrumentName = #"Bb Sop."
  \key g \major
  \time 25/8
  \override Staff.TimeSignature #'stencil = #ly:text-interface::print
  \override Staff.TimeSignature #'text = #(set-time-signature "3" "2" "2" "3"
    "2" "2" "2" "2" "3" "2" "2" "8" )
  \set Staff.beatGrouping = #'(3 2 2 3 2 2 2 2 3 2 2)
  #(override-auto-beam-setting '(end * * 25 8) 3 8)
  #(override-auto-beam-setting '(end * * 25 8) 5 8)
  #(override-auto-beam-setting '(end * * 25 8) 7 8)
  #(override-auto-beam-setting '(end * * 25 8) 10 8)
  #(override-auto-beam-setting '(end * * 25 8) 12 8)
  #(override-auto-beam-setting '(end * * 25 8) 14 8)
  #(override-auto-beam-setting '(end * * 25 8) 16 8)
  #(override-auto-beam-setting '(end * * 25 8) 18 8)
  #(override-auto-beam-setting '(end * * 25 8) 21 8)
  #(override-auto-beam-setting '(end * * 25 8) 23 8)

  c8 c c d4 c8 c b c b a4 g fis8 e d c b' c d e4-^ fis8 g \break
  c,4. d4 c4 d4. c4 d c2 d4. e4-^ d4
  c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 \break
  c4. d4 c4 d4. c4 d c2 d4. e4-^ d4
  c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 \break
}

drum = \new DrumStaff \drummode {
  \bar "|:" bd4.^\markup { "Drums" } sn4 bd \bar ":" sn4.
  bd4 sn \bar ":" bd sn bd4. sn4 bd \bar ":|"
}

{
  \melody
  \drum
}
</pre>
<p>
 <a href="../24/lily-302b7020.ly">
  <img align="middle"
    border="0" src="../24/lily-302b7020.png" alt="[image of music]">
 </a>
</p>

   <p><a name="making-an-object-invisible-with-the-transparent-property.ly"></a>

<h3 class="unnumberedsec">Making an object invisible with the transparent property</h3>

<p>Setting the <code>transparent</code> property will cause an object to be
printed in "invisible ink": the object is not printed, but all its
other behavior is retained.  The object still takes up space, it takes
part in collisions, and slurs, ties and beams can be attached to it.

   <p>This snippet demonstrates how to connect different voices using ties. 
Normally, ties only connect two notes in the same voice.  By
introducing a tie in a different voice, and blanking the first up-stem
in that voice, the tie appears to cross voices.  To prevent the blanked stem's
flag from interfering with tie positioning, the stem is extended.

<pre class="verbatim">
\relative c'' {
  \time 2/4
  &lt;&lt; {
    \once \override Stem #'transparent = ##t
    \once \override Stem #'length = #8
    b8 ~ b\noBeam
    \once \override Stem #'transparent = ##t
    \once \override Stem #'length = #8
    g8 ~ g\noBeam
  } \\ {
    b8 g g e
  } >>
}
</pre>
<p>
 <a href="../74/lily-ed1461a4.ly">
  <img align="middle"
    border="0" src="../74/lily-ed1461a4.png" alt="[image of music]">
 </a>
</p>

   <p><a name="manually-controlling-beam-positions.ly"></a>

<h3 class="unnumberedsec">Manually controlling beam positions</h3>

<p>Beam positions may be controlled manually, by overriding the
<code>positions</code> setting of the <code>Beam</code> grob.

<pre class="verbatim">
\relative c' {
  \time 2/4
  % from upper staffline (position 4) to center (position 0)
  \override Beam #'positions = #'(2 . 0)
  c8 c
  % from center to one above center (position 2)
  \override Beam #'positions = #'(0 . 1)
  c8 c
}

</pre>
<p>
 <a href="../5f/lily-7c61b35b.ly">
  <img align="middle"
    border="0" src="../5f/lily-7c61b35b.png" alt="[image of music]">
 </a>
</p>

   <p><a name="merging-multi-measure-rests-in-a-polyphonic-part.ly"></a>

<h3 class="unnumberedsec">Merging multi-measure rests in a polyphonic part</h3>

<p>When using multi-measure rests in a polyphonic staff, the rests will be
placed differently depending on the voice they belong to. However they
can be printed on the same staff line, using the following setting.

<pre class="verbatim">
normalPos= \revert MultiMeasureRest #'staff-position

{
  &lt;&lt;
    {
       c''1
       R1
       c''1
       \normalPos
       R1
     }
     \\
     {
       c'1
       R1
       c'1
       \normalPos
       R1
     }
  >>
}
</pre>
<p>
 <a href="../47/lily-1943c5f7.ly">
  <img align="middle"
    border="0" src="../47/lily-1943c5f7.png" alt="[image of music]">
 </a>
</p>

   <p><a name="modifying-tuplet-bracket-length.ly"></a>

<h3 class="unnumberedsec">Modifying tuplet bracket length</h3>

<p>Tuplet brackets can be made to run to prefatory matter or the next
note. Default tuplet brackets end at the right edge of the final note
of the tuplet; full-length tuplet brackets extend farther to the right,
either to cover all the non-rhythmic notation up to the following note,
or to cover only the whitespace before the next item of notation, be
that a clef, time signature, key signature, or another note.  The
example shows how to switch tuplets to full length mode and how to
modify what material they cover.

<pre class="verbatim">
\new RhythmicStaff {
  % Set tuplets to be extendable...
  \set tupletFullLength = ##t
  % ...to cover all items up to the next note
  \set tupletFullLengthNote = ##t
  \time 2/4
  \times 2/3 { c4 c c }
  % ...or to cover just whitespace
  \set tupletFullLengthNote = ##f
  \time 4/4
  \times 4/5 { c4 c1 }
  \time 3/4
  c2.
}
</pre>
<p>
 <a href="../08/lily-816eddcf.ly">
  <img align="middle"
    border="0" src="../08/lily-816eddcf.png" alt="[image of music]">
 </a>
</p>

   <p><a name="permitting-line-breaks-within-beamed-tuplets.ly"></a>

<h3 class="unnumberedsec">Permitting line breaks within beamed tuplets</h3>

<p>This artificial example shows how both manual and automatic line breaks
may be permitted to within a beamed tuplet. Note that such off-beat
tuplets have to be beamed manually.

<pre class="verbatim">
\layout {
  \context {
    \Voice
    % Permit line breaks within tuplets
    \remove "Forbid_line_break_engraver"
    % Allow beams to be broken at line breaks
    \override Beam #'breakable = ##t
  }
}
\relative c'' {
  a8
  \repeat unfold 8 { \times 2/3 { c[ b a] } }
  % Insert a manual line break within a tuplet
  \times 2/3 { c[ b \bar "" \break a] }
  \repeat unfold 2 { \times 2/3 { c[ b a] } }
  c8
}
</pre>
<p>
 <a href="../6f/lily-b415dc2f.ly">
  <img align="middle"
    border="0" src="../6f/lily-b415dc2f.png" alt="[image of music]">
 </a>
</p>

   <p><a name="positioning-multi--measure-rests.ly"></a>

<h3 class="unnumberedsec">Positioning multi-measure rests</h3>

<p>Unlike ordinary rests, there is no predefined command
to change the vertical position on the staff of a multi-measure
rest symbol of either form by attaching it to a note.  However,
in polyphonic music multi-measure rests in odd-numbered and
even-numbered voices are vertically separated.  The positioning
of multi-measure rests can be controlled as follows:
<pre class="verbatim">
\relative c'' {
  % Multi-measure rests by default are set under the second line
  R1
  % They can be moved with an override
  \override MultiMeasureRest #'staff-position = #-2
  R1
  % A value of 0 is the default position;
  % the following trick moves the rest to the center line
  \override MultiMeasureRest #'staff-position = #-0.01
  R1
  % Multi-measure rests in odd-numbered voices are under the top line
  &lt;&lt; { R1 } \\ { a1 } >>
  % Multi-measure rests in even-numbered voices are under the bottom line
  &lt;&lt; { c1 } \\ { R1 } >>
  % They remain separated even in empty measures
  &lt;&lt; { R1 } \\ { R1 } >>
  % This brings them together even though there are two voices
  \compressFullBarRests
  &lt;&lt;
    \revert MultiMeasureRest #'staff-position
    { R1*3 }
    \\
    \revert MultiMeasureRest #'staff-position
    { R1*3 }
  >>
}
</pre>
<p>
 <a href="../73/lily-ebd099b8.ly">
  <img align="middle"
    border="0" src="../73/lily-ebd099b8.png" alt="[image of music]">
 </a>
</p>

   <p><a name="printing-metronome-and-rehearsal-marks-below-the-staff.ly"></a>

<h3 class="unnumberedsec">Printing metronome and rehearsal marks below the staff</h3>

<p>By default, metronome and rehearsal marks are printed above the staff. 
To place them below the staff simply set the <code>direction</code> property
of <code>MetronomeMark</code> or <code>RehearsalMark</code> appropriately.

<pre class="verbatim">
\layout { ragged-right = ##f }

{
  % Metronome marks below the staff 
  \override Score.MetronomeMark #'direction = #DOWN
  \tempo 8. = 120
  c''1

  % Rehearsal marks below the staff
  \override Score.RehearsalMark #'direction = #DOWN
  \mark \default
  c''1
}
</pre>
<p>
 <a href="../4a/lily-cfdefdd1.ly">
  <img align="middle"
    border="0" src="../4a/lily-cfdefdd1.png" alt="[image of music]">
 </a>
</p>

   <p><a name="printing-music-with-different-time-signatures.ly"></a>

<h3 class="unnumberedsec">Printing music with different time signatures</h3>

<p>In the following snippet, two parts have a completely different time
signature, yet remain synchronized. The bar lines can no longer be
printed at the <code>Score</code> level; to allow independent bar lines in
each part, the <code>Barline_engraver</code> is moved from the <code>Score</code>
context to the <code>Staff</code> context.

<pre class="verbatim">
\paper {
  indent = #0
  ragged-right = ##t
}

global = { \time 3/4 { s2.*3 } \bar "" \break { s2.*3 } }

\layout {
  \context {
    \Score
    \remove "Timing_translator"
    \remove "Time_signature_engraver"
    \remove "Default_bar_line_engraver"
    \override SpacingSpanner #'uniform-stretching = ##t
    \override SpacingSpanner #'strict-note-spacing = ##t
    proportionalNotationDuration = #(ly:make-moment 1 64)
  }
  \context {
    \Staff
    \consists "Timing_translator"
    \consists "Default_bar_line_engraver"
    \consists "Time_signature_engraver"
  }
  \context {
    \Voice
    \remove "Forbid_line_break_engraver"
    tupletFullLength = ##t
  }
}

Bassklarinette = \new Staff &lt;&lt;
  \global {
    \bar "|"
    \clef treble
    \time 3/8
    d''4.
    
    \bar "|"
    \time 3/4
    r8 des''2( c''8)
    
    \bar "|"
    \time 7/8
    r4. ees''2 ~
    
    \bar "|"
    \time 2/4
    \tupletUp
    \times 2/3 { ees''4 r4 d''4 ~ }
    
    \bar "|"
    \time 3/8
    \tupletUp
    \times 3/4 { d''4 r4 }
    
    \bar "|"
    \time 2/4
    e''2
    
    \bar "|"
    \time 3/8
    es''4.
    
    \bar "|"
    \time 3/4
    r8 d''2 r8
    \bar "|"
  }
>>

Perkussion = \new StaffGroup &lt;&lt;
  \new Staff &lt;&lt;
    \global {
      \bar "|"
      \clef percussion
      \time 3/4
      r4 c'2 ~
      
      \bar "|"
      c'2.
      
      \bar "|"
      R2.
      
      \bar "|"
      r2 g'4 ~
      
      \bar "|"
      g'2. ~
      
      \bar "|"
      g'2.
    }
  >>
  \new Staff &lt;&lt;
    \global {
      \bar "|"
      \clef percussion
      \time 3/4
      R2.
      
      \bar "|"
      g'2. ~
      
      \bar "|"
      g'2.
      
      \bar "|"
      r4 g'2 ~
      
      \bar "|"
      g'2 r4
      
      \bar "|"
      g'2.
    }
  >>
>>

\score {
  &lt;&lt;  \Bassklarinette \Perkussion >>
}
</pre>
<p>
 <a href="../46/lily-ccd9189a.ly">
  <img align="middle"
    border="0" src="../46/lily-ccd9189a.png" alt="[image of music]">
 </a>
</p>

   <p><a name="rest-styles.ly"></a>

<h3 class="unnumberedsec">Rest styles</h3>

<p>Rests may be used in various styles.

<pre class="verbatim">
\layout {
  indent = 0.0
  \context {
    \Staff
    \remove "Time_signature_engraver"
  }
}

\relative c {
  \set Score.timing = ##f
  \override Staff.Rest  #'style = #'mensural
  r\maxima^\markup \typewriter { mensural }
  r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 r128
  \bar ""
  
  \override Staff.Rest  #'style = #'neomensural
  r\maxima^\markup \typewriter { neomensural }
  r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 r128
  \bar ""
  
  \override Staff.Rest  #'style = #'classical
  r\maxima^\markup \typewriter { classical }
  r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 r128
  \bar ""
  
  \override Staff.Rest  #'style = #'default
  r\maxima^\markup \typewriter { default }
  r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 r128
}
</pre>
<p>
 <a href="../b4/lily-5bfcd48c.ly">
  <img align="middle"
    border="0" src="../b4/lily-5bfcd48c.png" alt="[image of music]">
 </a>
</p>

   <p><a name="rhythmic-slashes.ly"></a>

<h3 class="unnumberedsec">Rhythmic slashes</h3>

<p>In "simple" lead-sheets, sometimes no actual notes are written,
instead only "rhythmic patterns" and chords above the measures are
notated giving the structure of a song. Such a feature is for example
useful while creating/transcribing the structure of a song and also
when sharing lead sheets with guitarists or jazz musicians. The
standard support for this using <code>\repeat percent</code> is unsuitable
here since the first beat has to be an ordinary note or rest. This
example shows two solutions to this problem, by redefining ordinary
rests to be printed as slashes. (If the duration of each beat is not a
quarter note, replace the <code>r4</code> in the definitions with a rest of
the appropriate duration).

<pre class="verbatim">
% Macro to print single slash
rs = {
  \once \override Rest #'stencil = #ly:percent-repeat-item-interface::beat-slash
  \once \override Rest #'thickness = #'0.48
  \once \override Rest #'slope = #'1.7
  r4
}

% Function to print a specified number of slashes
comp = #(define-music-function (parser location count) ( integer?)
  #{
    \override Rest #'stencil = #ly:percent-repeat-item-interface::beat-slash
    \override Rest #'thickness = #'0.48
    \override Rest #'slope = #'1.7
    \repeat unfold $count { r4 }
    \revert Rest #'stencil
  #}
)

\score{
  \relative c' {
    c d e f |
    \rs \rs \rs \rs |
    \comp #4 |
  }
}
</pre>
<p>
 <a href="../65/lily-23b8cebf.ly">
  <img align="middle"
    border="0" src="../65/lily-23b8cebf.png" alt="[image of music]">
 </a>
</p>

   <p><a name="skips-in-lyric-mode-2.ly"></a>

<h3 class="unnumberedsec">Skips in lyric mode (2)</h3>

<p>Although <code>s</code> skips cannot be used in <code>\lyricmode</code> (it is
taken to be a literal "s", not a space), double quotes (<code>""</code>)
or underscores (<code>_</code>) are available.So for example:

<pre class="verbatim">
&lt;&lt;
  \relative c'' { a4 b c d }
  \new Lyrics \lyricmode { a4 "" _ gap }
>>
</pre>
<p>
 <a href="../d8/lily-8cca9479.ly">
  <img align="middle"
    border="0" src="../d8/lily-8cca9479.png" alt="[image of music]">
 </a>
</p>

   <p><a name="skips-in-lyric-mode.ly"></a>

<h3 class="unnumberedsec">Skips in lyric mode</h3>

<p>The <code>s</code> syntax for skips is only available in note mode and chord
mode. In other situations, for example, when entering lyrics, using the
<code>\skip</code> command is recommended.

<pre class="verbatim">
&lt;&lt;
  \relative { a'1 a }
  \new Lyrics \lyricmode { \skip 1 bla1 }
>>
</pre>
<p>
 <a href="../20/lily-845ca688.ly">
  <img align="middle"
    border="0" src="../20/lily-845ca688.png" alt="[image of music]">
 </a>
</p>

   <p><a name="three-sided-box.ly"></a>

<h3 class="unnumberedsec">Three-sided box</h3>

<p>This example shows how to add a markup command to get a three sided box
around some text (or other markup).

<pre class="verbatim">
% New command to add a three sided box, with sides north, west and south
% Based on the box-stencil command defined in scm/stencil.scm
% Note that you use ";" to comment a line in Scheme
#(define-public (NWS-box-stencil stencil thickness padding)
  "Add a box around STENCIL, producing a new stencil."
  (let* ((x-ext (interval-widen (ly:stencil-extent stencil 0) padding))
	 (y-ext (interval-widen (ly:stencil-extent stencil 1) padding))
	 (y-rule (make-filled-box-stencil (cons 0 thickness) y-ext))
	 (x-rule (make-filled-box-stencil
		  (interval-widen x-ext thickness) (cons 0 thickness))))
;    (set! stencil (ly:stencil-combine-at-edge stencil X 1 y-rule padding))
    (set! stencil (ly:stencil-combine-at-edge stencil X -1 y-rule padding))
    (set! stencil (ly:stencil-combine-at-edge stencil Y 1 x-rule 0.0))  
    (set! stencil (ly:stencil-combine-at-edge stencil Y -1 x-rule 0.0))
    stencil))

% The corresponding markup command, based on the \box command defined 
% in scm/define-markup-commands.scm
#(define-markup-command (NWS-box layout props arg) (markup?)
  "Draw a box round @var{arg}.  Looks at @code{thickness},
@code{box-padding} and @code{font-size} properties to determine line
thickness and padding around the markup."
  
  (let* ((th (chain-assoc-get 'thickness props  0.1))
	 (size (chain-assoc-get 'font-size props 0))
	 (pad (* (magstep size)
		 (chain-assoc-get 'box-padding props 0.2)))
	 (m (interpret-markup layout props arg)))
    (NWS-box-stencil m th pad)))


% Test it:

\layout { ragged-right = ##f }

\relative c' { 
  c2^\markup { \NWS-box ABCD }
  c^\markup { \NWS-box \note #"4" #1.0 } 
}
</pre>
<p>
 <a href="../ea/lily-0cb168f8.ly">
  <img align="middle"
    border="0" src="../ea/lily-0cb168f8.png" alt="[image of music]">
 </a>
</p>

   <p><a name="using-ties-with-arpeggios.ly"></a>

<h3 class="unnumberedsec">Using ties with arpeggios</h3>

<p>Ties are sometimes used to write out arpeggios.  In this case, two tied
notes need not be consecutive.  This can be achieved by setting the
<code>tieWaitForNote</code> property to "true".  The same feature is also
useful, for example, to tie a tremolo to a chord, but in principle, it
can also be used for ordinary consecutive notes, as demonstrated in
this example.

<pre class="verbatim">
\relative c' {
  \set tieWaitForNote = ##t
  \grace { c16[~ e~ g]~ } &lt;c, e g>2
  \repeat tremolo 8 { c32~ c'~ } &lt;c c,>1
  e8~ c~ a~ f~ &lt;e' c a f>2
  \tieUp c8~ a \tieDown \tieDotted g~ c g2
}
</pre>
<p>
 <a href="../ef/lily-0d5306d7.ly">
  <img align="middle"
    border="0" src="../ef/lily-0d5306d7.png" alt="[image of music]">
 </a>
</p>

   <!-- footer_tag --><br><hr>
<div class="node">
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Expressive-marks.html#Expressive-marks">Expressive marks</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Pitches.html#Pitches">Pitches</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
</div>

<div style="background-color: #e8ffe8; padding: 2; border: #c0ffc0 1px solid;">
<p>
<font size="-1">
This page is for LilyPond-2.11.57 (development-branch).
<br>
<address>
Report errors to <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>. </address>
<br>
Your <a href="http://lilypond.org/web/devel/participating/documentation-adding">suggestions for the documentation</a> are welcome.
</font>
</p>
</div>

</BODY></html>