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