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