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