]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/repeats.itely
Merge branch 'master' of ssh+git://git.sv.gnu.org/srv/git/lilypond
[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 { g 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 d2 | e2 f2 | }
133   \alternative { { g4 g g e } { a a a a | b2. } }
134 }
135 @end lilypond
136
137 @noindent
138 or
139
140 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
141 \new Staff {
142   \partial 4 
143   \repeat volta 4 { e | c2 d2 | e2 f2 | }
144   \alternative { { \partial 4*3 g4 g g } { a a a a | b2. } }
145 }
146 @end lilypond
147
148
149 @funindex \repeatTie
150
151 Ties may be added to a second ending:
152
153 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
154 c1
155 \repeat volta 2 {c4 d e f ~ }
156 \alternative { {f2 d} {f\repeatTie f,} }
157 @end lilypond
158
159 @snippets
160
161 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
162 {shortening-volta-brackets.ly}
163
164 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
165 {adding-volta-brackets-to-additional-staves.ly}
166
167
168 @c Is there a way to have a final bar ("|.") at the end of the
169 @c previous line? Doesn't seem to be.
170 If you want to start a repeat at the beginning of a line and have a
171 double bar at the end of the previous line, use @code{\bar}. For more
172 information, see @ref{Bar lines}.
173
174 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
175 c4 c c c
176 \bar "||:" \break 
177 \repeat volta 2 { c4 d e f }   
178 @end lilypond
179
180
181 @seealso
182
183 Music Glossary: @rglos{repeat}, @rglos{volta}.
184
185 Notation Reference: @ref{Bar lines}, @ref{Modifying context plug-ins}.
186
187 Snippets:
188 @lsrdir{Repeats,Repeats}.
189
190 Internals Reference: @internalsref{VoltaBracket},
191 @internalsref{RepeatedMusic}, @internalsref{VoltaRepeatedMusic},
192 @internalsref{UnfoldedRepeatedMusic}.
193
194 @knownissues
195
196 @cindex repeat, ambiguous
197
198 A nested repeat like
199
200 @example
201 \repeat @dots{}
202 \repeat @dots{}
203 \alternative
204 @end example
205
206 @noindent
207 is ambiguous, since it is is not clear to which @code{\repeat} the
208 @code{\alternative} belongs.  This ambiguity is resolved by always
209 having the @code{\alternative} belong to the inner @code{\repeat}.
210 For clarity, it is advisable to use braces in such situations.
211
212 Timing information is not remembered at the start of an alternative,
213 so after a repeat timing information must be reset by hand; for
214 example, by setting @code{Score.measurePosition} or entering
215 @code{\partial}.  Similarly, slurs or ties are also not repeated.
216
217
218
219 @node Manual repeat marks
220 @subsubsection Manual repeat marks
221
222 @funindex repeatCommands
223
224 @c FIXME: Markup does not work in the "text" field
225 @c And how does one change the font?
226 @c On the whole, this section needs better documentation (why the
227 @c double parentheses around the volta expressions?)
228
229 The property @code{repeatCommands} can be used to control the
230 layout of repeats.  Its value is a Scheme list of repeat commands.
231
232 @table @asis
233 @item @code{start-repeat}
234 Print a @code{|:} bar line.
235
236 @item @code{end-repeat}
237 Print a @code{:|} bar line.
238
239 @item @code{(volta @var{text})}
240 Print a volta bracket saying @var{text}.  The text can be specified as
241 a text string or as a markup text, see @ref{Formatting text}.  Do not
242 forget to change the font, as the default number font does not contain
243 alphabetic characters;
244
245
246 @item @code{(volta #f)}
247 Stop a running volta bracket.
248 @end table
249
250 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
251 c4
252 \set Score.repeatCommands = #'((volta "93") end-repeat)
253 c4 b4
254 \set Score.repeatCommands = #'((volta #f))
255 d4 e4
256 @end lilypond
257
258 @c FIXME: improve visibility of bar lines link?
259
260 @seealso
261
262 Notation Reference: @ref{Bar lines}, @ref{Formatting text}.
263
264 Snippets:
265 @lsrdir{Repeats,Repeats}.
266
267 Internals Reference: @internalsref{VoltaBracket},
268 @internalsref{RepeatedMusic}, @internalsref{VoltaRepeatedMusic}.
269
270
271 @node Written-out repeats
272 @subsubsection Written-out repeats
273
274 @cindex written-out repeats
275 @cindex repetitious music
276 @cindex repeats, written-out
277
278 By using the @code{unfold} command, repeats can be used to simplify
279 the writing out of repetitious music.  The syntax is
280
281 @example
282 \repeat unfold @var{repeatcount} @var{musicexpr}
283 @end example
284
285 where @var{musicexpr} is a music expression.  Unfold repeats can be
286 made with or without alternate endings.  Unfold repeats without
287 alternate endings:
288
289 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
290 c1
291 \repeat unfold 2 { c4 d e f }
292 c1
293 @end lilypond
294
295 Unfold repeats with alternate endings:
296
297 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
298 c1
299 \repeat unfold 2 { g4 f e d }
300   \alternative {
301     { cis2 g' }
302     { cis,2 b }
303   }
304 c1
305 @end lilypond
306
307 @seealso
308
309 Snippets:
310 @lsrdir{Repeats,Repeats}.
311
312 Internals Reference: @internalsref{RepeatedMusic},
313 @internalsref{UnfoldedRepeatedMusic}.
314
315 @node Short repeats
316 @subsection Short repeats
317
318 @menu
319 * Percent repeats::             
320 * Tremolo repeats::             
321 @end menu
322
323 @node Percent repeats
324 @subsubsection Percent repeats
325
326 @cindex percent repeats
327 @cindex measure repeats
328
329 Repeated short patterns of notes are also supported.  The music is
330 printed once, and the pattern is replaced with a special sign.
331 Patterns of one and two measures are replaced by percent-like signs,
332 patterns that are shorter than onee measure are replaced by slashes.
333 Percent repeats must be declared within a @code{Voice} context.  The
334 syntax is
335
336 @example
337 @code{\repeat percent @var{number} @var{musicexpr}}
338 @end example
339
340 where @var{musicexpr} is a music expression. 
341
342 @lilypond[quote,verbatim,ragged-right]
343 \new Voice \relative c' {
344   \repeat percent 4 { c4 }
345   \repeat percent 2 { b4 a4 g4 f4 }
346   \repeat percent 2 { c2 es2 f4 fis4 g4 c4 }
347 }
348 @end lilypond
349
350 Measure repeats of more than two measures get a counter if you
351 switch on the @code{countPercentRepeats} property:
352
353 @lilypond[relative=2,fragment,quote,verbatim,ragged-right]
354 \new Voice {
355   \set countPercentRepeats = ##t
356   \repeat percent 4 { c1 }
357 }
358 @end lilypond
359
360
361 Isolated percents can also be printed.  This is done by entering a
362 multi-measure rest with a different print function:
363
364 @lilypond[fragment,verbatim,quote]
365 \override MultiMeasureRest #'stencil
366   = #ly:multi-measure-rest::percent
367 R1
368 @end lilypond
369
370
371 @seealso
372
373 Snippets:
374 @lsrdir{Repeats,Repeats}.
375
376 Internals Reference: @internalsref{RepeatSlash},
377 @internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
378 @internalsref{DoublePercentRepeatCounter},
379 @internalsref{PercentRepeatCounter},
380 @internalsref{PercentRepeatedMusic}.
381
382 @node Tremolo repeats
383 @subsubsection Tremolo repeats
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 \new Voice \relative c' {
392   \repeat tremolo 8 { c16 d16 }
393   \repeat tremolo 4 { c16 d16 }
394   \repeat tremolo 2 { c16 d16 }
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: @internalsref{Beam},
444 @internalsref{StemTremolo}.
445
446 Snippets:
447 @lsrdir{Repeats,Repeats}.
448
449 Elsewhere: @internalsref{StemTremolo}.
450