]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/notation.itely
cd6e0a060e885b4112b1eaf74641fd220c3976a1
[lilypond.git] / Documentation / user / notation.itely
1 @c Note: -*-texinfo-*-
2 @c This file is part of lilypond.tely
3
4 @c A menu is needed before every deeper *section nesting of @node's; run
5 @c     M-x texinfo-all-menus-update
6 @c to automatically fill in these menus before saving changes
7
8 @node Notation manual
9 @chapter Notation manual
10
11 This chapter describes all the different types of notation supported
12 by LilyPond.  It is intended as a reference for users that are already
13 somewhat familiar with LilyPond.
14
15 @menu
16 * Note entry::                  
17 * Easier music entry::          
18 * Staff notation::              
19 * Polyphony::                   
20 * Beaming::                     
21 * Accidentals::                 
22 * Expressive marks::            
23 * Repeats::                     
24 * Rhythmic music::              
25 * Piano music::                 
26 * Vocal music::                 
27 * Other instrument specific notation::  
28 * Tablatures::                  
29 * Popular music::               
30 * Orchestral music::            
31 * Ancient notation::            
32 * Contemporary notation::       
33 * Educational use::             
34 @end menu
35
36 @c FIXME: Note entry vs Music entry at top level menu is confusing.
37
38 @node Note entry
39 @section Note entry
40 @cindex Note entry
41
42 This section is about basic notation elements notes, rests and
43 related constructs, such as stems, tuplets and ties.
44
45 @menu
46 * Notes::                       
47 * Pitches::                     
48 * Chromatic alterations::       
49 * Micro tones::                 
50 * Chords::                      
51 * Rests::                       
52 * Skips::                       
53 * Durations::                   
54 * Augmentation dots::           
55 * Scaling durations::           
56 * Stems::                       
57 * Ties::                        
58 * Tuplets::                     
59 @end menu
60
61
62 @node Notes
63 @subsection Notes
64
65
66 A note is printed by specifying its pitch and then its duration,
67
68 @lilypond[quote,verbatim]
69 { cis'4 d'8 e'16 c'16 }
70 @end lilypond
71
72
73 @node Pitches
74 @subsection Pitches
75
76 @cindex Pitch names
77 @cindex Note specification
78 @cindex pitches
79 @cindex entering notes
80
81 The most common syntax for pitch entry is used for standard notes and
82 @code{\chordmode} modes.  In these modes, pitches may be designated by
83 names.  The notes are specified by the letters @code{a} through
84 @code{g}.  The octave is formed with notes ranging from @code{c}
85 to @code{b}.  The pitch @code{c} is an octave below middle C and the
86 letters span the octave above that C
87
88 @lilypond[fragment,verbatim,noindent]
89 \clef bass
90 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
91 @end lilypond
92
93 @cindex note names, Dutch
94
95 A sharp is formed by adding @code{-is} to the end of a pitch name and
96 a flat is formed by adding @code{-es}.  Double sharps and double flats
97 are obtained by adding @code{-isis} or @code{-eses}.  These
98 names are the Dutch note names.  In Dutch, @code{aes} is contracted to
99 @code{as}, but both forms are accepted.  Similarly, both
100 @code{es} and @code{ees} are accepted
101
102 @lilypond[fragment,quote,verbatim,relative=2]
103 ceses4
104 ces
105 c
106 cis 
107 cisis
108 @end lilypond
109
110 There are predefined sets of note names for various other languages.
111 To use them,  include the language specific init file.  For
112 example: @code{\include "english.ly"}.  The available language files
113 and the note names they define are
114
115 @anchor{note name}
116 @anchor{note names}
117 @example 
118                         Note Names               sharp       flat
119 nederlands.ly  c   d   e   f   g   a   bes b   -is         -es
120 english.ly     c   d   e   f   g   a   bf  b   -s/-sharp   -f/-flat
121                                                -x (double)
122 deutsch.ly     c   d   e   f   g   a   b   h   -is         -es
123 norsk.ly       c   d   e   f   g   a   b   h   -iss/-is    -ess/-es
124 svenska.ly     c   d   e   f   g   a   b   h   -iss        -ess
125 italiano.ly    do  re  mi  fa  sol la  sib si  -d          -b
126 catalan.ly     do  re  mi  fa  sol la  sib si  -d/-s       -b 
127 espanol.ly     do  re  mi  fa  sol la  sib si  -s          -b 
128
129 @end example 
130
131 @cindex @code{'}
132 @cindex @code{,}
133
134
135
136 The optional octave specification takes the form of a series of
137 single quote (`@code{'}') characters or a series of comma
138 (`@code{,}') characters.  Each @code{'} raises the pitch by one
139 octave; each @code{,} lowers the pitch by an octave
140
141 @lilypond[quote,fragment,verbatim]
142 c' c'' es' g' as' gisis' ais'
143 @end lilypond
144
145 @c FIXME: we need this info (hide/unhide) somewhere in the manual, but this ain't the place.  -gp
146 @refcommands
147 Notes can be hidden and unhidden with the following commands
148
149 @cindex @code{\hideNotes}
150 @code{\hideNotes}, 
151 @cindex @code{\unHideNotes}
152 @code{\unHideNotes}.
153
154
155 @seealso
156
157 Program reference: @internalsref{NoteEvent}, and @internalsref{NoteHead}.
158
159
160
161 @node Chromatic alterations
162 @subsection Chromatic alterations
163
164 Normally accidentals are printed automatically, but you may also
165 print them manually.  A reminder accidental
166 @cindex reminder accidental
167 @cindex @code{?}
168 can be forced by adding an exclamation mark @code{!}
169 after the pitch.  A cautionary accidental
170 @cindex cautionary accidental
171 @cindex parenthesized accidental
172 (i.e. an accidental within parentheses) can be obtained by adding the
173 question mark `@code{?}' after the pitch.
174
175 @lilypond[quote,fragment,verbatim]
176 cis' cis' cis'! cis'?
177 @end lilypond
178
179
180 @seealso
181
182 The automatic production of accidentals can be tuned in many
183 ways.  For more information, refer to @ref{Automatic accidentals}.
184
185
186
187 @node Micro tones
188 @subsection Micro tones
189
190 Half-flats and half-sharps are formed by adding @code{-eh} and
191 @code{-ih}; the following is a series of Cs with increasing pitches
192
193 @cindex quarter tones
194 @cindex semi-flats, semi-sharps
195
196 @lilypond[verbatim,quote,relative=2,fragment]
197 { ceseh ceh cih cisih }
198 @end lilypond
199
200 Micro tones are also exported to the MIDI file 
201
202
203 @refbugs
204
205 There are no generally accepted standards for denoting three quarter
206 flats, so LilyPond's symbol does not conform to any standard.
207
208 @node Chords
209 @subsection Chords
210
211 A chord is formed by a enclosing a set of pitches in @code{<} and
212 @code{>}.  A chord may be followed by a duration, and a set of
213 articulations, just like simple notes
214
215 @lilypond[verbatim,fragment,quote,relative=1]
216 <c e g>4 <c>8
217 @end lilypond
218
219 @node Rests
220 @subsection Rests
221 @cindex Rests
222
223
224 @cindex @code{\rest}
225 @cindex @code{r}
226
227 Rests are entered like notes, with the note name @code{r}
228
229 @lilypond[fragment,quote,raggedright,verbatim]
230 r1 r2 r4 r8
231 @end lilypond
232
233 Whole bar rests, centered in middle of the bar,
234 must be done with multi-measure rests.  They are discussed in
235 @ref{Multi measure rests}.
236
237
238 A rest's vertical position may be explicitly specified by entering a
239 note with the @code{\rest} keyword appended.  This makes manual
240 formatting in polyphonic music easier.  Automatic rest collision
241 formatting will leave these rests alone
242
243 @lilypond[fragment,quote,raggedright,verbatim]
244 a'4\rest d'4\rest
245 @end lilypond
246
247 @seealso
248
249 Program reference: @internalsref{RestEvent}, and @internalsref{Rest}.
250
251
252 @c FIXME: naming.
253 @node Skips
254 @subsection Skips
255 @cindex Skip
256 @cindex Invisible rest
257 @cindex Space note
258
259 @cindex @code{\skip}
260 @cindex @code{s}
261 An invisible rest (also called a `skip') can be entered like a note
262 with note name `@code{s}' or with @code{\skip @var{duration}}
263
264 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
265 a4 a4 s4 a4 \skip 1 a4
266 @end lilypond
267
268 The @code{s} syntax is only available in note mode and chord mode.  In
269 other situations, for example, when entering lyrics, you should use
270 the @code{\skip} command
271
272 @lilypond[quote,raggedright,verbatim]
273 <<
274   \relative { a'2 a1 }
275   \new Lyrics \lyricmode { \skip 2 bla1 }
276 >>
277 @end lilypond
278
279 The skip command is merely an empty musical placeholder.  It does not
280 produce any output, not even transparent output.
281
282 The @code{s} skip command does create @internalsref{Staff} and
283 @internalsref{Voice} when necessary, similar to note and rest
284 commands.  For example, the following results in an empty staff.
285
286 @lilypond[quote,raggedright,verbatim]
287 { s4 } 
288 @end lilypond
289
290 The fragment @code{@{ \skip 4 @} } would produce an empty page.
291
292 @seealso
293
294 Program reference: @internalsref{SkipEvent}, @internalsref{SkipMusic}.
295
296
297
298 @node Durations
299 @subsection Durations
300
301
302 @cindex duration
303 @cindex @code{\longa}
304 @cindex @code{\breve}
305 @cindex @code{\maxima}
306
307
308 In Note, Chord, and Lyrics mode, durations are designated by numbers
309 and dots: durations are entered as their reciprocal values.  For example,
310 a quarter note is entered using a @code{4} (since it is a 1/4 note), while
311 a half note is entered using a @code{2} (since it is a 1/2 note).  For notes
312 longer than a whole you must use variables
313
314 @example 
315 c'\breve  
316 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
317 r\longa r\breve  
318 r1 r2 r4 r8 r16 r32 r64 r64 
319 @end example 
320
321 @lilypond[quote,noindent]
322 \score {
323  \relative c'' {
324     a\breve*1/2  \autoBeamOff
325     a1 a2 a4 a8 a16 a32 a64 a64 
326    \bar "empty"
327    \break
328     r\longa*1/4 r\breve  *1/2
329     r1 r2 r4 r8 r16 r32 r64 r64 
330   }
331   \paper {
332     raggedright = ##t
333     \context {
334       \Staff
335         \remove "Clef_engraver"
336         \override StaffSymbol #'transparent = ##t 
337         \override TimeSignature #'transparent = ##t
338         \override BarLine #'transparent = ##t
339         \consists "Pitch_squash_engraver"
340     }
341   }
342 }
343 @end lilypond
344
345 If the duration is omitted then it is set to the previously entered
346 duration.  The default for the first note is a quarter note.
347
348 @lilypond[quote,raggedright,verbatim,fragment]
349 {
350 a a a2 a a4 a a1 a
351
352 @end lilypond
353
354
355
356 @node Augmentation dots
357 @subsection Augmentation dots
358
359 @cindex @code{.}
360 To obtain dotted note lenghts, simply add a dot (`@code{.}') to
361 the number.  Double-dotted notes are produced in a similar way.
362
363 @lilypond[quote,fragment,verbatim]
364 a'4 b' c''4. b'8 a'4. b'4.. c''8.
365 @end lilypond
366
367 @refcommands
368
369 Dots are normally moved up to avoid staff lines, except in polyphonic
370 situations.  The following commands may be used to force a particular
371 direction manually
372
373 @cindex @code{\dotsUp}
374 @code{\dotsUp}, 
375 @cindex @code{\dotsDown}
376 @code{\dotsDown}, 
377 @cindex @code{\dotsNeutral}
378 @code{\dotsNeutral}.
379
380 @seealso
381
382 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}. 
383
384 @node Scaling durations
385 @subsection Scaling durations
386
387 You can alter the length of duration by a fraction @var{N/M}
388 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}).  This
389 will not affect the appearance of the notes or rests produced.
390
391 In the following example, the first three notes take up exactly two
392 beats, but no triplet bracket is printed.
393 @lilypond[quote,fragment,relative=2,verbatim]
394 \time 2/4
395 a4*2/3 gis4*2/3 a4*2/3
396 a4 a4 a4*2
397 b16*4 c4
398 @end lilypond
399
400
401 @seealso
402
403 This manual: @ref{Tuplets}
404
405
406 @c  TODO: I'm not certain that Stems belong here in the manual.  -gp
407 @node Stems
408 @subsection Stems
409
410 Whenever a note is found, a @internalsref{Stem} object is created
411 automatically.  For whole notes and rests, they are also created but
412 made invisible.
413
414 @refcommands
415
416 @cindex @code{\stemUp}
417 @code{\stemUp}, 
418 @cindex @code{\stemDown}
419 @code{\stemDown}, 
420 @cindex @code{\stemNeutral}
421 @code{\stemNeutral}. 
422
423
424 @node Ties
425 @subsection Ties
426
427 @cindex Tie
428 @cindex ties
429 @cindex @code{~}
430
431 A tie connects two adjacent note heads of the same pitch.  The tie in
432 effect extends the length of a note.  Ties should not be confused with
433 slurs, which indicate articulation, or phrasing slurs, which indicate
434 musical phrasing.  A tie is entered using the tilde symbol `@code{~}'
435
436 @lilypond[quote,fragment,verbatim]
437 e' ~ e' <c' e' g'> ~ <c' e' g'>
438 @end lilypond
439
440 When a tie is applied to a chord, all note heads whose pitches match
441 are connected.  When no note heads match, no ties will be created.
442
443 A tie is just a way of extending a note duration, similar to the
444 augmentation dot.  The following example shows two ways of notating
445 exactly the same concept
446 @c
447 @lilypond[quote,fragment,raggedright]
448 \time 3/4 c'2. c'2 ~ c'4
449 @end lilypond
450
451 @noindent
452 Ties are used either when the note crosses a bar line, or when dots
453 cannot be used to denote the rhythm.  When using ties, larger note
454 values should be aligned to subdivisions of the measure, eg.
455
456 @lilypond[fragment]
457 \relative {
458   r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4  
459 }
460 @end lilypond
461
462 If you need to tie a lot of notes over bars, it may be easier to use
463 automatic note splitting (see @ref{Automatic note splitting}).  This
464 mechanism automatically splits long notes, and ties them across bar
465 lines.
466
467 @refcommands
468
469
470 @cindex @code{\tieUp}
471 @code{\tieUp}, 
472 @cindex @code{\tieDown}
473 @code{\tieDown}, 
474 @cindex @code{\tieNeutral}
475 @code{\tieNeutral}, 
476 @cindex @code{\tieDotted}
477 @code{\tieDotted}, 
478 @cindex @code{\tieSolid}
479 @code{\tieSolid}.
480
481 @seealso 
482
483 In this manual: @ref{Automatic note splitting}.
484
485 Program reference: @internalsref{TieEvent}, @internalsref{Tie}.
486
487 @refbugs
488
489
490 Switching staves when a tie is active will not produce a slanted tie.
491
492 Formatting of ties is a difficult subject.  The results are often not
493 optimal. 
494
495 @node Tuplets
496 @subsection Tuplets
497
498 @cindex tuplets
499 @cindex triplets
500 @cindex @code{\times}
501
502 Tuplets are made out of a music expression by multiplying all durations
503 with a fraction
504
505 @cindex @code{\times}
506 @example
507 \times @var{fraction} @var{musicexpr}
508 @end example
509
510 @noindent
511 The duration of @var{musicexpr} will be multiplied by the fraction.
512 The fraction's denominator will be printed over the notes, optionally
513 with a bracket.  The most common tuplet is the triplet in which 3
514 notes have the length of 2, so the notes are 2/3 of their written
515 length
516
517 @lilypond[quote,fragment,verbatim]
518 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
519 @end lilypond
520
521 The property @code{tupletSpannerDuration} specifies how long each
522 bracket should last.  With this, you can make lots of tuplets while
523 typing @code{\times} only once, thus saving lots of typing.  In the next
524 example, there are two triplets shown, while @code{\times} was only
525 used once
526
527 @lilypond[quote,fragment,relative=1,raggedright,verbatim]
528 \set tupletSpannerDuration = #(ly:make-moment 1 4)
529 \times 2/3 { c'8 c c c c c }
530 @end lilypond
531
532 The format of the number is determined by the property
533 @code{tupletNumberFormatFunction}.  The default prints only the
534 denominator, but if it is set to the Scheme function
535 @code{fraction-tuplet-formatter}, @var{num}:@var{den} will be printed
536 instead.
537
538
539 @cindex @code{tupletNumberFormatFunction}
540 @cindex tuplet formatting 
541
542
543 @refcommands
544
545 @cindex @code{\tupletUp}
546 @code{\tupletUp}, 
547 @cindex @code{\tupletDown}
548 @code{\tupletDown}, 
549 @cindex @code{\tupletNeutral}
550 @code{\tupletNeutral}.
551
552 @seealso
553
554 User manual: @ref{Changing context properties on the fly} for the
555 @code{\set} command.
556
557
558 Program reference: @internalsref{TupletBracket}, and @internalsref{TimeScaledMusic}.
559
560 Examples: @inputfileref{input/regression,tuplet-nest.ly}.
561
562 @refbugs
563
564 Nested tuplets are not formatted automatically.  In this case, outer
565 tuplet brackets should be moved manually, which is demonstrated in
566 @inputfileref{input/regression,tuplet-nest.ly}.
567
568
569
570 @node Easier music entry
571 @section Easier music entry
572 @cindex Music entry
573
574 This section deals with tricks and features of the input language that
575 were added solely to help entering music and finding and correcting
576 mistakes.  There are also external tools that make debugging easier.
577 See @ref{Point and click} for more information.
578
579 It is also possible to enter and edit music using other programs, such as
580 GUI interfaces or MIDI sequencers.  Refer to the LilyPond
581 website for more information.
582
583
584 @menu
585 * Relative octaves::            
586 * Octave check::                
587 * Bar check::                   
588 * Skipping corrected music::    
589 * Automatic note splitting::    
590 @end menu
591
592
593
594
595 @node Relative octaves
596 @subsection Relative octaves
597 @cindex Relative
598 @cindex relative octave specification
599
600 Octaves are specified by adding @code{'} and @code{,} to pitch names.
601 When you copy existing music, it is easy to accidentally put a pitch
602 in the wrong octave and hard to find such an error.  The relative
603 octave mode prevents these errors by making the mistakes much
604 larger: a single error puts the rest of the piece off by one octave
605
606 @cindex @code{\relative}
607 @example
608   \relative @var{startpitch} @var{musicexpr}
609 @end example
610 or
611 @example
612   \relative @var{musicexpr}
613 @end example
614  
615 The octave of notes that appear in @var{musicexpr} are calculated as
616 follows: if no octave changing marks are used, the basic interval
617 between this and the last note is always taken to be a fourth or
618 less.  This distance is determined without regarding alterations; a
619 @code{fisis} following a @code{ceses} will be put above the
620 @code{ceses}.  In other words, a doubly-augmented fourth is considered
621 a smaller interval than a diminshed fifth, even though the fourth is
622 seven semitones while the fifth is only six semitones.
623
624 The octave changing marks @code{'} and @code{,} can be added to raise
625 or lower the pitch by an extra octave.  Upon entering relative mode,
626 an absolute starting pitch can be specified that will act as the
627 predecessor of the first note of @var{musicexpr}.  If no starting pitch
628 is specified, then middle C is used as a start.
629
630 Here is the relative mode shown in action
631 @lilypond[quote,fragment,raggedright,verbatim]
632 \relative c'' {
633   b c d c b c bes a 
634 }
635 @end lilypond
636
637 Octave changing marks are used for intervals greater than a fourth
638 @lilypond[quote,fragment,verbatim]
639 \relative c'' {
640   c g c f, c' a, e''
641 }
642 @end lilypond
643
644 If the preceding item is a chord, the first note of the chord is used
645 to determine the first note of the next chord
646
647 @lilypond[quote,fragment,verbatim]
648 \relative c' {
649   c <c e g> 
650   <c' e g>
651   <c, e' g>
652 }
653 @end lilypond
654
655 The pitch after the @code{\relative} contains a note name.
656
657
658 The relative conversion will not affect @code{\transpose},
659 @code{\chordmode} or @code{\relative} sections in its argument.  To use
660 relative within transposed music, an additional @code{\relative} must
661 be placed inside @code{\transpose}.
662
663 @node Octave check
664 @subsection Octave check
665
666
667 Octave checks make octave errors easier to correct:  a note may be
668 followed by @code{=}@var{quotes} which indicates what its absolute
669 octave should be.  In the following example,
670 @example
671 \relative c'' @{ c='' b=' d,='' @}        
672 @end example
673
674 @noindent
675 @c take care with @code, adds confusing quotes.
676 the @code{d} will generate a warning, because a @code{d''} is expected
677 (because @code{b'} to @code{d''} is only a third), but a @code{d}' is
678 found.  In the output, the octave is corrected to be a @code{d''} and
679 the next note is calculated relative to @code{d''} instead of @code{d'}.
680
681
682
683 There is also a syntax that is separate from the notes.  The syntax
684
685 @example
686 \octave @var{pitch}
687 @end example
688
689 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
690 quotes) in \relative mode.  If not, a warning is printed, and the
691 octave is corrected.
692
693 In the example below, the first check passes without incident, since
694 the @code{e} (in relative mode) is within a fifth of @code{a'}.  However,
695 the second check produces a warning, since the @code{e} is not within
696 a fifth of @code{b'}.  The warning message is printed, and the octave
697 is adjusted so that the following notes are in the correct octave
698 once again.
699
700 @example
701 \relative c' @{
702   e
703   \octave a'
704   \octave b'
705 @}
706 @end example
707
708
709 The octave of a note following an octave check is determined with
710 respect to the note preceding it.  In the next fragment, the last note
711 is a @code{a'}, above middle C.  That means that the @code{\octave}
712 check passes successfully, so the check could be deleted without changing
713 the output of the piece.
714
715 @lilypond[quote,verbatim,fragment] 
716 \relative c' {
717   e
718   \octave b
719   a        
720 }
721 @end lilypond
722
723 @node Bar check
724 @subsection Bar check
725 @cindex Bar check
726
727 @cindex bar check
728 @cindex @code{barCheckSynchronize}
729 @cindex @code{|}
730
731 Bar checks help detect errors in the durations.  A bar check is
732 entered using the bar symbol, `@code{|}'.  Whenever it is encountered
733 during interpretation, it should fall on a measure boundary.  If it
734 does not, a warning is printed.  In the next example, the second bar
735 check will signal an error
736 @example
737 \time 3/4 c2 e4 | g2 | 
738 @end example
739
740 Bar checks can also be used in lyrics, for example 
741
742 @example
743 \lyricmode @{
744   \time 2/4
745   Twin -- kle | Twin -- kle
746 @} 
747 @end example
748
749
750 @cindex @code{skipTypesetting}
751
752 Failed bar checks are caused by entering incorrect
753 durations.  Incorrect durations often completely garble up the score,
754 especially if the score is polyphonic, so a good place to start correcting
755 input is by scanning for failed bar checks and incorrect durations.  To
756 speed up this process, the @code{skipTypesetting} feature may be
757 used.  It is described in the next section.
758
759 @cindex @code{|}
760 @cindex @code{pipeSymbol}
761
762 It is also possible to redefine the meaning of @code{|}.  This is done
763 by assigning a music expression to @code{pipeSymbol},
764
765 @lilypond[quote,raggedright,verbatim]
766 pipeSymbol = \bar "||"
767
768 { c'2 c' | c'2 c }
769 @end lilypond 
770
771
772 @node Skipping corrected music
773 @subsection Skipping corrected music
774
775 The property @code{Score.skipTypesetting} can be used to switch on and
776 off typesetting completely during the interpretation phase.  When
777 typesetting is switched off, the music is processed much more
778 quickly.  This can be used to skip over the parts of a score that
779 have already been checked for errors
780
781 @lilypond[quote,fragment,raggedright,verbatim]
782 \relative c'' {
783   c8 d
784   \set Score.skipTypesetting = ##t
785   e e e e e e e e
786   \set Score.skipTypesetting = ##f
787   c d b bes a g c2 }
788 @end lilypond
789
790 In polyphonic music, @code{Score.skipTypesetting} will affect all
791 voices and staves, saving even more time.
792
793 @node Automatic note splitting
794 @subsection Automatic note splitting
795
796 Long notes can be converted automatically to tied notes.  This is done
797 by replacing the @internalsref{Note_heads_engraver} by the
798 @internalsref{Completion_heads_engraver}.
799 In the following examples, notes crossing the bar line are split and tied.
800
801
802 @lilypond[quote,fragment,verbatim,relative=1,raggedright]
803 \new Voice \with {
804   \remove "Note_heads_engraver"
805   \consists "Completion_heads_engraver"
806 } {
807   c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 
808 }
809 @end lilypond
810
811 This engraver splits all running notes at the bar line, and inserts
812 ties.  One of its uses is to debug complex scores: if the measures are
813 not entirely filled, then the ties exactly show how much each measure
814 is off.
815
816 @refbugs
817
818 Not all durations (especially those containing tuplets) can be
819 represented exactly with normal notes and dots, but the engraver will
820 not insert tuplets.
821
822 @seealso
823
824 Examples: @inputfileref{input/regression,completion-heads.ly}.
825
826 @noindent
827
828 Program reference: @internalsref{Completion_heads_engraver}.
829
830
831 @node Staff notation
832 @section Staff notation
833
834 This section describes music notation that occurs on staff level,
835 such as key signatures, clefs and time signatures.
836
837 @cindex Staff notation
838
839 @menu
840 * Staff symbol::                
841 * Key signature::               
842 * Clef::                        
843 * Ottava brackets::             
844 * Time signature::              
845 * Partial measures::            
846 * Unmetered music::             
847 * Bar lines::                   
848 * Time administration::         
849 * Controlling formatting of prefatory matter::  
850 @end menu
851
852 @node Staff symbol
853 @subsection Staff symbol
854
855 @cindex adjusting staff symbol
856
857 Notes, dynamic signs, etc. are grouped
858 with a set of horizontal lines, into a staff (plural `staves').  In our
859 system, these lines are drawn using a separate layout object called
860 staff symbol.  
861
862
863 @cindex staff lines, setting number of
864 @cindex staff lines, setting thickness of
865 @cindex thickness of staff lines, setting 
866 @cindex number of staff lines, setting 
867
868 @seealso
869
870 Program reference: @internalsref{StaffSymbol}.
871
872 Examples: @inputfileref{input/test,staff-lines.ly},
873 @inputfileref{input/test,staff-size.ly}.
874
875 @refbugs
876
877 If a staff is ended halfway a piece, the staff symbol may not end
878 exactly on the bar line.
879
880
881 @node Key signature
882 @subsection Key signature
883 @cindex Key signature
884
885 @cindex @code{\key}
886
887 The key signature indicates the scale in which a piece is played.  It
888 is denoted by a set of alterations (flats or sharps) at the start of
889 the staff.
890
891
892 Setting or changing the key signature is done with the @code{\key}
893 command
894 @example
895   @code{\key} @var{pitch} @var{type}
896 @end example
897
898 @cindex @code{\minor}
899 @cindex @code{\major}
900 @cindex @code{\minor}
901 @cindex @code{\ionian}
902 @cindex @code{\locrian}
903 @cindex @code{\aeolian}
904 @cindex @code{\mixolydian}
905 @cindex @code{\lydian}
906 @cindex @code{\phrygian}
907 @cindex @code{\dorian}
908
909 Here, @var{type} should be @code{\major} or @code{\minor} to get
910 @var{pitch}-major or @var{pitch}-minor, respectively.
911 The standard mode names @code{\ionian},
912 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
913 @code{\phrygian}, and @code{\dorian} are also defined.
914
915 This command sets the context property
916 @internalsref{Staff}.@code{keySignature}.  Non-standard key signatures
917 can be specified by setting this property directly.
918
919 Accidentals and key signatures often confuse new users, because
920 unaltered notes get natural signs depending on the key signature.  For
921 more information, see @ref{More about pitches}.
922
923 @seealso
924
925 Program reference: @internalsref{KeyChangeEvent},
926 @internalsref{KeyCancellation} and @internalsref{KeySignature}.
927
928 @cindex @code{keySignature}
929
930
931 @node Clef
932 @subsection Clef
933 @cindex @code{\clef}
934
935 The clef indicates which lines of the staff correspond to which
936 pitches.
937
938
939 The clef can be set with the @code{\clef} command
940 @lilypond[quote,fragment,verbatim]
941 { c''2 \clef alto g'2 }
942 @end lilypond
943
944 Supported clef-names include
945 @c Moved standard clefs to the top /MB
946 @table @code
947 @cindex treble clef
948 @cindex violin clef
949 @item treble, violin, G, G2
950 G clef on 2nd line
951 @item alto, C
952 @cindex alto clef 
953  C clef on 3rd line
954 @item tenor
955 @cindex tenor clef 
956  C clef on 4th line. 
957 @item bass, F
958 @cindex bass clef
959  F clef on 4th line
960 @item french
961 @cindex french clef
962  G clef on 1st line, so-called French violin clef
963 @item soprano
964 @cindex soprano clef
965  C clef on 1st line
966 @item mezzosoprano
967 @cindex mezzosoprano clef
968  C clef on 2nd line
969 @item baritone
970 @cindex baritone clef
971  C clef on 5th line
972 @item varbaritone
973 @cindex varbaritone clef
974  F clef on 3rd line
975 @item subbass
976 @cindex subbass clef
977  F clef on 5th line
978 @item percussion
979  percussion clef
980 @item tab
981  tablature clef
982 @end table
983
984 By adding @code{_8} or @code{^8} to the clef name, the clef is
985 transposed one octave down or up, respectively, and @code{_15} and
986 @code{^15} transposes by two octaves.  The argument @var{clefname}
987 must be enclosed in quotes when it contains underscores or digits.  For
988 example,
989
990
991 @cindex choral tenor clef  
992 @lilypond[quote,verbatim,fragment,relative=1]
993 \clef "G_8" c4
994 @end lilypond
995
996 This command is equivalent to setting @code{clefGlyph},
997 @code{clefPosition} (which controls the Y position of the clef),
998 @code{centralCPosition} and @code{clefOctavation}.  A clef is printed
999 when any of these properties are changed.  The following example shows
1000 possibilities when setting properties manually.
1001
1002 @lilypond[verbatim]
1003 {
1004   \set Staff.clefGlyph = #"clefs-F"
1005   \set Staff.clefPosition = #2
1006   c'4
1007   \set Staff.clefGlyph = #"clefs-G"
1008   c'4
1009   \set Staff.clefGlyph = #"clefs-C"
1010   c'4
1011   \set Staff.clefOctavation = #7 
1012   c'4
1013   \set Staff.clefOctavation = #0 
1014   \set Staff.clefPosition = #0
1015   c'4
1016   \clef "bass"
1017   c'4
1018 }
1019 @end lilypond
1020
1021
1022 @seealso
1023
1024 Program reference: @internalsref{Clef}.
1025
1026
1027
1028 @node Ottava brackets
1029 @subsection Ottava brackets
1030
1031 `Ottava' brackets introduce an extra transposition of an octave for
1032 the staff.  They are created by invoking the function
1033 @code{set-octavation}
1034
1035 @cindex ottava
1036 @cindex 15ma
1037 @cindex octavation
1038
1039 @lilypond[quote,verbatim,fragment]
1040 \relative c''' {
1041   a2 b
1042   #(set-octavation 1)
1043   a b 
1044   #(set-octavation 0)
1045   a b
1046 }
1047 @end lilypond
1048
1049 The @code{set-octavation} function also takes -1 (for 8va bassa) and 2
1050 (for 15ma) as arguments.  Internally the function sets the properties
1051 @code{ottavation} (e.g. to @code{"8va"}) and
1052 @code{centralCPosition}.  For overriding the text of the bracket, set
1053 @code{ottavation} after invoking @code{set-octavation}, i.e.,
1054
1055 @lilypond[verbatim]
1056 {
1057   #(set-octavation 1)
1058   \set Staff.ottavation = #"8"
1059   c'''
1060 }
1061 @end lilypond
1062
1063 @seealso
1064
1065 Program reference: @internalsref{OttavaBracket}.
1066
1067 Examples: @inputfileref{input/regression,ottava.ly},
1068 @inputfileref{input/regression,ottava-broken.ly}.
1069
1070 @refbugs
1071
1072 @code{set-octavation} will get confused when clef changes happen
1073 during an octavation bracket.
1074
1075
1076
1077
1078 @node Time signature
1079 @subsection Time signature
1080 @cindex Time signature
1081 @cindex meter
1082 @cindex @code{\time}
1083
1084 Time signature indicates the metrum of a piece: a regular pattern of
1085 strong and weak beats.  It is denoted by a fraction at the start of the
1086 staff.
1087
1088
1089 The time signature is set or changed by the @code{\time}
1090 command
1091 @lilypond[quote,fragment,verbatim]
1092 \time 2/4 c'2 \time 3/4 c'2. 
1093 @end lilypond
1094
1095 The symbol that is printed can be customized with the @code{style}
1096 property.  Setting it to @code{#'()} uses fraction style for 4/4 and
1097 2/2 time,
1098
1099 @lilypond[fragment,verbatim]
1100 \time 4/4 c'1
1101 \time 2/2 c'1
1102 \override Staff.TimeSignature #'style = #'()
1103 \time 4/4 c'1
1104 \time 2/2 c'1
1105 @end lilypond
1106
1107
1108
1109 There are many more options for its layout.  See @ref{Ancient time
1110 signatures} for more examples.
1111
1112
1113 This command sets the property @code{timeSignatureFraction},
1114 @code{beatLength} and @code{measureLength} in the @code{Timing}
1115 context, which is normally aliased to @internalsref{Score}.  The
1116 property @code{measureLength} determines where bar lines should be
1117 inserted, and how automatic beams should be generated.  Changing the
1118 value of @code{timeSignatureFraction} also causes the symbol to be
1119 printed.
1120
1121 More options are available through the Scheme function
1122 @code{set-time-signature}.  In combination with the
1123 @internalsref{Measure_grouping_engraver}, it will create
1124 @internalsref{MeasureGrouping} signs.  Such signs ease reading
1125 rhythmically complex modern music.  In the following example, the 9/8
1126 measure is subdivided in 2, 2, 2 and 3.  This is passed to
1127 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1128
1129 @lilypond[quote,raggedright,verbatim]
1130 \score {
1131   \relative c'' {
1132     #(set-time-signature 9 8 '(2 2 2 3))
1133     g8[ g] d[ d] g[ g] a8[( bes g]) | 
1134     #(set-time-signature 5 8 '(3 2))
1135     a4. g4
1136   }
1137   \paper {
1138     \context {
1139       \Staff
1140       \consists "Measure_grouping_engraver"
1141     }
1142   }
1143 }
1144 @end lilypond
1145
1146 @seealso
1147
1148 Program reference: @internalsref{TimeSignature}, and @internalsref{Timing_engraver}.
1149
1150
1151 @refbugs
1152
1153 Automatic beaming does not use the measure grouping specified with
1154 @code{set-time-signature}.
1155
1156 @node Partial measures
1157 @subsection Partial measures
1158 @cindex Partial
1159 @cindex anacrusis
1160 @cindex partial measure
1161 @cindex measure, partial
1162 @cindex shorten measures
1163 @cindex @code{\partial}
1164
1165 Partial measures, for example in upsteps, are entered using the
1166 @code{\partial} command
1167 @lilypond[quote,fragment,verbatim,relative=2]
1168 \partial 16*5  c16 cis d dis e | a2. c,4 | b2
1169 @end lilypond
1170
1171 The syntax for this command is 
1172 @example
1173   \partial @var{duration} 
1174 @end example
1175 This is internally translated into
1176 @example
1177   \set Timing.measurePosition = -@var{length of duration}
1178 @end example
1179 @cindex @code{|}
1180 The property @code{measurePosition} contains a rational number
1181 indicating how much of the measure has passed at this point.
1182
1183 @refbugs
1184
1185 This command does not take into account grace notes at the start of
1186 the music.  When a piece starts with graces notes in the pickup, then
1187 the @code{\partial} should follow the grace notes
1188
1189 @lilypond[verbatim,relative,fragment]
1190 {
1191   \grace f16 
1192   \partial 4
1193   g4
1194   a2 g2 
1195 }
1196 @end lilypond
1197
1198
1199 @node Unmetered music
1200 @subsection Unmetered music
1201
1202 @cindex @code{\bar}
1203
1204 Bar lines and bar numbers are calculated automatically.  For unmetered
1205 music (e.g. cadenzas), this is not desirable.  By setting
1206 @code{Score.timing} to false, this automatic timing can be switched
1207 off.  Empty bar lines,
1208
1209 @example
1210   \bar ""
1211 @end example
1212
1213 @noindent
1214 indicate where line breaks can occur.
1215
1216 @refcommands
1217
1218 @cindex @code{\cadenzaOn}
1219 @code{\cadenzaOn}, 
1220 @cindex @code{\cadenzaOff}
1221 @code{\cadenzaOff}.
1222
1223
1224
1225
1226 @node Bar lines
1227 @subsection Bar lines
1228 @cindex Bar lines
1229
1230 @cindex @code{\bar}
1231 @cindex measure lines
1232 @cindex repeat bars
1233
1234
1235 Bar lines delimit measures, but are also used to indicate repeats.
1236 Normally, they are inserted automatically.  Line breaks may only
1237 happen on bar lines.
1238
1239 Special types of bar lines can be forced with the @code{\bar} command
1240 @c
1241 @lilypond[quote,relative=2,fragment,verbatim]
1242 c4 \bar "|:" c4
1243 @end lilypond
1244
1245 The following bar types are available
1246 @lilypondfile[]{bar-lines.ly}
1247
1248 For allowing line breaks, there is a special command,
1249 @example
1250   \bar ""
1251 @end example 
1252 This will insert an invisible bar line, and allow line breaks at this
1253 point.
1254
1255 In scores with many staves, a @code{\bar} command in one staff is
1256 automatically applied to all staves.  The resulting bar lines are
1257 connected between different staves of a @internalsref{StaffGroup}
1258 @c
1259 @lilypond[quote,fragment,verbatim]
1260 <<
1261   \context StaffGroup <<
1262     \new Staff {
1263       e'4 d'
1264       \bar "||"
1265       f' e'
1266     }
1267     \new Staff { \clef bass c4 g e g }
1268   >>
1269   \new Staff { \clef bass c2 c2 }
1270 >>
1271 @end lilypond
1272
1273
1274 The command @code{\bar }@var{bartype} is a short cut for doing
1275 @code{\set Timing.whichBar = }@var{bartype}.  Whenever @code{whichBar}
1276 is set to a string, a bar line of that type is created.
1277
1278 A bar line is created whenever the @code{whichBar} property is set.
1279 At the start of a measure it is set to the contents of
1280 @code{Timing.defaultBarType}.  The contents of @code{repeatCommands} are used
1281 to override default measure bars.
1282
1283 @cindex @code{whichBar}
1284 @cindex @code{repeatCommands}
1285 @cindex @code{defaultBarType}
1286
1287 You are encouraged to use @code{\repeat} for repetitions.  See
1288 @ref{Repeats}.
1289
1290
1291
1292 @seealso
1293
1294 In this manual: @ref{Repeats}, @ref{System start delimiters}
1295
1296
1297 Program reference: @internalsref{BarLine} (created at
1298 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1299
1300 @cindex bar lines at start of system
1301 @cindex start of system
1302
1303
1304
1305 Examples: @inputfileref{input/test,bar-lines.ly},
1306
1307
1308 @node Time administration
1309 @subsection Time administration
1310
1311 Time is administered by the @internalsref{Time_signature_engraver},
1312 which usually lives in the @internalsref{Score} context.
1313 The bookkeeping deals with the following variables
1314
1315 @table @code
1316 @item currentBarNumber
1317  the measure number
1318 @item measureLength
1319   the length of the measures in the current time signature.  For a 4/4
1320   time this is 1, and for 6/8 it is 3/4.
1321 @item measurePosition
1322   the point within the measure where we currently are.  This quantity
1323   is reset to 0 whenever it exceeds @code{measureLength}.  When that happens,
1324   @code{currentBarNumber} is incremented.
1325 @item timing
1326  if set to true, the above variables are updated for every time
1327  step.  When set to false, the engraver stays in the current measure
1328  indefinitely.
1329 @end table
1330
1331 Timing can be changed by setting any of these variables explicitly.
1332 In the next example, the 4/4 time signature is printed, but
1333 @code{measureLength} is set to 5/4.  After a while, the measure is
1334 shortened by 1/8, by setting @code{measurePosition} to -3/8 at 2/4 in
1335 the measure, so the next bar line will fall at 2/4 + 3/8. 
1336
1337 @lilypond[verbatim]
1338 \relative {
1339   \set Score.measureLength = #(ly:make-moment 5 4)
1340   c1 c4
1341   c1 c4 
1342   c4 c4
1343   \set Score.measurePosition = #(ly:make-moment -3 8)
1344   b8 b b
1345   c4 c1
1346 }
1347 @end lilypond
1348
1349
1350 @node Controlling formatting of prefatory matter
1351 @subsection Controlling formatting of prefatory matter
1352
1353 TODO  Somebody needs to explain this example, but I don't know what
1354 they're trying to do, so it won't be me.  -gp
1355
1356 @lilypond[verbatim]
1357 \transpose c c' {
1358         \override Staff.Clef  #'break-visibility = #end-of-line-visible
1359         \override Staff.KeySignature  #'break-visibility = #end-of-line-visible
1360         \set Staff.explicitClefVisibility = #end-of-line-visible
1361         \set Staff.explicitKeySignatureVisibility = #end-of-line-visible
1362
1363         % We want the time sig to take space, otherwise there is not
1364         % enough white at the start of the line.
1365         %
1366         
1367         \override Staff.TimeSignature  #'transparent = ##t
1368         \set Score.defaultBarType = #"empty"
1369         
1370         c1 d e f g a b c
1371         \key d \major
1372         \break
1373
1374         % see above.
1375         \time 4/4
1376         
1377         d e fis g a b cis d 
1378         \key g \major
1379         \break
1380         \time 4/4    
1381 }
1382 @end lilypond
1383
1384
1385 @node Polyphony
1386 @section Polyphony
1387
1388 Polyphony in music refers to having more than one voice occuring in
1389 a piece of music.  Polyphony in LilyPond refers to having more than
1390 one voice on the same staff.
1391
1392 @menu
1393 * Writing polyphonic music::
1394 @end menu
1395
1396 @node Writing polyphonic music
1397 @subsection Writing polyphonic music
1398 @cindex polyphony
1399
1400 The easiest way to enter fragments with more than one voice on a staff
1401 is to split chords using the separator @code{\\}.  You can use it for
1402 small, short-lived voices or for single chords
1403
1404 @cindex @code{\\}
1405
1406 @lilypond[quote,verbatim,fragment]
1407 \context Staff \relative c'' {
1408   c4 << { f d e  } \\ { b c2 } >>
1409   c4 << g' \\ b, \\  f' \\ d >>
1410 }
1411 @end lilypond
1412
1413 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
1414 voices are sometimes called ``layers'' in other notation packages}
1415 @cindex layers
1416 to be instantiated.  They bear the names @code{"1"}, @code{"2"}, etc.  In
1417 each of these contexts, vertical direction of slurs, stems, etc. is set
1418 appropriately.
1419
1420 @cindex @code{\voiceOne}
1421 @cindex @code{\voiceFour}
1422
1423 This can also be done by instantiating @internalsref{Voice} contexts
1424 by hand, and using @code{\voiceOne}, up to @code{\voiceFour} to assign
1425 a stem directions and horizontal shift for each part
1426 @c
1427
1428 @lilypond[quote,raggedright,verbatim]
1429 \relative c''
1430 \context Staff <<
1431   \new Voice { \voiceOne cis2 b  }
1432   \new Voice { \voiceThree b4 ais ~ ais4 gis4 } 
1433   \new Voice { \voiceTwo fis4~  fis4 f ~ f  } >>
1434 @end lilypond
1435
1436 @noindent
1437 The command @code{\oneVoice} will revert back to the normal setting.
1438 @cindex @code{\oneVoice}
1439
1440
1441 Normally, note heads with a different number of dots are not merged, but
1442 when the object property @code{merge-differently-dotted} is set in
1443 the @internalsref{NoteCollision} object, they are merged
1444 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
1445 \context Voice << {
1446   g8 g8 
1447   \override Staff.NoteCollision  
1448     #'merge-differently-dotted = ##t
1449   g8 g8
1450 } \\ { g8.[ f16] g8.[ f16] } >>
1451 @end lilypond
1452
1453 Similarly, you can merge half note heads with eighth notes, by setting
1454 @code{merge-differently-headed}
1455 @lilypond[quote,fragment,relative=2,verbatim]
1456 \context Voice << {
1457   c8 c4.
1458   \override Staff.NoteCollision
1459     #'merge-differently-headed = ##t
1460 c8 c4. } \\ { c2 c2 } >>
1461 @end lilypond
1462
1463 LilyPond also vertically shifts rests that are opposite of a stem,
1464 for example
1465
1466 @lilypond[quote,raggedright,fragment,verbatim]
1467 \context Voice << c''4 \\  r4 >>
1468 @end lilypond
1469
1470
1471 @refcommands
1472
1473
1474
1475 @cindex @code{\oneVoice}
1476 @code{\oneVoice}, 
1477 @cindex @code{\voiceOne}
1478 @code{\voiceOne}, 
1479 @cindex @code{\voiceTwo}
1480 @code{\voiceTwo}, 
1481 @cindex @code{\voiceThree}
1482 @code{\voiceThree}, 
1483 @cindex @code{\voiceFour}
1484 @code{\voiceFour}.
1485
1486
1487
1488 @cindex @code{\shiftOn}
1489 @code{\shiftOn}, 
1490 @cindex @code{\shiftOnn}
1491 @code{\shiftOnn}, 
1492 @cindex @code{\shiftOnnn}
1493 @code{\shiftOnnn}, 
1494 @cindex @code{\shiftOff}
1495 @code{\shiftOff}: these commands specify in what chords of the current
1496 voice should be shifted.  The outer voices (normally: voice one and
1497 two) have @code{\shiftOff}, while the inner voices (three and four)
1498 have @code{\shiftOn}.  @code{\shiftOnn} and @code{\shiftOnnn} define
1499 further shift levels.
1500
1501
1502 When LilyPond cannot cope, the @code{force-hshift}
1503 property of the @internalsref{NoteColumn} object and pitched rests can
1504 be used to override typesetting decisions.
1505
1506 @lilypond[verbatim,raggedright]
1507 \relative <<
1508 {
1509   <d g>
1510   <d g>
1511 } \\ {
1512   <b f'>
1513   \once \override NoteColumn  #'force-hshift = #1.7
1514   <b f'>
1515 } >> 
1516 @end lilypond
1517
1518
1519
1520 @seealso
1521
1522 Program reference: the objects responsible for resolving collisions are
1523 @internalsref{NoteCollision} and @internalsref{RestCollision}.
1524
1525 Examples: 
1526 @inputfileref{input/regression,collision-dots.ly},
1527 @inputfileref{input/regression,collision-head-chords.ly},
1528 @inputfileref{input/regression,collision-heads.ly},
1529 @inputfileref{input/regression,collision-mesh.ly}, and
1530 @inputfileref{input/regression,collisions.ly}.
1531
1532
1533 @refbugs
1534
1535
1536 When using @code{merge-differently-headed} with an upstem eighth or a
1537 shorter note, and a downstem half note, the eighth note gets the wrong
1538 offset.
1539
1540 There is no support for clusters where the same note occurs with
1541 different accidentals in the same chord.  In this case, it is
1542 recommended to use enharmonic transcription, or to use special cluster
1543 notation (see @ref{Clusters}).
1544
1545 @node Beaming
1546 @section Beaming
1547
1548 Beams are used to group short notes into chunks that are aligned with
1549 the metrum.  LilyPond normally inserts beams automatically, but if you
1550 wish you may control them manually or changed how beams are automatically
1551 grouped.
1552
1553 @cindex Automatic beams
1554 @menu
1555 * Automatic beams::
1556 * Manual beams::                
1557 * Setting automatic beam behavior::  
1558 * Beam formatting::             
1559 @end menu
1560
1561 @node Automatic beams
1562 @subsection Automatic beams
1563
1564 LilyPond inserts beams automatically
1565
1566 @lilypond[quote,fragment,verbatim,relative=2]
1567 \time 2/4 c8 c c c \time 6/8 c c c c8. c16  c8
1568 @end lilypond
1569
1570 When these automatic decisions are not good enough, beaming can be
1571 entered explicitly.  It is also possible to define beaming patterns
1572 that differ from the defaults.
1573
1574 Individual notes may be marked with @code{\noBeam}, to prevent them
1575 from being beamed
1576
1577 @lilypond[quote,fragment,verbatim,relative=2]
1578 \time 2/4 c8 c\noBeam c c
1579 @end lilypond
1580
1581
1582 @seealso
1583
1584 Program reference: @internalsref{Beam}. 
1585
1586
1587 @node Manual beams
1588 @subsection Manual beams
1589 @cindex beams, manual
1590 @cindex @code{]}
1591 @cindex @code{[}
1592
1593 In some cases it may be necessary to override the automatic beaming
1594 algorithm.  For example, the autobeamer will not put beams over rests
1595 or bar lines.  Such beams are specified manually by marking the begin
1596 and end point with @code{[} and @code{]}
1597
1598 @lilypond[quote,fragment,relative=1,verbatim]
1599 {
1600   r4 r8[ g' a r8] r8 g[ | a] r8
1601 }
1602 @end lilypond
1603
1604 @cindex @code{stemLeftBeamCount}
1605
1606 Normally, beaming patterns within a beam are determined automatically.
1607 If necessary, the properties @code{stemLeftBeamCount} and
1608 @code{stemRightBeamCount} can be used to override the defaults.  If
1609 either property is set, its value will be used only once, and then it
1610 is erased
1611
1612 @lilypond[quote,fragment,relative=1,verbatim]
1613 {
1614    f8[ r16
1615       f g a]
1616    f8[ r16
1617    \set stemLeftBeamCount = #1
1618       f g a]
1619 }
1620 @end lilypond
1621 @cindex @code{stemRightBeamCount}
1622
1623
1624 The property @code{subdivideBeams} can be set in order to subdivide
1625 all 16th or shorter beams at beat positions, as defined by the
1626 @code{beatLength} property.
1627
1628
1629 @lilypond[fragment,quote,relative=2,verbatim,noindent]
1630 c16[ c c c c c c c]
1631 \set subdivideBeams = ##t
1632 c16[ c c c c c c c]
1633 \set Score.beatLength = #(ly:make-moment 1 8)
1634 c16[ c c c c c c c]
1635 @end lilypond
1636 @cindex @code{subdivideBeams}
1637
1638 Normally, line breaks are forbidden when beams cross bar lines.  This
1639 behavior can be changed by setting @code{allowBeamBreak}.
1640
1641 @cindex @code{allowBeamBreak}
1642 @cindex beams and line breaks
1643
1644 @cindex beams, kneed
1645 @cindex kneed beams
1646 @cindex auto-knee-gap
1647
1648
1649 @seealso
1650
1651 User manual: @ref{Changing context properties on the fly} for the
1652 @code{\set} command
1653
1654
1655 @refbugs
1656
1657 @cindex Frenched staves
1658 Kneed beams are inserted automatically, when a large gap is detected
1659 between the note heads.  This behavior can be tuned through the object.
1660
1661
1662 Automatically kneed cross-staff beams cannot be used together with
1663 hidden staves.  See @ref{Hiding staves}.
1664
1665 Beams do not avoid collisions with symbols around the notes, such as
1666 texts and accidentals.
1667
1668 @c FIXME.
1669
1670
1671 @node Setting automatic beam behavior
1672 @subsection Setting automatic beam behavior 
1673
1674 @cindex @code{autoBeamSettings}
1675 @cindex @code{(end * * * *)}
1676 @cindex @code{(begin * * * *)}
1677 @cindex automatic beams, tuning
1678 @cindex tuning automatic beaming
1679
1680 @c [TODO: use \applycontext]
1681
1682 In normal time signatures, automatic beams can start on any note but can
1683 only end in a few positions within the measure: beams can end on a beat,
1684 or at durations specified by the properties in
1685 @code{autoBeamSettings}.  The defaults for @code{autoBeamSettings}
1686 are defined in @file{scm/auto-beam.scm}.
1687
1688 The value of @code{autoBeamSettings} is changed with two functions,
1689 @example
1690   #(override-auto-beam-setting
1691      '(@var{be} @var{p} @var{q} @var{n} @var{m}) @var{a} @var{b}
1692      [@var{context}])
1693   #(revert-auto-beam-setting '(@var{be} @var{p} @var{q} @var{n} @var{m}))
1694 @end example
1695 Here, @var{be} is the symbol @code{begin} or @code{end}, and
1696 @var{context} is an optional context (default: @code{'Voice}).  It
1697 determines whether the rule applies to begin or end-points.  The
1698 quantity @var{p}/@var{q} refers to the length of the beamed notes (and
1699 `@code{* *}' designates notes of any length), @var{n}/@var{M} refers
1700 to a time signature (wildcards `@code{* *}' may be entered to
1701 designate all time signatures), @var{a}/@var{b} is a duration.  By
1702 default, this command changes settings for the current voice.  It is
1703 also possible to adjust settings at higher contexts, by adding a
1704 @var{context} argument.
1705
1706 For example, if automatic beams should end on every quarter note, use
1707 the following
1708 @example
1709    #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
1710 @end example
1711 Since the duration of a quarter note is 1/4 of a whole note, it is
1712 entered as @code{(ly:make-moment 1 4)}.
1713
1714 The same syntax can be used to specify beam starting points.  In this
1715 example, automatic beams can only end on a dotted quarter note
1716 @example
1717    #(override-auto-beam-setting '(end * * * *) 3 8)
1718 @end example
1719 In 4/4 time signature, this means that automatic beams could end only on
1720 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1721 3/8, has passed within the measure).
1722
1723 Rules can also be restricted to specific time signatures.  A rule that
1724 should only be applied in @var{N}/@var{M} time signature is formed by
1725 replacing the second asterisks by @var{N} and @var{M}.  For example, a
1726 rule for 6/8 time exclusively looks like
1727 @example
1728  #(override-auto-beam-setting '(begin * * 6 8) @dots{})
1729 @end example
1730
1731 If a rule should be to applied only to certain types of beams, use the
1732 first pair of asterisks.  Beams are classified according to the
1733 shortest note they contain.  For a beam ending rule that only applies
1734 to beams with 32nd notes (and no shorter notes), use @code{(end 1 32 *
1735 *)}.
1736
1737 @cindex automatic beam generation
1738 @cindex autobeam
1739 @cindex @code{autoBeaming}
1740 @cindex lyrics
1741
1742 If beams are used to indicate melismata in songs, then automatic
1743 beaming should be switched off.  This is done by setting
1744 @code{autoBeaming} to @code{#f}.
1745
1746 @refcommands
1747
1748 @cindex @code{\autoBeamOff}
1749 @code{\autoBeamOff}, 
1750 @cindex @code{\autoBeamOn}
1751 @code{\autoBeamOn}.
1752
1753
1754 @refbugs
1755
1756 If a score ends while an automatic beam has not been ended and is
1757 still accepting notes, this last beam will not be typeset at all.  The
1758 same holds polyphonic voices, entered with @code{<< @dots{} \\ @dots{}
1759 >>}.  If a polyphonic voice ends while an automatic beam is still
1760 accepting notes, it is not typeset.
1761
1762 The rules for ending a beam depend on the shortest note in a beam.
1763 So, while it is possible to have different ending rules for eight
1764 beams and sixteenth beams, a beam that contains both eight and
1765 sixteenth notes will use the rules for the sixteenth beam.
1766
1767 In the example below, the autobeamer makes eighth beams and sixteenth
1768 end at three eighths.  The third beam can only be corrected by
1769 specifying manual beaming.
1770
1771 @lilypond[quote,raggedright,fragment,relative=1]
1772 #(override-auto-beam-setting '(end * * * *) 3 8)
1773 % rather show case where it goes wrong
1774 %\time 12/8 c'8 c c c16 c c c c c c[ c c c] c8[ c] c4
1775 \time 12/8 c'8 c c c16 c c c c c c c c c c8 c c4
1776 @end lilypond
1777 It is not possible to specify beaming parameters that act differently in
1778 different parts of a measure.  This means that it is not possible to use
1779 automatic beaming in irregular meters such as @code{5/8}.
1780
1781 @node Beam formatting
1782 @subsection Beam formatting
1783
1784
1785 When a beam falls in the middle of the staff, the beams point normally
1786 down.  However, this behaviour can be altered with the
1787 @code{neutral-direction} property.
1788
1789
1790 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1791 {
1792    b8[ b]
1793   \override Beam  #'neutral-direction = #-1
1794    b[ b]
1795   \override Beam  #'neutral-direction = #1
1796    b[ b]
1797 }
1798 @end lilypond
1799
1800 @node Accidentals
1801 @section Accidentals
1802
1803 This section describes how to change the way that accidentals are
1804 inserted automatically before notes.
1805
1806 @menu
1807 * Automatic accidentals::
1808 @end menu
1809
1810 @node Automatic accidentals
1811 @subsection Automatic accidentals
1812 @cindex Automatic accidentals
1813
1814 Common rules for typesetting accidents have been placed in a
1815 function.  This function is called as follows
1816
1817 @cindex @code{set-accidental-style}
1818 @example
1819 #(set-accidental-style 'STYLE #('CONTEXT#))
1820 @end example
1821
1822 The function can take two arguments: the name of the accidental style,
1823 and an optional argument that denotes the context which should be
1824 changed.  If no context name is supplied, @code{Staff} is the default,
1825 but you may wish to apply the accidental style to a single @code{Voice}
1826 instead.
1827
1828 The following accidental styles are supported
1829 @table @code
1830 @item default
1831 This is the default typesetting behavior.  It corresponds
1832 to 18th century common practice: Accidentals are
1833 remembered to the end of the measure in which they occur and
1834 only on their own octave.
1835
1836 @item voice
1837 The normal behavior is to remember the accidentals on
1838 Staff-level.  This variable, however, typesets accidentals
1839 individually for each voice.  Apart from that, the rule is similar to
1840 @code{default}.
1841
1842 As a result, accidentals from one voice do not get canceled in other
1843 voices, which is often an unwanted result
1844
1845 @lilypond[quote,raggedright,relative=1,fragment,verbatim]
1846 \context Staff <<
1847   #(set-accidental-style 'voice)
1848   <<
1849     { es g } \\
1850     { c, e }
1851 >> >>
1852 @end lilypond
1853
1854 The @code{voice} option should be used if the voices
1855 are to be read solely by individual musicians.  If the staff is to be
1856 used by one musician (e.g. a conductor) then 
1857 @code{modern} or @code{modern-cautionary}
1858 should be used instead.
1859
1860 @item modern
1861 @cindex @code{modern} style accidentals
1862 This rule corresponds to the common practice in the 20th century.  This rule
1863 prints the same accidentals as @code{default}, but temporary
1864 accidentals also are canceled in other octaves.  Furthermore,
1865 in the same octave, they also get canceled in the following
1866 measure
1867
1868 @lilypond[quote,raggedright,fragment,verbatim]
1869 #(set-accidental-style 'modern)
1870 cis' c'' cis'2 | c'' c'
1871 @end lilypond
1872
1873 @item @code{modern-cautionary}
1874 @cindex @code{modern-cautionary}
1875 This rule is similar to @code{modern}, but the ``extra'' accidentals
1876 (the ones not typeset by @code{default}) are typeset as cautionary
1877 accidentals.  They are printed in reduced size or with parentheses
1878 @lilypond[quote,raggedright,fragment,verbatim]
1879 #(set-accidental-style 'modern-cautionary)
1880 cis' c'' cis'2 | c'' c'
1881 @end lilypond
1882
1883 @cindex @code{modern-voice}
1884 @item modern-voice
1885 This rule is used for multivoice accidentals to be read both by musicians
1886 playing one voice and musicians playing all voices.  Accidentals are
1887 typeset for each voice, but they @emph{are} canceled across voices in
1888 the same @internalsref{Staff}.
1889
1890 @cindex @code{modern-voice-cautionary}
1891 @item modern-voice-cautionary
1892 This rule is the same as @code{modern-voice}, but with the extra
1893 accidentals (the ones not typeset by @code{voice}) typeset
1894 as cautionaries.  Even though all accidentals typeset by
1895 @code{default} @emph{are} typeset by this variable then
1896 some of them are typeset as cautionaries.
1897
1898 @item piano
1899 @cindex @code{piano} accidentals
1900 This rule reflects 20th century practice for piano notation.  Very similar to
1901 @code{modern} but accidentals also get canceled
1902 across the staves in the same @internalsref{GrandStaff} or
1903 @internalsref{PianoStaff}.
1904
1905 @item piano-cautionary
1906 @cindex @code{#(set-accidental-style 'piano-cautionary)}
1907 As @code{#(set-accidental-style 'piano)} but with the extra accidentals
1908 typeset as cautionaries.
1909
1910 @item no-reset
1911 @cindex @code{no-reset} accidental style
1912 This is the same as @code{default} but with accidentals lasting
1913 ``forever'' and not only until the next measure
1914 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
1915 #(set-accidental-style 'no-reset)
1916 c1 cis cis c
1917 @end lilypond
1918
1919 @item forget
1920 This is sort of the opposite of @code{no-reset}: Accidentals
1921 are not remembered at all---and hence all accidentals are
1922 typeset relative to the key signature, regardless of what was
1923 before in the music
1924       
1925 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
1926 #(set-accidental-style 'forget)
1927 \key d\major c4 c cis cis d d dis dis
1928 @end lilypond
1929 @end table
1930
1931
1932 @seealso
1933
1934 Program reference: @internalsref{Accidental_engraver},
1935 @internalsref{Accidental}, and @internalsref{AccidentalPlacement}.
1936
1937
1938 @refbugs
1939
1940 Simultaneous notes are considered to be entered in sequential
1941 mode.  This means that in a chord the accidentals are typeset as if the
1942 notes in the chord happened once at a time - in the order in which
1943 they appear in the input file.
1944
1945 This is a problem when accidentals in a chord depend on each other,
1946 which does not happen for the default accidental style.  The problem
1947 can be solved by manually inserting @code{!} and @code{?}  for the
1948 problematic notes.
1949
1950
1951 @node Expressive marks
1952 @section Expressive marks
1953
1954
1955 @c todo: should change ordering
1956 @c where to put text spanners, metronome marks,
1957 @c fingering?
1958
1959 Expressive marks help musicians to bring more to the music than simple
1960 notes and rhythms.
1961
1962 @menu
1963 * Slurs::                       
1964 * Phrasing slurs::              
1965 * Breath marks::                
1966 * Metronome marks::             
1967 * Text scripts::                
1968 * Text spanners::               
1969 * Analysis brackets::           
1970 * Articulations::               
1971 * Running trills::              
1972 * Fingering instructions::      
1973 * Grace notes::                 
1974 * Glissando::                   
1975 * Dynamics::                    
1976 @end menu
1977
1978 @node Slurs
1979 @subsection Slurs
1980 @cindex Slurs
1981
1982 A slur indicates that notes are to be played bound or @emph{legato}.
1983
1984 They are entered using parentheses
1985 @lilypond[quote,relative=2,fragment,verbatim]
1986   f( g a) a8 b( a4 g2 f4)
1987   <c e>2( <b d>2)
1988 @end lilypond
1989
1990 The direction of a slur can be set with the
1991 generic commands
1992
1993 @example
1994   \override Slur #'direction = #UP
1995   \slurUp            % shortcut for the previous line 
1996 @end example
1997
1998 @noindent
1999 However, there is a convenient shorthand for forcing slur
2000 directions.  By adding @code{_} or @code{^} before the opening
2001 parentheses, the direction is also set.  For example,  
2002
2003 @lilypond[relative=2,verbatim,fragment]
2004   c4_( c)   c^( c)
2005 @end lilypond
2006
2007 Some composers write two slurs when they want legato chords.  This can
2008 be achieved in LilyPond by setting @code{doubleSlurs},
2009
2010 @lilypond[verbatim,raggedright]
2011 \relative {
2012    \set doubleSlurs = ##t
2013    <c e>4 ( <d f> <c e> <d f> )
2014 }
2015 @end lilypond  
2016
2017  
2018 @refcommands
2019
2020
2021 @cindex @code{\slurUp}
2022 @code{\slurUp}, 
2023 @cindex @code{\slurDown}
2024 @code{\slurDown}, 
2025 @cindex @code{\slurNeutral}
2026 @code{\slurNeutral}, 
2027 @cindex @code{\slurDotted}
2028 @code{\slurDotted}, 
2029 @cindex @code{\slurSolid}
2030 @code{\slurSolid}.
2031
2032 @seealso
2033
2034 Program reference: @seeinternals{Slur}, and @internalsref{SlurEvent}.
2035
2036
2037 @node Phrasing slurs
2038 @subsection Phrasing slurs
2039
2040 @cindex phrasing slurs
2041 @cindex phrasing marks
2042
2043 A phrasing slur (or phrasing mark) connects chords and is used to
2044 indicate a musical sentence.  It is written using @code{\(} and @code{\)}
2045 respectively
2046
2047 @lilypond[quote,fragment,verbatim,relative=1]
2048   \time 6/4 c'\( d( e) f( e)  d\) 
2049 @end lilypond
2050
2051 Typographically, the phrasing slur behaves almost exactly like a
2052 normal slur.  However, they are treated as different objects.  A
2053 @code{\slurUp} will have no effect on a phrasing slur; instead, use
2054 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
2055 @code{\phrasingSlurNeutral}.
2056
2057 The commands @code{\slurUp}, @code{\slurDown}, and @code{\slurNeutral}
2058 will only affect normal slurs and not phrasing slurs.
2059
2060 @refcommands
2061
2062 @cindex @code{\phrasingSlurUp}
2063 @code{\phrasingSlurUp}, 
2064 @cindex @code{\phrasingSlurDown}
2065 @code{\phrasingSlurDown}, 
2066 @cindex @code{\phrasingSlurNeutral}
2067 @code{\phrasingSlurNeutral}.
2068
2069 @seealso
2070
2071 Program reference: see also @internalsref{PhrasingSlur}, and
2072 @internalsref{PhrasingSlurEvent}.
2073
2074 @refbugs
2075
2076 Putting phrasing slurs over rests leads to spurious warnings.
2077
2078 @node Breath marks
2079 @subsection Breath marks
2080
2081 Breath marks are entered using @code{\breathe}
2082
2083
2084 @lilypond[quote,fragment,relative=1,verbatim]
2085   c'4 \breathe d4
2086 @end lilypond
2087
2088 The glyph of the breath mark can be tuned by overriding the
2089 @code{text} property of the @code{BreathingSign} layout object with
2090 any markup text.  For example,
2091 @lilypond[quote,fragment,verbatim,relative=1]
2092   c'4
2093   \override BreathingSign #'text
2094     = #(make-musicglyph-markup "scripts-rvarcomma")
2095   \breathe
2096   d4
2097 @end lilypond
2098
2099 @seealso 
2100
2101 Program reference: @internalsref{BreathingSign},
2102 @internalsref{BreathingSignEvent}.
2103
2104 Examples: @inputfileref{input/regression,breathing-sign.ly}.
2105
2106
2107 @node Metronome marks
2108 @subsection Metronome marks
2109
2110 @cindex Tempo
2111 @cindex beats per minute
2112 @cindex metronome marking
2113
2114 Metronome settings can be entered as follows
2115 @example 
2116   \tempo @var{duration} = @var{per-minute} 
2117 @end example
2118
2119 In the MIDI output, they are interpreted as a tempo change.  In the
2120 paper output, a metronome marking is printed
2121 @cindex @code{\tempo}
2122 @lilypond[quote,verbatim,fragment]
2123   \tempo 8.=120 c''1
2124 @end lilypond
2125
2126 @seealso
2127
2128 Program reference: @internalsref{MetronomeChangeEvent}.
2129   
2130
2131 @node Text scripts
2132 @subsection Text scripts
2133 @cindex Text scripts
2134
2135 @cindex text items, non-empty
2136 @cindex non-empty texts
2137
2138 It is possible to place arbitrary strings of text or markup text (see
2139 @ref{Text markup}) above or below notes by using a string
2140 @code{c^"text"}.  By default, these indications do not influence the
2141 note spacing, but by using the command @code{\fatText}, the widths
2142 will be taken into account
2143 @c
2144 @lilypond[quote,fragment,raggedright,verbatim,relative=1]
2145   c4^"longtext" \fatText c4_"longlongtext" c4
2146 @end lilypond
2147
2148 More complex formatting may also be added to a note by using the
2149 markup command,
2150 @lilypond[fragment,raggedright,verbatim]
2151   c'4^\markup { bla \bold bla }
2152 @end lilypond
2153
2154 The @code{\markup} is described in more detail in
2155 @ref{Text markup}.
2156  
2157
2158 @refcommands
2159
2160 @cindex @code{\fatText}
2161 @code{\fatText}, 
2162 @cindex @code{\emptyText}
2163 @code{\emptyText}.
2164
2165 @seealso
2166
2167 In this manual: @ref{Text markup}.
2168
2169 Program reference: @internalsref{TextScriptEvent}, @internalsref{TextScript}.
2170
2171
2172 @node Text spanners
2173 @subsection Text spanners
2174 @cindex Text spanners
2175
2176 Some performance indications, e.g. @i{rallentando} or @i{accelerando},
2177 are written as text and are extended over many measures with dotted
2178 lines.  Such texts are created using text spanners; attach
2179 @code{\startTextSpan} and @code{\stopTextSpan} to the first and last
2180 notes of the spanner.
2181
2182 The string to be printed, as well as the style, is set through object
2183 properties
2184
2185 @lilypond[quote,fragment,relative=1,verbatim]
2186   c1 
2187   \override TextSpanner #'direction = #-1
2188   \override TextSpanner #'edge-text = #'("rall " . "")
2189   c2\startTextSpan b c\stopTextSpan a
2190 @end lilypond
2191
2192
2193 @seealso
2194
2195 Internals @internalsref{TextSpanEvent},
2196 @internalsref{TextSpanner}.
2197
2198 Examples: @inputfileref{input/regression,text-spanner.ly}.
2199
2200
2201 @node Analysis brackets
2202 @subsection Analysis brackets
2203 @cindex brackets
2204 @cindex phrasing brackets
2205 @cindex musicological analysis
2206 @cindex note grouping bracket
2207
2208 Brackets are used in musical analysis to indicate structure in musical
2209 pieces.  LilyPond supports a simple form of nested horizontal
2210 brackets.  To use this, add the @internalsref{Horizontal_bracket_engraver}
2211 to @internalsref{Staff} context.  A bracket is started with
2212 @code{\startGroup} and closed with @code{\stopGroup}
2213
2214 @lilypond[quote,raggedright,verbatim]
2215 \score {
2216   \relative c'' {  
2217     c4\startGroup\startGroup
2218     c4\stopGroup
2219     c4\startGroup
2220     c4\stopGroup\stopGroup
2221   }
2222   \paper {
2223     \context {
2224       \Staff \consists "Horizontal_bracket_engraver"
2225 }}}
2226 @end lilypond
2227
2228 @seealso
2229
2230 Program reference: @internalsref{HorizontalBracket},
2231 @internalsref{NoteGroupingEvent}.
2232
2233 Examples: @inputfileref{input/regression,note-group-bracket.ly}. 
2234
2235
2236 @node Articulations
2237 @subsection Articulations
2238 @cindex Articulations
2239
2240 @cindex articulations
2241 @cindex scripts
2242 @cindex ornaments
2243
2244 A variety of symbols can appear above and below notes to indicate
2245 different characteristics of the performance.  They are added to a note
2246 by adding a dash and the character signifying the
2247 articulation.  They are demonstrated here
2248
2249 @lilypondfile[quote,raggedright]{script-abbreviations.ly}
2250
2251 The meanings of these shorthands can be changed.  See
2252 @file{ly/script-init.ly} for examples.
2253
2254
2255 The script is automatically placed, but the direction can be forced as
2256 well.  Like other pieces of LilyPond code, @code{_} will place them
2257 below the staff, and @code{^} will place them above.
2258
2259
2260 @lilypond[quote,fragment,verbatim]
2261   c''4^^ c''4_^
2262 @end lilypond
2263
2264 Other symbols can be added using the syntax
2265 @var{note}@code{\}@var{name}.  Again, they
2266 can be forced up or down using @code{^} and @code{_},
2267 e.g.
2268
2269 @lilypond[quote,verbatim,fragment,relative=2]
2270   c\fermata c^\fermata c_\fermata
2271 @end lilypond
2272
2273
2274
2275 @cindex accent
2276 @cindex marcato
2277 @cindex staccatissimo
2278 @cindex fermata
2279 @cindex stopped
2280 @cindex staccato
2281 @cindex portato
2282 @cindex tenuto
2283 @cindex upbow
2284 @cindex downbow
2285 @cindex foot marks
2286 @cindex organ pedal marks
2287 @cindex turn
2288 @cindex open
2289 @cindex flageolet
2290 @cindex reverseturn
2291 @cindex trill
2292 @cindex prall
2293 @cindex mordent
2294 @cindex prallprall
2295 @cindex prallmordent
2296 @cindex prall, up
2297 @cindex prall, down
2298 @cindex mordent
2299 @cindex thumb marking
2300 @cindex segno
2301 @cindex coda
2302 @cindex varcoda
2303
2304 Here is a chart showing all scripts available,
2305
2306 @lilypondfile[quote]{script-chart.ly}
2307
2308
2309 The vertical ordering of scripts is controlled with the
2310 @code{script-priority} property.  The lower this number, the closer it
2311 will be put to the note.  In this example, the
2312 @internalsref{TextScript} (the sharp symbol) first has the lowest
2313 priority, so it is put lowest in the first example.  In the second, the
2314 prall trill (the @internalsref{Script}) has the lowest, so it on the
2315 inside.  When two objects have the same priority, the order in which
2316 they are entered decides which one comes first.
2317
2318
2319 @lilypond[verbatim,relative=3,raggedright,fragment,quote]
2320   \once \override TextScript #'script-priority = #-100
2321   a4^\prall^\markup { \sharp }
2322     
2323   \once \override Script  #'script-priority = #-100
2324   a4^\prall^\markup { \sharp }
2325 @end lilypond
2326
2327
2328
2329
2330 @seealso
2331
2332 Program reference: @internalsref{ScriptEvent}, and @internalsref{Script}.
2333
2334 @refbugs
2335
2336 These signs appear in the printed output but have no effect on the
2337 MIDI rendering of the music.
2338
2339
2340
2341 @node  Running trills
2342 @subsection Running trills
2343
2344 Long running trills are made with @code{\startTrillSpan} and
2345 @code{\stopTrillSpan},
2346
2347
2348 @lilypond[verbatim,raggedright,relative=2,quote,fragment]
2349 \new Voice {
2350   << { c1 \startTrillSpan }
2351      { s2. \grace { d16[\stopTrillSpan e] } } >>
2352   c4 }
2353 @end lilypond
2354
2355 @refcommands
2356
2357 @code{\startTrillSpan},
2358 @cindex @code{\startTrillSpan}
2359 @code{\stopTrillSpan}.
2360 @cindex @code{\stopTrillSpan}
2361
2362 @seealso
2363
2364 Program reference: @internalsref{TrillSpanner},
2365 @internalsref{TrillSpanEvent}.
2366
2367 @node Fingering instructions
2368 @subsection Fingering instructions
2369
2370 @cindex fingering
2371
2372 Fingering instructions can be entered using
2373 @example
2374   @var{note}-@var{digit}
2375 @end example
2376 For finger changes, use markup texts
2377 @c
2378 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
2379   c4-1 c-2 c-3 c-4
2380   c^\markup { \finger "2-3" }
2381 @end lilypond
2382
2383 @cindex finger change
2384 @cindex scripts
2385 @cindex superscript
2386 @cindex subscript
2387
2388 You can use the thumb-script to indicate that a note should be
2389 played with the thumb (e.g. in cello music)
2390
2391 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
2392   <a_\thumb a'-3>8 <b_\thumb b'-3>
2393 @end lilypond
2394
2395 Fingerings for chords can also be added to individual notes
2396 of the chord by adding them after the pitches
2397 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
2398   < c-1 e-2 g-3 b-5 >4
2399 @end lilypond
2400
2401 @noindent
2402 In this case, setting @code{fingeringOrientations} will put fingerings next
2403 to note heads
2404
2405 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
2406   \set fingeringOrientations = #'(left down)
2407   <c-1 es-2 g-4 bes-5 > 4
2408   \set fingeringOrientations = #'(up right down)
2409   <c-1 es-2 g-4 bes-5 > 4
2410 @end lilypond
2411
2412 Using this feature, it is also possible to put fingering instructions
2413 very close to note heads in monophonic music,
2414
2415 @lilypond[verbatim,raggedright]
2416 {
2417   \set fingeringOrientations = #'(right)
2418   <es'-2>4
2419 }
2420 @end lilypond
2421
2422         
2423 @seealso
2424
2425 Program reference: @internalsref{FingerEvent}, and @internalsref{Fingering}.
2426
2427 Examples: @inputfileref{input/regression,finger-chords.ly}.
2428
2429
2430
2431
2432 @node Grace notes
2433 @subsection Grace notes
2434
2435
2436 @c should have blurb about accaciatura / appogiatura
2437
2438 @cindex @code{\grace}
2439 @cindex ornaments
2440 @cindex grace notes
2441
2442 Grace notes are ornaments that are written out.  The most common ones
2443 are acciaccatura, which should be played as very short.  It is denoted
2444 by a slurred small note with a slashed stem.  The appoggiatura is a
2445 grace note that takes a fixed fraction of the main note, and is
2446 denoted as a slurred note in small print without a slash.  They
2447 are entered with the commands @code{\acciaccatura} and
2448 @code{\appoggiatura}, as demonstrated in the following example
2449
2450
2451 @cindex appoggiatura
2452 @cindex acciaccatura
2453
2454 @lilypond[quote,relative=2,verbatim,fragment]
2455   b4 \acciaccatura d8 c4 \appoggiatura e8 d4
2456   \acciaccatura { g16[ f] } e4
2457 @end lilypond
2458
2459 Both are special forms of the @code{\grace} command.  By prefixing this
2460 keyword to a music expression, a new one is formed, which will be
2461 printed in a smaller font and takes up no logical time in a measure.
2462
2463 @lilypond[quote,relative=2,verbatim,fragment]
2464   c4 \grace c16 c4
2465   \grace { c16[ d16] } c2 c4
2466 @end lilypond
2467
2468 @noindent
2469 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
2470 @code{\grace} command does not start a slur.
2471
2472 Internally, timing for grace notes is done using a second, `grace'
2473 time.  Every point in time consists of two rational numbers: one
2474 denotes the logical time, one denotes the grace timing.  The above
2475 example is shown here with timing tuples
2476
2477 @lilypond[quote,raggedright]
2478 <<
2479   \relative c''{ 
2480     c4 \grace c16  c4  \grace {
2481     c16[  d16] } c2 c4
2482   }
2483   \new Lyrics \lyricmode {
2484     \override LyricText #'font-family = #'typewriter
2485     
2486     \markup { (0,0) } 4
2487     \grace { \markup {
2488       ( \fraction 1 4 ,  \fraction -1 16 ) } 16 }
2489     \markup { (\fraction 1 4 , 0 ) } 4
2490     \grace {
2491       \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
2492       \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
2493     } 
2494     \markup { ( \fraction 2 4 , 0 ) }
2495   }
2496 >>
2497 @end lilypond
2498
2499
2500 The placement of grace notes is synchronized between different staves.
2501 In the following example, there are two sixteenth graces notes for
2502 every eighth grace note
2503
2504 @lilypond[quote,relative=2,verbatim,fragment] 
2505 << \new Staff { e4 \grace { c16[ d e f] } e4 }
2506    \new Staff { c4 \grace { g8[ b] } c4 } >>
2507 @end lilypond
2508
2509
2510
2511 If you want to end a note with a grace, the standard trick is to put
2512 the grace notes after a ``space note''
2513
2514 @lilypond[quote,fragment,verbatim,relative=2]
2515 \context Voice {
2516   << { d1^\trill_( }
2517      { s2 \grace { c16[ d] } } >>
2518   c4)
2519 }
2520 @end lilypond
2521
2522 @noindent
2523 By adjusting the duration of the skip note (here it is a half-note),
2524 the space between the main-note and the grace is adjusted.
2525
2526
2527 A @code{\grace} section will introduce special typesetting settings,
2528 for example, to produce smaller type, and set directions.  Hence, when
2529 introducing layout tweaks, they should be inside the grace section,
2530 for example,
2531 @lilypond[quote,fragment,verbatim,relative=2]
2532 \new Voice {
2533   \acciaccatura {
2534     \stemDown
2535     f16->
2536     \stemNeutral
2537   }
2538   g4
2539 }
2540 @end lilypond
2541
2542 @noindent
2543 The overrides should also be reverted inside the grace section.
2544
2545 The layout of grace sections can be changed throughout the music using
2546 the function @code{add-grace-property}.  The following example
2547 undefines the Stem direction for this grace, so stems do not always
2548 point up.
2549
2550 @example
2551 \new Staff @{
2552    #(add-grace-property 'Voice 'Stem 'direction '())
2553    @dots{}
2554 @}
2555 @end example
2556
2557 @noindent
2558 Another option is to change the variables @code{startGraceMusic},
2559 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2560 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2561 @code{stopAppoggiaturaMusic}.  More information is in the file
2562 @file{ly/grace-init.ly}.
2563
2564
2565 @seealso
2566
2567 Program reference: @internalsref{GraceMusic}.
2568
2569 @refbugs
2570
2571 A score that starts with a @code{\grace} section needs an explicit
2572 @code{\context Voice} declaration, otherwise the main note and grace
2573 note end up on different staves.
2574
2575 Grace note synchronization can also lead to surprises.  Staff notation,
2576 such as key signatures, bar lines, etc. are also synchronized.  Take
2577 care when you mix staves with grace notes and staves without, for example,
2578
2579 @lilypond[quote,relative=2,verbatim,fragment]
2580 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2581    \new Staff { c4  \bar "|:"  d4 } >>
2582 @end lilypond
2583
2584 @noindent
2585 This can be remedied by inserting grace skips, for the above example
2586
2587 @example
2588 \new Staff @{ c4  \bar "|:"  \grace s16 d4 @} 
2589 @end example
2590
2591 Grace sections should only be used within sequential music
2592 expressions.  Nesting or juxtaposing grace sections is not supported,
2593 and might produce crashes or other errors.
2594
2595
2596 @node Glissando
2597 @subsection Glissando
2598 @cindex Glissando 
2599
2600 @cindex @code{\glissando}
2601
2602 A glissando is a smooth change in pitch.  It is denoted by a line or a
2603 wavy line between two notes.  It is requested by attaching 
2604 @code{\glissando} to a note
2605
2606 @lilypond[quote,fragment,relative=2,verbatim]
2607 c\glissando c'
2608 @end lilypond
2609
2610 @seealso
2611
2612 Program reference: @internalsref{Glissando}, and @internalsref{GlissandoEvent}.
2613
2614 Example files: @file{input/regression/glissando.ly}.
2615
2616  
2617
2618 @refbugs
2619
2620 Printing text over the line (such as @emph{gliss.}) is not supported.
2621
2622
2623 @node Dynamics
2624 @subsection Dynamics
2625 @cindex Dynamics
2626
2627
2628
2629 @cindex @code{\ppp}
2630 @cindex @code{\pp}
2631 @cindex @code{\p}
2632 @cindex @code{\mp}
2633 @cindex @code{\mf}
2634 @cindex @code{\f}
2635 @cindex @code{\ff}
2636 @cindex @code{\fff}
2637 @cindex @code{\ffff}
2638 @cindex @code{\fp}
2639 @cindex @code{\sf}
2640 @cindex @code{\sff}
2641 @cindex @code{\sp}
2642 @cindex @code{\spp}
2643 @cindex @code{\sfz}
2644 @cindex @code{\rfz}
2645
2646
2647 Absolute dynamic marks are specified using a command after a note
2648 @code{c4\ff}.  The available dynamic marks are @code{\ppp},
2649 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2650 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2651 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}
2652
2653 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
2654   c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2655   c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
2656 @end lilypond
2657
2658 @cindex @code{\<}
2659 @cindex @code{\>}
2660 @cindex @code{\"!}
2661
2662
2663
2664 A crescendo mark is started with @code{\<} and terminated with
2665 @code{\!}.  A decrescendo is started with @code{\>} and also terminated
2666 with @code{\!}.  Because these marks are bound to notes, if you must
2667 use spacer notes if multiple marks are needed during one note 
2668
2669 @lilypond[quote,fragment,verbatim,relative=2]
2670   c\< c\! d\> e\! 
2671   << f1 { s4 s4\< s4\! \> s4\! } >>
2672 @end lilypond
2673 This may give rise to very short hairpins.  Use @code{minimum-length}
2674 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2675 example
2676
2677 @example
2678   \override Staff.Hairpin #'minimum-length = #5
2679 @end example
2680
2681 You can also use a text saying @emph{cresc.} instead of hairpins.  Here
2682 is an example how to do it
2683
2684 @lilypond[quote,fragment,relative=2,verbatim]
2685   \setTextCresc
2686   c \< d e f\!
2687   \setHairpinCresc
2688   e\> d c b\!
2689 @end lilypond
2690
2691 @cindex crescendo
2692 @cindex decrescendo
2693
2694 You can also supply your own texts
2695 @lilypond[quote,fragment,relative=1,verbatim]
2696   \set crescendoText = \markup { \italic "cresc. poco" }
2697   \set crescendoSpanner = #'dashed-line
2698   a'2\< a a a\!\mf
2699 @end lilypond
2700
2701 @cindex diminuendo
2702
2703
2704 @refcommands
2705
2706 @cindex @code{\dynamicUp}
2707 @code{\dynamicUp}, 
2708 @cindex @code{\dynamicDown}
2709 @code{\dynamicDown}, 
2710 @cindex @code{\dynamicNeutral}
2711 @code{\dynamicNeutral}.
2712
2713 @cindex direction, of dynamics
2714
2715 @seealso
2716
2717 Program reference: @internalsref{CrescendoEvent},
2718 @internalsref{DecrescendoEvent}, and
2719 @internalsref{AbsoluteDynamicEvent}.
2720
2721 Dynamics are @internalsref{DynamicText} and @internalsref{Hairpin}
2722 objects.  Vertical positioning of these symbols is handled by the
2723 @internalsref{DynamicLineSpanner} object.
2724
2725
2726 @node Repeats
2727 @section Repeats
2728
2729 Repetition is a central concept in music, and multiple notations exist
2730 for repetitions.
2731
2732 @menu
2733 * Repeat types::
2734 * Repeat syntax::               
2735 * Repeats and MIDI::            
2736 * Manual repeat commands::      
2737 * Tremolo repeats::             
2738 * Tremolo subdivisions::        
2739 * Measure repeats::             
2740 @end menu
2741
2742 @node Repeat types
2743 @subsection Repeat types
2744
2745 @cindex repeats
2746 @cindex @code{\repeat}
2747
2748 The following types of repetition are supported
2749
2750 @table @code
2751 @item unfold
2752 Repeated music is fully written (played) out.  This is useful when
2753 entering repetitious music.  This is the only kind of repeat that
2754 is included in MIDI output.
2755
2756 @item volta
2757 Repeats are not written out, but alternative endings (volte) are
2758 printed, left to right with brackets.  This is the standard notation
2759 for repeats with alternatives.  These are not played in MIDI output by default.
2760
2761 @ignore
2762 @item fold
2763 Alternative endings are written stacked.  This has limited use but may be
2764 used to typeset two lines of lyrics in songs with repeats, see
2765 @inputfileref{input,star-spangled-banner.ly}.
2766 @end ignore
2767
2768 @c tremolo, beamed
2769 @item tremolo
2770 Make tremolo beams.  These are not played in MIDI output by default.
2771
2772 @item percent
2773 Make beat or measure repeats.  These look like percent signs.  These are not played
2774 in MIDI output by default.
2775
2776 @end table  
2777
2778 @node Repeat syntax
2779 @subsection Repeat syntax
2780
2781
2782 LilyPond has one syntactic construct for specifying different types of
2783 repeats.  The syntax is
2784
2785 @example
2786   \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2787 @end example
2788
2789 If you have alternative endings, you may add
2790 @cindex @code{\alternative}
2791 @example
2792  \alternative @code{@{} @var{alternative1}
2793             @var{alternative2}
2794             @var{alternative3} @dots{} @code{@}}
2795 @end example
2796 where each @var{alternative} is a music expression.  If you do not
2797 give enough alternatives for all of the repeats, the first alternative
2798 is assumed to be played more than once.
2799
2800 Standard repeats are used like this
2801 @lilypond[quote,fragment,verbatim,relative=2]
2802 c1
2803 \repeat volta 2 { c4 d e f }
2804 \repeat volta 2 { f e d c }
2805 @end lilypond
2806
2807 With alternative endings
2808 @lilypond[quote,fragment,verbatim,relative=2]
2809 c1
2810 \repeat volta 2 {c4 d e f} 
2811 \alternative { {d2 d} {f f,} }
2812 @end lilypond
2813
2814
2815 @lilypond[quote,fragment,verbatim,relative=2]
2816 \context Staff {
2817   \partial 4
2818   \repeat volta 4 { e | c2 d2 | e2 f2 | }
2819   \alternative { { g4 g g } { a | a a a a | b2. } }
2820 }
2821 @end lilypond
2822
2823 It is possible to shorten volta brackets
2824 by setting @code{voltaSpannerDuration}.  In the next example, the
2825 bracket only lasts one measure, which is a duration of 3/4. 
2826
2827
2828
2829 @lilypond[verbatim,raggedright]
2830 \relative c''{
2831     \time 3/4
2832     c c c 
2833     \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2834     \repeat "volta" 5 { d d d  }
2835     \alternative { { e e e f f f }
2836     { g g g } }
2837 }
2838 @end lilypond
2839         
2840
2841 @seealso
2842
2843 Examples:
2844
2845 Brackets for the repeat are normally only printed over the topmost
2846 staff.  This can be adjusted by setting the @code{voltaOnThisStaff}
2847 property @inputfileref{input/regression,volta-multi-staff.ly},
2848 @inputfileref{input/regression,volta-chord-names.ly}
2849
2850
2851 @refbugs
2852
2853 A nested repeat like
2854
2855 @example 
2856 \repeat @dots{}
2857 \repeat @dots{}
2858 \alternative 
2859 @end example 
2860
2861 @noindent
2862 is ambiguous, since it is is not clear to which @code{\repeat} the
2863 @code{\alternative} belongs.  This ambiguity is resolved by always
2864 having the @code{\alternative} belong to the inner @code{\repeat}.
2865 For clarity, it is advisable to use braces in such situations.
2866 @cindex ambiguity
2867
2868
2869
2870 Timing information is not remembered at the start of an alternative,
2871 so after a repeat timing information must be reset by hand, for
2872 example by setting @code{Score.measurePosition} or entering
2873 @code{\partial}.  Similarly, slurs or ties are also not repeated.
2874
2875
2876
2877
2878 @node Repeats and MIDI
2879 @subsection Repeats and MIDI
2880
2881 @cindex expanding repeats
2882
2883 With a little bit of tweaking, all types of repeats can be present
2884 in the MIDI output.  This is achieved by applying the
2885 @code{\unfoldrepeats} music function.  This functions changes all
2886 repeats to unfold repeats.
2887
2888 @lilypond[verbatim,raggedright,fragment]
2889 \unfoldrepeats {
2890   \repeat tremolo 8 {c'32 e' }
2891   \repeat percent 2 { c''8 d'' }
2892   \repeat volta 2 {c'4 d' e' f'} 
2893   \alternative {
2894     { g' a' a' g' }
2895     {f' e' d' c' }
2896   }
2897 }
2898 \bar "|."
2899 @end lilypond
2900
2901 When creating a score file using @code{\unfoldrepeats} for midi, then
2902 it is necessary to make two @code{\score} blocks.  One for MIDI (with
2903 unfolded repeats) and one for notation (with volta, tremolo, and
2904 percent repeats).  For example,
2905
2906 @example
2907   \score @{
2908       @var{..music..}
2909       \paper @{ .. @}
2910   @} 
2911   \score @{
2912       \unfoldrepeats @var{..music..}
2913       \midi @{ .. @}
2914   @} 
2915 @end example
2916
2917 @node Manual repeat commands
2918 @subsection Manual repeat commands
2919
2920 @cindex @code{repeatCommands}
2921
2922 The property @code{repeatCommands} can be used to control the layout of
2923 repeats.  Its value is a Scheme list of repeat commands, where each repeat
2924 command can be
2925
2926 @table @asis
2927 @item @code{start-repeat},
2928   which prints a @code{|:} bar line;
2929 @item @code{end-repeat},
2930   which prints a @code{:|} bar line;
2931 @item @code{(volta @var{text})},
2932   which prints a volta bracket saying @var{text}: The text can be specified as
2933 a text string or as a markup text, see @ref{Text markup}.  Do not
2934 forget to change the font, as the default number font does not contain
2935 alphabetic characters;
2936 @item @code{(volta #f)}, which 
2937   stops a running volta bracket.
2938 @end table
2939
2940 @lilypond[quote,verbatim,fragment,relative=2]
2941 c4
2942   \set Score.repeatCommands = #'((volta "93") end-repeat)
2943 c4 c4
2944   \set Score.repeatCommands = #'((volta #f))
2945 c4 c4
2946 @end lilypond
2947
2948
2949
2950 @seealso
2951
2952 Program reference: @internalsref{VoltaBracket}, @internalsref{RepeatedMusic},
2953 @internalsref{VoltaRepeatedMusic},
2954 @internalsref{UnfoldedRepeatedMusic}, and
2955 @internalsref{FoldedRepeatedMusic}.
2956
2957 @node Tremolo repeats
2958 @subsection Tremolo repeats
2959 @cindex tremolo beams
2960
2961 To place tremolo marks between notes, use @code{\repeat} with tremolo
2962 style
2963 @lilypond[quote,verbatim,raggedright]
2964 \new Voice \relative c' {
2965   \repeat "tremolo" 8 { c16 d16 }
2966   \repeat "tremolo" 4 { c16 d16 }    
2967   \repeat "tremolo" 2 { c16 d16 }
2968 }
2969 @end lilypond
2970
2971 Tremolo marks can also be put on a single note.  In this case, the
2972 note should not be surrounded by braces.
2973 @lilypond[quote,verbatim,raggedright]
2974   \repeat "tremolo" 4 c'16
2975 @end lilypond
2976
2977 Similar output is obtained using the tremolo subdivision, described in
2978 @ref{Tremolo subdivisions}.
2979
2980 @seealso
2981
2982 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
2983
2984 Program reference: tremolo beams are @internalsref{Beam} objects.  Single stem
2985 tremolos are @internalsref{StemTremolo} objects.  The music expression is
2986 @internalsref{TremoloEvent}.
2987
2988 Example files: @inputfileref{input/regression,chord-tremolo.ly},
2989 @inputfileref{input/regression,stem-tremolo.ly}.
2990
2991 @node Tremolo subdivisions
2992 @subsection Tremolo subdivisions
2993 @cindex tremolo marks
2994 @cindex @code{tremoloFlags}
2995
2996 Tremolo marks can be printed on a single note by adding
2997 `@code{:}[@var{number}]' after the note.  The number indicates the
2998 duration of the subdivision, and it must be at least 8.  A
2999 @var{length} value of 8 gives one line across the note stem.  If the
3000 length is omitted, the last value (stored in @code{tremoloFlags}) is
3001 used
3002
3003 @lilypond[quote,verbatim,fragment]
3004   c'2:8 c':32 | c': c': |
3005 @end lilypond
3006
3007 @c [TODO : stok is te kort bij 32en]
3008 @c   somebody want to translate that into English?  :)
3009
3010 @refbugs
3011
3012 Tremolos entered in this way do not carry over into the MIDI output.
3013
3014 @seealso
3015
3016 In this manual: @ref{Tremolo repeats}.
3017
3018 Elsewhere: @internalsref{StemTremolo}, @internalsref{TremoloEvent}.
3019
3020 @node Measure repeats
3021 @subsection Measure repeats
3022
3023 @cindex percent repeats
3024 @cindex measure repeats
3025
3026 In the @code{percent} style, a note pattern can be repeated.  It is
3027 printed once, and then the pattern is replaced with a special sign.
3028 Patterns of one and two measures are replaced by percent-like signs,
3029 patterns that divide the measure length are replaced by slashes
3030
3031 @lilypond[quote,verbatim,raggedright]
3032 \new Voice \relative c' {
3033   \repeat "percent" 4  { c4 }
3034   \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
3035 }
3036 @end lilypond
3037
3038 @seealso
3039
3040 Program reference: @internalsref{RepeatSlash}, @internalsref{PercentRepeat},
3041 @internalsref{PercentRepeatedMusic}, and
3042 @internalsref{DoublePercentRepeat}.
3043
3044
3045
3046 @node Rhythmic music
3047 @section Rhythmic music
3048
3049 Rhythmic music is primarily used for percussion and drum notation, but it can
3050 also be used to show the rhythms of melodies.
3051
3052 @menu
3053 * Showing melody rhythms::      
3054 * Entering percussion::         
3055 * Percussion staves::           
3056 @end menu
3057
3058
3059 @node Showing melody rhythms
3060 @subsection Showing melody rhythms
3061
3062 Sometimes you might want to show only the rhythm of a melody.  This
3063 can be done with the rhythmic staff.  All pitches of notes on such a
3064 staff are squashed, and the staff itself has a single line
3065
3066 @lilypond[quote,fragment,relative=1,verbatim]
3067 \context RhythmicStaff {
3068   \time 4/4
3069   c4 e8 f g2 | r4 g r2 | g1:32 | r1 |
3070 }
3071 @end lilypond
3072
3073 @seealso
3074
3075 Program reference: @internalsref{RhythmicStaff}.
3076
3077 Examples: @inputfileref{input/regression,rhythmic-staff.ly}.
3078
3079
3080 @node Entering percussion
3081 @subsection Entering percussion
3082
3083 @cindex percussion
3084 @cindex drums
3085
3086
3087 Percussion notes may be entered in @code{\drummode} mode, which is
3088 similar to the standard mode for entering notes.  Each piece of
3089 percussion has a full name and an abbreviated name, and both can be used
3090 in input files
3091
3092 @lilypond[quote,raggedright,verbatim]
3093 \drums {
3094   hihat hh bassdrum bd
3095 }
3096 @end lilypond
3097
3098 The complete list of drum names is in the init file
3099 @file{ly/drumpitch-init.ly}.
3100 @c TODO: properly document this.
3101
3102 @seealso
3103
3104 Program reference: @internalsref{DrumNoteEvent}.
3105
3106 @node Percussion staves
3107 @subsection Percussion staves
3108 @cindex percussion
3109 @cindex drums
3110
3111 A percussion part for more than one instrument typically uses a
3112 multi line staff where each position in the staff refers to one piece
3113 of percussion.
3114
3115
3116 To typeset the music, the notes must be interpreted in a
3117 @internalsref{DrumStaff} and @internalsref{DrumVoice} contexts
3118
3119 @c
3120 @lilypond[quote,raggedright,verbatim]
3121 up = \drummode { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
3122 down = \drummode { bassdrum4 snare8 bd r bd sn4 }
3123   \new DrumStaff <<
3124     \new DrumVoice { \voiceOne \up } 
3125     \new DrumVoice { \voiceTwo \down } 
3126   >>
3127 @end lilypond
3128
3129 The above example shows verbose polyphonic notation.  The short
3130 polyphonic notation, described in @ref{Polyphony}, can also be used if
3131 the @internalsref{DrumVoices} are instantiated by hand first.  For example, 
3132
3133 @lilypond[quote,fragment,verbatim] 
3134 \new DrumStaff <<
3135   \context DrumVoice = "1" {  s1 *2 }
3136   \context DrumVoice = "2" {  s1 *2 }
3137   \drummode {
3138     bd4 sn4 bd4 sn4
3139     <<
3140       { \repeat unfold 16 hh16 }
3141       \\
3142       { bd4 sn4 bd4 sn4 }
3143     >>
3144   }   
3145 >>
3146 @end lilypond
3147
3148
3149 There are also other layout possibilities.  To use these, set the
3150 property @code{drumStyleTable} in context @internalsref{DrumVoice}.
3151 The following variables have been predefined
3152
3153 @table @code
3154 @item drums-style
3155 This is the default.  It typesets a typical drum kit on a five-line staff
3156
3157 @lilypond[quote,noindent]
3158 nam = \lyricmode { cymc cyms cymr hh hhc hho hhho hhp cb hc
3159     bd sn ss tomh tommh tomml toml tomfh tomfl }
3160 mus = \drummode  { cymc cyms cymr hh | hhc hho hhho hhp | \break cb hc
3161     bd sn ss tomh tommh tomml toml tomfh tomfl s16 }
3162 \score {
3163     << \new DrumStaff\with {
3164             \remove Bar_engraver
3165             \remove Time_signature_engraver
3166             \override Stem #'transparent = ##t
3167             \override Stem #'Y-extent-callback = ##f
3168             minimumVerticalExtent = #'(-4.0 . 5.0)
3169     } \mus
3170         \context Lyrics \nam 
3171     >>
3172     \paper {
3173     %% need to do this, because of indented @itemize
3174     linewidth= 9 \cm 
3175     \context { \Score
3176     \override LyricText #'font-family = #'typewriter
3177     \override BarNumber #'transparent =##T
3178 }}}
3179 @end lilypond
3180
3181 The drum scheme supports six different toms.  When there fewer toms, simply
3182 select the toms that produce the desired result, i.e. to get toms on
3183 the three middle lines you use @code{tommh}, @code{tomml} and
3184 @code{tomfh}.
3185
3186 @item timbales-style
3187 This typesets timbales on a two line staff
3188
3189 @lilypond[quote,raggedright]
3190 nam = \lyricmode { timh ssh timl ssl cb }
3191 mus = \drummode  { timh ssh timl ssl cb s16 }
3192
3193 <<
3194         \context DrumStaff \with {
3195             \remove Bar_engraver
3196             \remove Time_signature_engraver
3197             \override Stem #'transparent = ##t
3198             \override Stem #'Y-extent-callback = ##f
3199             \override StaffSymbol #'line-count = #2
3200             \override StaffSymbol #'staff-space = #2
3201             minimumVerticalExtent = #'(-3.0 . 4.0)
3202             drumStyleTable = #timbales-style
3203         } \mus
3204         \context Lyrics {
3205             \override LyricText #'font-family = #'typewriter
3206
3207         \nam  }
3208 >>
3209 @end lilypond
3210 @item congas-style
3211 This typesets congas on a two line staff
3212
3213 @lilypond[quote,raggedright]
3214 nam = \lyricmode { cgh cgho cghm ssh cgl cglo cglm ssl }
3215 mus = \drummode  { cgh cgho cghm ssh cgl cglo cglm ssl s16 }
3216 <<
3217         \context DrumStaff\with {
3218             \remove Bar_engraver
3219             \remove Time_signature_engraver
3220             drumStyleTable = #congas-style
3221             \override StaffSymbol #'line-count = #2
3222             
3223             %% this sucks; it will lengthen stems.
3224             \override StaffSymbol #'staff-space = #2
3225             \override Stem #'transparent = ##t
3226             \override Stem #'Y-extent-callback = ##f
3227         } \mus
3228         \context Lyrics {
3229                     \override LyricText #'font-family = #'typewriter
3230 \nam  }
3231 >>
3232 @end lilypond
3233 @item bongos-style
3234 This typesets bongos on a two line staff
3235
3236 @lilypond[quote,raggedright]
3237 nam = \lyricmode { boh boho bohm ssh bol bolo bolm ssl }
3238 mus = \drummode  { boh boho bohm ssh bol bolo bolm ssl s16 }
3239 <<
3240         \context DrumStaff\with {
3241             \remove Bar_engraver
3242             \remove Time_signature_engraver
3243             \override StaffSymbol #'line-count = #2
3244             drumStyleTable = #bongos-style
3245            
3246             %% this sucks; it will lengthen stems.
3247             \override StaffSymbol #'staff-space = #2
3248             \override Stem #'transparent = ##t
3249             \override Stem #'Y-extent-callback = ##f
3250         } \mus
3251         \context Lyrics {
3252                     \override LyricText #'font-family = #'typewriter
3253 \nam  }
3254 >>
3255 @end lilypond
3256
3257 @item percussion-style
3258 to typeset all kinds of simple percussion on one line staves
3259 @lilypond[quote,raggedright]
3260 nam = \lyricmode { tri trio trim gui guis guil cb cl tamb cab mar hc }
3261 mus = \drummode  { tri trio trim gui guis guil cb cl tamb cab mar hc s16 }
3262 <<
3263         \context DrumStaff\with{
3264             \remove Bar_engraver
3265             drumStyleTable = #percussion-style
3266             \override StaffSymbol #'line-count = #1
3267             \remove Time_signature_engraver
3268             \override Stem #'transparent = ##t
3269             \override Stem #'Y-extent-callback = ##f
3270         } \mus
3271         \context Lyrics {
3272           \override LyricText #'font-family = #'typewriter
3273           \nam
3274         }
3275 >>
3276 @end lilypond
3277 @end table
3278
3279 If you do not like any of the predefined lists you can define your own
3280 list at the top of your file
3281
3282 @lilypond[quote,raggedright,verbatim]
3283 #(define mydrums '(
3284         (bassdrum     default   #f        -1)
3285         (snare        default   #f        0)
3286         (hihat        cross     #f        1)
3287         (pedalhihat   xcircle   "stopped" 2)
3288         (lowtom       diamond   #f       3)))
3289 up = \drummode { hh8 hh hh hh hhp4 hhp }
3290 down = \drummode { bd4 sn bd toml8 toml }
3291
3292 \new DrumStaff <<
3293     \set DrumStaff.drumStyleTable
3294        = #(alist->hash-table mydrums)
3295     \new DrumVoice { \voiceOne \up }
3296     \new DrumVoice { \voiceTwo \down }
3297 >>
3298 @end lilypond
3299
3300
3301 @seealso
3302
3303 Init files: @file{ly/drumpitch-init.ly}.
3304
3305 Program reference: @internalsref{DrumStaff}, @internalsref{DrumVoice}.
3306
3307 @refbugs
3308
3309 Because general MIDI does not contain rim shots, the sidestick is used
3310 for this purpose instead.
3311
3312 @node Piano music
3313 @section Piano music
3314
3315 Piano staves are two normal staves coupled with a brace.  The staves
3316 are largely independent, but sometimes voices can cross between the
3317 two staves.  The same notation is also used for harps and other key
3318 instruments.  The @internalsref{PianoStaff} is especially built to
3319 handle this cross-staffing behavior.  In this section we discuss the
3320 @internalsref{PianoStaff} and some other pianistic peculiarities.
3321
3322
3323 @menu
3324 * Automatic staff changes::     
3325 * Manual staff switches::       
3326 * Pedals::                      
3327 * Arpeggio::                    
3328 * Staff switch lines::          
3329 * Cross staff stems::           
3330 @end menu 
3331
3332 @refbugs
3333
3334 Dynamics are not centered, but workarounds do exist.  See the
3335 ``piano centered dynamics'' template in @ref{Piano templates}.
3336
3337 @cindex cross staff stem
3338 @cindex stem, cross staff
3339 @cindex distance between staves in piano music
3340
3341 The distance between the two staves is the same for all systems in the
3342 score.  It is possible to override this per system, but it does require
3343 an arcane command incantation.  See
3344 @inputfileref{input/test,piano-staff-distance.ly}.
3345
3346
3347 @node Automatic staff changes
3348 @subsection Automatic staff changes
3349 @cindex Automatic staff changes
3350
3351 Voices can be made to switch automatically between the top and the bottom
3352 staff.  The syntax for this is
3353
3354 @quotation
3355 @example
3356   \autochange @dots{}@var{music}@dots{} 
3357 @end example
3358 @end quotation
3359
3360 @noindent
3361 This will create two staves inside the current PianoStaff, called
3362 @code{up} and @code{down}.  The lower staff will be in bass clef by
3363 default.
3364
3365 A @code{\relative} section that is outside of @code{\autochange} has
3366 no effect on the pitches of @var{music}, so, if necessary, put
3367 @code{\relative} inside @code{\autochange} like
3368
3369 @quotation
3370 @example
3371 \autochange \relative @dots{} @dots{}
3372 @end example
3373 @end quotation
3374
3375
3376 The autochanger switches on basis of pitch (middle C is the turning
3377 point), and it looks ahead skipping over rests to switch in
3378 advance.  Here is a practical example
3379         
3380 @lilypond[quote,verbatim,raggedright]
3381 \context PianoStaff
3382   \autochange \relative c'
3383   {
3384     g4 a b c d r4 a g
3385   }
3386 @end lilypond
3387
3388
3389 @seealso
3390
3391 In this manual: @ref{Manual staff switches}.
3392
3393 Program reference: @internalsref{AutoChangeMusic}.
3394
3395
3396
3397 @refbugs
3398
3399 The staff switches may not end up in optimal places.  For high
3400 quality output, staff switches should be specified manually.
3401
3402
3403 @code{\autochange} cannot be inside @code{\times}. 
3404
3405 Internally, the @code{\partcombine} interprets both arguments as
3406 @code{Voice}s named @code{one} and @code{two}, and then decides when
3407 the parts can be combined.  Consequently, if the arguments switch to
3408 differently named @internalsref{Voice} contexts, the events in those
3409 will be ignored.
3410
3411
3412 @node Manual staff switches
3413 @subsection Manual staff switches
3414
3415 @cindex manual staff switches
3416 @cindex staff switch, manual
3417
3418 Voices can be switched between staves manually, using the command
3419 @example
3420 \change Staff = @var{staffname} @var{music}
3421 @end example
3422
3423 @noindent
3424 The string @var{staffname} is the name of the staff.  It switches the
3425 current voice from its current staff to the Staff called
3426 @var{staffname}.  Typically @var{staffname} is @code{"up"} or
3427 @code{"down"}.  The @context{Staff} referred to must already exist, so
3428 usually the setup for a score will start with a setup of the staves,
3429
3430 @example
3431 <<
3432   \context Staff = up @{
3433     \skip 1 * 10  %@emph{ keep staff alive}
3434     @}
3435   \context Staff = down @{
3436     \skip 1 * 10  %@emph{idem}
3437     @}
3438 >>
3439 @end example 
3440
3441
3442 and the @context{Voice} is inserted afterwards
3443
3444 @example
3445 \context Staff = down
3446   \new Voice @{ @dots{} \change Staff = up @dots{} @}
3447 @end example
3448
3449
3450 @node Pedals
3451 @subsection Pedals
3452 @cindex Pedals
3453
3454 Pianos have pedals that alter the way sound is produced.  Generally, a
3455 piano has three pedals, sustain, una corda, and sostenuto.
3456
3457
3458 Piano pedal instruction can be expressed by attaching
3459 @code{\sustainDown}, @code{\sustainUp}, @code{\unaCorda},
3460 @code{\treCorde}, @code{\sostenutoDown} and @code{\sostenutoUp} to a
3461 note or chord
3462
3463 @lilypond[quote,fragment,verbatim]
3464   c'4\sustainDown c'4\sustainUp
3465 @end lilypond
3466
3467 What is printed can be modified by setting @code{pedal@var{X}Strings},
3468 where @var{X} is one of the pedal types: @code{Sustain},
3469 @code{Sostenuto} or @code{UnaCorda}.  Refer to
3470 @internalsref{SustainPedal} in the program reference for more
3471 information.
3472
3473 Pedals can also be indicated by a sequence of brackets, by setting the
3474 @code{pedalSustainStyle} property to bracket objects
3475
3476 @lilypond[quote,fragment,verbatim,relative=2]
3477   \set Staff.pedalSustainStyle = #'bracket
3478   c\sustainDown d e
3479   b\sustainUp\sustainDown
3480   b g \sustainUp a \sustainDown \bar "|."
3481 @end lilypond
3482
3483 A third style of pedal notation is a mixture of text and brackets,
3484 obtained by setting the @code{pedalSustainStyle} style property to
3485 @code{mixed}
3486
3487 @lilypond[quote,fragment,verbatim,relative=2]
3488   \set Staff.pedalSustainStyle = #'mixed
3489   c\sustainDown d e
3490   b\sustainUp\sustainDown
3491   b g \sustainUp a \sustainDown \bar "|."
3492 @end lilypond
3493
3494 The default `*Ped.' style for sustain and damper pedals corresponds to
3495 style @code{#'text}.  The sostenuto pedal uses @code{mixed} style by
3496 default.
3497
3498 @lilypond[quote,fragment,verbatim,relative=2]
3499   c\sostenutoDown d e c, f g a\sostenutoUp
3500 @end lilypond
3501
3502 For fine-tuning of the appearance of a pedal bracket, the properties
3503 @code{edge-width}, @code{edge-height}, and @code{shorten-pair} of
3504 @code{PianoPedalBracket} objects (see
3505 @internalsref{PianoPedalBracket} in the Program reference) can be modified.  For example, the
3506 bracket may be extended to the right edge of the note head
3507
3508 @lilypond[quote,fragment,verbatim,relative=2]
3509   \override Staff.PianoPedalBracket #'shorten-pair = #'(0 . -1.0)
3510   c\sostenutoDown d e c, f g a\sostenutoUp
3511 @end lilypond
3512
3513 @node Arpeggio
3514 @subsection Arpeggio
3515 @cindex Arpeggio
3516
3517 @cindex broken arpeggio
3518 @cindex @code{\arpeggio}
3519
3520 You can specify an arpeggio sign on a chord by attaching an
3521 @code{\arpeggio} to a chord
3522
3523
3524 @lilypond[quote,fragment,relative=1,verbatim]
3525   <c e g c>\arpeggio
3526 @end lilypond
3527
3528 When an arpeggio crosses staves, you attach an arpeggio to the chords
3529 in both staves, and set
3530 @internalsref{PianoStaff}.@code{connectArpeggios}
3531
3532 @lilypond[quote,fragment,relative=1,verbatim]
3533 \context PianoStaff <<
3534   \set PianoStaff.connectArpeggios = ##t
3535   \new Staff  { <c' e g c>\arpeggio }
3536   \new Staff { \clef bass  <c,, e g>\arpeggio }
3537 >>
3538 @end lilypond
3539
3540 The direction of the arpeggio is sometimes denoted by adding an
3541 arrowhead to the wiggly line
3542
3543 @lilypond[quote,fragment,relative=1,verbatim]
3544 \context Voice {
3545   \arpeggioUp
3546   <c e g c>\arpeggio
3547   \arpeggioDown
3548   <c e g c>\arpeggio
3549 }
3550 @end lilypond
3551
3552 A square bracket on the left indicates that the player should not
3553 arpeggiate the chord
3554
3555 @c todo: ugh, lousy typography.  Look for real example. --hwn
3556
3557 @lilypond[quote,fragment,relative=1,verbatim]
3558   \arpeggioBracket
3559   <c' e g c>\arpeggio
3560 @end lilypond
3561
3562 @refcommands
3563
3564 @cindex @code{\arpeggio}
3565 @code{\arpeggio},
3566 @cindex @code{\arpeggioUp}
3567 @code{\arpeggioUp},
3568 @cindex @code{\arpeggioDown}
3569 @code{\arpeggioDown},
3570 @cindex @code{\arpeggioNeutral}
3571 @code{\arpeggioNeutral},
3572 @cindex @code{\arpeggioBracket}
3573 @code{\arpeggioBracket}.
3574
3575 @seealso
3576
3577 Program reference: @internalsref{ArpeggioEvent},
3578 @internalsref{Arpeggio}.
3579
3580 @refbugs
3581
3582 It is not possible to mix connected arpeggios and unconnected
3583 arpeggios in one @internalsref{PianoStaff} at the same point in time.
3584
3585 @node Staff switch lines
3586 @subsection Staff switch lines
3587
3588
3589 @cindex follow voice
3590 @cindex staff switching
3591 @cindex cross staff
3592
3593 @cindex @code{followVoice}
3594
3595 Whenever a voice switches to another staff a line connecting the notes
3596 can be printed automatically.  This is switched on by setting
3597 @code{PianoStaff.followVoice} to true
3598
3599 @lilypond[quote,fragment,relative=1,verbatim]
3600 \context PianoStaff <<
3601   \set PianoStaff.followVoice = ##t
3602   \context Staff \context Voice {
3603     c1
3604     \change Staff=two
3605     b2 a
3606   }
3607  \context Staff=two { \clef bass \skip 1*2 }
3608 >>  
3609 @end lilypond
3610
3611 @seealso
3612
3613 Program reference: @internalsref{VoiceFollower}.
3614
3615 @refcommands
3616
3617 @cindex @code{\showStaffSwitch}
3618 @code{\showStaffSwitch}, 
3619 @cindex @code{\hideStaffSwitch}
3620 @code{\hideStaffSwitch}.
3621
3622
3623 @node Cross staff stems
3624 @subsection Cross staff stems
3625
3626 The chords which cross staves may be produced by increasing the length
3627 of the stem in the lower stave, so it reaches the stem in the upper
3628 stave, or vice versa.
3629
3630 @lilypond[raggedright,verbatim,quote]
3631 stemExtend = \once \override Stem #'length = #22
3632 noFlag = \once \override Stem #'flag-style = #'no-flag
3633 \context PianoStaff <<
3634   \new Staff {
3635     \stemDown \stemExtend
3636     f'4
3637     \stemExtend \noFlag
3638     f'8
3639   }
3640   \new Staff {
3641     \clef bass
3642     a4 a8
3643   }
3644 >>
3645 @end lilypond
3646
3647
3648 @node Vocal music
3649 @section Vocal music
3650
3651 There are three different issues when printing vocal music
3652
3653 @itemize @bullet
3654 @item
3655   Song texts must be entered as texts, not notes.  For example, the
3656 input @code{d} should be interpreted as a one letter syllable, not the note D.
3657 @item
3658   Song texts must be printed as text, not as notes. 
3659 @item
3660   Song texts must be aligned with the notes of their melody
3661 @end itemize
3662
3663 The simplest solution to printing music uses the @code{\addlyrics}
3664 function to solve all these problems at once.  However, these
3665 three functions can be controlled separately, which is necessary
3666 for complex vocal music. 
3667
3668
3669 @menu
3670 * Setting simple songs::        
3671 * Entering lyrics::             
3672 * Hyphens and extenders::       
3673 * The Lyrics context::          
3674 * Flexibility in alignment::    
3675 * More stanzas::                
3676 * Ambitus::                     
3677 @end menu
3678
3679 @node Setting simple songs
3680 @subsection Setting simple songs
3681
3682 The easiest way to add lyrics to a melody is to append
3683 @cindex \addlyrics
3684 @example
3685   \addlyrics @{ @var{the lyrics} @} 
3686 @end example
3687
3688 @noindent
3689 to a melody.  Here is an example,
3690
3691 @lilypond[raggedright,verbatim,fragment,quote]
3692   \time 3/4 
3693   \relative { c2 e4 g2. }
3694   \addlyrics { play the game }
3695 @end lilypond
3696
3697 More stanzas can be added by adding more
3698 @code{\addlyrics} sections 
3699
3700 @lilypond[raggedright,verbatim,fragment,quote]
3701   \time 3/4
3702   \relative { c2 e4 g2. }
3703   \addlyrics { play the game } 
3704   \addlyrics { speel het spel } 
3705   \addlyrics { joue le jeu }
3706 @end lilypond
3707
3708 @c TODO - this isn't such a great place for this note, but I can't
3709 @c  find a better place without rearranging a lot of lyric stuff.
3710 @c  It's yet another thing to look at post-3.0.
3711
3712 The @code{\addlyrics} command is actually just a convienient way
3713 to write a more complicated LilyPond structure that sets up the
3714 lyrics.  You should use @code{\addlyrics} unless you need to
3715 fancy things, in which case you should investigate
3716 @code{\lyricsto} or @code{\lyricmode}.
3717
3718 @example
3719   @{ MUSIC @}
3720   \addlyrics @{ LYRICS @}
3721 @end example
3722
3723 is the same as
3724
3725 @example
3726   \context Voice = blah @{ music @}
3727   \lyricsto "blah" \lyricsmode \new lyrics @{ LYRICS @}
3728 @end example
3729
3730
3731 @node Entering lyrics
3732 @subsection Entering lyrics
3733
3734
3735 @cindex lyrics
3736 @cindex @code{\lyricmode}
3737 @cindex punctuation
3738
3739 Lyrics are entered in a special input mode.  This mode is is introduced
3740 by the keyword @code{\lyricmode}, or by using @code{addlyrics} or
3741 @code{lyricsto}.  In this mode you can enter lyrics,
3742 with punctuation and accents, and the input @code{d} is not parsed as
3743 a pitch, but rather as a one letter syllable.  Syllables are entered
3744 like notes, but with pitches replaced by text.  For example,
3745 @example
3746   \lyricmode @{ Twin-4 kle4 twin- kle litt- le star2 @}
3747 @end example
3748
3749
3750 A word lyrics mode begins with an alphabetic character, and ends with
3751 any space or digit.  The following characters can be any character
3752 that is not a digit or white space.  One important consequence of this
3753 is that a word can end with @code{@}}.  The following example is
3754 usually a mistake in the input file.  The syllable includes a @code{@}}, so the
3755 opening brace is not balanced
3756 @example
3757   \lyricmode @{ twinkle@}
3758 @end example
3759
3760 @cindex @code{\property}, in @code{\lyricmode}
3761 @noindent
3762 Similarly, a period which follows an alphabetic sequence is included in
3763 the resulting string.  As a consequence, spaces must be inserted around
3764 property commands
3765 @example
3766   \override Score . LyricText #'font-shape = #'italic
3767 @end example
3768
3769 @cindex @code{_}
3770 @cindex spaces, in lyrics
3771 @cindex quotes, in lyrics
3772
3773 Any @code{_} character which appears in an unquoted word is converted
3774 to a space.  This provides a mechanism for introducing spaces into words
3775 without using quotes.  Quoted words can also be used in Lyrics mode to
3776 specify words that cannot be written with the above rules.  The
3777 following example incorporates double quotes
3778
3779 @example
3780   \lyricmode @{ He said: "\"Let" my peo ple "go\"" @}
3781 @end example
3782
3783 This example is slightly academic, since it gives better looking
3784 results to use single quotes, @code{``} and @code{''}
3785 @example
3786   \lyricmode @{ He said: ``Let my peo ple go'' @}
3787 @end example
3788
3789
3790 The full definition of a word start in Lyrics mode is somewhat more
3791 complex.
3792
3793 A word in Lyrics mode begins with: an alphabetic character, @code{_},
3794 @code{?}, @code{!}, @code{:}, @code{'}, the control characters @code{^A}
3795 through @code{^F}, @code{^Q} through @code{^W}, @code{^Y}, @code{^^},
3796 any 8-bit character with ASCII code over 127, or a two-character
3797 combination of a backslash followed by one of @code{`}, @code{'},
3798 @code{"}, or @code{^}.
3799
3800
3801
3802 @seealso
3803
3804 Program reference: events @internalsref{LyricEvent}, and
3805 @internalsref{LyricText}.
3806
3807 @refbugs
3808
3809 The definition of lyrics mode is too complex.
3810
3811 @node Hyphens and extenders
3812 @subsection Hyphens and extenders
3813
3814 @cindex hyphens
3815
3816 Centered hyphens are entered as `@code{-}@code{-}' between syllables.
3817 The hyphen will have variable length depending on the space between
3818 the syllables and it will be centered between the syllables.
3819
3820 @cindex melisma
3821 @cindex extender
3822
3823 When a lyric is sung over many notes (this is called a melisma), this is
3824 indicated with a horizontal line centered between a syllable and the
3825 next one.  Such a line is called an extender line, and it is entered as
3826 @code{__}.
3827
3828
3829 @seealso
3830
3831 Program reference: @internalsref{HyphenEvent}, 
3832 @internalsref{ExtenderEvent}, @internalsref{LyricHyphen}, and
3833 @internalsref{LyricExtender}
3834
3835 Examples: @inputfileref{input/test,lyric-hyphen-retain.ly}.
3836
3837
3838
3839 @node The Lyrics context
3840 @subsection  The Lyrics context
3841
3842
3843 Lyrics are printed by interpreting them in a @internalsref{Lyrics} context
3844 @example
3845   \context Lyrics \lyricmode @dots{}
3846 @end example
3847
3848 @cindex automatic syllable durations
3849 @cindex @code{\lyricsto}
3850 @cindex lyrics and melodies
3851
3852 This will place the lyrics according to the durations that were
3853 entered.  The lyrics can also be aligned under a given melody
3854 automatically.  In this case, it is no longer necessary to enter the
3855 correct duration for each syllable.  This is achieved by combining the
3856 melody and the lyrics with the @code{\lyricsto} expression
3857 @example
3858 \lyricsto @var{name} \new Lyrics @dots{} 
3859 @end example
3860
3861 This aligns the lyrics to the
3862 @c
3863 notes of the @internalsref{Voice} context called @var{name}, which has
3864 to exist.  Therefore, normally the @code{Voice} is specified first, and
3865 then the lyrics are specified with @code{\lyricsto}.  The command
3866 @code{\lyricsto} switches to @code{\lyricmode} mode automatically, so the
3867 @code{\lyricmode} keyword may be omitted.
3868
3869 For different or more complex orderings, the best way is to setup the
3870 hierarchy of staves and lyrics first, e.g.
3871 @example
3872 \context ChoirStaff  <<
3873   \context Lyrics = sopranoLyrics @{ s1 @}
3874   \context Voice = soprano @{ @emph{music} @}
3875   \context Lyrics = tenorLyrics @{ s1 @}
3876   \context Voice = tenor @{ @emph{music} @}
3877 >>
3878 @end example
3879 and then combine the appropriate melodies and lyric lines
3880 @example
3881   \lyricsto "soprano" \context Lyrics = sopranoLyrics
3882     @emph{the lyrics}
3883 @end example
3884
3885 @noindent
3886 The final input would resemble
3887
3888 @example
3889 <<\context ChoirStaff  << @emph{setup the music}  >>
3890   \lyricsto "soprano" @emph{etc}
3891   \lyricsto "alto" @emph{etc}
3892   @emph{etc}
3893 >>
3894 @end example 
3895
3896
3897 The @code{\lyricsto} command detects melismata: it only puts one
3898 syllable under a tied or slurred group of notes.  If you want to force
3899 an unslurred group of notes to be a melisma, insert @code{\melisma}
3900 after the first note of the group, and @code{\melismaEnd} after the
3901 last one, e.g.
3902
3903 @lilypond[quote,relative=2,raggedright,fragment,verbatim]
3904 <<
3905   \context Voice = "lala" {
3906     \time 3/4
3907     f4 g8
3908     \melisma 
3909     f e f
3910     \melismaEnd
3911     e2
3912   }
3913   \lyricsto "lala" \new Lyrics {
3914     la di __ daah 
3915   }
3916 >>
3917 @end lilypond
3918
3919 In addition, notes are considered a melisma if they are manually
3920 beamed, and automatic beaming (see @ref{Setting automatic beam
3921 behavior}) is switched off.
3922
3923 @ignore
3924
3925 @c nonformation:
3926
3927 The criteria for deciding melismata can
3928 be tuned with the property @code{melismaBusyProperties}.  See
3929 @internalsref{Melisma_translator} in the program reference for more
3930 information.
3931
3932 @end ignore
3933
3934 Lyrics can also be entered without @code{\lyricsto}.  In this case the
3935 durations of each syllable must be entered explicitly, for example,
3936
3937 @verbatim
3938   play2 the4 game2.
3939   sink2 or4 swim2.  
3940 @end verbatim
3941
3942 The alignment to a melody can be specified with the
3943 @code{associatedVoice} property,
3944
3945 @verbatim
3946   \set associatedVoice = #"lala"
3947 @end verbatim 
3948
3949 @noindent
3950 The value of the property (here: @code{"lala"}) should be the name of
3951 a @internalsref{Voice} context.  Without this setting, extender lines
3952 will not be formatted properly.
3953
3954 Here is an example demonstrating manual lyric durations,
3955
3956 @lilypond[relative=1,verbatim,fragment,quote]
3957 << \context Voice = melody {
3958      \time 3/4
3959      c2 e4 g2.
3960   } 
3961   \new Lyrics \lyricmode {
3962     \set associatedVoice = #"melody"
3963     play2 the4 game2.
3964   } >>
3965 @end lilypond
3966
3967 @cindex SATB
3968 @cindex choral score
3969
3970 A complete example of a SATB score setup is in section
3971 @ref{Small ensembles}.
3972
3973
3974 @refcommands
3975
3976 @code{\melisma}, @code{\melismaEnd}
3977 @cindex @code{\melismaEnd}
3978 @cindex @code{\melisma}
3979
3980 @seealso
3981
3982 Program reference: @internalsref{LyricCombineMusic},
3983 @internalsref{Lyrics}, @internalsref{Melisma_translator}.
3984
3985 Examples: @ref{Small ensembles},
3986 @inputfileref{input/regression,lyric-combine-new.ly},
3987 @c TODO: make separate section for melismata 
3988 @inputfileref{input/test,lyrics-melisma-variants.ly}.
3989 @inputfileref{input/test,lyrics-melisma-faster.ly}.
3990  
3991 @refbugs
3992
3993 Melismata are not detected automatically, and extender lines must be
3994 inserted by hand.
3995
3996
3997 @c TODO: document \new Staff << Voice \lyricsto >> bug
3998
3999 @node Flexibility in alignment
4000 @subsection Flexibility in alignment
4001
4002
4003 Often, different stanzas of one song are put to one melody in slightly
4004 differing ways.  Such variations can still be captured with
4005 @code{\lyricsto}.
4006
4007 One possibility is that the text has a melisma in one stanza, but
4008 multiple syllables in another one.  One solution is to make the faster
4009 voice ignore the melisma.  This is done by setting
4010 @code{ignoreMelismata} in the Lyrics context.
4011
4012 There has one tricky aspect.  The setting for @code{ignoreMelismata}
4013 must be set one syllable @emph{before} the non-melismatic syllable
4014 in the text, as shown here,
4015
4016 @lilypond[verbatim,raggedright,quote]
4017 <<
4018   \relative \context Voice = "lahlah" {
4019     \set Staff.autoBeaming = ##f 
4020     c4
4021     \slurDotted
4022     f8.[( g16])
4023     a4
4024   }
4025   \new Lyrics \lyricsto "lahlah" {
4026     more slow -- ly
4027   }
4028   \new Lyrics \lyricsto "lahlah" {
4029     \set ignoreMelismata = ##t % applies to "fas"
4030     go fas -- ter
4031     \unset ignoreMelismata
4032     still
4033   }
4034 >>
4035 @end lilypond
4036
4037
4038 The @code{ignoreMelismata} applies to the syllable ``fas'', so it
4039 should be entered before ``go''.
4040
4041 The reverse is also possible: making a lyric line slower than the
4042 standard.  This can be achieved by insert @code{\skip}s into the
4043 lyrics.  For every @code{\skip}, the text will be delayed another note.
4044 For example,
4045
4046 @lilypond[verbatim,raggedright,quote]
4047 \relative { c c g' }
4048 \addlyrics {
4049   twin -- \skip 4
4050   kle
4051 }
4052 @end lilypond
4053
4054 More complex variations in text underlay are possible.  It is possible
4055 to switch the melody for a line of lyrics during the text.  This is
4056 done by setting the @code{associatedVoice} property.  In the example 
4057
4058 @lilypond[raggedright,quote]
4059
4060 <<
4061   \relative \context Voice = "lahlah" {
4062     \set Staff.autoBeaming = ##f 
4063     c4
4064     <<
4065       \context Voice = alternative {
4066         \voiceOne
4067         \times 2/3 {
4068           % show associations clearly.
4069           \override NoteColumn #'force-hshift = #-3
4070           f8 f g
4071         }
4072       }
4073       {
4074         \voiceTwo
4075         f8.[ g16]
4076         \oneVoice
4077       } >>
4078     a8( b) c
4079   }
4080   \new Lyrics \lyricsto "lahlah" {
4081     Ju -- ras -- sic Park
4082   }
4083   \new Lyrics \lyricsto "lahlah" {
4084     % Tricky: need to set associatedVoice
4085     % one syllable too soon! 
4086     \set associatedVoice = alternative % applies to "ran"
4087     Ty --
4088     ran  --
4089     no --
4090     \set associatedVoice = lahlah % applies to "rus"
4091     sau -- rus Rex
4092   } >>
4093 @end lilypond
4094
4095 @noindent
4096 the text for the first stanza is set to a melody called ``lahlah'',
4097
4098 @verbatim
4099 \new Lyrics \lyricsto "lahlah" {
4100   Ju -- ras -- sic Park
4101 }
4102 @end verbatim 
4103
4104
4105 The second stanza initially is set to the @code{lahlah} context, but
4106 for the syllable ``ran'', it switches to a different melody.
4107 This is achieved with
4108 @example
4109   \set associatedVoice = alternative
4110 @end example
4111
4112 @noindent
4113 Here, @code{alternative} is the name of the @code{Voice} context
4114 containing the triplet.
4115
4116 Again, the command must be one syllable too early, before ``Ty'' in
4117 this case.
4118
4119 @verbatim
4120 \new Lyrics \lyricsto "lahlah" {
4121   \set associatedVoice = alternative % applies to "ran"
4122   Ty --
4123   ran  --
4124   no --
4125   \set associatedVoice = lahlah % applies to "rus"
4126   sau -- rus Rex
4127 }
4128 @end verbatim 
4129
4130 @noindent
4131 The underlay is switched back to the starting situation by assigning
4132 @code{lahlah} to @code{associatedVoice}.
4133
4134
4135
4136
4137 @node More stanzas
4138 @subsection More stanzas
4139
4140 @cindex phrasing, in lyrics
4141
4142
4143 @cindex stanza number
4144 @cindex singer's names
4145 @cindex name of singer 
4146
4147 Stanza numbers can be added by setting @code{stanza}, e.g.
4148
4149 @lilypond[quote,verbatim,relative=2,fragment]
4150 \new Voice {
4151   \time 3/4 g2 e4 a2 f4 g2.
4152 } \addlyrics {
4153   \set stanza = "1. "
4154   Hi, my name is Bert.
4155 } \addlyrics {
4156   \set stanza = "2. "
4157   Oh, che -- ri, je t'aime
4158 }
4159 @end lilypond
4160
4161 These numbers are put just before the start of first syllable.
4162
4163 Names of singers can also be added.  They are printed at the start of
4164 the line, just like instrument names.  They are created by setting
4165 @code{vocalName}.  A short version may be entered as @code{vocNam}.
4166
4167
4168 @lilypond[fragment,quote,verbatim,relative=2]
4169 \new Voice {
4170   \time 3/4 g2 e4 a2 f4 g2.
4171 } \addlyrics {
4172   \set vocalName = "Bert "
4173   Hi, my name is Bert.
4174 } \addlyrics {
4175   \set vocalName = "Ernie "
4176   Oh, che -- ri, je t'aime
4177 }
4178 @end lilypond
4179
4180 @seealso
4181
4182 Program reference: Layout objects @internalsref{LyricText} and
4183 @internalsref{VocalName}.  Music expressions
4184 @internalsref{LyricEvent}.
4185
4186
4187
4188 @node Ambitus
4189 @subsection Ambitus
4190 @cindex ambitus
4191
4192 The term @emph{ambitus} denotes a range of pitches for a given voice
4193 in a part of music.  It also may denote the pitch range that a musical
4194 instrument is capable of playing.  Ambits are printed on vocal parts,
4195 so performers can easily determine it meets their capabilities.
4196
4197 It denoted at the beginning of a piece near the initial clef.  The
4198 range is graphically specified by two note heads, that represent the
4199 minimum and maximum pitch.  To print such ambits, add the
4200 @internalsref{Ambitus_engraver} to the @internalsref{Voice} context,
4201 for example,
4202
4203 @example
4204   \paper @{
4205     \context @{
4206       \Voice
4207       \consists Ambitus_engraver
4208     @}
4209   @}
4210 @end example
4211
4212 This results in the following output
4213
4214 @lilypond[quote,raggedright]
4215 \paper {
4216   \context {
4217     \Staff
4218     \consists Ambitus_engraver
4219   }
4220 }
4221
4222 \relative \new Staff {
4223   as'' c e2 cis,2
4224 }
4225 @end lilypond
4226
4227 If you have multiple voices in a single staff, and you want a single
4228 ambitus per staff rather than per each voice, add the
4229 @internalsref{Ambitus_engraver} to the @internalsref{Staff} context
4230 rather than to the @internalsref{Voice} context.  Here is an example,
4231
4232 @lilypond[verbatim,raggedright,quote]
4233 \new Staff <<
4234   \new Voice \with {
4235     \consists "Ambitus_engraver"
4236   } \relative c'' {
4237     \override Ambitus #'X-offset-callbacks
4238       = #(list (lambda (grob axis) -1.0))
4239     \voiceOne
4240     c4 a d e f2
4241   }
4242   \new Voice \with {
4243     \consists "Ambitus_engraver"
4244   } \relative c' {
4245     \voiceTwo
4246     es4 f g as b2
4247   }
4248 >>
4249 @end lilypond
4250
4251 @noindent
4252 This example uses one advanced feature,
4253
4254 @example
4255   \override Ambitus #'X-offset-callbacks
4256     = #(list (lambda (grob axis) -1.0))
4257 @end example
4258
4259 @noindent
4260 This code moves the ambitus to the left.  The same effect could have
4261 been achieved with @code{extra-offset}, but then the formatting system
4262 would not reserve space for the moved object. 
4263
4264 @seealso
4265
4266 Program reference: @internalsref{Ambitus},
4267 @internalsref{AmbitusLine}, @internalsref{AmbitusNoteHead},
4268 @internalsref{AmbitusAccidental}.
4269
4270 Examples:  @inputfileref{input/regression,ambitus.ly}.
4271
4272 @refbugs
4273
4274 There is no collision handling in the case of multiple per-voice
4275 ambitus.
4276
4277 @node Other instrument specific notation, Tablatures, Vocal music, Notation manual
4278 @section Other instrument specific notation
4279
4280 This section includes extra information for writing string music, and may
4281 include extra information for other instruments in the future.
4282
4283 @menu
4284 * Harmonic notes::              
4285 @end menu
4286
4287 @node Harmonic notes,  , Other instrument specific notation, Other instrument specific notation
4288 @subsection Harmonic notes
4289
4290 @cindex artificial harmonics
4291 @cindex harmonics
4292
4293 Artificial harmonics are notated with a different notehead style.  They
4294 are entered by 
4295 marking the harmonic pitch with @code{\harmonic}.
4296
4297 @lilypond[raggedright,verbatim,quote,fragment]
4298  <c' g'\harmonic>4
4299 @end lilypond
4300
4301
4302 @node Tablatures, Popular music, Other instrument specific notation, Notation manual
4303 @section Tablatures
4304
4305 @cindex tablature
4306 @cindex guitar tablature
4307
4308 Tablature notation is used for notating music for plucked string
4309 instruments.  Pitches are not denoted with note heads, but by
4310 indicating on which string and fret a note must be played.  LilyPond
4311 offers limited support for tablature.
4312
4313 @menu
4314 * Tablatures basic::            
4315 * Non-guitar tablatures::       
4316 @end menu
4317
4318 @node Tablatures basic, Non-guitar tablatures, Tablatures, Tablatures
4319 @subsection Tablatures basic
4320 @cindex Tablatures basic
4321
4322 The string number associated to a note is given as a backslash
4323 followed by a number, e.g. @code{c4\3} for a C quarter on the third
4324 string.  By default, string 1 is the highest one, and the tuning
4325 defaults to the standard guitar tuning (with 6 strings).  The notes
4326 are printed as tablature, by using @internalsref{TabStaff} and
4327 @internalsref{TabVoice} contexts
4328
4329 @lilypond[quote,fragment,verbatim]
4330  \context TabStaff {
4331   a,4\5 c'\2 a\3 e'\1
4332   e\4 c'\2 a\3 e'\1
4333 }
4334 @end lilypond
4335
4336 @cindex @code{minimumFret}
4337 @cindex fret
4338
4339 When no string is specified, the first string that does not give a
4340 fret number less than @code{minimumFret} is selected.  The default
4341 value for @code{minimumFret} is 0
4342
4343
4344 @example
4345 e16 fis gis a b4
4346 \set TabStaff.minimumFret = #8
4347 e16 fis gis a b4
4348 @end example
4349 @lilypond[quote,noindent,raggedright]
4350 frag =  {
4351   \key e \major
4352   e16 fis gis a b4
4353   \set TabStaff.minimumFret = #8
4354   e16 fis gis a b4
4355 }
4356   \context StaffGroup <<
4357     \context Staff { \clef "G_8" \frag }
4358     \context TabStaff { \frag }
4359   >>
4360 @end lilypond
4361
4362 @seealso
4363
4364 Program reference: @internalsref{TabStaff}, @internalsref{TabVoice}, and
4365 @internalsref{StringNumberEvent}.
4366
4367 @refbugs
4368
4369 Chords are not handled in a special way, and hence the automatic
4370 string selector may easily select the same string to two notes in a
4371 chord.
4372
4373
4374 @node Non-guitar tablatures,  , Tablatures basic, Tablatures
4375 @subsection Non-guitar tablatures
4376 @cindex Non-guitar tablatures
4377
4378 You can change the number of strings, by setting the number of lines
4379 in the @internalsref{TabStaff}. 
4380
4381 You can change the tuning of the strings.  A string tuning is given as
4382 a Scheme list with one integer number for each string, the number
4383 being the pitch (measured in semitones relative to middle C) of an
4384 open string.  The numbers specified for @code{stringTuning} are the
4385 numbers of semitones to subtract or add, starting the specified pitch
4386 by default middle C, in string order.  In the next example,
4387 @code{stringTunings} is set for the pitches e, a, d, and g
4388
4389 @lilypond[quote,fragment,verbatim]
4390   \context TabStaff <<
4391     \set TabStaff.stringTunings = #'(-5 -10 -15 -20)
4392     
4393      {
4394       a,4 c' a e' e c' a e'
4395     }
4396   >> 
4397 @end lilypond
4398
4399 @refbugs
4400
4401 No guitar special effects have been implemented.
4402
4403 @seealso
4404
4405 Program reference: @internalsref{Tab_note_heads_engraver}.
4406
4407
4408 @node Popular music, Orchestral music, Tablatures, Notation manual
4409 @section Popular music 
4410
4411 This section discusses issues that arise when writing popular music.
4412
4413 @menu
4414 * Chord names::                 
4415 * Chords mode::                 
4416 * Printing chord names::        
4417 * Improvisation::               
4418 @end menu
4419
4420 @node Chord names, Chords mode, Popular music, Popular music
4421 @subsection Chord names
4422 @cindex Chords
4423
4424 LilyPond has support for both printing chord names.  Chords may be
4425 entered in musical chord notation, i.e. @code{< .. >}, but they can
4426 also be entered by name.  Internally, the chords are represented as a
4427 set of pitches, so they can be transposed
4428
4429
4430 @lilypond[quote,verbatim,raggedright]
4431 twoWays = \transpose c c' {
4432   \chordmode {
4433     c1 f:sus4 bes/f
4434   }
4435   <c e g>
4436   <f bes c'>
4437   <f bes d'>
4438 }
4439
4440   << \context ChordNames \twoWays
4441      \context Voice \twoWays >> 
4442 @end lilypond
4443
4444 This example also shows that the chord printing routines do not try to
4445 be intelligent.  The last chord (@code{f bes d}) is not interpreted as
4446 an inversion.
4447
4448 @c this menu isn't needed.
4449 @ignore
4450 @menu
4451 * Chords mode::                 
4452 * Printing chord names::        
4453 @end menu
4454 @end ignore
4455
4456 @node Chords mode
4457 @subsection Chords mode
4458 @cindex Chords mode
4459
4460 In chord mode sets of pitches (chords) are entered with normal note
4461 names.  A chord is entered by the root, which is entered like a
4462 normal pitch
4463
4464 @lilypond[quote,fragment,verbatim,relative=2]
4465   \chordmode { es4. d8 c2 }
4466 @end lilypond
4467
4468 @noindent
4469 The mode is introduced by the keyword @code{\chordmode}.
4470
4471 @cindex chord entry
4472 @cindex chord mode
4473
4474 Other chords may be entered by suffixing a colon and introducing a
4475 modifier (which may include a number if desired)
4476 @c
4477 @lilypond[quote,fragment,verbatim]
4478   \chordmode { e1:m e1:7 e1:m7  }
4479 @end lilypond
4480 The first number following the root is taken to be the `type' of the
4481 chord, thirds are added to the root until it reaches the specified
4482 number
4483 @lilypond[quote,fragment,verbatim]
4484   \chordmode { c:3 c:5 c:6 c:7 c:8 c:9 c:10 c:11 }
4485 @end lilypond
4486
4487 @cindex root of chord
4488 @cindex additions, in chords
4489 @cindex removals, in chords
4490
4491 More complex chords may also be constructed adding separate steps
4492 to a chord.  Additions are added after the number following
4493 the colon, and are separated by dots
4494 @c
4495 @lilypond[quote,verbatim,fragment]
4496   \chordmode { c:5.6 c:3.7.8 c:3.6.13 }
4497 @end lilypond
4498 Chord steps can be altered by suffixing a @code{-} or @code{+} sign
4499 to the number
4500 @lilypond[quote,verbatim,fragment]
4501   \chordmode { c:7+ c:5+.3-  c:3-.5-.7- }
4502 @end lilypond
4503 Removals are specified similarly, and are introduced by a caret.  They
4504 must come after the additions
4505 @lilypond[quote,verbatim,fragment]
4506   \chordmode { c^3 c:7^5 c:9^3.5 }
4507 @end lilypond
4508
4509 Modifiers can be used to change pitches.  The following modifiers are
4510 supported
4511 @table @code
4512 @item m
4513   is the minor chord.  This modifier lowers the 3rd and (if present) the 7th step.
4514 @item dim
4515   is the diminished chord.  This modifier lowers the 3rd, 5th and (if present)
4516   the 7th step.
4517 @item aug
4518   is the augmented chord.  This modifier raises the 5th step.
4519 @item maj
4520   is the major 7th chord.  This modifier raises the 7th step if present.  
4521 @item sus
4522   is the suspended 4th or 2nd.  This modifier removes the 3rd
4523 step.  Append either @code{2} or @code{4} to add the 2nd or 4th step to
4524 the chord.
4525 @end table
4526 Modifiers can be mixed with additions
4527 @lilypond[quote,verbatim,fragment]
4528   \chordmode { c:sus4 c:7sus4 c:dim7 c:m6 } 
4529 @end lilypond
4530
4531 @cindex modifiers, in chords. 
4532 @cindex @code{aug}
4533 @cindex @code{dim}
4534 @cindex @code{maj}
4535 @cindex @code{sus}
4536 @cindex @code{m}
4537
4538 Since an unaltered 11 does not sound good when combined with an
4539 unaltered 3, the 11 is removed in this case (unless it is added
4540 explicitly)
4541 @c
4542 @lilypond[quote,fragment,verbatim]
4543   \chordmode { c:13 c:13.11 c:m13 }
4544 @end lilypond
4545
4546 @cindex @code{/}
4547
4548 An inversion (putting one pitch of the chord on the bottom), as well
4549 as bass notes, can be specified by appending
4550 @code{/}@var{pitch} to the chord
4551 @lilypond[quote,fragment,verbatim]
4552   \chordmode { c1 c/g c/f }
4553 @end lilypond
4554 @cindex @code{/+}
4555
4556 A bass note can be added instead of transposed out of the chord,
4557 by using  @code{/+}@var{pitch}.
4558
4559 @lilypond[quote,fragment,verbatim]
4560 \chordmode { c1 c/+g c/+f }
4561 @end lilypond
4562
4563 Chords is a mode similar to @code{\lyricmode} etc.  Most
4564 of the commands continue to work, for example, @code{r} and
4565 @code{\skip} can be used to insert rests and spaces, and property
4566 commands may be used to change various settings.
4567
4568
4569
4570 @refbugs
4571
4572 Each step can only be present in a chord once.  The following
4573 simply produces the augmented chord, since @code{5+} is interpreted
4574 last
4575 @cindex clusters
4576 @lilypond[quote,verbatim,fragment]
4577 \chordmode { c:5.5-.5+ }
4578 @end lilypond
4579
4580
4581 @node Printing chord names
4582 @subsection Printing chord names
4583
4584 @cindex printing chord names
4585 @cindex chord names
4586 @cindex chords
4587
4588 For displaying printed chord names, use the @internalsref{ChordNames} context.
4589 The chords may be entered either using the notation
4590 described above, or directly using @code{<} and @code{>}
4591
4592 @lilypond[quote,verbatim,raggedright]
4593 harmonies = {
4594   \chordmode {a1 b c} <d' f' a'>  <e' g' b'>
4595 }
4596 <<
4597   \context ChordNames \harmonies
4598   \context Staff \harmonies
4599 >>
4600 @end lilypond
4601
4602 You can make the chord changes stand out by setting
4603 @internalsref{ChordNames}.@code{chordChanges} to true.  This will only
4604 display chord names when there is a change in the chords scheme and at
4605 the start of a new line
4606
4607 @lilypond[quote,verbatim,linewidth=9\cm]
4608 harmonies = \chordmode {
4609   c1:m c:m \break c:m c:m d
4610 }
4611 <<
4612   \context ChordNames {
4613     \set chordChanges = ##t
4614     \harmonies }
4615   \context Staff \transpose c c' \harmonies
4616 >>
4617 @end lilypond
4618
4619 The previous examples all show chords over a staff.  This is not
4620 necessary.  Chords may also be printed separately.  It may be necessary
4621 to add @internalsref{Volta_engraver} and @internalsref{Bar_engraver}
4622 for showing repeats.
4623
4624 @lilypond[raggedright,verbatim]
4625 \new ChordNames \with {
4626   \override BarLine #'bar-size = #4
4627   voltaOnThisStaff = ##t
4628   \consists Bar_engraver
4629   \consists "Volta_engraver"
4630
4631 \repeat volta 2 \chordmode {
4632   f1:maj f:7 bes:7
4633   c:maj  
4634 } \alternative {
4635   es e
4636 }
4637 @end lilypond
4638
4639
4640 The default chord name layout is a system for Jazz music, proposed by
4641 Klaus Ignatzek (see @ref{Literature list}).  It can be tuned through the
4642 following properties
4643
4644 @table @code
4645 @cindex @code{chordNameExceptions}
4646 @item chordNameExceptions
4647 This is a list that contains the chords that have special formatting.
4648 For an example of tuning this property, see
4649 @inputfileref{input/regression,chord-name-exceptions.ly}.
4650 @cindex exceptions, chord names.
4651
4652
4653 @cindex @code{majorSevenSymbol}
4654 @item majorSevenSymbol
4655 This property contains the markup object used for the 7th step, when
4656 it is major.  Predefined options are @code{whiteTriangleMarkup} and
4657 @code{blackTriangleMarkup}.  See
4658 @inputfileref{input/regression,chord-name-major7.ly} for an example.
4659
4660 @cindex @code{chordNameSeparator}
4661 @item chordNameSeparator
4662 Different parts of a chord name are normally separated by a
4663 slash.  By setting @code{chordNameSeparator}, you can specify other
4664 separators, e.g.
4665 @lilypond[quote,fragment,verbatim]
4666 \context ChordNames \chordmode {
4667   c:7sus4
4668   \set chordNameSeparator
4669     = \markup { \typewriter "|" }
4670   c:7sus4
4671 }
4672 @end lilypond
4673
4674 @cindex @code{chordRootNamer}
4675 @item chordRootNamer
4676 The root of a chord is usually printed as a letter with an optional
4677 alteration.  The transformation from pitch to letter is done by this
4678 function.  Special note names (for example, the German ``H'' for a
4679 B-chord) can be produced by storing a new function in this property.
4680
4681 @cindex @code{chordNoteNamer}
4682 @item chordNoteNamer
4683 The default is to print single pitch, e.g. the bass note, using the
4684 @code{chordRootNamer}.  The @code{chordNoteNamer} property can be set
4685 to a specialized function to change this behavior.  For example, the
4686 base can be printed in lower case.
4687
4688 @end table
4689
4690 The predefined variables @code{\germanChords},
4691 @code{\semiGermanChords} set these variables.  The effect is
4692 demonstrated here,
4693
4694 @lilypondfile[]{chord-names-german.ly}
4695
4696 There are also two other chord name schemes implemented: an alternate
4697 Jazz chord notation, and a systematic scheme called Banter chords.  The
4698 alternate jazz notation is also shown on the chart in @ref{Chord name
4699 chart}.  Turning on these styles is described in the input file
4700 @inputfileref{input/test,chord-names-jazz.ly}.
4701
4702 @cindex Banter
4703 @cindex jazz chords
4704 @cindex chords, jazz  
4705
4706
4707 @refcommands
4708
4709 @cindex @code{\germanChords}
4710 @code{\germanChords}, 
4711 @cindex @code{\semiGermanChords}
4712 @code{\semiGermanChords}.
4713
4714
4715
4716
4717 @seealso
4718
4719 Examples: @inputfileref{input/regression,chord-name-major7.ly},
4720 @inputfileref{input/regression,chord-name-exceptions.ly},
4721 @inputfileref{input/test,chord-names-jazz.ly},
4722 @inputfileref{input/test,chords-without-melody.ly}.
4723
4724
4725 Init files: @file{scm/chords-ignatzek.scm}, and @file{scm/chord-entry.scm}.
4726
4727
4728 @refbugs
4729
4730 Chord names are determined solely from the list of pitches.  Chord
4731 inversions are not identified, and neither are added bass notes.  This
4732 may result in strange chord names when chords are entered with the
4733 @code{< .. >} syntax.
4734
4735
4736 @node Improvisation
4737 @subsection Improvisation
4738
4739 Improvisation is sometimes denoted with slashed note heads.  Such note
4740 heads can be created by adding a @internalsref{Pitch_squash_engraver}
4741 to the @internalsref{Staff} or @internalsref{Voice} context.  Then, the
4742 following command
4743
4744 @example
4745     \set squashedPosition = #0
4746     \override NoteHead  #'style = #'slash
4747 @end example
4748
4749 @noindent
4750 switches on the slashes.
4751
4752 There are shortcuts @code{\improvisationOn} (and an accompanying
4753 @code{\improvisationOff}) for this command sequence.  They are used in
4754 the following example
4755
4756 @lilypond[verbatim,raggedright,quote]
4757 \new Staff \with {
4758   \consists Pitch_squash_engraver
4759 } \transpose c c' {
4760   e8 e g a a16(bes)(a8) g \improvisationOn
4761   e8
4762   ~e2~e8 f4 fis8
4763   ~fis2 \improvisationOff a16(bes) a8 g e
4764 }
4765 @end lilypond
4766
4767
4768
4769 @node Orchestral music
4770 @section Orchestral music
4771
4772 @cindex  Writing parts
4773
4774 Orchestral music involves some special notation, both in the full
4775 score and the individual parts.  This section explains how to tackle
4776 some common problems in orchestral music.
4777
4778
4779
4780 @menu
4781 * System start delimiters::     
4782 * Aligning to cadenzas::        
4783 * Rehearsal marks::             
4784 * Bar numbers::                 
4785 * Instrument names::            
4786 * Transpose::                   
4787 * Instrument transpositions::   
4788 * Multi measure rests::         
4789 * Automatic part combining::    
4790 * Hiding staves::               
4791 * Different editions from one source::  
4792 * Quoting other voices::        
4793 * Formatting cue notes::        
4794 @end menu
4795
4796 @node System start delimiters
4797 @subsection  System start delimiters
4798
4799 Polyphonic scores consist of many staves.  These staves can be
4800 constructed in three different ways
4801 @itemize @bullet
4802 @item The group is started with a brace at the left, and bar lines are
4803 connected.  This is done with the @internalsref{GrandStaff} context.
4804
4805 @lilypond[verbatim,quote]
4806 \new GrandStaff
4807 \relative <<
4808   \new Staff { c1 c }
4809   \new Staff { c c }
4810 >>
4811 @end lilypond 
4812
4813
4814 @item The group is started with a bracket, and bar lines are connected.  This is done with the
4815 @internalsref{StaffGroup} context
4816
4817 @lilypond[verbatim,quote]
4818 \new StaffGroup
4819 \relative <<
4820   \new Staff { c1 c }
4821   \new Staff { c c }
4822 >>
4823 @end lilypond 
4824
4825
4826 @item The group is started with a vertical line.  Bar lines are not
4827 connected.  This is the default for the score.
4828
4829 @lilypond[verbatim,quote]
4830 \relative <<
4831   \new Staff { c1 c }
4832   \new Staff { c c }
4833 >>
4834 @end lilypond 
4835
4836 @end itemize
4837
4838 @cindex Staff, multiple
4839 @cindex bracket, vertical
4840 @cindex brace, vertical
4841 @cindex grand staff
4842 @cindex staff group
4843
4844
4845 @seealso
4846
4847 The bar lines at the start of each system are
4848 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
4849 @internalsref{SystemStartBracket}.  Only one of these types is created
4850 in every context, and that type is determined by the property
4851 @code{systemStartDelimiter}.
4852
4853 @node Aligning to cadenzas
4854 @subsection Aligning to cadenzas
4855
4856
4857 In an orchestral context, cadenzas present a special problem:
4858 when constructing a score that includes a cadenza, all other
4859 instruments should skip just as many notes as the length of the
4860 cadenza, otherwise they will start too soon or too late. 
4861
4862 A solution to this problem are the functions @code{mmrest-of-length}
4863 and @code{skip-of-length}.  These Scheme functions take a piece music
4864 as argument, and generate a @code{\skip} or multi rest, exactly as
4865 long as the piece.  The use of @code{mmrest-of-length} is demonstrated
4866 in the following example. 
4867
4868 @lilypond[verbatim,raggedright,quote]
4869 cadenza =  \relative c' {
4870   c4 d8 << { e f g } \\ { d4. } >>
4871   g4 f2 g4 g
4872 }
4873     
4874 \new GrandStaff <<
4875   \new Staff { \cadenza c'4 } 
4876   \new Staff {
4877     #(ly:export (mmrest-of-length cadenza))
4878     c'4
4879   }
4880 >>
4881 @end lilypond
4882
4883
4884
4885
4886
4887 @node Rehearsal marks
4888 @subsection Rehearsal marks
4889 @cindex Rehearsal marks
4890 @cindex mark
4891 @cindex @code{\mark}
4892
4893 To print a rehearsal mark, use the @code{\mark} command
4894
4895 @lilypond[quote,fragment,verbatim,relative=1]
4896   c1 \mark \default
4897   c1 \mark \default
4898   c1 \mark #8 
4899   c1 \mark \default
4900   c1 \mark \default
4901 @end lilypond
4902
4903 @noindent
4904 (The letter I is skipped in accordance with engraving traditions.)
4905 @c  umm, is the manual the right place for feature requests?  :)  -gp
4906 @c FIXME - should make that tunable.
4907
4908 The mark is incremented automatically if you use @code{\mark
4909 \default}, but you can also use an integer argument to set the mark
4910 manually.  The value to use is stored in the property
4911 @code{rehearsalMark}.
4912
4913 The style is defined by the property @code{markFormatter}.  It is a
4914 function taking the current mark (an integer) and the current context
4915 as argument.  It should return a markup object.  In the following
4916 example, @code{markFormatter} is set to a canned procedure.  After a
4917 few measures, it is set to function that produces a boxed number. 
4918
4919 @c  fragproblem? -gp
4920 @lilypond[quote,verbatim,relative=2]
4921 {
4922   \set Score.markFormatter = #format-mark-numbers 
4923   c1 \mark \default
4924   c1 \mark \default
4925   \set Score.markFormatter
4926      = #(lambda (mark context)
4927          (make-bold-markup
4928           (make-box-markup (number->string mark))))
4929   c1 \mark \default
4930   c1 \mark \default
4931 }
4932 @end lilypond
4933
4934 The file @file{scm/translation-functions.scm} contains the definitions
4935 of @code{format-mark-numbers} (the default format) and
4936 @code{format-mark-letters}.  These can be used as inspiration for other
4937 formatting functions.
4938
4939
4940 @cindex coda on bar line
4941 @cindex segno on bar line
4942 @cindex fermata on bar line
4943 @cindex bar lines, symbols on
4944
4945 The @code{\mark} command can also be used to put signs like coda,
4946 segno and fermatas on a bar line.  Use @code{\markup} to
4947 to access the appropriate symbol
4948
4949 @c fragproblem? -gp
4950 @lilypond[quote,verbatim,relative=2]
4951 {
4952   c1 \mark \markup { \musicglyph #"scripts-ufermata" }
4953   c1
4954 }
4955 @end lilypond
4956
4957 In the case of a line break, marks must also be printed at the end of
4958 the line, and not at the beginning.  Use the following to force that
4959 behavior
4960 @example
4961   \override Score.RehearsalMark  
4962     #'break-visibility = #begin-of-line-invisible
4963 @end example
4964
4965 @cindex fermatas
4966 @cindex coda
4967 @cindex segno
4968 @cindex bar lines, putting symbols on 
4969
4970 @seealso
4971
4972 Program reference: @internalsref{MarkEvent}, @internalsref{RehearsalMark}.
4973
4974 Init files: @file{scm/translation-functions.scm} contains the
4975 definition of @code{format-mark-numbers} and
4976 @code{format-mark-letters}.  They can be used as inspiration for other
4977 formatting functions.
4978
4979 Examples: @inputfileref{input/regression,rehearsal-mark-letter.ly},
4980
4981 @inputfileref{input/regression,rehearsal-mark-number.ly}.
4982
4983
4984 @node Bar numbers
4985 @subsection Bar numbers
4986
4987
4988 @cindex bar numbers
4989 @cindex measure numbers
4990 @cindex @code{currentBarNumber}
4991
4992 Bar numbers are printed by default at the start of the line.  The
4993 number itself is stored in the @code{currentBarNumber} property, which
4994 is normally updated automatically for every measure.
4995
4996 Bar numbers can be typeset at regular intervals instead of at the
4997 beginning of each line.  This is illustrated in the following example,
4998 whose source is available as
4999 @inputfileref{input/test,bar-number-regular-interval.ly}
5000
5001 @lilypondfile[quote]{bar-number-regular-interval.ly}
5002
5003 @seealso
5004
5005 Program reference: @internalsref{BarNumber}.
5006
5007 Examples: @inputfileref{input/test,bar-number-every-five-reset.ly},
5008 and @inputfileref{input/test,bar-number-regular-interval.ly}.
5009
5010 @refbugs
5011
5012 Bar numbers can collide with the @internalsref{StaffGroup} bracket, if
5013 there is one at the top.  To solve this, the
5014 @code{padding} property of @internalsref{BarNumber} can be
5015 used to position the number correctly.
5016
5017 @node Instrument names
5018 @subsection Instrument names
5019
5020 In an orchestral score, instrument names are printed left side of the
5021 staves.
5022
5023 This can be achieved by setting @internalsref{Staff}.@code{instrument}
5024 and @internalsref{Staff}.@code{instr}.  This will print a string before
5025 the start of the staff.  For the first start, @code{instrument} is
5026 used, for the next ones @code{instr} is used.
5027
5028 @lilypond[quote,verbatim,raggedright,relative=1,fragment]
5029   \set Staff.instrument = "Ploink "
5030   \set Staff.instr = "Plk "
5031   c1
5032   \break
5033   c''
5034 @end lilypond
5035
5036 You can also use markup texts to construct more complicated instrument
5037 names, for example
5038
5039 @lilypond[quote,fragment,verbatim,raggedright]
5040   \set Staff.instrument = \markup {
5041     \column < "Clarinetti" { "in B"
5042       \smaller \flat } > }
5043 { c''1 }
5044 @end lilypond
5045
5046 For longer instrument names, it may be useful to increase the
5047 @code{indent} setting in the @code{\paper} block.
5048
5049 @seealso
5050
5051 Program reference: @internalsref{InstrumentName}.
5052
5053 @refbugs
5054
5055 When you put a name on a grand staff or piano staff the width of the
5056 brace is not taken into account.  You must add extra spaces to the end of
5057 the name to avoid a collision.
5058
5059 @node Transpose
5060 @subsection Transpose
5061 @cindex Transpose
5062 @cindex transposition of pitches
5063 @cindex @code{\transpose}
5064
5065 A music expression can be transposed with @code{\transpose}.  The
5066 syntax is
5067 @example
5068   \transpose @var{from} @var{to} @var{musicexpr}
5069 @end example
5070
5071 This means that @var{musicexpr} is transposed by the interval between
5072 the pitches @var{from} and @var{to}: any note with pitch @code{from}
5073 is changed to @code{to}.
5074
5075
5076 For example, consider a piece written in the key of  D major.  If
5077 this piece is a little too low for its performer, it can be
5078 transposed up to E major with
5079 @example
5080   \transpose d e @dots{}
5081 @end example
5082
5083 Consider a part written for violin (a C instrument).  If
5084 this part is to be played on the A clarinet, the following
5085 transposition will produce the appropriate part
5086
5087 @example
5088   \transpose a c @dots{}
5089 @end example   
5090
5091 @code{\transpose} distinguishes between enharmonic pitches: both
5092 @code{\transpose c cis} or @code{\transpose c des} will transpose up
5093 half a tone.  The first version will print sharps and the second
5094 version will print flats
5095
5096 @lilypond[quote,raggedright,verbatim]
5097 mus = { \key d \major cis d fis g }
5098 \context Staff {
5099   \clef "F" \mus
5100   \clef "G"
5101   \transpose c g' \mus
5102   \transpose c f' \mus
5103 }
5104 @end lilypond
5105
5106
5107 @seealso
5108
5109 Program reference: @internalsref{TransposedMusic}, and
5110 @internalsref{UntransposableMusic}.
5111
5112 @refbugs
5113
5114 If you want to use both @code{\transpose} and @code{\relative},
5115 you must put @code{\transpose} outside of @code{\relative}, since
5116 @code{\relative} will have no effect music that appears inside a
5117 @code{\transpose}.
5118
5119 @node Instrument transpositions
5120 @subsection Instrument transpositions
5121
5122 The key of a transposing instrument can also be specified.  This
5123 applies to many wind instruments, for example, clarinets (B-flat, A and
5124 E-flat), horn (F) and trumpet (B-flat, C, D and E-flat).
5125
5126 The transposition is entered after the keyword @code{\transposition}
5127
5128 @example
5129   \transposition bes   %%  B-flat clarinet
5130 @end example
5131
5132 @noindent
5133 This command sets the property @code{instrumentTransposition}.  The value of
5134 this property is used for MIDI output and quotations.  It does not
5135 affect how notes are printed in the current staff.
5136
5137 The pitch to use for @code{\transposition} should correspond to the
5138 transposition of the notes. For example, when entering a score in
5139 concert pitch, typically all voices are entered in C, so 
5140 they should be entered as
5141
5142 @example
5143   clarinet = @{
5144     \transposition c'
5145     ...
5146   @}
5147   saxophone  = @{
5148     \transposition c'
5149     ..
5150   @}
5151 @end example
5152
5153 The command @code{\transposition} should be used when the music is
5154 entered from a (transposed) orchestral part.  For example, in
5155 classical horn parts, the tuning of the instrument is often changed
5156 during a piece. When copying the notes from the part, use
5157 @code{\transposition}, e.g.
5158
5159 @example
5160   \transposition d'
5161   c'4^"in D"
5162   ...
5163   \transposition g'
5164   c'4^"in G"
5165   ...
5166 @end example
5167  
5168
5169
5170 @cindex transposition, MIDI
5171 @cindex transposition, instrument
5172
5173
5174 @node Multi measure rests
5175 @subsection Multi measure rests
5176 @cindex multi measure rests
5177 @cindex Rests, multi measure
5178
5179 @cindex @code{R}
5180
5181 Multi measure rests are entered using `@code{R}'.  It is specifically
5182 meant for full bar rests and for entering parts: the rest can expand
5183 to fill a score with rests, or it can be printed as a single
5184 multimeasure rest.  This expansion is controlled by the property
5185 @code{Score.skipBars}.  If this is set to true, empty measures will not
5186 be expanded, and the appropriate number is added automatically
5187
5188 @lilypond[quote,fragment,verbatim]
5189   \time 4/4 r1 | R1 | R1*2
5190   \set Score.skipBars = ##t R1*17  R1*4
5191 @end lilypond
5192
5193 The @code{1} in @code{R1} is similar to the duration notation used for
5194 notes.  Hence, for time signatures other than 4/4, you must enter other
5195 durations.  This can be done with augmentation dots or fractions
5196
5197 @lilypond[quote,fragment,verbatim]
5198   \set Score.skipBars = ##t
5199   \time 3/4
5200   R2. | R2.*2
5201   \time 13/8
5202   R1*13/8
5203   R1*13/8*12 |
5204   \time 10/8 R4*5*4 |
5205 @end lilypond
5206
5207 An @code{R} spanning a single measure is printed as either a whole rest
5208 or a breve, centered in the measure regardless of the time signature.
5209
5210 If there are only a few measures of rest, LilyPond prints ``church rests''
5211 (a series of rectangles) in the staff.  To replace that with a simple
5212 rest, use @code{MultiMeasureRest.expand-limit}.
5213
5214 @lilypond[quote,fragment,verbatim]
5215   \set Score.skipBars = ##t
5216   R1*2 | R1*5 | R1*9
5217   \override MultiMeasureRest #'expand-limit = 1
5218   R1*2 | R1*5 | R1*9
5219 @end lilypond
5220
5221
5222 @cindex text on multi-measure rest
5223 @cindex script on multi-measure rest
5224 @cindex fermata on multi-measure rest
5225
5226 Texts can be added to multi-measure rests by using the
5227 @var{note}-@code{markup} syntax (see @ref{Text markup}).  In this case, the number is
5228 replaced.  If you need both texts and the number, you must add the
5229 number by hand.  A variable (@code{\fermataMarkup}) is provided for
5230 adding fermatas
5231
5232
5233 @lilypond[quote,verbatim,fragment]
5234   \set Score.skipBars = ##t
5235   \time 3/4
5236   R2.*10^\markup { \number 10 }_\markup { "Ad lib" }
5237   R2.^\fermataMarkup
5238 @end lilypond
5239
5240 If you want to have a text on the left end of a multi-measure rest,
5241 attach the text to a zero-length skip note, i.e.
5242
5243 @example
5244   s1*0^"Allegro"
5245   R1*4 
5246 @end example
5247
5248
5249 @cindex whole rests for a full measure 
5250
5251 @seealso
5252
5253 Program reference: @internalsref{MultiMeasureRestEvent},
5254 @internalsref{MultiMeasureTextEvent},
5255 @internalsref{MultiMeasureRestMusicGroup}, and
5256 @internalsref{MultiMeasureRest}.
5257
5258 The layout object @internalsref{MultiMeasureRestNumber} is for the
5259 default number, and @internalsref{MultiMeasureRestText} for user
5260 specified texts.
5261
5262 @refbugs
5263
5264 It is not possible to use fingerings (e.g. @code{R1-4}) to put numbers
5265 over multi-measure rests.
5266
5267 @cindex condensing rests
5268
5269 There is no way to automatically condense multiple rests into a single
5270 multimeasure rest.  Multi measure rests do not take part in rest
5271 collisions.
5272
5273 Be careful when entering multimeasure rests followed by whole
5274 notes.  The following will enter two notes lasting four measures each
5275 @example
5276   R1*4 cis cis 
5277 @end example
5278 When @code{skipBars} is set, the result will look OK, but the bar
5279 numbering will be off.
5280
5281 @node Automatic part combining
5282 @subsection Automatic part combining
5283 @cindex automatic part combining
5284 @cindex part combiner
5285
5286
5287 Automatic part combining is used to merge two parts of music onto a
5288 staff.  It is aimed at typesetting orchestral scores.  When the two
5289 parts are identical for a period of time, only one is shown.  In
5290 places where the two parts differ, they are typeset as separate
5291 voices, and stem directions are set automatically.  Also, solo and
5292 @emph{a due} parts are identified and can be marked.
5293
5294 The syntax for part combining is
5295
5296 @example
5297   \partcombine @var{musicexpr1} @var{musicexpr2}
5298 @end example
5299
5300
5301
5302 The following example demonstrates the basic functionality of the part
5303 combiner: putting parts on one staff, and setting stem directions and
5304 polyphony
5305
5306 @lilypond[quote,verbatim,raggedright,fragment]
5307 \new Staff \partcombine
5308   \relative g' { g g a( b) c c r r }
5309   \relative g' { g g r4 r e e g g }
5310 @end lilypond
5311
5312 The first @code{g} appears only once, although it was
5313 specified twice (once in each part).  Stem, slur and tie directions are
5314 set automatically, depending whether there is a solo or unisono.  The
5315 first part (with context called @code{one}) always gets up stems, and
5316 `solo', while the second (called @code{two}) always gets down stems and
5317 `Solo II'.
5318
5319 If you just want the merging parts, and not the textual markings, you
5320 may set the property @code{printPartCombineTexts} to false
5321
5322 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
5323 \new Staff <<
5324   \set Staff.printPartCombineTexts = ##f
5325   \partcombine
5326     \relative g' { g a( b) r }
5327     \relative g' { g r4 r f }
5328 >>
5329 @end lilypond
5330
5331
5332 Both arguments to @code{\partcombine} will be interpreted as
5333 @internalsref{Voice} contexts.  If using relative octaves,
5334 @code{\relative} should be specified for both music expressions, i.e.
5335
5336 @example
5337 \partcombine
5338   \relative @dots{} @var{musicexpr1}
5339   \relative @dots{} @var{musicexpr2}
5340 @end example
5341
5342 @noindent
5343 A @code{\relative} section that is outside of @code{\partcombine} has
5344 no effect on the pitches of @var{musicexpr1} and @var{musicexpr2}.
5345
5346 @seealso
5347
5348 Program reference: @internalsref{PartCombineMusic},
5349 @internalsref{SoloOneEvent}, and
5350 @internalsref{SoloTwoEvent}, and
5351 @internalsref{UnisonoEvent}.
5352
5353 @refbugs
5354
5355 When @code{printPartCombineTexts} is set, when the two voices play the
5356 same notes on and off, the part combiner may typeset @code{a2} more
5357 than once in a measure.
5358
5359 @code{\partcombine} cannot be inside @code{\times}. 
5360
5361 @code{\partcombine} cannot be inside @code{\relative}. 
5362
5363 Internally, the @code{\partcombine} interprets both arguments as
5364 @code{Voice}s named @code{one} and @code{two}, and then decides when
5365 the parts can be combined.  Consequently, if the arguments switch to
5366 differently named @internalsref{Voice} contexts, the events in those
5367 will be ignored.
5368
5369 @node Hiding staves
5370 @subsection Hiding staves
5371
5372 @cindex Frenched scores
5373 @cindex Hiding staves
5374
5375 In orchestral scores, staff lines that only have rests are usually
5376 removed.  This saves some space.  This style is called `French Score'.
5377 For @internalsref{Lyrics}, 
5378 @internalsref{ChordNames} and @internalsref{FiguredBass}, this is
5379 switched on by default.  When these line of these contexts turn out
5380 empty after the line-breaking process, they are removed.
5381
5382 For normal staves, a specialized @internalsref{Staff} context is
5383 available, which does the same: staves containing nothing (or only
5384 multi measure rests) are removed.  The context definition is stored in
5385 @code{\RemoveEmptyStaffContext} variable.  Observe how the second staff
5386 in this example disappears in the second line
5387
5388
5389 @lilypond[quote,verbatim]
5390 \paper {
5391   \context { \RemoveEmptyStaffContext }
5392 }
5393
5394 {
5395   \relative c' <<
5396     \new Staff { e4 f g a \break c1 }
5397     \new Staff { c4 d e f \break R1 }
5398   >>
5399 }
5400 @end lilypond
5401
5402 The first system shows all staves in full.  If empty staves should be
5403 removed from the first system too, set @code{remove-first} to false in
5404 @internalsref{RemoveEmptyVerticalGroup}.
5405
5406 Another application is making ossia sections, i.e. alternative
5407 melodies on a separate piece of staff, with help of a Frenched
5408 staff.  See @inputfileref{input/test,ossia.ly} for an example.
5409
5410
5411 @node Different editions from one source
5412 @subsection Different editions from one source
5413
5414 The @code{\tag} command marks music expressions with a name.  These
5415 tagged expressions can be filtered out later.  With this mechanism it
5416 is possible to make different versions of the same music source.
5417
5418 In the following example, we see two versions of a piece of music, one
5419 for the full score, and one with cue notes for the instrumental part
5420
5421 @example
5422   c1
5423   <<
5424     \tag #'part <<
5425       R1 \\
5426       @{
5427         \set fontSize = #-1
5428         c4_"cue" f2 g4 @} 
5429     >>
5430     \tag #'score R1
5431   >>
5432   c1
5433 @end example
5434
5435 The same can be applied to articulations, texts, etc.: they are
5436 made by prepending
5437 @example
5438   -\tag #@var{your-tag} 
5439 @end example
5440 to an articulation, for example, 
5441 @example
5442   c1-\tag #'part ^4
5443 @end example
5444
5445 This defines a note with a conditional fingering indication.
5446
5447 By applying the @code{\keepWithTag} command, tagged expressions
5448 can be filtered.  For example,
5449 @example
5450 <<
5451   @var{the music}
5452   \keepWithTag #'score @var{the music}
5453   \keepWithTag #'part @var{the music}
5454 >>
5455 @end example
5456 would yield
5457
5458 @lilypondfile[quote]{tag-filter.ly}
5459
5460
5461 The argument of the @code{\tag} command should be a symbol, or a list
5462 of symbols, for example,
5463 @example
5464   \tag #'(original-part transposed-part) @dots{}
5465 @end example
5466
5467 @seealso
5468
5469 Examples: @inputfileref{input/regression,tag-filter.ly}.
5470
5471 @refbugs
5472
5473 Multiple rests are not merged if you create the score with both tagged
5474 sections.
5475
5476 @node Quoting other voices
5477 @subsection Quoting other voices
5478
5479 With quotations, fragments of other parts can be inserted into a part
5480 directly.  Before a part can be quoted, it must be marked especially as
5481 quotable.  This is done with code @code{\addquote} command.
5482
5483 @example
5484   \addquote @var{name} @var{music}
5485 @end example
5486
5487
5488 @noindent
5489 Here, @var{name} is an identifying string.  The @var{music} is any kind
5490 of music.  This is an example of @code{\addquote}
5491
5492 @verbatim
5493 \addquote clarinet \relative c' {
5494   f4 fis g gis
5495 }
5496 @end verbatim
5497
5498 This command must be entered at toplevel, i.e.  outside any music
5499 blocks.
5500
5501 After calling @code{\addquote}, the quotation may then be done with
5502 @code{\quote},
5503
5504 @example
5505   \quote @var{name} @var{duration}  
5506 @end example
5507
5508 During a part, a piece of music can be quoted with the @code{\quote}
5509 command. 
5510   
5511 @example
5512 \quote clarinet 2.
5513 @end example
5514
5515 This would cite three quarter notes (@code{2.} is a dotted half note)
5516 of the previously added @code{clarinet} voice.
5517
5518 More precisely, it takes the current time-step of the part being
5519 printed, and extracts the notes at the corresponding point of the
5520 @code{\addquote}d voice.  Therefore, the argument to @code{\addquote}
5521 should be the entire part of the voice to be quoted, including any
5522 rests at the beginning. 
5523
5524 Quotations take into account the transposition of both source and target
5525 instruments, if they are specified using the @code{\transposition} command.
5526
5527 @lilypond[quote,raggedright,verbatim]
5528 \addquote clarinet \relative c' {
5529   \transposition bes
5530   f4 fis g gis
5531 }
5532
5533 {
5534   e'8 f'8 \quote clarinet 2
5535 }
5536 @end lilypond
5537
5538 The type of events that are present in cue notes can be trimmed with
5539 the @code{quotedEventTypes} property. The default value is
5540 @code{(note-event rest-event)}, which means that only notes of and
5541 rests of the cued voice end up in the @code{\quote}.
5542 Setting
5543
5544 @example
5545   \set Staff.quotedEventTypes = #'(note-event articulation-event dynamic-event)  
5546 @end example
5547
5548 @noindent
5549 will quote notes (but no rests), together with scripts and dynamics.
5550  
5551 @refbugs
5552
5553 Only the contents of the first @internalsref{Voice} occurring in an
5554 @code{\addquote} command will be considered for quotation, so
5555 @var{music} can not contain @code{\new} and @code{\context Voice}
5556 statements that would switch to a different Voice.
5557
5558
5559 @seealso
5560
5561 In this manual: @ref{Instrument transpositions}.
5562
5563 Examples: @inputfileref{input/regression,quote.ly}
5564 @inputfileref{input/regression,quote-transposition.ly}
5565
5566 Program reference: @internalsref{QuoteMusic}.
5567
5568 @node Formatting cue notes
5569 @subsection Formatting cue notes
5570
5571
5572 The previous section deals with inserting notes from another
5573 voice.  When making a part, these notes need to be specially formatted.
5574 Here is an example of formatted cue notes
5575
5576 @c TODO: This should be done with \quote stuff, not manually.
5577
5578 @lilypond[verbatim]
5579 smaller = {
5580   \set fontSize = #-1
5581   \override Stem  #'length = #5.5
5582   \override Beam  #'thickness = #0.384
5583   \override Beam  #'space-function =
5584     #(lambda (beam mult) (* 0.8 (Beam::space_function beam mult)))
5585 }
5586
5587 {
5588   \set Staff.instrument = #"Horn in F"
5589   \set Score.skipBars = ##t
5590   R1*21
5591   << {
5592     \once \override Staff.MultiMeasureRest  #'staff-position = #-6
5593     R1
5594   }
5595   \new Voice {
5596     s2
5597     \clef tenor
5598     \smaller
5599     r8^"Bsn." c'8  f'8[ f'8]
5600     \clef treble
5601   }
5602   >>
5603   c'8^"Horn" cis'
5604   eis'4 fis'4
5605 }
5606 @end lilypond
5607
5608
5609 There are a couple of points to take care of:
5610
5611 @itemize @bullet
5612 @item
5613 The multi rest of the original part should be moved up or down during
5614 the cue.
5615 @item
5616 Cue notes have smaller font sizes.
5617 @item
5618 When cued notes have a clef change relative to the original part, the
5619 clef should be restored after the cue section.  This minimizes
5620 confusion for the reader,
5621 @item
5622 When the original part starts, this should be marked with the name of
5623 the instrument, in this case ``Horn.''   Of course, the cue part is
5624 marked with the instrument playing the cue.
5625 @end itemize
5626
5627 @c  really?  Are you sure about that last point?  I'll check after 3.0 -gp 
5628
5629
5630 @node Ancient notation
5631 @section Ancient notation
5632
5633 @cindex Vaticana, Editio
5634 @cindex Medicaea, Editio
5635 @cindex hufnagel
5636 @cindex Petrucci
5637 @cindex mensural
5638
5639 Support for ancient notation includes features for mensural notation
5640 and Gregorian Chant notation.  There is also limited support for
5641 figured bass notation.
5642
5643 Many graphical objects provide a @code{style} property, see
5644 @itemize @bullet
5645 @item
5646 @ref{Ancient note heads},
5647 @item
5648 @ref{Ancient accidentals},
5649 @item
5650 @ref{Ancient rests},
5651 @item
5652 @ref{Ancient clefs},
5653 @item
5654 @ref{Ancient flags},
5655 @item
5656 @ref{Ancient time signatures}.
5657 @end itemize
5658
5659 By manipulating such a grob property, the typographical appearance of
5660 the affected graphical objects can be accommodated for a specific
5661 notation flavor without need for introducing any new notational
5662 concept.
5663
5664 In addition to the standard articulation signs described in section
5665 @ref{Articulations}, specific articulation signs for ancient notation
5666 are provided.
5667
5668 @itemize @bullet
5669 @item
5670 @ref{Ancient articulations}
5671 @end itemize
5672
5673 Other aspects of ancient notation can not that easily be expressed as
5674 in terms of just changing a style property of a graphical object or
5675 adding articulation signs.  Some notational concepts are introduced
5676 specifically for ancient notation,
5677
5678 @itemize @bullet
5679 @item
5680 @ref{Custodes},
5681 @item
5682 @ref{Divisiones},
5683 @item
5684 @ref{Ligatures}.
5685 @end itemize
5686
5687 If this all is too much of documentation for you, and you just want to
5688 dive into typesetting without worrying too much about the details on
5689 how to customize a context, you may have a look at the predefined
5690 contexts.  Use them to set up predefined style-specific voice and
5691 staff contexts, and directly go ahead with the note entry,
5692
5693 @itemize @bullet
5694 @item
5695 @ref{Gregorian Chant contexts},
5696 @item
5697 @ref{Mensural contexts}.
5698 @end itemize
5699
5700 There is limited support for figured bass notation which came
5701 up during the baroque period.
5702
5703 @itemize @bullet
5704 @item
5705 @ref{Figured bass}
5706 @end itemize
5707
5708 Here are all suptopics at a glance:
5709
5710 @menu
5711 * Ancient note heads::          
5712 * Ancient accidentals::         
5713 * Ancient rests::               
5714 * Ancient clefs::               
5715 * Ancient flags::               
5716 * Ancient time signatures::     
5717 * Ancient articulations::       
5718 * Custodes::                    
5719 * Divisiones::                  
5720 * Ligatures::                   
5721 * Gregorian Chant contexts::    
5722 * Mensural contexts::           
5723 * Figured bass::                
5724 @end menu
5725
5726
5727 @node Ancient note heads
5728 @subsection Ancient note heads
5729
5730 @cindex note heads
5731
5732
5733 For ancient notation, a note head style other than the @code{default}
5734 style may be chosen.  This is accomplished by setting the @code{style}
5735 property of the NoteHead object to @code{baroque}, @code{neomensural}
5736 or @code{mensural}.  The @code{baroque} style differs from the
5737 @code{default} style only in using a square shape for @code{\breve}
5738 note heads.  The @code{neomensural} style differs from the
5739 @code{baroque} style in that it uses rhomboidal heads for whole notes
5740 and all smaller durations.  Stems are centered on the note heads.
5741 This style is in particular useful when transcribing mensural music,
5742 e.g. for the incipit.  The @code{mensural} style finally produces note
5743 heads that mimic the look of note heads in historic printings of the
5744 16th century.
5745
5746 The following example demonstrates the @code{neomensural} style
5747
5748 @lilypond[quote,fragment,raggedright,verbatim]
5749   \set Score.skipBars = ##t
5750   \override NoteHead #'style = #'neomensural
5751   a'\longa a'\breve a'1 a'2 a'4 a'8 a'16
5752 @end lilypond
5753
5754 When typesetting a piece in Gregorian Chant notation, the
5755 @internalsref{Gregorian_ligature_engraver} will automatically select
5756 the proper note heads, such there is no need to explicitly set the
5757 note head style.  Still, the note head style can be set e.g.@: to
5758 @code{vaticana_punctum} to produce punctum neumes.  Similarly, a
5759 @internalsref{Mensural_ligature_engraver} is used to automatically
5760 assemble mensural ligatures.  See @ref{Ligatures} for how ligature
5761 engravers work.
5762
5763 @seealso
5764
5765 Examples: @inputfileref{input/regression,note-head-style.ly} gives an
5766 overview over all available note head styles.
5767
5768
5769 @node Ancient accidentals
5770 @subsection Ancient accidentals
5771
5772 @cindex accidentals
5773
5774
5775 Use the @code{style} property of grob @internalsref{Accidental} to
5776 select ancient accidentals.   Supported styles are
5777 @code{mensural}, @code{vaticana}, @code{hufnagel} and @code{medicaea}.
5778
5779 @lilypond[quote,raggedright,staffsize=26]
5780 \score {
5781 {
5782   \fatText
5783   s^\markup {
5784     \column <
5785       "vaticana" 
5786       { " " \musicglyph #"accidentals-vaticana-1"
5787       " " \musicglyph #"accidentals-vaticana0" }
5788     >
5789     \column <
5790       "medicaea"
5791       { " " \musicglyph #"accidentals-medicaea-1" }
5792     >
5793     \column <
5794       "hufnagel"
5795       { " " \musicglyph #"accidentals-hufnagel-1" }
5796     >
5797     \column <
5798       "mensural"
5799       { " " \musicglyph #"accidentals-mensural-1"
5800       " " \musicglyph #"accidentals-mensural1" }
5801     >
5802   }
5803 }
5804 \paper {
5805   interscoreline = 1
5806   \context { \Score \remove "Bar_number_engraver" }
5807   \context { \Staff
5808       \remove "Clef_engraver"
5809       \remove "Key_engraver"
5810       \remove "Time_signature_engraver"
5811       \remove "Staff_symbol_engraver"
5812       minimumVerticalExtent = ##f
5813     }
5814   }
5815 }
5816 @end lilypond
5817
5818 As shown, not all accidentals are supported by each style.  When
5819 trying to access an unsupported accidental, LilyPond will switch to a
5820 different style, as demonstrated in
5821 @inputfileref{input/test,ancient-accidentals.ly}.
5822
5823 Similarly to local accidentals, the style of the key signature can be
5824 controlled by the @code{style} property of the
5825 @internalsref{KeySignature} grob.
5826
5827 @seealso
5828
5829 In this manual: @ref{Pitches}, @ref{Chromatic alterations} and
5830 @ref{Accidentals} give a general introduction into the use of
5831 accidentals.  @ref{Key signature} gives a general introduction into
5832 the use of key signatures.
5833
5834 Program reference: @internalsref{KeySignature}.
5835
5836 Examples: @inputfileref{input/test,ancient-accidentals.ly}.
5837
5838 @node Ancient rests
5839 @subsection Ancient rests
5840
5841 @cindex rests
5842
5843
5844 Use the @code{style} property of grob @internalsref{Rest} to select
5845 ancient accidentals.   Supported styles are @code{classical},
5846 @code{neomensural} and @code{mensural}.  @code{classical} differs
5847 from the @code{default} style only in that the quarter rest looks like
5848 a horizontally mirrored 8th rest.  The @code{neomensural} style suits
5849 well for e.g. the incipit of a transcribed mensural piece of music.
5850 The @code{mensural} style finally mimics the appearance of rests as
5851 in historic prints of the 16th century.
5852
5853 The following example demonstrates the @code{neomensural} style
5854
5855 @lilypond[quote,fragment,raggedright,verbatim]
5856   \set Score.skipBars = ##t 
5857   \override Rest #'style = #'neomensural
5858   r\longa r\breve r1 r2 r4 r8 r16
5859 @end lilypond
5860
5861 There are no 32th and 64th rests specifically for the mensural or
5862 neo-mensural style.  Instead, the rests from the default style will be
5863 taken.  See @inputfileref{input/test,rests.ly} for a chart of all
5864 rests.
5865
5866 There are no rests in Gregorian Chant notation; instead, it uses
5867 @ref{Divisiones}.
5868
5869 @seealso
5870
5871 In this manual: @ref{Rests} gives a general introduction into the use of rests.
5872
5873
5874 @node Ancient clefs
5875 @subsection Ancient clefs
5876
5877 @cindex clefs
5878
5879
5880 LilyPond supports a variety of clefs, many of them ancient.
5881
5882 The following table shows all ancient clefs that are supported via the
5883 @code{\clef} command.  Some of the clefs use the same glyph, but
5884 differ only with respect to the line they are printed on.  In such
5885 cases, a trailing number in the name is used to enumerate these clefs.
5886 Still, you can manually force a clef glyph to be typeset on an
5887 arbitrary line, as described in @ref{Clef}.  The note printed to the
5888 right side of each clef in the example column denotes the @code{c'}
5889 with respect to that clef.
5890
5891 @multitable @columnfractions   .4 .4 .2
5892
5893 @item
5894 @b{Description} @tab
5895 @b{Supported Clefs} @tab
5896 @b{Example}
5897
5898 @item
5899 modern style mensural C clef @tab
5900 @code{neomensural-c1}, @code{neomensural-c2},
5901 @code{neomensural-c3}, @code{neomensural-c4} @tab
5902 @lilypond[fragment,quote,relative=1,notime]
5903   \clef "neomensural-c2" c
5904 @end lilypond
5905
5906 @item
5907 petrucci style mensural C clefs, for use on different staff lines
5908 (the examples shows the 2nd staff line C clef).
5909
5910 @tab
5911 @code{petrucci-c1}
5912 @code{petrucci-c2}
5913 @code{petrucci-c3}
5914 @code{petrucci-c4}
5915 @code{petrucci-c5}
5916
5917 @tab
5918 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5919   \clef "petrucci-c2" c
5920 @end lilypond
5921
5922 @item
5923 petrucci style mensural F clef @tab
5924 @code{petrucci-f} @tab
5925 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5926   \clef "petrucci-f" c
5927 @end lilypond
5928
5929 @item
5930 petrucci style mensural G clef @tab
5931 @code{petrucci-g} @tab
5932 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5933   \clef "petrucci-g" c
5934 @end lilypond
5935
5936 @item
5937 historic style mensural C clef @tab
5938 @code{mensural-c1}, @code{mensural-c2}, @code{mensural-c3},
5939 @code{mensural-c4} @tab
5940 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5941   \clef "mensural-c2" c
5942 @end lilypond
5943
5944 @item
5945 historic style mensural F clef @tab
5946 @code{mensural-f} @tab
5947 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5948   \clef "mensural-f" c
5949 @end lilypond
5950
5951 @item
5952 historic style mensural G clef @tab
5953 @code{mensural-g} @tab
5954 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5955   \clef "mensural-g" c
5956 @end lilypond
5957
5958 @item
5959 Editio Vaticana style do clef @tab
5960 @code{vaticana-do1}, @code{vaticana-do2}, @code{vaticana-do3} @tab
5961 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5962   \override Staff.StaffSymbol   #'line-count = #4
5963   \clef "vaticana-do2" c
5964 @end lilypond
5965
5966 @item
5967 Editio Vaticana style fa clef @tab
5968 @code{vaticana-fa1}, @code{vaticana-fa2} @tab
5969 @lilypond[quote,relative=1,notime,indent=0.0\mm,fragment]
5970   \override Staff.StaffSymbol   #'line-count = #4
5971   \clef "vaticana-fa2" c
5972 @end lilypond
5973
5974 @item
5975 Editio Medicaea style do clef @tab
5976 @code{medicaea-do1}, @code{medicaea-do2}, @code{medicaea-do3} @tab
5977 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5978   \override Staff.StaffSymbol   #'line-count = #4
5979   \clef "medicaea-do2" c
5980 @end lilypond
5981
5982 @item
5983 Editio Medicaea style fa clef @tab
5984 @code{medicaea-fa1}, @code{medicaea-fa2} @tab
5985 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5986   \override Staff.StaffSymbol   #'line-count = #4
5987   \clef "medicaea-fa2" c
5988 @end lilypond
5989
5990 @item
5991 historic style hufnagel do clef @tab
5992 @code{hufnagel-do1}, @code{hufnagel-do2}, @code{hufnagel-do3} @tab
5993 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
5994   \override Staff.StaffSymbol   #'line-count = #4
5995   \clef "hufnagel-do2" c
5996 @end lilypond
5997
5998 @item
5999 historic style hufnagel fa clef @tab
6000 @code{hufnagel-fa1}, @code{hufnagel-fa2} @tab
6001 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
6002   \override Staff.StaffSymbol   #'line-count = #4
6003   \clef "hufnagel-fa2" c
6004 @end lilypond
6005
6006 @item
6007 historic style hufnagel combined do/fa clef @tab
6008 @code{hufnagel-do-fa} @tab
6009 @lilypond[fragment,quote,relative=1,notime,indent=0.0\mm]
6010   \clef "hufnagel-do-fa" c
6011 @end lilypond
6012
6013 @end multitable
6014
6015
6016
6017 @emph{Modern style} means ``as is typeset in contemporary editions of
6018 transcribed mensural music''.
6019
6020 @emph{Petrucci style} means ``inspired by printings published by the
6021 famous engraver Petrucci (1466-1539)''.
6022
6023 @emph{Historic style} means ``as was typeset or written in historic
6024 editions (other than those of Petrucci)''.
6025
6026 @emph{Editio XXX style} means ``as is/was printed in Editio XXX''.
6027
6028 Petrucci used C clefs with differently balanced left-side vertical
6029 beams, depending on which staff line it is printed.
6030
6031 @seealso
6032
6033 In this manual: see @ref{Clef}.
6034
6035 @refbugs
6036
6037 The mensural g clef is mapped to the Petrucci g clef.
6038
6039
6040
6041 @node Ancient flags
6042 @subsection Ancient flags
6043
6044 @cindex flags
6045
6046
6047 Use the @code{flag-style} property of grob @internalsref{Stem} to
6048 select ancient flags.  Besides the @code{default} flag style,
6049  only @code{mensural} style is supported
6050
6051 @lilypond[quote,fragment,raggedright,verbatim]
6052   \override Stem #'flag-style = #'mensural
6053   \override Stem #'thickness = #1.0
6054   \override NoteHead #'style = #'mensural
6055   \autoBeamOff
6056   c'8 d'8 e'8 f'8 c'16 d'16 e'16 f'16 c'32 d'32 e'32 f'32 s8
6057   c''8 d''8 e''8 f''8 c''16 d''16 e''16 f''16 c''32 d''32 e''32 f''32
6058 @end lilypond
6059
6060 Note that the innermost flare of each mensural flag always is
6061 vertically aligned with a staff line.
6062
6063 There is no particular flag style for neo-mensural notation.  Hence,
6064 when typesetting the incipit of a transcribed piece of mensural
6065 music, the default flag style should be used.  There are no flags in
6066 Gregorian Chant notation.
6067
6068 @refbugs
6069
6070 The attachment of ancient flags to stems is slightly off due to a
6071 change in early 2.3.x.
6072
6073 Vertically aligning each flag with a staff line assumes that stems
6074 always end either exactly on or exactly in the middle between two
6075 staff lines.  This may not always be true when using advanced layout
6076 features of classical notation (which however are typically out of
6077 scope for mensural notation).
6078
6079 @node Ancient time signatures
6080 @subsection Ancient time signatures
6081
6082 @cindex time signatures
6083
6084
6085 There is limited support for mensural time signatures.   The
6086 glyphs are hard-wired to particular time fractions.  In other words,
6087 to get a particular mensural signature glyph with the @code{\time n/m}
6088 command, @code{n} and @code{m} have to be chosen according to the
6089 following table
6090
6091 @lilypond[quote,raggedright]
6092 \paper {
6093   indent = 0.0
6094   \context { \Staff
6095     \remove Staff_symbol_engraver
6096     \remove Clef_engraver
6097     \remove Time_signature_engraver
6098   }
6099 } {
6100   \set Score.timing = ##f
6101   \set Score.barAlways = ##t
6102   s_\markup { "$\\backslash$time 4/4" }
6103   ^\markup { "       " \musicglyph #"timesig-neomensural4/4" }
6104   s
6105   s_\markup { "$\\backslash$time 2/2" }
6106   ^\markup { "       " \musicglyph #"timesig-neomensural2/2" }
6107   s
6108   s_\markup { "$\\backslash$time 6/4" }
6109   ^\markup { "       " \musicglyph #"timesig-neomensural6/4" }
6110   s
6111   s_\markup { "$\\backslash$time 6/8" }
6112   ^\markup { "       " \musicglyph #"timesig-neomensural6/8" }
6113   \break
6114   s_\markup { "$\\backslash$time 3/2" }
6115   ^\markup { "       " \musicglyph #"timesig-neomensural3/2" }
6116   s
6117   s_\markup { "$\\backslash$time 3/4" }
6118   ^\markup { "       " \musicglyph #"timesig-neomensural3/4" }
6119   s
6120   s_\markup { "$\\backslash$time 9/4" }
6121   ^\markup { "       " \musicglyph #"timesig-neomensural9/4" }
6122   s
6123   s_\markup { "$\\backslash$time 9/8" }
6124   ^\markup { "       " \musicglyph #"timesig-neomensural9/8" }
6125   \break
6126   s_\markup { "$\\backslash$time 4/8" }
6127   ^\markup { "       " \musicglyph #"timesig-neomensural4/8" }
6128   s
6129   s_\markup { "$\\backslash$time 2/4" }
6130   ^\markup { "       " \musicglyph #"timesig-neomensural2/4" }
6131 }
6132 @end lilypond
6133
6134 Use the @code{style} property of grob @internalsref{TimeSignature} to
6135 select ancient time signatures.  Supported styles are
6136 @code{neomensural} and @code{mensural}.  The above table uses the
6137 @code{neomensural} style.  This style is appropriate for the
6138 incipit of transcriptions of mensural pieces.  The @code{mensural}
6139 style mimics the look of historical printings of the 16th century.
6140
6141 The following examples shows the differences in style,
6142
6143 @c  why isn't relative working?
6144 @lilypond[raggedright,relative=1,quote]
6145 {
6146   \fatText
6147   \time 2/2
6148   c1^\markup { \hspace #-2.0 \typewriter default }
6149
6150   \override Staff.TimeSignature #'style = #'numbered  
6151   \time 2/2
6152   c1^\markup { \hspace #-2.0 \typewriter numbered }
6153
6154   \override Staff.TimeSignature #'style = #'mensural
6155   \time 2/2
6156   c1^\markup { \hspace #-2.0 \typewriter mensural }
6157   
6158   \override Staff.TimeSignature #'style = #'neomensural
6159   \time 2/2
6160   c1^\markup { \hspace #-2.0 \typewriter neomensural }
6161   \override Staff.TimeSignature #'style = #'single-digit
6162   \time 2/2
6163   c1^\markup { \hspace #-2.0 \typewriter single-digit }
6164 }
6165 @end lilypond
6166
6167 @seealso
6168
6169 This manual: @ref{Time signature} gives a general introduction into
6170 the use of time signatures.
6171
6172 @refbugs
6173
6174 Ratios of note durations do not change with the time signature.  For
6175 example, the ratio of 1 brevis = 3 semibrevis (tempus perfectum) must
6176 be made by hand, by setting
6177
6178 @example
6179   breveTP = #(ly:make-duration -1 0 3 2)
6180   @dots{}
6181   @{ c\breveTP f1 @}
6182 @end example
6183
6184 @noindent
6185 This sets @code{breveTP} to 3/2 times 2 = 3 times a whole note. 
6186
6187 The @code{old6/8alt} symbol (an alternate symbol for 6/8) is not
6188 addressable with @code{\time}.  Use a @code{\markup} instead
6189
6190 @node Ancient articulations
6191 @subsection Ancient articulations
6192
6193 @cindex articulations
6194
6195 In addition to the standard articulation signs described in section
6196 @ref{Articulations}, articulation signs for ancient notation are
6197 provided.  These are specifically designed for use with notation in
6198 Editio Vaticana style.
6199
6200 @lilypond[quote,raggedright,verbatim,noindent]
6201 \include "gregorian-init.ly"
6202 \score {
6203   \context VaticanaVoice {
6204     \override TextScript #'font-family = #'typewriter
6205     \override TextScript #'font-shape = #'upright
6206     \override Script #'padding = #-0.1
6207     a4\ictus_"ictus" s1
6208     a4\circulus_"circulus" s1
6209     a4\semicirculus_"semicirculus" s1 s
6210     a4\accentus_"accentus" s1
6211     \[ a4_"episem" \episemInitium \pes b \flexa a \episemFinis \]
6212   }
6213 }
6214 @end lilypond
6215
6216 @refbugs
6217
6218 Some articulations are vertically placed too closely to the
6219 correpsonding note heads.
6220
6221 @node Custodes
6222 @subsection Custodes
6223
6224 @cindex custos
6225 @cindex custodes
6226
6227 A @emph{custos} (plural: @emph{custodes}; Latin word for `guard') is a
6228 symbol that appears at the end of a staff.  It anticipates the pitch
6229 of the first note(s) of the following line thus helping the performer
6230 to manage line breaks during performance.
6231
6232 Custodes were frequently used in music notation until the 17th
6233 century.  Nowadays, they have survived only in a few particular forms
6234 of musical notation such as contemporary editions of Gregorian chant
6235 like the @emph{editio vaticana}.  There are different custos glyphs
6236 used in different flavors of notational style.
6237
6238 For typesetting custodes, just put a @internalsref{Custos_engraver} into the
6239 @internalsref{Staff} context when declaring the @code{\paper} block,
6240 as shown in the following example
6241
6242 @example
6243 \paper @{
6244   \context @{
6245     \Staff
6246     \consists Custos_engraver
6247     Custos \override #'style = #'mensural
6248   @}
6249 @}
6250 @end example
6251
6252 The result looks like this
6253
6254 @lilypond[quote,raggedright]
6255 \score {
6256 {
6257   a'1
6258   \override Staff.Custos #'style = #'mensural
6259   \break
6260   g'
6261 }
6262 \paper {
6263   \context { \Staff \consists Custos_engraver }
6264   }
6265 }
6266 @end lilypond
6267
6268 The custos glyph is selected by the @code{style} property.  The styles
6269 supported are @code{vaticana}, @code{medicaea}, @code{hufnagel} and
6270 @code{mensural}.  They are demonstrated in the following fragment
6271
6272 @lilypond[quote,raggedright,fragment]
6273 \new Lyrics \lyricmode {
6274   \markup { \column <
6275     \typewriter "vaticana" 
6276     { " " \musicglyph #"custodes-vaticana-u0" }
6277   > }
6278   \markup { \column <
6279     \typewriter "medicaea"
6280     { " " \musicglyph #"custodes-medicaea-u0" }
6281   >}
6282   \markup { \column <
6283     \typewriter "hufnagel"
6284     { " " \musicglyph #"custodes-hufnagel-u0" }
6285   >}
6286   \markup { \column <
6287     \typewriter "mensural"
6288     { " " \musicglyph #"custodes-mensural-u0" }
6289   >}
6290 }
6291
6292 @end lilypond
6293
6294 @seealso
6295
6296 Program reference: @internalsref{Custos}.
6297
6298 Examples: @inputfileref{input/regression,custos.ly}.
6299
6300
6301 @node Divisiones
6302 @subsection Divisiones
6303
6304 @cindex divisio
6305 @cindex divisiones
6306 @cindex finalis
6307
6308 A @emph{divisio} (plural: @emph{divisiones}; Latin word for
6309 `division') is a staff context symbol that is used to structure
6310 Gregorian music into phrases and sections.  The musical meaning of
6311 @emph{divisio minima}, @emph{divisio maior} and @emph{divisio maxima}
6312 can be characterized as short, medium and long pause, somewhat like
6313 the breathmarks from @ref{Breath marks}.  The @emph{finalis} sign not
6314 only marks the end of a chant, but is also frequently used within a
6315 single antiphonal/responsorial chant to mark the end of each section.
6316
6317
6318 To use divisiones, include the file @code{gregorian-init.ly}.  It
6319 contains definitions that you can apply by just inserting
6320 @code{\divisioMinima}, @code{\divisioMaior}, @code{\divisioMaxima},
6321 and @code{\finalis} at proper places in the input.  Some editions use
6322 @emph{virgula} or @emph{caesura} instead of divisio minima.
6323 Therefore, @code{gregorian-init.ly} also defines @code{\virgula} and
6324 @code{\caesura}
6325
6326 @lilypondfile[quote,raggedright]{divisiones.ly}
6327
6328 @refcommands
6329
6330 @cindex @code{\virgula}
6331 @code{\virgula},
6332 @cindex @code{\caesura}
6333 @code{\caesura},
6334 @cindex @code{\divisioMinima}
6335 @code{\divisioMinima},
6336 @cindex @code{\divisioMaior}
6337 @code{\divisioMaior},
6338 @cindex @code{\divisioMaxima}
6339 @code{\divisioMaxima},
6340 @cindex @code{\finalis}
6341 @code{\finalis}.
6342
6343 @seealso
6344
6345 In this manual: @ref{Breath marks}.
6346
6347 Program reference: @internalsref{BreathingSign}, @internalsref{BreathingSignEvent}.
6348
6349 Examples: @inputfileref{input/test,divisiones.ly}.
6350
6351 @node Ligatures
6352 @subsection Ligatures
6353
6354 @cindex Ligatures
6355
6356 @c TODO: Should double check if I recalled things correctly when I wrote
6357 @c down the following paragraph by heart.
6358
6359 A ligature is a graphical symbol that represents at least two distinct
6360 notes.  Ligatures originally appeared in the manuscripts of Gregorian
6361 chant notation to denote ascending or descending sequences of notes.
6362
6363 Ligatures are entered by enclosing them in @code{\[} and @code{\]}.
6364 Some ligature styles may need additional input syntax specific for
6365 this particular type of ligature.  By default, the
6366 @internalsref{LigatureBracket} engraver just puts a square bracket
6367 above the ligature
6368
6369 @lilypond[quote,raggedright,verbatim]
6370 \transpose c c' {
6371   \[ g c a f d' \]
6372   a g f
6373   \[ e f a g \]
6374 }
6375 @end lilypond
6376
6377 To select a specific style of ligatures, a proper ligature engraver
6378 has to be added to the @internalsref{Voice} context, as explained in
6379 the following subsections.   Only white mensural ligatures
6380 are supported with certain limitations.
6381
6382
6383
6384 @refbugs
6385
6386 Ligatures need special spacing that has not yet been implemented.  As
6387 a result, there is too much space between ligatures most of the time,
6388 and line breaking often is unsatisfactory.  Also, lyrics do not
6389 correctly align with ligatures.
6390
6391 Accidentals must not be printed within a ligature, but instead need to
6392 be collected and printed in front of it.
6393
6394 Augmentum dots within ligatures are not handled correctly.
6395
6396
6397 @menu
6398 * White mensural ligatures::    
6399 * Gregorian square neumes ligatures::  
6400 @end menu
6401
6402 @node White mensural ligatures
6403 @subsubsection White mensural ligatures
6404
6405 @cindex Mensural ligatures
6406 @cindex White mensural ligatures
6407
6408 There is limited support for white mensural ligatures.  
6409
6410 To engrave white mensural ligatures, in the paper block the
6411 @internalsref{Mensural_ligature_engraver} has to be put into the
6412 @internalsref{Voice} context, and remove the
6413 @internalsref{Ligature_bracket_engraver}
6414
6415 @example
6416 \paper @{
6417   \context @{
6418     \Voice
6419     \remove Ligature_bracket_engraver
6420     \consists Mensural_ligature_engraver
6421   @}
6422 @}
6423 @end example
6424
6425 There is no additional input language to describe the shape of a
6426 white mensural ligature.  The shape is rather determined solely from
6427 the pitch and duration of the enclosed notes.  While this approach may
6428 take a new user a while to get accustomed, it has the great advantage
6429 that the full musical information of the ligature is known internally.
6430 This is not only required for correct MIDI output, but also allows for
6431 automatic transcription of the ligatures.
6432
6433 For example,
6434
6435 @example
6436   \set Score.timing = ##f
6437   \set Score.defaultBarType = "empty"
6438   \override NoteHead #'style = #'neomensural
6439   \override Staff.TimeSignature   #'style = #'neomensural
6440   \clef "petrucci-g"
6441   \[ g\longa c\breve a\breve f\breve d'\longa \]
6442   s4
6443   \[ e1 f1 a\breve g\longa \]
6444 @end example
6445 @lilypond[quote,raggedright]
6446 \score {
6447   \transpose c c' {
6448     \set Score.timing = ##f
6449     \set Score.defaultBarType = "empty"
6450     \override NoteHead #'style = #'neomensural
6451     \override Staff.TimeSignature   #'style = #'neomensural
6452     \clef "petrucci-g"
6453     \[ g\longa c\breve a\breve f\breve d'\longa \]
6454     s4
6455     \[ e1 f1 a\breve g\longa \]
6456   }
6457   \paper {
6458     \context {
6459       \Voice
6460       \remove Ligature_bracket_engraver
6461       \consists Mensural_ligature_engraver
6462     }
6463   }
6464 }
6465 @end lilypond
6466
6467 Without replacing @internalsref{Ligature_bracket_engraver} with
6468 @internalsref{Mensural_ligature_engraver}, the same music transcribes
6469 to the following
6470
6471 @lilypond[quote,raggedright]
6472 \transpose c c' {
6473   \set Score.timing = ##f
6474   \set Score.defaultBarType = "empty"
6475   \override NoteHead #'style = #'neomensural
6476   \override Staff.TimeSignature   #'style = #'neomensural
6477   \clef "petrucci-g"
6478   \[ g\longa c\breve a\breve f\breve d'\longa \]
6479   s4
6480   \[ e1 f1 a\breve g\longa \]
6481 }
6482 @end lilypond
6483
6484 @refbugs
6485
6486 The implementation is experimental.  It may output strange warnings,
6487 incorrect results, and might even crash on more complex ligatures.
6488
6489 @node Gregorian square neumes ligatures
6490 @subsubsection Gregorian square neumes ligatures
6491
6492 @cindex Square neumes ligatures
6493 @cindex Gregorian square neumes ligatures
6494
6495 There is limited support for Gregorian square neumes notation
6496 (following the style of the Editio Vaticana).  Core ligatures can
6497 already be typeset, but essential issues for serious typesetting are
6498 still lacking, such as (among others) horizontal alignment of multiple
6499 ligatures, lyrics alignment and proper accidentals handling.
6500
6501
6502 The following table contains the extended neumes table of the 2nd
6503 volume of the Antiphonale Romanum (@emph{Liber Hymnarius}), published
6504 1983 by the monks of Solesmes.
6505
6506 @multitable @columnfractions .4 .2 .2 .2
6507
6508 @item
6509 @b{Neuma aut@*Neumarum Elementa} @tab
6510 @b{Figurae@*Rectae} @tab
6511 @b{Figurae@*Liquescentes Auctae} @tab
6512 @b{Figurae@*Liquescentes Deminutae}
6513
6514 @c TODO: \paper block is identical in all of the below examples.
6515 @c Therefore, it should somehow be included rather than duplicated all
6516 @c the time. --jr
6517
6518 @c why not make identifiers in ly/engraver-init.ly? --hwn
6519
6520 @c Because it's just used to typeset plain notes without
6521 @c a staff for demonstration purposes rather than something
6522 @c special of Gregorian chant notation. --jr
6523
6524 @item
6525 @code{1. Punctum}
6526 @tab
6527 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.5\cm]
6528 \include "gregorian-init.ly"
6529 \score {
6530   \transpose c c' {
6531     % Punctum
6532     \[ b \]
6533     \noBreak s^\markup {"a"} \noBreak
6534
6535     % Punctum Inclinatum
6536     \[ \inclinatum b \]
6537     \noBreak s^\markup {"b"}
6538   }
6539 \paper { \neumeDemoPaper }}
6540 @end lilypond
6541 @tab
6542 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=2.5\cm]
6543 \include "gregorian-init.ly"
6544 \score {
6545   \transpose c c' {
6546     % Punctum Auctum Ascendens
6547     \[ \auctum \ascendens b \]
6548     \noBreak s^\markup {"c"} \noBreak
6549
6550     % Punctum Auctum Descendens
6551     \[ \auctum \descendens b \]
6552     \noBreak s^\markup {"d"} \noBreak
6553
6554     % Punctum Inclinatum Auctum
6555     \[ \inclinatum \auctum b \]
6556     \noBreak s^\markup {"e"}
6557   }
6558 \paper { \neumeDemoPaper }}
6559 @end lilypond
6560 @tab
6561 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6562 \include "gregorian-init.ly"
6563 \score {
6564   \transpose c c' {
6565     % Punctum Inclinatum Parvum
6566     \[ \inclinatum \deminutum b \]
6567     \noBreak s^\markup {"f"}
6568   }
6569 \paper { \neumeDemoPaper }}
6570 @end lilypond
6571
6572 @item
6573 @code{2. Virga}
6574 @tab
6575 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6576 \include "gregorian-init.ly"
6577 \score {
6578   \transpose c c' {
6579     % Virga
6580     \[ \virga b \]
6581     \noBreak s^\markup {"g"}
6582   }
6583 \paper { \neumeDemoPaper }}
6584 @end lilypond
6585 @tab
6586 @tab
6587
6588 @item
6589 @code{3. Apostropha vel Stropha}
6590 @tab
6591 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6592 \include "gregorian-init.ly"
6593 \score {
6594   \transpose c c' {
6595     % Stropha
6596     \[ \stropha b \]
6597     \noBreak s^\markup {"h"}
6598   }
6599 \paper { \neumeDemoPaper }}
6600 @end lilypond
6601 @tab
6602 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6603 \include "gregorian-init.ly"
6604 \score {
6605   \transpose c c' {
6606     % Stropha Aucta
6607     \[ \stropha \auctum b \]
6608     \noBreak s^\markup {"i"}
6609   }
6610 \paper { \neumeDemoPaper }}
6611 @end lilypond
6612 @tab
6613
6614 @item
6615 @code{4. Oriscus}
6616 @tab
6617 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6618 \include "gregorian-init.ly"
6619 \score {
6620   \transpose c c' {
6621     % Oriscus
6622     \[ \oriscus b \]
6623     \noBreak s^\markup {"j"}
6624   }
6625 \paper { \neumeDemoPaper }}
6626 @end lilypond
6627 @tab
6628 @tab
6629
6630 @item
6631 @code{5. Clivis vel Flexa}
6632 @tab
6633 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6634 \include "gregorian-init.ly"
6635 \score {
6636   \transpose c c' {
6637     % Clivis vel Flexa
6638     \[ b \flexa g \]
6639     s^\markup {"k"}
6640   }
6641 \paper { \neumeDemoPaper }}
6642 @end lilypond
6643 @tab
6644 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=2.0\cm]
6645 \include "gregorian-init.ly"
6646 \score {
6647   \transpose c c' {
6648     % Clivis Aucta Descendens
6649     \[ b \flexa \auctum \descendens g \]
6650     \noBreak s^\markup {"l"} \noBreak
6651
6652     % Clivis Aucta Ascendens
6653     \[ b \flexa \auctum \ascendens g \]
6654     \noBreak s^\markup {"m"}
6655   }
6656 \paper { \neumeDemoPaper }}
6657 @end lilypond
6658 @tab
6659 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6660 \include "gregorian-init.ly"
6661 \score {
6662   \transpose c c' {
6663     % Cephalicus
6664     \[ b \flexa \deminutum g \]
6665     s^\markup {"n"}
6666   }
6667 \paper { \neumeDemoPaper }}
6668 @end lilypond
6669
6670 @item
6671 @code{6. Podatus vel Pes}
6672 @tab
6673 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6674 \include "gregorian-init.ly"
6675 \score {
6676   \transpose c c' {
6677     % Podatus vel Pes
6678     \[ g \pes b \]
6679     s^\markup {"o"}
6680   }
6681 \paper { \neumeDemoPaper }}
6682 @end lilypond
6683 @tab
6684 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=2.0\cm]
6685 \include "gregorian-init.ly"
6686 \score {
6687   \transpose c c' {
6688     % Pes Auctus Descendens
6689     \[ g \pes \auctum \descendens b \]
6690     \noBreak s^\markup {"p"} \noBreak
6691
6692     % Pes Auctus Ascendens
6693     \[ g \pes \auctum \ascendens b \]
6694     \noBreak s^\markup {"q"}
6695   }
6696 \paper { \neumeDemoPaper }}
6697 @end lilypond
6698 @tab
6699 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6700 \include "gregorian-init.ly"
6701 \score {
6702   \transpose c c' {
6703     % Epiphonus
6704     \[ g \pes \deminutum b \]
6705     s^\markup {"r"}
6706   }
6707 \paper { \neumeDemoPaper }}
6708 @end lilypond
6709
6710 @item
6711 @code{7. Pes Quassus}
6712 @tab
6713 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6714 \include "gregorian-init.ly"
6715 \score {
6716   \transpose c c' {
6717     % Pes Quassus
6718     \[ \oriscus g \pes \virga b \]
6719     s^\markup {"s"}
6720   }
6721 \paper { \neumeDemoPaper }}
6722 @end lilypond
6723 @tab
6724 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6725 \include "gregorian-init.ly"
6726 \score {
6727   \transpose c c' {
6728     % Pes Quassus Auctus Descendens
6729     \[ \oriscus g \pes \auctum \descendens b \]
6730     s^\markup {"t"}
6731   }
6732 \paper { \neumeDemoPaper }}
6733 @end lilypond
6734 @tab
6735
6736 @item
6737 @code{8. Quilisma Pes}
6738 @tab
6739 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6740 \include "gregorian-init.ly"
6741 \score {
6742   \transpose c c' {
6743     % Quilisma Pes
6744     \[ \quilisma g \pes b \]
6745     s^\markup {"u"}
6746   }
6747 \paper { \neumeDemoPaper }}
6748 @end lilypond
6749 @tab
6750 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6751 \include "gregorian-init.ly"
6752 \score {
6753   \transpose c c' {
6754     % Quilisma Pes Auctus Descendens
6755     \[ \quilisma g \pes \auctum \descendens b \]
6756     s^\markup {"v"}
6757   }
6758 \paper { \neumeDemoPaper }}
6759 @end lilypond
6760 @tab
6761
6762 @item
6763 @code{9. Podatus Initio Debilis}
6764 @tab
6765 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6766 \include "gregorian-init.ly"
6767 \score {
6768   \transpose c c' {
6769     % Pes Initio Debilis
6770     \[ \deminutum g \pes b \]
6771     s^\markup {"w"}
6772   }
6773 \paper { \neumeDemoPaper }}
6774 @end lilypond
6775 @tab
6776 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6777 \include "gregorian-init.ly"
6778 \score {
6779   \transpose c c' {
6780     % Pes Auctus Descendens Initio Debilis
6781     \[ \deminutum g \pes \auctum \descendens b \]
6782     s^\markup {"x"}
6783   }
6784 \paper { \neumeDemoPaper }}
6785 @end lilypond
6786 @tab
6787
6788 @item
6789 @code{10. Torculus}
6790 @tab
6791 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6792 \include "gregorian-init.ly"
6793 \score {
6794   \transpose c c' {
6795     % Torculus
6796     \[ a \pes b \flexa g \]
6797     s^\markup {"y"}
6798   }
6799 \paper { \neumeDemoPaper }}
6800 @end lilypond
6801 @tab
6802 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6803 \include "gregorian-init.ly"
6804 \score {
6805   \transpose c c' {
6806     % Torculus Auctus Descendens
6807     \[ a \pes b \flexa \auctum \descendens g \]
6808     s^\markup {"z"}
6809   }
6810 \paper { \neumeDemoPaper }}
6811 @end lilypond
6812 @tab
6813 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6814 \include "gregorian-init.ly"
6815 \score {
6816   \transpose c c' {
6817     % Torculus Deminutus
6818     \[ a \pes b \flexa \deminutum g \]
6819     s^\markup {"A"}
6820   }
6821 \paper { \neumeDemoPaper }}
6822 @end lilypond
6823
6824 @item
6825 @code{11. Torculus Initio Debilis}
6826 @tab
6827 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6828 \include "gregorian-init.ly"
6829 \score {
6830   \transpose c c' {
6831     % Torculus Initio Debilis
6832     \[ \deminutum a \pes b \flexa g \]
6833     s^\markup {"B"}
6834   }
6835 \paper { \neumeDemoPaper }}
6836 @end lilypond
6837 @tab
6838 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6839 \include "gregorian-init.ly"
6840 \score {
6841   \transpose c c' {
6842     % Torculus Auctus Descendens Initio Debilis
6843     \[ \deminutum a \pes b \flexa \auctum \descendens g \]
6844     s^\markup {"C"}
6845   }
6846 \paper { \neumeDemoPaper }}
6847 @end lilypond
6848 @tab
6849 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6850 \include "gregorian-init.ly"
6851 \score {
6852   \transpose c c' {
6853     % Torculus Deminutus Initio Debilis
6854     \[ \deminutum a \pes b \flexa \deminutum g \]
6855     s^\markup {"D"}
6856   }
6857 \paper { \neumeDemoPaper }}
6858 @end lilypond
6859
6860 @item
6861 @code{12. Porrectus}
6862 @tab
6863 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6864 \include "gregorian-init.ly"
6865 \score {
6866   \transpose c c' {
6867     % Porrectus
6868     \[ a \flexa g \pes b \]
6869     s^\markup {"E"}
6870   }
6871 \paper { \neumeDemoPaper }}
6872 @end lilypond
6873 @tab
6874 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6875 \include "gregorian-init.ly"
6876 \score {
6877   \transpose c c' {
6878     % Porrectus Auctus Descendens
6879     \[ a \flexa g \pes \auctum \descendens b \]
6880     s^\markup {"F"}
6881   }
6882 \paper { \neumeDemoPaper }}
6883 @end lilypond
6884 @tab
6885 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6886 \include "gregorian-init.ly"
6887 \score {
6888   \transpose c c' {
6889     % Porrectus Deminutus
6890     \[ a \flexa g \pes \deminutum b \]
6891     s^\markup {"G"}
6892   }
6893 \paper { \neumeDemoPaper }}
6894 @end lilypond
6895
6896 @item
6897 @code{13. Climacus}
6898 @tab
6899 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6900 \include "gregorian-init.ly"
6901 \score {
6902   \transpose c c' {
6903     % Climacus
6904     \[ \virga b \inclinatum a \inclinatum g \]
6905     s^\markup {"H"}
6906   }
6907   \paper { \neumeDemoPaper }
6908 }
6909 @end lilypond
6910 @tab
6911 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6912 \include "gregorian-init.ly"
6913 \score {
6914   \transpose c c' {
6915     % Climacus Auctus
6916     \[ \virga b \inclinatum a \inclinatum \auctum g \]
6917     s^\markup {"I"}
6918   }
6919 \paper { \neumeDemoPaper }}
6920 @end lilypond
6921 @tab
6922 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6923 \include "gregorian-init.ly"
6924 \score {
6925   \transpose c c' {
6926     % Climacus Deminutus
6927     \[ \virga b \inclinatum a \inclinatum \deminutum g \]
6928     s^\markup {"J"}
6929   }
6930 \paper { \neumeDemoPaper }}
6931 @end lilypond
6932
6933 @item
6934 @code{14. Scandicus}
6935 @tab
6936 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6937 \include "gregorian-init.ly"
6938 \score {
6939   \transpose c c' {
6940     % Scandicus
6941     \[ g \pes a \virga b \]
6942     s^\markup {"K"}
6943   }
6944 \paper { \neumeDemoPaper }}
6945 @end lilypond
6946 @tab
6947 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6948 \include "gregorian-init.ly"
6949 \score {
6950   \transpose c c' {
6951     % Scandicus Auctus Descendens
6952     \[ g \pes a \pes \auctum \descendens b \]
6953     s^\markup {"L"}
6954   }
6955 \paper { \neumeDemoPaper }}
6956 @end lilypond
6957 @tab
6958 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6959 \include "gregorian-init.ly"
6960 \score {
6961   \transpose c c' {
6962     % Scandicus Deminutus
6963     \[ g \pes a \pes \deminutum b \]
6964     s^\markup {"M"}
6965   }
6966 \paper { \neumeDemoPaper }}
6967 @end lilypond
6968
6969 @item
6970 @code{15. Salicus}
6971 @tab
6972 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6973 \include "gregorian-init.ly"
6974 \score {
6975   \transpose c c' {
6976     % Salicus
6977     \[ g \oriscus a \pes \virga b \]
6978     s^\markup {"N"}
6979   }
6980 \paper { \neumeDemoPaper }}
6981 @end lilypond
6982 @tab
6983 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6984 \include "gregorian-init.ly"
6985 \score {
6986   \transpose c c' {
6987     % Salicus Auctus Descendens
6988     \[ g \oriscus a \pes \auctum \descendens b \]
6989     s^\markup {"O"}
6990   }
6991 \paper { \neumeDemoPaper }}
6992 @end lilypond
6993 @tab
6994
6995 @item
6996 @code{16. Trigonus}
6997 @tab
6998 @lilypond[quote,noindent,staffsize=26,nofragment,linewidth=1.0\cm]
6999 \include "gregorian-init.ly"
7000 \score {
7001   \transpose c c' {
7002     % Trigonus
7003     \[ \stropha b \stropha b \stropha a \]
7004     s^\markup {"P"}
7005   }
7006   \paper { \neumeDemoPaper }
7007 }
7008 @end lilypond
7009 @tab
7010 @tab
7011
7012 @end multitable
7013
7014
7015 Unlike most other neumes notation systems, the input language for
7016 neumes does not reflect the typographical appearance, but is designed
7017 to focus on musical meaning.  For example, @code{\[ a \pes b
7018 \flexa g \]} produces a Torculus consisting of three Punctum heads,
7019 while @code{\[ a \flexa g \pes b \]} produces a Porrectus with a
7020 curved flexa shape and only a single Punctum head.  There is no
7021 command to explicitly typeset the curved flexa shape; the decision of
7022 when to typeset a curved flexa shape is based on the musical
7023 input.  The idea of this approach is to separate the musical aspects
7024 of the input from the notation style of the output.  This way, the
7025 same input can be reused to typeset the same music in a different
7026 style of Gregorian chant notation.
7027
7028 The following table shows the code fragments that produce the
7029 ligatures in the above neumes table.  The letter in the first column
7030 in each line of the below table indicates to which ligature in the
7031 above table it refers.  The second column gives the name of the
7032 ligature.  The third column shows the code fragment that produces this
7033 ligature, using @code{g}, @code{a} and @code{b} as example pitches.
7034
7035 @multitable @columnfractions .1 .4 .5
7036
7037 @item
7038 @b{#} @tab
7039 @b{Name} @tab
7040 @b{Input Language}
7041
7042 @item
7043 a @tab
7044 Punctum @tab
7045 @code{\[ b \]}
7046
7047 @item
7048 b @tab
7049 Punctum Inclinatum @tab
7050 @code{\[ \inclinatum b \]}
7051
7052 @item
7053 c @tab
7054 Punctum Auctum Ascendens @tab
7055 @code{\[ \auctum \ascendens b \]}
7056
7057 @item
7058 d @tab
7059 Punctum Auctum Descendens @tab
7060 @code{\[ \auctum \descendens b \]}
7061
7062 @item
7063 e @tab
7064 Punctum Inclinatum Auctum @tab
7065 @code{\[ \inclinatum \auctum b \]}
7066
7067 @item
7068 f @tab
7069 Punctum Inclinatum Parvum @tab
7070 @code{\[ \inclinatum \deminutum b \]}
7071
7072 @item
7073 g @tab
7074 Virga @tab
7075 @code{\[ \virga b \]}
7076
7077 @item
7078 h @tab
7079 Stropha @tab
7080 @code{\[ \stropha b \]}
7081
7082 @item
7083 i @tab
7084 Stropha Aucta @tab
7085 @code{\[ \stropha \auctum b \]}
7086
7087 @item
7088 j @tab
7089 Oriscus @tab
7090 @code{\[ \oriscus b \]}
7091
7092 @item
7093 k @tab
7094 Clivis vel Flexa @tab
7095 @code{\[ b \flexa g \]}
7096
7097 @item
7098 l @tab
7099 Clivis Aucta Descendens @tab
7100 @code{\[ b \flexa \auctum \descendens g \]}
7101
7102 @item
7103 m @tab
7104 Clivis Aucta Ascendens @tab
7105 @code{\[ b \flexa \auctum \ascendens g \]}
7106
7107 @item
7108 n @tab
7109 Cephalicus @tab
7110 @code{\[ b \flexa \deminutum g \]}
7111
7112 @item
7113 o @tab
7114 Podatus vel Pes @tab
7115 @code{\[ g \pes b \]}
7116
7117 @item
7118 p @tab
7119 Pes Auctus Descendens @tab
7120 @code{\[ g \pes \auctum \descendens b \]}
7121
7122 @item
7123 q @tab
7124 Pes Auctus Ascendens @tab
7125 @code{\[ g \pes \auctum \ascendens b \]}
7126
7127 @item
7128 r @tab
7129 Epiphonus @tab
7130 @code{\[ g \pes \deminutum b \]}
7131
7132 @item
7133 s @tab
7134 Pes Quassus @tab
7135 @code{\[ \oriscus g \pes \virga b \]}
7136
7137 @item
7138 t @tab
7139 Pes Quassus Auctus Descendens @tab
7140 @code{\[ \oriscus g \pes \auctum \descendens b \]}
7141
7142 @item
7143 u @tab
7144 Quilisma Pes @tab
7145 @code{\[ \quilisma g \pes b \]}
7146
7147 @item
7148 v @tab
7149 Quilisma Pes Auctus Descendens @tab
7150 @code{\[ \quilisma g \pes \auctum \descendens b \]}
7151
7152 @item
7153 w @tab
7154 Pes Initio Debilis @tab
7155 @code{\[ \deminutum g \pes b \]}
7156
7157 @item
7158 x @tab
7159 Pes Auctus Descendens Initio Debilis @tab
7160 @code{\[ \deminutum g \pes \auctum \descendens b \]}
7161
7162 @item
7163 y @tab
7164 Torculus @tab
7165 @code{\[ a \pes b \flexa g \]}
7166
7167 @item
7168 z @tab
7169 Torculus Auctus Descendens @tab
7170 @code{\[ a \pes b \flexa \auctum \descendens g \]}
7171
7172 @item
7173 A @tab
7174 Torculus Deminutus @tab
7175 @code{\[ a \pes b \flexa \deminutum g \]}
7176
7177 @item
7178 B @tab
7179 Torculus Initio Debilis @tab
7180 @code{\[ \deminutum a \pes b \flexa g \]}
7181
7182 @item
7183 C @tab
7184 Torculus Auctus Descendens Initio Debilis @tab
7185 @code{\[ \deminutum a \pes b \flexa \auctum \descendens g \]}
7186
7187 @item
7188 D @tab
7189 Torculus Deminutus Initio Debilis @tab
7190 @code{\[ \deminutum a \pes b \flexa \deminutum g \]}
7191
7192 @item
7193 E @tab
7194 Porrectus @tab
7195 @code{\[ a \flexa g \pes b \]}
7196
7197 @item
7198 F @tab
7199 Porrectus Auctus Descendens @tab
7200 @code{\[ a \flexa g \pes \auctum \descendens b \]}
7201
7202 @item
7203 G @tab
7204 Porrectus Deminutus @tab
7205 @code{\[ a \flexa g \pes \deminutum b \]}
7206
7207 @item
7208 H @tab
7209 Climacus @tab
7210 @code{\[ \virga b \inclinatum a \inclinatum g \]}
7211
7212 @item
7213 I @tab
7214 Climacus Auctus @tab
7215 @code{\[ \virga b \inclinatum a \inclinatum \auctum g \]}
7216
7217 @item
7218 J @tab
7219 Climacus Deminutus @tab
7220 @code{\[ \virga b \inclinatum a \inclinatum \deminutum g \]}
7221
7222 @item
7223 K @tab
7224 Scandicus @tab
7225 @code{\[ g \pes a \virga b \]}
7226
7227 @item
7228 L @tab
7229 Scandicus Auctus Descendens @tab
7230 @code{\[ g \pes a \pes \auctum \descendens b \]}
7231
7232 @item
7233 M @tab
7234 Scandicus Deminutus @tab
7235 @code{\[ g \pes a \pes \deminutum b \]}
7236
7237 @item
7238 N @tab
7239 Salicus @tab
7240 @code{\[ g \oriscus a \pes \virga b \]}
7241
7242 @item
7243 O @tab
7244 Salicus Auctus Descendens @tab
7245 @code{\[ g \oriscus a \pes \auctum \descendens b \]}
7246
7247 @item
7248 P @tab
7249 Trigonus @tab
7250 @code{\[ \stropha b \stropha b \stropha a \]}
7251
7252 @end multitable
7253
7254 @refcommands
7255
7256 The following head prefixes are supported
7257
7258 @cindex @code{\virga}
7259 @code{\virga},
7260 @cindex @code{\stropha}
7261 @code{\stropha},
7262 @cindex @code{\inclinatum}
7263 @code{\inclinatum},
7264 @cindex @code{\auctum}
7265 @code{\auctum},
7266 @cindex @code{\descendens}
7267 @code{\descendens},
7268 @cindex @code{\ascendens}
7269 @code{\ascendens},
7270 @cindex @code{\oriscus}
7271 @code{\oriscus},
7272 @cindex @code{\quilisma}
7273 @code{\quilisma},
7274 @cindex @code{\deminutum}
7275 @code{\deminutum}.
7276
7277 Head prefixes can be accumulated, though restrictions apply.  For
7278 example, either @code{\descendens} or @code{\ascendens} can be applied
7279 to a head, but not both to the same head.
7280
7281 @cindex @code{\pes}
7282 @cindex @code{\flexa}
7283 Two adjacent heads can be tied together with the @code{\pes} and
7284 @code{\flexa} infix commands for a rising and falling line of melody,
7285 respectively.
7286
7287
7288
7289 @node Gregorian Chant contexts
7290 @subsection Gregorian Chant contexts
7291
7292 @cindex VaticanaVoiceContext
7293 @cindex VaticanaStaffContext
7294
7295 The predefined @code{VaticanaVoiceContext} and
7296 @code{VaticanaStaffContext} can be used to engrave a piece of
7297 Gregorian Chant in the style of the Editio Vaticana.  These contexts
7298 initialize all relevant context properties and grob properties to
7299 proper values, so you can immediately go ahead entering the chant, as
7300 the following excerpt demonstrates
7301
7302 @lilypond[quote,raggedright,verbatim,noindent]
7303 \include "gregorian-init.ly"
7304 \score {
7305   <<
7306     \context VaticanaVoice = "cantus" {
7307       \override Score.BarNumber #'transparent = ##t {
7308         \[ c'\melisma c' \flexa a \]
7309         \[ a \flexa \deminutum g\melismaEnd \]
7310         f \divisioMinima
7311         \[ f\melisma \pes a c' c' \pes d'\melismaEnd \]
7312         c' \divisioMinima \break
7313         \[ c'\melisma c' \flexa a \]
7314         \[ a \flexa \deminutum g\melismaEnd \] f \divisioMinima
7315       }
7316     }
7317     \lyricsto "cantus" \new Lyrics {
7318       San- ctus, San- ctus, San- ctus
7319     }
7320   >>
7321 }
7322 @end lilypond
7323
7324
7325 @node Mensural contexts
7326 @subsection Mensural contexts
7327
7328 @cindex MensuralVoiceContext
7329 @cindex MensuralStaffContext
7330
7331 The predefined @code{MensuralVoiceContext} and
7332 @code{MensuralStaffContext} can be used to engrave a piece in mensural
7333 style.  These contexts initialize all relevant context properties and
7334 grob properties to proper values, so you can immediately go ahead
7335 entering the chant, as the following excerpt demonstrates
7336
7337 @lilypond[quote,raggedright,verbatim,noindent]
7338 \score {
7339   <<
7340     \context MensuralVoice = "discantus" \transpose c c' {
7341       \override Score.BarNumber #'transparent = ##t {
7342         c'1\melisma bes a g\melismaEnd
7343         f\breve
7344         \[ f1\melisma a c'\breve d'\melismaEnd \]
7345         c'\longa
7346         c'\breve\melisma a1 g1\melismaEnd
7347         fis\longa^\signumcongruentiae
7348       }
7349     }
7350     \lyricsto "discantus" \new Lyrics {
7351       San -- ctus, San -- ctus, San -- ctus
7352     }
7353   >>
7354 }
7355 @end lilypond
7356
7357
7358 @node Figured bass
7359 @subsection Figured bass
7360
7361 @cindex Basso continuo
7362
7363 @c TODO: musicological blurb about FB
7364
7365
7366 LilyPond has limited support for figured bass
7367
7368 @lilypond[quote,verbatim,fragment]
7369 <<
7370   \context Voice  { \clef bass dis4  c d ais }
7371   \context FiguredBass \figuremode {
7372     < 6 >4 < 7 >8 < 6+ [_!] >
7373     < 6 >4 <6 5 [3+] >
7374   }
7375 >>
7376 @end lilypond
7377
7378 The support for figured bass consists of two parts: there is an input
7379 mode, introduced by @code{\figuremode}, where you can enter bass figures
7380 as numbers, and there is a context called @internalsref{FiguredBass} that
7381 takes care of making @internalsref{BassFigure} objects.
7382
7383 In figures input mode, a group of bass figures is delimited by
7384 @code{<} and @code{>}.  The duration is entered after the @code{>}
7385 @example
7386 <4 6>
7387 @end example
7388 @lilypond[quote,fragment]
7389 \context FiguredBass
7390 \figuremode { <4 6> }
7391 @end lilypond
7392
7393 Accidentals are added when you append @code{-}, @code{!}  and @code{+}
7394 to the numbers
7395
7396 @example
7397 <4- 6+ 7!>
7398 @end example
7399 @lilypond[quote,fragment]
7400   \context FiguredBass
7401   \figuremode { <4- 6+ 7!> }
7402 @end lilypond
7403
7404 Spaces or dashes may be inserted by using @code{_}.  Brackets are
7405 introduced with @code{[} and @code{]}
7406
7407 @example
7408 < [4 6] 8 [_! 12]>
7409 @end example
7410 @lilypond[quote,fragment]
7411   \context FiguredBass
7412   \figuremode { < [4 6] 8 [_! 12]> }
7413 @end lilypond
7414
7415 Although the support for figured bass may superficially resemble chord
7416 support, it works much simpler.  The @code{\figuremode} mode simply
7417 stores the numbers , and @internalsref{FiguredBass} context prints
7418 them as entered.  There is no conversion to pitches, and no
7419 realizations of the bass are played in the MIDI file.
7420
7421 Internally, the code produces markup texts.  You can use any of the
7422 markup text properties to override formatting.  For example, the
7423 vertical spacing of the figures may be set with @code{baseline-skip}.
7424
7425 @seealso
7426
7427 Program reference: @internalsref{BassFigureEvent} music, @internalsref{BassFigure} object, 
7428 and @internalsref{FiguredBass} context.
7429
7430 @refbugs
7431
7432 Slash notation for alterations is not supported.
7433
7434 @node Contemporary notation
7435 @section Contemporary notation
7436
7437 In the 20th century, composers have greatly expanded the musical
7438 vocabulary.  With this expansion, many innovations in musical notation
7439 have been tried.  The book ``Music Notation in the 20th century'' by
7440 Kurt Stone gives a comprehensive overview (see @ref{Literature
7441 list}).  In general, the use of new, innovative notation makes a piece
7442 harder to understand and perform and its use should therefore be
7443 avoided.  For this reason, support for contemporary notation in
7444 LilyPond is limited.
7445
7446
7447 @menu
7448 * Polymetric notation::         
7449 * Clusters::                    
7450 * Special fermatas::            
7451 * Feathered beams::             
7452 @end menu
7453
7454 @node Polymetric notation
7455 @subsection Polymetric notation
7456
7457 Double time signatures are not supported explicitly, but they can be
7458 faked.  In the next example, the markup for the time signature is
7459 created with a markup text.  This markup text is inserted in the
7460 @internalsref{TimeSignature} grob.
7461
7462 @lilypond[verbatim,raggedright]
7463
7464 % create 2/4 + 5/8
7465 tsMarkup =\markup  {
7466   \number { 
7467     \column < "2" "4" >
7468     \musicglyph #"scripts-stopped" 
7469     \bracket \column < "5" "8" >
7470   }
7471 }
7472
7473 {
7474   \override Staff.TimeSignature #'print-function = #Text_interface::print
7475   \override Staff.TimeSignature #'text = #tsMarkup
7476   \time 3/2
7477   c'2 \bar ":" c'4 c'4.
7478 }
7479 @end lilypond
7480
7481 Each staff can also have its own time signature.  This is done by
7482 moving the @internalsref{Timing_engraver} to @internalsref{Staff}
7483 context.
7484
7485 @verbatim
7486 \paper{
7487   \context{ \Score \remove "Timing_engraver" }
7488   \context{ \Staff \consists "Timing_engraver" }
7489 }       
7490 @end verbatim
7491
7492
7493 Now, each staff has its own time signature.
7494 @verbatim
7495 <<
7496   \new Staff {
7497     \time 3/4
7498     c4 c c | c c c |
7499   }
7500   \new Staff {
7501     \time 2/4
7502     c4 c | c c | c c
7503   }
7504   \new Staff {
7505     \time 3/8
7506     c4. c8 c c c4. c8 c c
7507   }
7508 >>
7509 @end verbatim
7510
7511 @lilypond[raggedright]
7512 \paper{
7513   \context{ \Score \remove "Timing_engraver" }
7514   \context{ \Staff \consists "Timing_engraver" }
7515 }       
7516
7517 \relative c'  <<
7518   \new Staff {
7519     \time 3/4
7520     c4 c c | c c c |
7521   }
7522   \new Staff {
7523     \time 2/4
7524     c4 c | c c | c c
7525   }
7526   \new Staff {
7527     \time 3/8
7528     c4. c8 c c c4. c8 c c
7529   }
7530 >>
7531 @end lilypond
7532
7533
7534 A different form of polymetric notation is where note lengths have
7535 different values across staves.
7536
7537 This notation can be created by setting a common time signature for
7538 each staff but replacing it manually using
7539 @code{timeSignatureFraction} to the desired fraction.  Then the printed
7540 durations in each staff are scaled to the common time signature.
7541 The latter is done with @code{\compressmusic}, which is similar to
7542 @code{\times}, but does not create a tuplet bracket.
7543
7544
7545 In this example, music with the time signatures of 3/4, 9/8 and 10/8 are
7546 used in parallel.  In the second staff, shown durations are multiplied by 
7547 2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are 
7548 multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
7549
7550 @lilypond[raggedright,verbatim,fragment]
7551 \relative c' { <<
7552   \new Staff {
7553     \time 3/4
7554     c4 c c | c c c |
7555   }
7556   \new Staff {
7557     \time 3/4
7558     \set Staff.timeSignatureFraction = #'(9 . 8)
7559     \compressmusic #'(2 . 3)
7560       \repeat unfold 6 { c8[ c c] }
7561   }
7562   \new Staff {
7563     \time 3/4
7564     \set Staff.timeSignatureFraction = #'(10 . 8)
7565     \compressmusic #'(3 . 5) {
7566       \repeat unfold 2 { c8[ c c] }
7567       \repeat unfold 2 { c8[  c] }
7568       | c4. c4. \times 2/3 { c8 c c } c4
7569     }
7570   }
7571 >> }
7572 @end lilypond
7573
7574
7575
7576
7577 @refbugs
7578
7579 When using different time signatures in parallel, the spacing is
7580 aligned vertically, but bar lines distort the regular spacing.
7581
7582
7583
7584 @node Clusters
7585 @subsection Clusters
7586
7587 @cindex cluster
7588
7589 A cluster indicates a continuous range of pitches to be played.  They
7590 can be denoted as the envelope of a set of notes.  They are entered by
7591 applying the function @code{makeClusters} to a sequence of
7592 chords, e.g.
7593 @c
7594 @lilypond[quote,relative=2,fragment,verbatim]
7595   \makeClusters { <c e > <b f'> }
7596 @end lilypond
7597
7598 The following example (from
7599 @inputfileref{input/regression,cluster.ly}) shows what the result
7600 looks like
7601
7602 @lilypondfile[quote]{cluster.ly}
7603
7604 Ordinary notes and clusters can be put together in the same staff,
7605 even simultaneously.  In such a case no attempt is made to
7606 automatically avoid collisions between ordinary notes and clusters.
7607
7608 @seealso
7609
7610 Program reference: @internalsref{ClusterSpanner},
7611 @internalsref{ClusterSpannerBeacon},
7612 @internalsref{Cluster_spanner_engraver}, and
7613 @internalsref{ClusterNoteEvent}.
7614
7615 Examples: @inputfileref{input/regression,cluster.ly}.
7616
7617 @refbugs
7618
7619 Music expressions like @code{<< @{ g8 e8 @} a4 >>} are not printed
7620 accurately.  Use @code{<g a>8 <e a>8} instead.
7621
7622
7623
7624 @node Special fermatas
7625 @subsection Special fermatas
7626
7627 @cindex fermatas, special
7628
7629 In contemporary music notation, special fermata symbols denote breaks
7630 of differing lengths.  The following fermatas are supported
7631
7632 @lilypond[quote,raggedright]
7633 <<
7634   \oldaddlyrics  {
7635     b'2
7636     ^\shortfermata
7637     _\shortfermata
7638     r
7639
7640     b'
7641     ^\fermata
7642     _\fermata
7643     r
7644
7645     b'
7646     ^\longfermata
7647     _\longfermata
7648     r
7649
7650     b'
7651     ^\verylongfermata
7652     _\verylongfermata
7653     r
7654   }
7655   \context Lyrics \lyricmode {
7656     \override LyricText #'font-family = #'typewriter
7657     "shortfermata" "fermata"  "longfermata" "verylongfermata"
7658   }
7659 >>
7660 @end lilypond
7661
7662 See @ref{Articulations} for general instructions how to apply scripts
7663 such as fermatas to notes.
7664
7665 @node Feathered beams
7666 @subsection Feathered beams
7667
7668 Feathered beams are not supported natively, but they can be faked by
7669 forcing two beams to overlap.  Here is an example,
7670
7671 @c don't change  relative setting witout changing positions!
7672 @lilypond[raggedright,relative=1,fragment,verbatim]
7673 \new Staff <<
7674   \new Voice
7675   {
7676     \stemUp
7677     \once \override Voice.Beam #'positions = #'(0 . 0.5)
7678     c8[ c c c c ]
7679   }
7680   \new Voice {
7681     \stemUp
7682     \once \override Voice.Beam #'positions = #'(0 . -0.5) 
7683     c[ c c c c]
7684   }
7685 >>
7686 @end lilypond
7687
7688
7689
7690 @node Educational use
7691 @section Educational use
7692
7693 With the amount of control that LilyPond offers, one can make great
7694 teaching tools in addition to great musical scores.
7695
7696 @menu
7697 * Balloon help::                
7698 * Blank music paper::           
7699 * Hidden notes::     
7700 * Easy Notation note heads::    
7701 @end menu
7702
7703 @node Balloon help
7704 @subsection Balloon help
7705
7706 Elements of notation can be marked and named with the help of a square
7707 balloon.  The primary purpose of this feature is to explain notation.
7708
7709 The following example demonstrates its use.
7710
7711 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
7712 \context Voice {
7713   \applyoutput
7714     #(add-balloon-text 'NoteHead "heads, or tails?"
7715     '(1 . -3))
7716   c8
7717 }
7718 @end lilypond
7719
7720 @noindent
7721 The function @code{add-balloon-text} takes the name of a grob, the
7722 label to print, and the position where to put the label relative to 
7723 the object.  In the above example, the text ``heads or tails?'' ends 
7724 3 spaces below and 1 space to the right of the marked head.
7725
7726 @cindex balloon
7727 @cindex notation, explaining
7728
7729 @seealso
7730
7731 Program reference: @internalsref{text-balloon-interface}.
7732
7733 Examples: @inputfileref{input/regression,balloon.ly}.
7734
7735
7736
7737
7738 @node Blank music paper
7739 @subsection Blank music paper
7740
7741 A blank music paper can be produced also by using invisible notes, and
7742 removing @code{Bar_number_engraver}.
7743
7744
7745 @lilypond
7746 emptymusic =  {
7747   \repeat unfold 2 % Change this for more lines. 
7748   { s1\break }
7749   \bar "|."
7750 }
7751 \new Score \with {
7752   \override TimeSignature #'transparent = ##t
7753   defaultBarType = #""
7754   \remove Bar_number_engraver
7755 } <<
7756   \context Staff \emptymusic
7757   \context TabStaff \emptymusic
7758 >>
7759 @end lilypond
7760
7761
7762 @node Hidden notes
7763 @subsection Hidden notes
7764
7765 @cindex Hidden notes
7766 @cindex Invisible notes
7767 @cindex Transparent notes
7768
7769 Hidden (or invisible or transparent) notes can be useful in preparing theory
7770 or composition exercises.
7771
7772 @lilypond[quote,verbatim,relative=2,fragment]
7773   c4 d4 
7774   \hideNotes
7775   e4 f4
7776   \unHideNotes
7777   g4 a 
7778 @end lilypond
7779
7780 Hidden notes are also great for performing weird tricks.  For example,
7781 slurs cannot be attached to rests or spacer rests, but you may with
7782 to include that in your score -- string instruments use this notation
7783 when doing pizzicato to indicate that the note should ring for as long
7784 as possible.
7785
7786 @lilypond[quote,verbatim,relative=0,fragment]
7787   \clef bass
7788   << {
7789     c4^"pizz"( \hideNotes c)
7790     \unHideNotes c( \hideNotes c)
7791   } {
7792     s4 r s r
7793   } >>
7794 @end lilypond
7795
7796
7797 @node Easy Notation note heads
7798 @subsection Easy Notation note heads
7799
7800 @cindex easy notation
7801 @cindex Hal Leonard
7802
7803 The `easy play' note head includes a note name inside the head.  It is
7804 used in music for beginners
7805
7806 @lilypond[quote,raggedright,verbatim,fragment,staffsize=26]
7807   \setEasyHeads
7808   c'2 e'4 f' | g'1
7809 @end lilypond
7810
7811 The command @code{\setEasyHeads} overrides settings for the
7812 @internalsref{NoteHead} object.  To make the letters readable, it has
7813 to be printed in a large font size.  To print with a larger font, see
7814 @ref{Setting global staff size}.
7815
7816 @refcommands
7817
7818 @cindex @code{\setEasyHeads}
7819 @code{\setEasyHeads}
7820