]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/repeats.itely
Standardize on "Notation Reference: "
[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 Repetition is a central concept in music, and multiple notations
13 exist for repetitions.
14
15 @menu
16 * Writing repeats::             
17 * Other repeats::               
18 @end menu
19
20 @node Writing repeats
21 @subsection Writing repeats
22
23 Blah blah
24
25 @menu
26 * Normal repeats::              
27 * Repeat syntax::               
28 * Manual repeat commands::      
29 * Repeats and MIDI::            
30 @end menu
31
32 @node Normal repeats
33 @unnumberedsubsubsec Normal repeats
34
35 @cindex volta
36 @cindex prima volta
37 @cindex seconda volta
38 @funindex \repeat
39
40 Normal repeats, with or without alternate repeats, may be printed:
41
42 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
43 \repeat volta 2 { c4 d e f }
44 \repeat volta 2 { g f e d }
45   \alternative {
46     { cis2 g' }
47     { cis,2 b }
48   }
49 c1
50 @end lilypond
51
52 Repeats with upbeats may be created.
53
54 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
55 \new Staff {
56   \partial 4 e |
57   \repeat volta 4 { c2 d2 | e2 f2 | }
58   \alternative { { g4 g g e } { a a a a | b2. } }
59 }
60 @end lilypond
61
62 @noindent
63 or
64
65 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
66 \new Staff {
67   \partial 4 
68   \repeat volta 4 { e | c2 d2 | e2 f2 | }
69   \alternative { { \partial 4*3 g4 g g } { a a a a | b2. } }
70 }
71 @end lilypond
72
73
74 @funindex \repeatTie
75
76 Ties may be added to a second ending,
77
78 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
79 c1
80 \repeat volta 2 {c4 d e f ~ }
81 \alternative { {f2 d} {f\repeatTie f,} }
82 @end lilypond
83
84 It is possible to shorten volta brackets by setting
85 @code{voltaSpannerDuration}.  In the next example, the bracket
86 only lasts one measure, which is a duration of 3/4.
87
88 @lilypond[verbatim,ragged-right,quote]
89 \relative c''{
90   \time 3/4
91   c c c
92   \set Score.voltaSpannerDuration = #(ly:make-moment 3 4)
93   \repeat volta 5 { d d d }
94   \alternative { { e e e f f f }
95   { g g g } }
96 }
97 @end lilypond
98
99 If you want to start a repeat at the beginning of a line and have
100 a double bar at the end of the previous line, use
101
102 @example
103 @dots{} \bar "||:" \break 
104 \repeat volta 2 @{ @dots{} 
105 @end example
106
107 see @ref{Bar lines} for more information.
108
109 @seealso
110
111 Snippets: @lsrdir{repeats}
112
113 Internals Reference: @internalsref{VoltaBracket},
114 @internalsref{RepeatedMusic},
115 @internalsref{VoltaRepeatedMusic}, and
116 @internalsref{UnfoldedRepeatedMusic}.
117
118 Examples:
119
120 Brackets for the repeat are normally only printed over the topmost
121 staff.  This can be adjusted by moving @code{Volta_engraver} to
122 the Staff context where you want the brackets to appear; see
123 @ref{Modifying context plug-ins} and
124 @lsr{repeats,volta@/-multi@/-staff@/.ly}.
125
126
127 @refbugs
128
129 @cindex repeat, ambiguous
130
131 A nested repeat like
132
133 @example
134 \repeat @dots{}
135 \repeat @dots{}
136 \alternative
137 @end example
138
139 @noindent
140 is ambiguous, since it is is not clear to which @code{\repeat} the
141 @code{\alternative} belongs.  This ambiguity is resolved by always
142 having the @code{\alternative} belong to the inner @code{\repeat}.
143 For clarity, it is advisable to use braces in such situations.
144
145 Timing information is not remembered at the start of an
146 alternative, so after a repeat timing information must be reset by
147 hand; for example, by setting @code{Score.measurePosition} or
148 entering @code{\partial}.  Similarly, slurs or ties are also not
149 repeated.
150
151
152
153 @node Repeat syntax
154 @unnumberedsubsubsec Repeat syntax
155
156 @cindex repeats
157
158 LilyPond has one syntactic construct for specifying different
159 types of repeats.  The syntax is
160
161 @example
162 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
163 @end example
164
165 If you have alternative endings, you may add
166 @funindex \alternative
167 @example
168 \alternative @{
169   @var{alternative1}
170   @var{alternative2}
171   @var{alternative3}
172   @dots{}
173 @}
174 @end example
175
176 @noindent
177 where each @var{alternative} is a music expression.  If you do not
178 give enough alternatives for all of the repeats, the first
179 alternative is assumed to be played more than once.
180
181 The following types of repetition are supported
182
183 @table @code
184 @item unfold
185 Repeated music is fully written (played) out.  This is useful when
186 entering repetitious music.  This is the only kind of repeat that
187 is included in MIDI output.
188
189 @item volta
190 Repeats are not written out, but alternative endings (volte) are
191 printed, left to right with brackets.  This is the standard
192 notation for repeats with alternatives.  These are not played in
193 MIDI output by default.
194
195
196 @item tremolo
197 Make tremolo beams.  These are not played in MIDI output by
198 default.
199
200 @item percent
201 Make beat or measure repeats.  These look like percent signs.
202 These are not played in MIDI output by default.  Percent repeats
203 must be declared within a @code{Voice} context.
204
205 @end table
206
207
208 @node Manual repeat commands
209 @unnumberedsubsubsec Manual repeat commands
210
211 @funindex repeatCommands
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
225 as a text string or as a markup text, see @ref{Text markup}.  Do
226 not forget to change the font, as the default number font does not
227 contain alphabetic characters;
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 c4
237   \set Score.repeatCommands = #'((volta #f))
238 c4 c4
239 @end lilypond
240
241
242 @seealso
243
244 Snippets: @lsrdir{repeats}
245
246 Internals Reference: @internalsref{VoltaBracket},
247 @internalsref{RepeatedMusic}, @internalsref{VoltaRepeatedMusic},
248 and @internalsref{UnfoldedRepeatedMusic}.
249
250 @node Repeats and MIDI
251 @unnumberedsubsubsec Repeats and MIDI
252
253 @cindex expanding repeats
254 @funindex \unfoldRepeats
255
256 With a little bit of tweaking, all types of repeats can be present
257 in the MIDI output.  This is achieved by applying the
258 @code{\unfoldRepeats} music function.  This function changes all
259 repeats to unfold repeats.
260
261 @lilypond[quote,verbatim,fragment,line-width=8.0\cm]
262 \unfoldRepeats {
263   \repeat tremolo 8 {c'32 e' }
264   \repeat percent 2 { c''8 d'' }
265   \repeat volta 2 {c'4 d' e' f'}
266   \alternative {
267     { g' a' a' g' }
268     {f' e' d' c' }
269   }
270 }
271 \bar "|."
272 @end lilypond
273
274 When creating a score file using @code{\unfoldRepeats} for MIDI,
275 it is necessary to make two @code{\score} blocks: one for MIDI
276 (with unfolded repeats) and one for notation (with volta, tremolo,
277 and percent repeats).  For example,
278
279 @example
280 \score @{
281   @var{..music..}
282   \layout @{ .. @}
283 @}
284 \score @{
285   \unfoldRepeats @var{..music..}
286   \midi @{ .. @}
287 @}
288 @end example
289
290
291 @node Other repeats
292 @subsection Other repeats
293
294 @menu
295 * Tremolo repeats::             
296 * Tremolo subdivisions::        
297 * Measure repeats::             
298 @end menu
299
300 @node Tremolo repeats
301 @unnumberedsubsubsec Tremolo repeats
302
303 @cindex tremolo beams
304
305 To place tremolo marks between notes, use @code{\repeat} with
306 tremolo style
307
308 @lilypond[quote,verbatim,ragged-right]
309 \new Voice \relative c' {
310   \repeat tremolo 8 { c16 d16 }
311   \repeat tremolo 4 { c16 d16 }
312   \repeat tremolo 2 { c16 d16 }
313 }
314 @end lilypond
315
316 Tremolo marks can also be put on a single note.  In this case, the
317 note should not be surrounded by braces.
318
319 @lilypond[quote,verbatim,ragged-right]
320 \repeat tremolo 4 c'16
321 @end lilypond
322
323 Similar output is obtained using the tremolo subdivision,
324 described in @ref{Tremolo subdivisions}.
325
326
327 @seealso
328
329 Notation Reference: @ref{Tremolo subdivisions}, @ref{Repeats}.
330
331 Snippets: @lsrdir{repeats}
332
333 Internals Reference: @internalsref{Beam},
334 @internalsref{StemTremolo}.
335
336
337 @node Tremolo subdivisions
338 @unnumberedsubsubsec Tremolo subdivisions
339
340 @cindex tremolo marks
341 @funindex tremoloFlags
342
343 Tremolo marks can be printed on a single note by adding
344 @q{@code{:}[@var{number}]} after the note.  The number indicates
345 the duration of the subdivision, and it must be at least 8.  A
346 @var{length} value of 8 gives one line across the note stem.  If
347 the length is omitted, the last value (stored in
348 @code{tremoloFlags}) is used
349
350 @lilypond[quote,ragged-right,verbatim,fragment]
351 c'2:8 c':32 | c': c': |
352 @end lilypond
353
354
355 @refbugs
356
357 Tremolos entered in this way do not carry over into the MIDI
358 output.
359
360
361 @seealso
362
363 Notation Reference: @ref{Tremolo repeats}.
364
365 Snippets: @lsrdir{repeats}
366
367 Elsewhere: @internalsref{StemTremolo}.
368
369
370 @node Measure repeats
371 @unnumberedsubsubsec Measure repeats
372
373 @cindex percent repeats
374 @cindex measure repeats
375
376 In the @code{percent} style, a note pattern can be repeated.  It
377 is printed once, and then the pattern is replaced with a special
378 sign.  Patterns of one and two measures are replaced by
379 percent-like signs, patterns that divide the measure length are
380 replaced by slashes.  Percent repeats must be declared within a
381 @code{Voice} context.
382
383 @lilypond[quote,verbatim,ragged-right]
384 \new Voice \relative c' {
385   \repeat percent 4 { c4 }
386   \repeat percent 2 { c2 es2 f4 fis4 g4 c4 }
387 }
388 @end lilypond
389
390 Measure repeats of more than 2 measures get a counter, if you
391 switch on the @code{countPercentRepeats} property,
392
393 @lilypond[relative=2,fragment,quote,verbatim,ragged-right]
394 \new Voice {
395 \set countPercentRepeats = ##t
396   \repeat percent 4 { c1 }
397 }
398 @end lilypond
399
400
401
402 Isolated percents can also be printed.  This is done by putting a
403 multi-measure rest with a different print function,
404
405 @lilypond[fragment,verbatim,quote]
406 \override MultiMeasureRest #'stencil
407   = #ly:multi-measure-rest::percent
408 R1
409 @end lilypond
410
411
412
413
414 @seealso
415
416 Snippets: @lsrdir{repeats}
417
418 Internals Reference: @internalsref{RepeatSlash},
419 @internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
420 @internalsref{DoublePercentRepeatCounter},
421 @internalsref{PercentRepeatCounter},
422 @internalsref{PercentRepeatedMusic}.
423
424
425