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