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