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