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