]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/repeats.itely
Merge branch 'master' of ssh://kainhofer@git.sv.gnu.org/srv/git/lilypond into kainhofer
[lilypond.git] / Documentation / user / repeats.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @ignore
3     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
4
5     When revising a translation, copy the HEAD committish of the
6     version that you are working on.  See TRANSLATION for details.
7 @end ignore
8
9 @node Repeats
10 @section Repeats
11
12 @lilypondfile[ragged-right,line-width=16\cm,staffsize=16,quote]
13 {repeats-headword.ly}
14
15 Repetition is a central concept in music, and multiple notations
16 exist for repetitions. LilyPond supports the following kinds of repeats:
17
18
19 @table @code
20 @item volta
21 The repeated music is not written out but enclosed in repeat bar
22 lines.  If the repeat is at the beginning of a piece, a repeat bar
23 line is only printed at the end. Alternative endings (volte) are
24 printed, left to right with brackets.  This is the standard
25 notation for repeats with alternatives.
26
27 @item unfold
28 The repeated music is fully written out, as many times as
29 specified by @var{repeatcount}.  This is useful when
30 entering repetitious music. 
31
32 @item percent
33 Make beat or measure repeats.  These look like percent signs.
34 Percent repeats must be declared within a @code{Voice} context.
35
36 @item tremolo
37 Make tremolo beams.
38
39 @end table
40
41 LilyPond has one syntactic construct for specifying different
42 types of repeats.  The syntax is
43
44 @example
45 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
46 @end example
47
48 where @var{repeabody} is a music expression.
49
50
51 Alternative endings are entered with 
52 @funindex \alternative
53 @example
54 \alternative @{
55   @var{alternative1}
56   @var{alternative2}
57   @var{alternative3}
58   @dots{}
59 @}
60 @end example
61
62 @noindent
63 after a @code{\repeat volta} or @code{unfold} block, where each
64 @var{alternative} is a music expression.  If you give fewer
65 alternatives than @var{repeatcount}, the first alternative is assumed
66 to be played more than once.
67
68
69 @menu
70 * Writing long repeats::        
71 * Short repeats::               
72 @end menu
73
74 @node Writing long repeats
75 @subsection Writing long repeats
76
77 @menu
78 * Normal repeats::              
79 * Manual repeat marks::         
80 @end menu
81
82 @cindex volta
83 @cindex prima volta
84 @cindex seconda volta
85 @cindex volta, prima
86 @cindex volta, seconda
87 @funindex \repeat
88
89 @node Normal repeats
90 @subsubsection Normal repeats
91
92 FIXME: this example needs to go by itself.
93 @verbatim
94 \repeat volta 2 { c4 d e f }
95 @end verbatim
96
97 Normal repeats, with or without alternate repeats:
98
99 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
100 \repeat volta 2 { g f e d }
101   \alternative {
102     { cis2 g' }
103     { cis,2 b }
104   }
105 c1
106 @end lilypond
107 Repeats with upbeats:
108
109 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
110 \new Staff {
111   \partial 4 e |
112   \repeat volta 4 { c2 d2 | e2 f2 | }
113   \alternative { { g4 g g e } { a a a a | b2. } }
114 }
115 @end lilypond
116
117 @noindent
118 or
119
120 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
121 \new Staff {
122   \partial 4 
123   \repeat volta 4 { e | c2 d2 | e2 f2 | }
124   \alternative { { \partial 4*3 g4 g g } { a a a a | b2. } }
125 }
126 @end lilypond
127
128
129 @funindex \repeatTie
130
131 Ties may be added to a second ending:
132
133 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
134 c1
135 \repeat volta 2 {c4 d e f ~ }
136 \alternative { {f2 d} {f\repeatTie f,} }
137 @end lilypond
138
139 By default, the volta brackets will be drawn over all of the
140 alternative music, but it is possible to shorten them by
141 setting @code{voltaSpannerDuration}.  In the next example, the
142 bracket only lasts one measure, which is a duration of 3/4.
143
144 @lilypond[verbatim,ragged-right,quote]
145 \relative c''{
146   \time 3/4
147   c c c
148   \set Score.voltaSpannerDuration = #(ly:make-moment 3 4)
149   \repeat volta 5 { d d d }
150   \alternative { { e e e f f f }
151   { g g g } }
152 }
153 @end lilypond
154
155 The @code{Volta_engraver} by default resides in the Score context,
156 and brackets for the repeat are thus normally only printed over
157 the topmost staff.  This can be adjusted by adding
158 @code{Volta_engraver} to the Staff context where you want the
159 brackets to appear; see @ref{Modifying context plug-ins} and
160 @c @lsr{repeats,volta@/-multi@/-staff@/.ly}.
161
162 @lilypond[verbatim,ragged-right,quote]
163 \score { <<
164   \new Staff { \repeat volta 2 { c'1 } \alternative { c' } }
165   \new Staff { \repeat volta 2 { c'1 } \alternative { c' } }
166   \new Staff \with { \consists Volta_engraver } { c'2 g' e' a' }
167   \new Staff { \repeat volta 2 { c'1 } \alternative { c' } }
168  >> }
169 @end lilypond
170
171 @c Is there a way to have a final bar ("|.") at the end of the
172 @c previous line? Doesn't seem to be.
173 If you want to start a repeat at the beginning of a line and have
174 a double bar at the end of the previous line, use
175
176 @example
177 @dots{} \bar "||:" \break 
178 \repeat volta 2 @{ @dots{} 
179 @end example
180
181 see @ref{Bar lines} for more information.
182
183 @seealso
184
185 Snippets: @lsrdir{Repeats,Repeats}
186
187 Internals Reference: @internalsref{VoltaBracket},
188 @internalsref{RepeatedMusic},
189 @internalsref{VoltaRepeatedMusic}, and
190 @internalsref{UnfoldedRepeatedMusic}.
191
192 @c Examples:
193
194
195 @knownissues
196
197 @cindex repeat, ambiguous
198
199 A nested repeat like
200
201 @example
202 \repeat @dots{}
203 \repeat @dots{}
204 \alternative
205 @end example
206
207 @noindent
208 is ambiguous, since it is is not clear to which @code{\repeat} the
209 @code{\alternative} belongs.  This ambiguity is resolved by always
210 having the @code{\alternative} belong to the inner @code{\repeat}.
211 For clarity, it is advisable to use braces in such situations.
212
213 Timing information is not remembered at the start of an
214 alternative, so after a repeat timing information must be reset by
215 hand; for example, by setting @code{Score.measurePosition} or
216 entering @code{\partial}.  Similarly, slurs or ties are also not
217 repeated.
218
219
220
221 @node Manual repeat marks
222 @subsubsection Manual repeat marks
223
224 @funindex repeatCommands
225
226 @c FIXME: Markup does not work in the "text" field
227 @c And how does one change the font?
228 @c On the whole, this section needs better documentation (why the
229 @c double parentheses around the volta expressions?)
230
231 The property @code{repeatCommands} can be used to control the
232 layout of repeats.  Its value is a Scheme list of repeat commands.
233
234 @table @asis
235 @item @code{start-repeat}
236 Print a @code{|:} bar line.
237
238 @item @code{end-repeat}
239 Print a @code{:|} bar line.
240
241 @item @code{(volta @var{text})}
242 Print a volta bracket saying @var{text}.  The text can be
243 specified as a text string or as a markup text, see @ref{Text
244 markup}.  Do not forget to change the font, as the default number
245 font does not contain alphabetic characters;
246
247
248 @item @code{(volta #f)}
249 Stop a running volta bracket.
250 @end table
251
252 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
253 c4
254   \set Score.repeatCommands = #'((volta "93") end-repeat)
255 c4 c4
256   \set Score.repeatCommands = #'((volta #f))
257 c4 c4
258 @end lilypond
259
260 @c FIXME: improve visibility of bar lines link?
261
262 @seealso
263
264 Notation Reference: @ref{Bar lines}.
265
266 Snippets: @lsrdir{Repeats,Repeats}
267
268 Internals Reference: @internalsref{VoltaBracket},
269 @internalsref{RepeatedMusic}, @internalsref{VoltaRepeatedMusic},
270 and @internalsref{UnfoldedRepeatedMusic}.
271
272
273 @node Short repeats
274 @subsection Short repeats
275
276 @menu
277 * Percent repeats::             
278 * Tremolo repeats::             
279 @end menu
280
281 @node Percent repeats
282 @subsubsection Percent repeats
283
284 @cindex percent repeats
285 @cindex measure repeats
286
287 A note pattern can be repeated with the @code{\repeat percent
288 @var{number}} syntax.  The music is printed once, and the pattern
289 is replaced with a special sign.  Patterns of one and two measures
290 are replaced by percent-like signs, patterns that divide the
291 measure length are replaced by slashes.  Percent repeats must be
292 declared within a @code{Voice} context.
293
294 @lilypond[quote,verbatim,ragged-right]
295 \new Voice \relative c' {
296   \repeat percent 4 { c4 }
297   \repeat percent 2 { c2 es2 f4 fis4 g4 c4 }
298 }
299 @end lilypond
300
301 Measure repeats of more than two measures get a counter if you
302 switch on the @code{countPercentRepeats} property:
303
304 @lilypond[relative=2,fragment,quote,verbatim,ragged-right]
305 \new Voice {
306   \set countPercentRepeats = ##t
307   \repeat percent 4 { c1 }
308 }
309 @end lilypond
310
311
312 Isolated percents can also be printed.  This is done by entering a
313 multi-measure rest with a different print function:
314
315 @lilypond[fragment,verbatim,quote]
316 \override MultiMeasureRest #'stencil
317   = #ly:multi-measure-rest::percent
318 R1
319 @end lilypond
320
321
322 @seealso
323
324 Snippets: @lsrdir{Repeats,Repeats}
325
326 Internals Reference: @internalsref{RepeatSlash},
327 @internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
328 @internalsref{DoublePercentRepeatCounter},
329 @internalsref{PercentRepeatCounter},
330 @internalsref{PercentRepeatedMusic}.
331
332 @node Tremolo repeats
333 @subsubsection Tremolo repeats
334
335 @cindex tremolo beams
336
337 To place tremolo marks between notes, use @code{\repeat} with
338 tremolo style:
339
340 @lilypond[quote,verbatim,ragged-right]
341 \new Voice \relative c' {
342   \repeat tremolo 8 { c16 d16 }
343   \repeat tremolo 4 { c16 d16 }
344   \repeat tremolo 2 { c16 d16 }
345 }
346 @end lilypond
347
348 The @code{\repeat tremolo} syntax expects exactly two notes within
349 the braces, and the number of repetitions must correspond to a
350 note value that can be expressed with plain or dotted notes.  Thus,
351 @code{\repeat tremolo 7} is valid and produces a double dotted
352 note, but @code{\repeat tremolo 9} is not.
353
354 The duration of the tremolo equals the duration of the
355 braced expression multiplied by the number of repeats:
356 @code{\repeat tremolo 8 @{ c16 d16 @}} gives a whole note tremolo,
357 notated as two whole notes joined by tremolo beams. 
358
359 There are two ways to put tremolo marks on a single note.  The
360 @code{\repeat tremolo} syntax can be used even here, in which case
361 the note should not be surrounded by braces:
362
363 @lilypond[quote,verbatim,ragged-right]
364 \repeat tremolo 4 c'16
365 @end lilypond
366
367 @cindex tremolo marks
368 @funindex tremoloFlags
369
370 The same output can be obtained by adding
371 @q{@code{:}[@var{number}]} after the note.  The number indicates
372 the duration of the subdivision, and it must be at least 8.  A
373 @var{number} value of 8 gives one line across the note stem.  If
374 the length is omitted, the last value (stored in
375 @code{tremoloFlags}) is used
376
377 @lilypond[quote,ragged-right,verbatim,fragment]
378 c'2:8 c':32 | c': c': |
379 @end lilypond
380
381
382 @knownissues
383
384
385 Tremolos entered with @q{@code{:}[@var{number}]} do not carry over
386 into the MIDI output.
387
388
389 @seealso
390
391 Notation Reference: @ref{Tremolo repeats}.
392
393 Internals Reference: @internalsref{Beam},
394 @internalsref{StemTremolo}.
395
396 Snippets: @lsrdir{Repeats,Repeats}
397
398 Elsewhere: @internalsref{StemTremolo}.
399
400
401
402
403