]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/repeats.itely
Update indices from Ralph
[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.51"
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 endof 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 @funindex \repeat
69 @funindex \alternative
70 @funindex \partial
71
72 @node Normal repeats
73 @unnumberedsubsubsec Normal repeats
74
75 The syntax for a normal repeat is
76
77 @example
78 \repeat volta @var{repeatcount} @var{musicexpr}
79 @end example
80
81 where @var{musicexpr} is a music expression.  Alternate endings can be
82 produced using @code{\alternative}.  If there are more repeats than
83 there are alternate endings, the earliest repeats are given the first
84 alternative.
85
86 Normal repeats without alternate endings:
87
88 @lilypond[verbatim,quote,relative=2]
89 \repeat volta 2 { c4 d e f }
90 c2 d
91 \repeat volta 2 { d4 e f g }
92 @end lilypond
93
94 Normal repeats with alternate endings:
95
96 @lilypond[verbatim,quote,relative=2]
97 \repeat volta 4 { c4 d e f }
98 \alternative {
99   { d2 e }
100   { f2 g }
101 }
102 c1
103 @end lilypond
104
105
106 Repeats with upbeats can be entered in two ways:
107
108 @lilypond[verbatim,quote,relative=2]
109 \partial 4
110 e |
111 \repeat volta 4 { c2 d | e2 f | }
112 \alternative {
113   { g4 g g e }
114   { a4 a a a | b2. }
115 }
116 @end lilypond
117
118 @noindent
119 or
120
121 @lilypond[verbatim,quote,relative=2]
122 \partial 4 
123 \repeat volta 4 { e4 | c2 d | e2 f | }
124 \alternative {
125   { \partial 4*3 g4 g g }
126   { a4 a a a | b2. }
127 }
128 @end lilypond
129
130
131 @cindex repeats with ties
132 @cindex alternative endings with ties
133 @cindex ties in repeats
134 @cindex ties in alternative endings
135 @funindex \repeatTie
136
137 Ties may be added to a second ending:
138
139 @lilypond[verbatim,quote,relative=2]
140 c1
141 \repeat volta 2 { c4 d e f ~ }
142 \alternative {
143   { f2 d }
144   { f2\repeatTie f, }
145 }
146 @end lilypond
147
148 @snippets
149
150 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
151 {shortening-volta-brackets.ly}
152
153 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
154 {adding-volta-brackets-to-additional-staves.ly}
155
156
157 @seealso
158
159 Music Glossary: @rglos{repeat}, @rglos{volta}.
160
161 Notation Reference: @ref{Bar lines}, @ref{Modifying context plug-ins}.
162
163 Snippets: @rlsr{Repeats}.
164
165 Internals Reference: @rinternals{VoltaBracket},
166 @rinternals{RepeatedMusic}, @rinternals{VoltaRepeatedMusic},
167 @rinternals{UnfoldedRepeatedMusic}.
168
169 @knownissues
170
171 @cindex repeat, ambiguous
172
173 A nested repeat like
174
175 @example
176 \repeat @dots{}
177 \repeat @dots{}
178 \alternative
179 @end example
180
181 @noindent
182 is ambiguous, since it is is not clear to which @code{\repeat} the
183 @code{\alternative} belongs.  This ambiguity is resolved by always
184 having the @code{\alternative} belong to the inner @code{\repeat}.
185 For clarity, it is advisable to use braces in such situations.
186
187 Timing information is not remembered at the start of an alternative,
188 so after a repeat timing information must be reset by hand; for
189 example, by setting @code{Score.measurePosition} or entering
190 @code{\partial}.  Similarly, slurs are also not repeated.
191
192
193
194 @node Manual repeat marks
195 @unnumberedsubsubsec Manual repeat marks
196
197 @funindex repeatCommands
198
199 @warning{These methods are only used for displaying unusual repeat
200 constructs, and may produce unexpected behavior.  In most cases,
201 repeats should be created using the standard @code{\\repeat} command
202 or by printing the relevant bar lines.  For more information, see
203 @ref{Bar lines}.}
204
205 The property @code{repeatCommands} can be used to control the
206 layout of repeats.  Its value is a Scheme list of repeat commands.
207
208 @table @code
209 @item start-repeat
210 Print a @code{|:} bar line.
211
212 @lilypond[verbatim,quote,relative=2]
213 c1
214 \set Score.repeatCommands = #'( start-repeat )
215 d4 e f g
216 c1
217 @end lilypond
218
219 As per standard engraving practice, repeat signs are not printed
220 at the beginning of a piece.
221
222 @item end-repeat
223 Print a @code{:|} bar line:
224
225 @lilypond[verbatim,quote,relative=2]
226 c1
227 d4 e f g
228 \set Score.repeatCommands = #'( end-repeat )
229 c1
230 @end lilypond
231
232 @item (volta @var{number}) ... (volta #f)
233 Create a new volta with the specified number.  The volta bracket must
234 be explicitly terminated, or it will not be printed.
235
236 @lilypond[verbatim,quote,relative=2]
237 f4 g a b
238 \set Score.repeatCommands = #'( ( volta "2" ) )
239 g4 a g a
240 \set Score.repeatCommands = #'( ( volta #f ) )
241 c1
242 @end lilypond
243
244 @end table
245
246 Multiple repeat commands may occur at the same point:
247
248 @lilypond[verbatim,quote,relative=2]
249 f4 g a b
250 \set Score.repeatCommands = #'( ( volta "2, 5" ) end-repeat )
251 g4 a g a
252 c1
253 \set Score.repeatCommands = #'( ( volta #f ) ( volta "95" ) end-repeat )
254 b1
255 @end lilypond
256
257 Text can be included with the volta bracket.  The text can be a
258 number or numbers or markup text, see @ref{Formatting text}.  The
259 simplest way to use markup text is to define the markup first,
260 then include the the markup in a Scheme list.
261
262 @lilypond[verbatim,quote]
263 voltaAdLib = \markup { 1. 2. 3... \text \italic { ad lib. } }
264 \relative c'' {
265   c1
266   \set Score.repeatCommands = #(list (list 'volta voltaAdLib) 'start-repeat)
267   c4 b d e
268   \set Score.repeatCommands = #'((volta #f) (volta "4.") end-repeat)
269   f1
270   \set Score.repeatCommands = #'((volta #f))
271 }
272 @end lilypond
273
274
275 @snippets
276
277 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
278 {printing-a-repeat-sign-at-the-beginning-of-a-piece.ly}
279
280 @seealso
281
282 Notation Reference:
283 @ref{Bar lines},
284 @ref{Formatting text}.
285
286 Snippets:
287 @rlsr{Repeats}.
288
289 Internals Reference:
290 @rinternals{VoltaBracket},
291 @rinternals{RepeatedMusic},
292 @rinternals{VoltaRepeatedMusic}.
293
294
295 @node Written-out repeats
296 @unnumberedsubsubsec Written-out repeats
297
298 @cindex written-out repeats
299 @cindex repetitious music
300 @cindex repeats, written-out
301
302 By using the @code{unfold} command, repeats can be used to simplify
303 the writing out of repetitious music.  The syntax is
304
305 @example
306 \repeat unfold @var{repeatcount} @var{musicexpr}
307 @end example
308
309 where @var{musicexpr} is a music expression.  Unfold repeats can be
310 made with or without alternate endings.  If there are more repeats
311 than there are alternate endings, the first alternative ending is
312 applied to the earliest endings.  Unfold repeats without alternate
313 endings:
314
315 @lilypond[verbatim,quote,relative=2]
316 c1
317 \repeat unfold 2 { c4 d e f }
318 c1
319 @end lilypond
320
321 Unfold repeats with alternate endings:
322
323 @lilypond[verbatim,quote,relative=2]
324 c1
325 \repeat unfold 2 { g4 f e d }
326   \alternative {
327     { cis2 g' }
328     { cis,2 b }
329   }
330 c1
331 @end lilypond
332
333 @seealso
334
335 Snippets: @rlsr{Repeats}.
336
337 Internals Reference: @rinternals{RepeatedMusic},
338 @rinternals{UnfoldedRepeatedMusic}.
339
340 @node Short repeats
341 @subsection Short repeats
342
343 This section discusses how to input short repeats.  Short repeats can
344 take two basic forms: repeats of a single note to two measures,
345 represented by slashes or percent signs; and tremolos.
346
347 @menu
348 * Percent repeats::             
349 * Tremolo repeats::             
350 @end menu
351
352 @node Percent repeats
353 @unnumberedsubsubsec Percent repeats
354
355 @cindex percent repeats
356 @cindex measure repeats
357
358 Repeated short patterns of notes are supported.  The music is printed
359 once, and the pattern is replaced with a special sign.  Patterns that
360 are shorter than one measure are replaced by slashes, and patterns of
361 one or two measures are replaced by percent-like signs.  The syntax is
362
363 @example
364 @code{\repeat percent @var{number} @var{musicexpr}}
365 @end example
366
367 where @var{musicexpr} is a music expression. 
368
369 @lilypond[verbatim,quote,relative=2]
370 \repeat percent 4 { c4 }
371 \repeat percent 2 { b4 a g f }
372 \repeat percent 2 { c2 es | f4 fis g c | }
373 @end lilypond
374
375 @snippets
376
377 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
378 {percent-repeat-counter.ly}
379
380 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
381 {isolated-percent-repeats.ly}
382
383 @seealso
384
385 Music Glossary: @rglos{percent repeat}, @rglos{simile}.
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 @knownissues
395
396 Only three kinds of percent repeats are supported: a single slash
397 representing a single beat (regardless of the duration of the repeated
398 notes); a single slash with dots representing one full measure; and
399 two slashes with dots crossing a bar line representing two full
400 measures.  Neither multiple slashes representing single beat repeats
401 consisting of sixteenth or shorter notes, nor two slashes with dots
402 representing single beat repeats consisting of notes of varying
403 durations, are supported.
404
405
406 @node Tremolo repeats
407 @unnumberedsubsubsec Tremolo repeats
408
409 Tremolos can take two forms: alternation between two chords or two
410 notes, and rapid repetition of a single
411 note or chord. Tremolos consisting of an alternation are indicated by
412 adding beams between the notes or chords being alternated, while
413 tremolos consisting of the rapid repetition of a single note are
414 indicated by adding beams or slashes to a single note.
415
416 @cindex tremolo beams
417
418 To place tremolo marks between notes, use @code{\repeat} with
419 tremolo style:
420
421 @lilypond[quote,verbatim,relative=2]
422 \repeat tremolo 8 { c16 d }
423 \repeat tremolo 6 { c16 d }
424 \repeat tremolo 2 { c16 d }
425 @end lilypond
426
427 The @code{\repeat tremolo} syntax expects exactly two notes within
428 the braces, and the number of repetitions must correspond to a
429 note value that can be expressed with plain or dotted notes.  Thus,
430 @code{\repeat tremolo 7} is valid and produces a double dotted
431 note, but @code{\repeat tremolo 9} is not.
432
433 The duration of the tremolo equals the duration of the
434 braced expression multiplied by the number of repeats:
435 @code{\repeat tremolo 8 @{ c16 d16 @}} gives a whole note tremolo,
436 notated as two whole notes joined by tremolo beams. 
437
438 There are two ways to put tremolo marks on a single note.  The
439 @code{\repeat tremolo} syntax is also used here, in which case
440 the note should not be surrounded by braces:
441
442 @lilypond[quote,verbatim,ragged-right]
443 \repeat tremolo 4 c'16
444 @end lilypond
445
446 @cindex tremolo marks
447 @funindex tremoloFlags
448
449 The same output can be obtained by adding
450 @q{@code{:}[@var{number}]} after the note.  The number indicates
451 the duration of the subdivision, and it must be at least 8.  A
452 @var{number} value of 8 gives one line across the note stem.  If
453 the length is omitted, the last value (stored in
454 @code{tremoloFlags}) is used
455
456 @lilypond[quote,verbatim,relative=2]
457 c2:8 c:32
458 c: c:
459 @end lilypond
460
461 @seealso
462
463 Snippets: @rlsr{Repeats}.
464