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