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