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