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