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