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