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