]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/notation/repeats.itely
Minor formatting.
[lilypond.git] / Documentation / notation / 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.12.0"
10
11 @node Repeats
12 @section Repeats
13
14 @lilypondfile[quote]{repeats-headword.ly}
15
16 Repetition is a central concept in music, and multiple notations
17 exist for repetitions.  LilyPond supports the following kinds of
18 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 of the repeat.  Alternative endings
26 (volte) are printed left to right with brackets.  This is the standard
27 notation 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 single slashes or
36 percent signs.
37
38 @item tremolo
39 This is used to write tremolo beams.
40
41 @end table
42
43
44 @menu
45 * Long repeats::
46 * Short repeats::
47 @end menu
48
49 @node Long repeats
50 @subsection Long repeats
51
52 This section discusses how to input long (usually multi-measure)
53 repeats.  The repeats can take two forms: repeats enclosed between
54 repeat signs; or written out repeats, used to input repetitious music.
55 Repeat signs can also be controlled manually.
56
57 @menu
58 * Normal repeats::
59 * Manual repeat marks::
60 * Written-out repeats::
61 @end menu
62
63 @cindex volta
64 @cindex prima volta
65 @cindex seconda volta
66 @cindex volta, prima
67 @cindex volta, seconda
68 @cindex repeat, normal
69 @cindex normal repeat
70 @cindex repeat with alternate endings
71 @cindex alternate endings
72 @funindex \repeat
73 @funindex \alternative
74 @funindex \partial
75
76 @node Normal repeats
77 @unnumberedsubsubsec Normal repeats
78
79 The syntax for a normal repeat is
80
81 @example
82 \repeat volta @var{repeatcount} @var{musicexpr}
83 @end example
84
85 @noindent
86 where @var{musicexpr} is a music expression.  Alternate endings can be
87 produced using @code{\alternative}.  In order to delimit the alternate
88 endings, the group of alternatives must be enclosed in a set of
89 braces.  If there are more repeats than there are alternate endings,
90 the earliest repeats are given the first alternative.
91
92 Normal repeats without alternate endings:
93
94 @lilypond[verbatim,quote,relative=2]
95 \repeat volta 2 { c4 d e f }
96 c2 d
97 \repeat volta 2 { d4 e f g }
98 @end lilypond
99
100 Normal repeats with alternate endings:
101
102 @lilypond[verbatim,quote,relative=2]
103 \repeat volta 4 { c4 d e f }
104 \alternative {
105   { d2 e }
106   { f2 g }
107 }
108 c1
109 @end lilypond
110
111 @warning{Do not include @code{@bs{}relative} inside a
112 @code{@bs{}repeat}.  It will cause unwanted staves to appear.
113 See @rlearning{An extra staff appears}.}
114
115 @cindex repeat with upbeat
116 @cindex upbeat in a repeat
117 @cindex anacrucis in a repeat
118 @cindex repeat with anacrucis
119 @cindex repeat with pickup
120 @cindex pickup in a repeat
121 @funindex \partial
122
123 Repeats with upbeats can be entered in two ways:
124
125 @lilypond[verbatim,quote,relative=2]
126 \partial 4
127 e |
128 \repeat volta 4 { c2 d | e2 f | }
129 \alternative {
130   { g4 g g e }
131   { a4 a a a | b2. }
132 }
133 @end lilypond
134
135 @noindent
136 or
137
138 @lilypond[verbatim,quote,relative=2]
139 \partial 4
140 \repeat volta 4 { e4 | c2 d | e2 f | }
141 \alternative {
142   { \partial 4*3 g4 g g }
143   { a4 a a a | b2. }
144 }
145 @end lilypond
146
147
148 @cindex repeats with ties
149 @cindex alternative endings with ties
150 @cindex ties in repeats
151 @cindex ties in alternative endings
152 @funindex \repeatTie
153
154 Ties may be added to a second ending:
155
156 @lilypond[verbatim,quote,relative=2]
157 c1
158 \repeat volta 2 { c4 d e f ~ }
159 \alternative {
160   { f2 d }
161   { f2\repeatTie f, }
162 }
163 @end lilypond
164
165 @snippets
166
167 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
168 {shortening-volta-brackets.ly}
169
170 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
171 {adding-volta-brackets-to-additional-staves.ly}
172
173
174 @seealso
175 Music Glossary:
176 @rglos{repeat},
177 @rglos{volta}.
178
179 Notation Reference:
180 @ref{Bar lines},
181 @ref{Modifying context plug-ins}.
182
183 Snippets:
184 @rlsr{Repeats}.
185
186 Internals Reference:
187 @rinternals{VoltaBracket},
188 @rinternals{RepeatedMusic},
189 @rinternals{VoltaRepeatedMusic},
190 @rinternals{UnfoldedRepeatedMusic}.
191
192
193 @knownissues
194
195 @cindex repeat, ambiguous
196 @cindex nested repeat
197 @cindex repeat, nested
198 @cindex repeat timing information
199 @cindex repeat and measure number
200 @cindex timing information and repeats
201 @cindex measure number and repeats
202 @cindex repeat and slur
203 @cindex slur and repeat
204
205 A nested repeat like
206
207 @example
208 \repeat @dots{}
209 \repeat @dots{}
210 \alternative
211 @end example
212
213 @noindent
214 is ambiguous, since it is is not clear to which @code{\repeat} the
215 @code{\alternative} belongs.  This ambiguity is resolved by always
216 having the @code{\alternative} belong to the inner @code{\repeat}.
217 For clarity, it is advisable to use braces in such situations.
218
219 Timing information is not remembered at the start of an alternative,
220 so after a repeat timing information must be reset by hand; for
221 example, by setting @code{Score.measurePosition} or entering
222 @code{\partial}.  Similarly, slurs are also not repeated.
223
224
225
226 @node Manual repeat marks
227 @unnumberedsubsubsec Manual repeat marks
228
229 @cindex manual repeat mark
230 @cindex repeat, manual
231 @cindex start repeat
232 @cindex repeat, start
233 @cindex end repeat
234 @cindex repeat, end
235 @cindex repeat number, changing
236 @cindex repeat volta, changing
237 @cindex volta bracket
238 @cindex bracket, volta
239 @funindex repeatCommands
240 @funindex start-repeat
241
242 @warning{These methods are only used for displaying unusual repeat
243 constructs, and may produce unexpected behavior.  In most cases,
244 repeats should be created using the standard @code{\\repeat} command
245 or by printing the relevant bar lines.  For more information, see
246 @ref{Bar lines}.}
247
248 The property @code{repeatCommands} can be used to control the
249 layout of repeats.  Its value is a Scheme list of repeat commands.
250
251 @table @code
252 @item start-repeat
253 Print a @code{|:} bar line.
254
255 @lilypond[verbatim,quote,relative=2]
256 c1
257 \set Score.repeatCommands = #'(start-repeat)
258 d4 e f g
259 c1
260 @end lilypond
261
262 As per standard engraving practice, repeat signs are not printed
263 at the beginning of a piece.
264
265 @item end-repeat
266 Print a @code{:|} bar line:
267
268 @lilypond[verbatim,quote,relative=2]
269 c1
270 d4 e f g
271 \set Score.repeatCommands = #'(end-repeat)
272 c1
273 @end lilypond
274
275 @item (volta @var{number}) ... (volta #f)
276 Create a new volta with the specified number.  The volta bracket must
277 be explicitly terminated, or it will not be printed.
278
279 @lilypond[verbatim,quote,relative=2]
280 f4 g a b
281 \set Score.repeatCommands = #'((volta "2"))
282 g4 a g a
283 \set Score.repeatCommands = #'((volta #f))
284 c1
285 @end lilypond
286
287 @end table
288
289 Multiple repeat commands may occur at the same point:
290
291 @lilypond[verbatim,quote,relative=2]
292 f4 g a b
293 \set Score.repeatCommands = #'((volta "2, 5") end-repeat)
294 g4 a g a
295 c1
296 \set Score.repeatCommands = #'((volta #f) (volta "95") end-repeat)
297 b1
298 \set Score.repeatCommands = #'((volta #f))
299 @end lilypond
300
301 @cindex volta bracket with text
302 @cindex text in volta bracket
303
304 Text can be included with the volta bracket.  The text can be a
305 number or numbers or markup text, see @ref{Formatting text}.  The
306 simplest way to use markup text is to define the markup first,
307 then include the markup in a Scheme list.
308
309 @lilypond[verbatim,quote]
310 voltaAdLib = \markup { 1. 2. 3... \text \italic { ad lib. } }
311 \relative c'' {
312   c1
313   \set Score.repeatCommands = #(list(list 'volta voltaAdLib) 'start-repeat)
314   c4 b d e
315   \set Score.repeatCommands = #'((volta #f) (volta "4.") end-repeat)
316   f1
317   \set Score.repeatCommands = #'((volta #f))
318 }
319 @end lilypond
320
321
322 @snippets
323
324 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
325 {printing-a-repeat-sign-at-the-beginning-of-a-piece.ly}
326
327
328 @seealso
329 Notation Reference:
330 @ref{Bar lines},
331 @ref{Formatting text}.
332
333 Snippets:
334 @rlsr{Repeats}.
335
336 Internals Reference:
337 @rinternals{VoltaBracket},
338 @rinternals{RepeatedMusic},
339 @rinternals{VoltaRepeatedMusic}.
340
341
342 @node Written-out repeats
343 @unnumberedsubsubsec Written-out repeats
344
345 @cindex written-out repeats
346 @cindex repetitious music
347 @cindex repeats, written-out
348 @cindex repeat, unfold
349 @cindex unfold music
350 @cindex unfold repeat
351 @cindex unfold repeat with alternate endings
352 @cindex unfold music with alternate endings
353 @cindex alternate ending in written-out repeats
354 @funindex unfold
355
356 By using the @code{unfold} command, repeats can be used to simplify
357 the writing out of repetitious music.  The syntax is
358
359 @example
360 \repeat unfold @var{repeatcount} @var{musicexpr}
361 @end example
362
363 @noindent
364 where @var{musicexpr} is a music expression and @var{repeatcount} is
365 the number of times @var{musicexpr} is repeated.
366
367 @lilypond[verbatim,quote,relative=2]
368 c1
369 \repeat unfold 2 { c4 d e f }
370 c1
371 @end lilypond
372
373 Unfold repeats can be made with alternate endings.  If there are
374 more repeats than there are alternate endings, the first
375 alternative ending is applied to the earliest endings.
376
377 @lilypond[verbatim,quote,relative=2]
378 c1
379 \repeat unfold 2 { g4 f e d }
380   \alternative {
381     { cis2 g' }
382     { cis,2 b }
383   }
384 c1
385 @end lilypond
386
387
388 @seealso
389 Snippets:
390 @rlsr{Repeats}.
391
392 Internals Reference:
393 @rinternals{RepeatedMusic},
394 @rinternals{UnfoldedRepeatedMusic}.
395
396
397 @node Short repeats
398 @subsection Short repeats
399
400 This section discusses how to input short repeats.  Short repeats can
401 take two basic forms: repeats of a single note to two measures,
402 represented by slashes or percent signs; and tremolos.
403
404 @menu
405 * Percent repeats::
406 * Tremolo repeats::
407 @end menu
408
409 @node Percent repeats
410 @unnumberedsubsubsec Percent repeats
411
412 @cindex percent repeats
413 @cindex measure repeats
414 @cindex repeat, percent
415 @cindex repeat, measure
416 @cindex repeat, short
417 @funindex \repeat percent
418 @funindex percent
419
420 Repeated short patterns of notes are supported.  The music is printed
421 once, and the pattern is replaced with a special sign.  Patterns that
422 are shorter than one measure are replaced by slashes, and patterns of
423 one or two measures are replaced by percent-like signs.  The syntax is
424
425 @example
426 @code{\repeat percent @var{number} @var{musicexpr}}
427 @end example
428
429 @noindent
430 where @var{musicexpr} is a music expression.
431
432 @lilypond[verbatim,quote,relative=2]
433 \repeat percent 4 { c4 }
434 \repeat percent 2 { b4 a g f }
435 \repeat percent 2 { c2 es | f4 fis g c | }
436 @end lilypond
437
438 @snippets
439
440 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
441 {percent-repeat-counter.ly}
442
443 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
444 {percent-repeat-count-visibility.ly}
445
446 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
447 {isolated-percent-repeats.ly}
448
449
450 @seealso
451 Music Glossary:
452 @rglos{percent repeat},
453 @rglos{simile}.
454
455 Snippets:
456 @rlsr{Repeats}.
457
458 Internals Reference:
459 @rinternals{RepeatSlash},
460 @rinternals{PercentRepeat},
461 @rinternals{DoublePercentRepeat},
462 @rinternals{DoublePercentRepeatCounter},
463 @rinternals{PercentRepeatCounter},
464 @rinternals{PercentRepeatedMusic}.
465
466
467 @knownissues
468
469 Only three kinds of percent repeats are supported: a single slash
470 representing a single beat (regardless of the duration of the repeated
471 notes); a single slash with dots representing one full measure; and
472 two slashes with dots crossing a bar line representing two full
473 measures.  Neither multiple slashes representing single beat repeats
474 consisting of sixteenth or shorter notes, nor two slashes with dots
475 representing single beat repeats consisting of notes of varying
476 durations, are supported.
477
478
479 @node Tremolo repeats
480 @unnumberedsubsubsec Tremolo repeats
481
482 @cindex tremolo beams
483 @cindex tremolo
484 @cindex repeat, tremolo
485 @funindex \repeat tremolo
486 @funindex tremolo
487
488 Tremolos can take two forms: alternation between two chords or two
489 notes, and rapid repetition of a single note or chord. Tremolos
490 consisting of an alternation are indicated by adding beams between the
491 notes or chords being alternated, while tremolos consisting of the
492 rapid repetition of a single note are indicated by adding beams or
493 slashes to a single note.
494
495 To place tremolo marks between notes, use @code{\repeat} with
496 tremolo style:
497
498 @lilypond[quote,verbatim,relative=2]
499 \repeat tremolo 8 { c16 d }
500 \repeat tremolo 6 { c16 d }
501 \repeat tremolo 2 { c16 d }
502 @end lilypond
503
504 The @code{\repeat tremolo} syntax expects exactly two notes within
505 the braces, and the number of repetitions must correspond to a
506 note value that can be expressed with plain or dotted notes.  Thus,
507 @code{\repeat tremolo 7} is valid and produces a double dotted
508 note, but @code{\repeat tremolo 9} is not.
509
510 The duration of the tremolo equals the duration of the
511 braced expression multiplied by the number of repeats:
512 @code{\repeat tremolo 8 @{ c16 d16 @}} gives a whole note tremolo,
513 notated as two whole notes joined by tremolo beams.
514
515 There are two ways to put tremolo marks on a single note.  The
516 @code{\repeat tremolo} syntax is also used here, in which case
517 the note should not be surrounded by braces:
518
519 @lilypond[quote,verbatim,ragged-right]
520 \repeat tremolo 4 c'16
521 @end lilypond
522
523 @cindex tremolo marks
524 @funindex tremoloFlags
525 @funindex :
526
527 The same output can be obtained by adding
528 @q{@code{:}[@var{number}]} after the note.  The number indicates
529 the duration of the subdivision, and it must be at least 8.  A
530 @var{number} value of 8 gives one line across the note stem.  If
531 the length is omitted, the last value (stored in
532 @code{tremoloFlags}) is used:
533
534 @lilypond[quote,verbatim,relative=2]
535 c2:8 c:32
536 c: c:
537 @end lilypond
538
539 @snippets
540
541 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
542 {cross-staff-tremolos.ly}
543
544
545 @seealso
546 Snippets:
547 @rlsr{Repeats}.
548
549 @cindex tremolo, cross-staff
550 @cindex cross-staff tremolo
551
552 @knownissues
553
554 Cross-staff tremolos do not work well.
555