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