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