1 @c -*- coding: latin-1; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
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
9 @chapter Basic notation
11 This chapter explains how to use all basic notation features.
15 * Easier music entry::
29 This section is about basic notation elements like notes, rests, and
30 related constructs, such as stems, tuplets and ties.
35 * Chromatic alterations::
54 A note is printed by specifying its pitch and then its duration,
56 @lilypond[quote,verbatim,raggedright]
57 { cis'4 d'8 e'16 c'16 }
65 @cindex Note specification
67 @cindex entering notes
69 The most common syntax for pitch entry is used for standard notes and
70 @code{\chordmode} modes. In these modes, pitches may be designated by
71 names. The notes are specified by the letters @code{a} through
72 @code{g}. The octave is formed with notes ranging from @code{c}
73 to @code{b}. The pitch @code{c} is an octave below middle C and the
74 letters span the octave above that C
76 @lilypond[quote,fragment,verbatim]
78 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
81 @cindex note names, Dutch
83 A sharp is formed by adding @code{-is} to the end of a pitch name and
84 a flat is formed by adding @code{-es}. Double sharps and double flats
85 are obtained by adding @code{-isis} or @code{-eses}. These
86 names are the Dutch note names. In Dutch, @code{aes} is contracted to
87 @code{as}, but both forms are accepted. Similarly, both
88 @code{es} and @code{ees} are accepted
90 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
98 In accordance with standard typsetting rules, a natural sign is printed
99 before a sharp or flat if a previous accidental needs to be
100 cancelled. To change this behaviour, use
101 @code{\set Staff.extraNatural = ##f}
103 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
105 \set Staff.extraNatural = ##f
109 There are predefined sets of note names for various other languages.
110 To use them, include the language specific init file. For
111 example: @code{\include "english.ly"}. The available language files
112 and the note names they define are
117 Note Names sharp flat
118 nederlands.ly c d e f g a bes b -is -es
119 english.ly c d e f g a bf b -s/-sharp -f/-flat
121 deutsch.ly c d e f g a b h -is -es
122 norsk.ly c d e f g a b h -iss/-is -ess/-es
123 svenska.ly c d e f g a b h -iss -ess
124 italiano.ly do re mi fa sol la sib si -d -b
125 catalan.ly do re mi fa sol la sib si -d/-s -b
126 espanol.ly do re mi fa sol la sib si -s -b
134 The optional octave specification takes the form of a series of
135 single quote (`@code{'}') characters or a series of comma
136 (`@code{,}') characters. Each @code{'} raises the pitch by one
137 octave; each @code{,} lowers the pitch by an octave
139 @lilypond[quote,raggedright,fragment,verbatim]
140 c' c'' es' g' as' gisis' ais'
145 @c FIXME: we need this info (hide/unhide) somewhere in the manual, but this ain't the place. -gp
146 @c wait; this is already in advanced notation.
148 Notes can be hidden and unhidden with the following commands
150 @cindex @code{\hideNotes}
152 @cindex @code{\unHideNotes}
158 Program reference: @internalsref{NoteEvent}, and @internalsref{NoteHead}.
162 @node Chromatic alterations
163 @subsection Chromatic alterations
165 Normally accidentals are printed automatically, but you may also
166 print them manually. A reminder accidental
167 @cindex reminder accidental
169 can be forced by adding an exclamation mark @code{!}
170 after the pitch. A cautionary accidental
171 @cindex cautionary accidental
172 @cindex parenthesized accidental
173 (i.e., an accidental within parentheses) can be obtained by adding the
174 question mark `@code{?}' after the pitch.
176 @lilypond[quote,raggedright,fragment,verbatim]
177 cis' cis' cis'! cis'?
183 The automatic production of accidentals can be tuned in many
184 ways. For more information, refer to @ref{Automatic accidentals}.
189 @subsection Micro tones
191 Half-flats and half-sharps are formed by adding @code{-eh} and
192 @code{-ih}; the following is a series of Cs with increasing pitches
194 @cindex quarter tones
195 @cindex semi-flats, semi-sharps
197 @lilypond[verbatim,raggedright,quote,relative=2,fragment]
198 { ceseh ceh cih cisih }
201 Micro tones are also exported to the MIDI file
206 There are no generally accepted standards for denoting three quarter
207 flats, so LilyPond's symbol does not conform to any standard.
212 A chord is formed by a enclosing a set of pitches in @code{<} and
213 @code{>}. A chord may be followed by a duration, and a set of
214 articulations, just like simple notes
216 @lilypond[verbatim,raggedright,fragment,quote,relative=1]
228 Rests are entered like notes, with the note name @code{r}
230 @lilypond[fragment,quote,raggedright,verbatim]
234 Whole bar rests, centered in middle of the bar,
235 must be done with multi-measure rests. They are discussed in
236 @ref{Multi measure rests}.
239 A rest's vertical position may be explicitly specified by entering a
240 note with the @code{\rest} keyword appended, the rest will be placed at
241 the note's place. This makes manual formatting in polyphonic music
242 easier. Automatic rest collision formatting will leave these rests
245 @lilypond[fragment,quote,raggedright,verbatim]
251 Program reference: @internalsref{RestEvent}, and @internalsref{Rest}.
258 @cindex Invisible rest
263 An invisible rest (also called a `skip') can be entered like a note
264 with note name `@code{s}' or with @code{\skip @var{duration}}
266 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
267 a4 a4 s4 a4 \skip 1 a4
270 The @code{s} syntax is only available in note mode and chord mode. In
271 other situations, for example, when entering lyrics, you should use
272 the @code{\skip} command
274 @lilypond[quote,raggedright,verbatim]
277 \new Lyrics \lyricmode { \skip 2 bla1 }
281 The skip command is merely an empty musical placeholder. It does not
282 produce any output, not even transparent output.
284 The @code{s} skip command does create @internalsref{Staff} and
285 @internalsref{Voice} when necessary, similar to note and rest
286 commands. For example, the following results in an empty staff.
288 @lilypond[quote,raggedright,verbatim]
292 The fragment @code{@{ \skip 4 @} } would produce an empty page.
296 Program reference: @internalsref{SkipEvent}, @internalsref{SkipMusic}.
301 @subsection Durations
305 @cindex @code{\longa}
306 @cindex @code{\breve}
307 @cindex @code{\maxima}
310 In Note, Chord, and Lyrics mode, durations are designated by numbers and
311 dots: durations are entered as their reciprocal values. For example, a
312 quarter note is entered using a @code{4} (since it is a 1/4 note), while
313 a half note is entered using a @code{2} (since it is a 1/2 note). For
314 notes longer than a whole you must use the variables @code{\longa} and
319 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
321 r1 r2 r4 r8 r16 r32 r64 r64
327 a\breve*1/2 \autoBeamOff
328 a1 a2 a4 a8 a16 a32 a64 a64
331 r\longa*1/4 r\breve *1/2
332 r1 r2 r4 r8 r16 r32 r64 r64
338 \remove "Clef_engraver"
339 \override StaffSymbol #'transparent = ##t
340 \override TimeSignature #'transparent = ##t
341 \override BarLine #'transparent = ##t
342 \consists "Pitch_squash_engraver"
348 If the duration is omitted then it is set to the previously entered
349 duration. The default for the first note is a quarter note.
351 @lilypond[quote,raggedright,verbatim,fragment]
352 { a a a2 a a4 a a1 a }
357 @node Augmentation dots
358 @subsection Augmentation dots
361 To obtain dotted note lenghts, simply add a dot (`@code{.}') to
362 the number. Double-dotted notes are produced in a similar way.
364 @lilypond[quote,raggedright,fragment,verbatim]
365 a'4 b' c''4. b'8 a'4. b'4.. c''8.
370 Dots are normally moved up to avoid staff lines, except in polyphonic
371 situations. The following commands may be used to force a particular
374 @cindex @code{\dotsUp}
376 @cindex @code{\dotsDown}
378 @cindex @code{\dotsNeutral}
383 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}.
385 @node Scaling durations
386 @subsection Scaling durations
388 You can alter the length of duration by a fraction @var{N/M}
389 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
390 will not affect the appearance of the notes or rests produced.
392 In the following example, the first three notes take up exactly two
393 beats, but no triplet bracket is printed.
394 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
396 a4*2/3 gis4*2/3 a4*2/3
404 This manual: @ref{Tuplets}
407 @c TODO: I'm not certain that Stems belong here in the manual. -gp
411 Whenever a note is found, a @internalsref{Stem} object is created
412 automatically. For whole notes and rests, they are also created but
417 @cindex @code{\stemUp}
419 @cindex @code{\stemDown}
421 @cindex @code{\stemNeutral}
432 A tie connects two adjacent note heads of the same pitch. The tie in
433 effect extends the length of a note. Ties should not be confused with
434 slurs, which indicate articulation, or phrasing slurs, which indicate
435 musical phrasing. A tie is entered using the tilde symbol `@code{~}'
437 @lilypond[quote,raggedright,fragment,verbatim]
438 e' ~ e' <c' e' g'> ~ <c' e' g'>
441 When a tie is applied to a chord, all note heads whose pitches match
442 are connected. When no note heads match, no ties will be created.
444 A tie is just a way of extending a note duration, similar to the
445 augmentation dot. The following example shows two ways of notating
446 exactly the same concept
448 @lilypond[quote,fragment,raggedright]
449 \time 3/4 c'2. c'2 ~ c'4
453 Ties are used either when the note crosses a bar line, or when dots
454 cannot be used to denote the rhythm. When using ties, larger note
455 values should be aligned to subdivisions of the measure, eg.
457 @lilypond[fragment,quote,raggedright]
459 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
463 If you need to tie a lot of notes over bars, it may be easier to use
464 automatic note splitting (see @ref{Automatic note splitting}). This
465 mechanism automatically splits long notes, and ties them across bar
468 Ties are sometimes used to write out arpeggios. In this case, two tied
469 notes need not be consecutive. This can be achieved by setting the
470 @code{tieWaitForNote} property to true. For example,
472 @lilypond[fragment,verbatim,relative=1,raggedright]
473 \set tieWaitForNote = ##t
474 \grace { c16[~ e~ g]~ } <c, e g>4
481 @cindex @code{\tieUp}
483 @cindex @code{\tieDown}
485 @cindex @code{\tieNeutral}
487 @cindex @code{\tieDotted}
489 @cindex @code{\tieSolid}
494 In this manual: @ref{Automatic note splitting}.
496 Program reference: @internalsref{TieEvent}, @internalsref{Tie}.
501 Switching staves when a tie is active will not produce a slanted tie.
503 Formatting of ties is a difficult subject. The results are often not
511 @cindex @code{\times}
513 Tuplets are made out of a music expression by multiplying all durations
516 @cindex @code{\times}
518 \times @var{fraction} @var{musicexpr}
522 The duration of @var{musicexpr} will be multiplied by the fraction.
523 The fraction's denominator will be printed over the notes, optionally
524 with a bracket. The most common tuplet is the triplet in which 3
525 notes have the length of 2, so the notes are 2/3 of their written
528 @lilypond[quote,raggedright,fragment,verbatim]
529 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
532 The property @code{tupletSpannerDuration} specifies how long each
533 bracket should last. With this, you can make lots of tuplets while
534 typing @code{\times} only once, thus saving lots of typing. In the next
535 example, there are two triplets shown, while @code{\times} was only
538 @lilypond[quote,fragment,relative=1,raggedright,verbatim]
539 \set tupletSpannerDuration = #(ly:make-moment 1 4)
540 \times 2/3 { c'8 c c c c c }
543 The format of the number is determined by the property
544 @code{tupletNumberFormatFunction}. The default prints only the
545 denominator, but if it is set to the Scheme function
546 @code{fraction-tuplet-formatter}, @var{num}:@var{den} will be printed
550 @cindex @code{tupletNumberFormatFunction}
551 @cindex tuplet formatting
556 @cindex @code{\tupletUp}
558 @cindex @code{\tupletDown}
560 @cindex @code{\tupletNeutral}
561 @code{\tupletNeutral}.
565 User manual: @ref{Changing context properties on the fly} for the
569 Program reference: @internalsref{TupletBracket}, and @internalsref{TimeScaledMusic}.
571 Examples: @inputfileref{input/@/regression,tuplet@/-nest@/.ly}.
575 Nested tuplets are not formatted automatically. In this case, outer
576 tuplet brackets should be moved manually, which is demonstrated in
577 @inputfileref{input/@/regression,tuplet@/-nest@/.ly}.
581 @subsection Transpose
583 @cindex transposition of pitches
584 @cindex @code{\transpose}
586 A music expression can be transposed with @code{\transpose}. The
589 \transpose @var{from} @var{to} @var{musicexpr}
592 This means that @var{musicexpr} is transposed by the interval between
593 the pitches @var{from} and @var{to}: any note with pitch @code{from}
594 is changed to @code{to}.
597 For example, consider a piece written in the key of D-major. If
598 this piece is a little too low for its performer, it can be
599 transposed up to E-major with
601 \transpose d e @dots{}
604 Consider a part written for violin (a C instrument). If
605 this part is to be played on the A clarinet, the following
606 transposition will produce the appropriate part
609 \transpose a c @dots{}
612 @code{\transpose} distinguishes between enharmonic pitches: both
613 @code{\transpose c cis} or @code{\transpose c des} will transpose up
614 half a tone. The first version will print sharps and the second
615 version will print flats
617 @lilypond[quote,raggedright,verbatim]
618 mus = { \key d \major cis d fis g }
627 @code{\transpose} may also be used to input written notes for a
628 transposing instrument. Pitches are normally entered into LilyPond
629 in C (or ``concert pitch''), but they may be entered in another
630 key. For example, when entering music for a B-flat trumpet which
631 begins on concert D, one would write
634 \transpose c bes @{ e4 @dots{} @}
637 To print this music in B-flat again (ie producing a trumpet part,
638 instead of a concert pitch conductor's score) you would wrap the
639 existing music with another @code{transpose}
642 \transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @}
648 Program reference: @internalsref{TransposedMusic}, and
649 @internalsref{UntransposableMusic}.
653 If you want to use both @code{\transpose} and @code{\relative},
654 you must put @code{\transpose} outside of @code{\relative}, since
655 @code{\relative} will have no effect music that appears inside a
659 @node Easier music entry
660 @section Easier music entry
663 This section deals with tricks and features of the input language that
664 were added solely to help entering music and finding and correcting
665 mistakes. There are also external tools that make debugging easier.
666 See @ref{Point and click} for more information.
668 It is also possible to enter and edit music using other programs, such as
669 GUI interfaces or MIDI sequencers. Refer to the LilyPond
670 website for more information.
677 * Skipping corrected music::
678 * Automatic note splitting::
684 @node Relative octaves
685 @subsection Relative octaves
687 @cindex relative octave specification
689 Octaves are specified by adding @code{'} and @code{,} to pitch names.
690 When you copy existing music, it is easy to accidentally put a pitch
691 in the wrong octave and hard to find such an error. The relative
692 octave mode prevents these errors by making the mistakes much
693 larger: a single error puts the rest of the piece off by one octave
695 @cindex @code{\relative}
697 \relative @var{startpitch} @var{musicexpr}
704 \relative @var{musicexpr}
707 The octave of notes that appear in @var{musicexpr} are calculated as
708 follows: if no octave changing marks are used, the basic interval
709 between this and the last note is always taken to be a fourth or
710 less. This distance is determined without regarding alterations; a
711 @code{fisis} following a @code{ceses} will be put above the
712 @code{ceses}. In other words, a doubly-augmented fourth is considered
713 a smaller interval than a diminshed fifth, even though the fourth is
714 seven semitones while the fifth is only six semitones.
716 The octave changing marks @code{'} and @code{,} can be added to raise
717 or lower the pitch by an extra octave. Upon entering relative mode,
718 an absolute starting pitch can be specified that will act as the
719 predecessor of the first note of @var{musicexpr}. If no starting pitch
720 is specified, then middle C is used as a start.
722 Here is the relative mode shown in action
723 @lilypond[quote,fragment,raggedright,verbatim]
729 Octave changing marks are used for intervals greater than a fourth
730 @lilypond[quote,raggedright,fragment,verbatim]
736 If the preceding item is a chord, the first note of the chord is used
737 to determine the first note of the next chord
739 @lilypond[quote,raggedright,fragment,verbatim]
747 The pitch after the @code{\relative} contains a note name.
750 The relative conversion will not affect @code{\transpose},
751 @code{\chordmode} or @code{\relative} sections in its argument. To use
752 relative within transposed music, an additional @code{\relative} must
753 be placed inside @code{\transpose}.
756 @subsection Octave check
759 Octave checks make octave errors easier to correct: a note may be
760 followed by @code{=}@var{quotes} which indicates what its absolute
761 octave should be. In the following example,
763 \relative c'' @{ c='' b=' d,='' @}
767 @c take care with @code, adds confusing quotes.
768 the @code{d} will generate a warning, because a @code{d''} is expected
769 (because @code{b'} to @code{d''} is only a third), but a @code{d}' is
770 found. In the output, the octave is corrected to be a @code{d''} and
771 the next note is calculated relative to @code{d''} instead of @code{d'}.
775 There is also a syntax that is separate from the notes. The syntax
781 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
782 quotes) in \relative mode. If not, a warning is printed, and the
785 In the example below, the first check passes without incident, since
786 the @code{e} (in relative mode) is within a fifth of @code{a'}. However,
787 the second check produces a warning, since the @code{e} is not within
788 a fifth of @code{b'}. The warning message is printed, and the octave
789 is adjusted so that the following notes are in the correct octave
801 The octave of a note following an octave check is determined with
802 respect to the note preceding it. In the next fragment, the last note
803 is a @code{a'}, above middle C. That means that the @code{\octave}
804 check passes successfully, so the check could be deleted without changing
805 the output of the piece.
807 @lilypond[quote,raggedright,verbatim,fragment]
816 @subsection Bar check
820 @cindex @code{barCheckSynchronize}
823 Bar checks help detect errors in the durations. A bar check is
824 entered using the bar symbol, `@code{|}'. Whenever it is encountered
825 during interpretation, it should fall on a measure boundary. If it
826 does not, a warning is printed. In the next example, the second bar
827 check will signal an error
829 \time 3/4 c2 e4 | g2 |
832 Bar checks can also be used in lyrics, for example
837 Twin -- kle | Twin -- kle
842 @cindex @code{skipTypesetting}
844 Failed bar checks are caused by entering incorrect
845 durations. Incorrect durations often completely garble up the score,
846 especially if the score is polyphonic, so a good place to start correcting
847 input is by scanning for failed bar checks and incorrect durations. To
848 speed up this process, the @code{skipTypesetting} feature may be
849 used. It is described in the next section.
852 @cindex @code{pipeSymbol}
854 It is also possible to redefine the meaning of @code{|}. This is done
855 by assigning a music expression to @code{pipeSymbol},
857 @lilypond[quote,raggedright,verbatim]
858 pipeSymbol = \bar "||"
864 @node Skipping corrected music
865 @subsection Skipping corrected music
867 The property @code{Score.skipTypesetting} can be used to switch on and
868 off typesetting completely during the interpretation phase. When
869 typesetting is switched off, the music is processed much more
870 quickly. This can be used to skip over the parts of a score that
871 have already been checked for errors
873 @lilypond[quote,fragment,raggedright,verbatim]
876 \set Score.skipTypesetting = ##t
878 \set Score.skipTypesetting = ##f
882 In polyphonic music, @code{Score.skipTypesetting} will affect all
883 voices and staves, saving even more time.
885 @node Automatic note splitting
886 @subsection Automatic note splitting
888 Long notes can be converted automatically to tied notes. This is done
889 by replacing the @internalsref{Note_heads_engraver} by the
890 @internalsref{Completion_heads_engraver}.
891 In the following examples, notes crossing the bar line are split and tied.
894 @lilypond[quote,fragment,verbatim,relative=1,linewidth=12\cm]
896 \remove "Note_heads_engraver"
897 \consists "Completion_heads_engraver"
899 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
903 This engraver splits all running notes at the bar line, and inserts
904 ties. One of its uses is to debug complex scores: if the measures are
905 not entirely filled, then the ties exactly show how much each measure
910 Not all durations (especially those containing tuplets) can be
911 represented exactly with normal notes and dots, but the engraver will
916 Examples: @inputfileref{input/@/regression,completion@/-heads@/.ly}.
920 Program reference: @internalsref{Completion_heads_engraver}.
924 @section Staff notation
926 This section describes music notation that occurs on staff level,
927 such as key signatures, clefs and time signatures.
929 @cindex Staff notation
940 * Time administration::
941 * Controlling formatting of prefatory matter::
942 * System start delimiters::
943 * Aligning to cadenzas::
947 @subsection Staff symbol
949 @cindex adjusting staff symbol
951 Notes, dynamic signs, etc., are grouped
952 with a set of horizontal lines, into a staff (plural `staves'). In our
953 system, these lines are drawn using a separate layout object called
957 @cindex staff lines, setting number of
958 @cindex staff lines, setting thickness of
959 @cindex thickness of staff lines, setting
960 @cindex number of staff lines, setting
964 Program reference: @internalsref{StaffSymbol}.
966 Examples: @inputfileref{input/@/test,staff@/-lines@/.ly},
967 @inputfileref{input/@/test,staff@/-size@/.ly}.
971 If a staff is ended halfway a piece, the staff symbol may not end
972 exactly on the bar line.
976 @subsection Key signature
977 @cindex Key signature
981 The key signature indicates the tonality in which a piece is played. It
982 is denoted by a set of alterations (flats or sharps) at the start of the
986 Setting or changing the key signature is done with the @code{\key}
989 @code{\key} @var{pitch} @var{type}
992 @cindex @code{\minor}
993 @cindex @code{\major}
994 @cindex @code{\minor}
995 @cindex @code{\ionian}
996 @cindex @code{\locrian}
997 @cindex @code{\aeolian}
998 @cindex @code{\mixolydian}
999 @cindex @code{\lydian}
1000 @cindex @code{\phrygian}
1001 @cindex @code{\dorian}
1003 Here, @var{type} should be @code{\major} or @code{\minor} to get
1004 @var{pitch}-major or @var{pitch}-minor, respectively.
1005 The standard mode names @code{\ionian},
1006 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
1007 @code{\phrygian}, and @code{\dorian} are also defined.
1009 This command sets the context property
1010 @internalsref{Staff}.@code{keySignature}. Non-standard key signatures
1011 can be specified by setting this property directly.
1013 A natural sign is printed to cancel any previous accidentals. This
1014 can be suppressed by setting the @code{Staff.printKeyCancellation}
1017 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1023 \set Staff.printKeyCancellation = ##f
1031 Accidentals and key signatures often confuse new users, because
1032 unaltered notes get natural signs depending on the key signature. For
1033 more information, see @ref{More about pitches}.
1037 Program reference: @internalsref{KeyChangeEvent},
1038 @internalsref{KeyCancellation} and @internalsref{KeySignature}.
1040 @cindex @code{keySignature}
1045 @cindex @code{\clef}
1047 The clef indicates which lines of the staff correspond to which
1051 The clef can be set with the @code{\clef} command
1052 @lilypond[quote,raggedright,fragment,verbatim]
1053 { c''2 \clef alto g'2 }
1056 Supported clef-names include
1057 @c Moved standard clefs to the top /MB
1061 @item treble, violin, G, G2
1074 G clef on 1st line, so-called French violin clef
1076 @cindex soprano clef
1079 @cindex mezzosoprano clef
1082 @cindex baritone clef
1085 @cindex varbaritone clef
1088 @cindex subbass clef
1096 By adding @code{_8} or @code{^8} to the clef name, the clef is
1097 transposed one octave down or up, respectively, and @code{_15} and
1098 @code{^15} transposes by two octaves. The argument @var{clefname}
1099 must be enclosed in quotes when it contains underscores or digits. For
1103 @cindex choral tenor clef
1104 @lilypond[quote,raggedright,verbatim,fragment,relative=1]
1108 This command is equivalent to setting @code{clefGlyph},
1109 @code{clefPosition} (which controls the Y position of the clef),
1110 @code{middleCPosition} and @code{clefOctavation}. A clef is printed
1111 when any of these properties are changed. The following example shows
1112 possibilities when setting properties manually.
1114 @lilypond[quote,raggedright,verbatim]
1116 \set Staff.clefGlyph = #"clefs.F"
1117 \set Staff.clefPosition = #2
1119 \set Staff.clefGlyph = #"clefs.G"
1121 \set Staff.clefGlyph = #"clefs.C"
1123 \set Staff.clefOctavation = #7
1125 \set Staff.clefOctavation = #0
1126 \set Staff.clefPosition = #0
1130 \set Staff.middleCPosition = #4
1137 Program reference: @internalsref{Clef}.
1141 @node Ottava brackets
1142 @subsection Ottava brackets
1144 `Ottava' brackets introduce an extra transposition of an octave for
1145 the staff. They are created by invoking the function
1146 @code{set-octavation}
1152 @lilypond[quote,raggedright,verbatim,fragment]
1162 The @code{set-octavation} function also takes -1 (for 8va bassa) and 2
1163 (for 15ma) as arguments. Internally the function sets the properties
1164 @code{ottavation} (e.g., to @code{"8va"}) and
1165 @code{centralCPosition}. For overriding the text of the bracket, set
1166 @code{ottavation} after invoking @code{set-octavation}, i.e.,
1168 @lilypond[quote,raggedright,verbatim]
1171 \set Staff.ottavation = #"8"
1178 Program reference: @internalsref{OttavaBracket}.
1180 Examples: @inputfileref{input/@/regression,ottava@/.ly},
1181 @inputfileref{input/@/regression,ottava@/-broken@/.ly}.
1185 @code{set-octavation} will get confused when clef changes happen
1186 during an octavation bracket.
1191 @node Time signature
1192 @subsection Time signature
1193 @cindex Time signature
1195 @cindex @code{\time}
1197 Time signature indicates the metrum of a piece: a regular pattern of
1198 strong and weak beats. It is denoted by a fraction at the start of the
1202 The time signature is set or changed by the @code{\time}
1204 @lilypond[quote,raggedright,fragment,verbatim]
1205 \time 2/4 c'2 \time 3/4 c'2.
1208 The symbol that is printed can be customized with the @code{style}
1209 property. Setting it to @code{#'()} uses fraction style for 4/4 and
1212 @lilypond[fragment,quote,raggedright,verbatim]
1215 \override Staff.TimeSignature #'style = #'()
1222 There are many more options for its layout. See @ref{Ancient time
1223 signatures} for more examples.
1226 This command sets the property @code{timeSignatureFraction},
1227 @code{beatLength} and @code{measureLength} in the @code{Timing}
1228 context, which is normally aliased to @internalsref{Score}. The
1229 property @code{measureLength} determines where bar lines should be
1230 inserted, and how automatic beams should be generated. Changing the
1231 value of @code{timeSignatureFraction} also causes the symbol to be
1234 More options are available through the Scheme function
1235 @code{set-time-signature}. In combination with the
1236 @internalsref{Measure_grouping_engraver}, it will create
1237 @internalsref{MeasureGrouping} signs. Such signs ease reading
1238 rhythmically complex modern music. In the following example, the 9/8
1239 measure is subdivided in 2, 2, 2 and 3. This is passed to
1240 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1242 @lilypond[quote,raggedright,verbatim]
1245 #(set-time-signature 9 8 '(2 2 2 3))
1246 g8[ g] d[ d] g[ g] a8[( bes g]) |
1247 #(set-time-signature 5 8 '(3 2))
1253 \consists "Measure_grouping_engraver"
1261 Program reference: @internalsref{TimeSignature}, and @internalsref{Timing_engraver}.
1266 Automatic beaming does not use the measure grouping specified with
1267 @code{set-time-signature}.
1269 @node Partial measures
1270 @subsection Partial measures
1273 @cindex partial measure
1274 @cindex measure, partial
1275 @cindex shorten measures
1276 @cindex @code{\partial}
1278 Partial measures, for example in upsteps, are entered using the
1279 @code{\partial} command
1280 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1281 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1284 The syntax for this command is
1286 \partial @var{duration}
1288 This is internally translated into
1290 \set Timing.measurePosition = -@var{length of duration}
1293 The property @code{measurePosition} contains a rational number
1294 indicating how much of the measure has passed at this point.
1298 This command does not take into account grace notes at the start of
1299 the music. When a piece starts with graces notes in the pickup, then
1300 the @code{\partial} should follow the grace notes
1302 @lilypond[verbatim,quote,raggedright,relative,fragment]
1312 @node Unmetered music
1313 @subsection Unmetered music
1317 Bar lines and bar numbers are calculated automatically. For unmetered
1318 music (cadenzas, for example), this is not desirable. By setting
1319 @code{Score.timing} to false, this automatic timing can be switched
1320 off. Empty bar lines,
1327 indicate where line breaks can occur.
1331 @cindex @code{\cadenzaOn}
1333 @cindex @code{\cadenzaOff}
1340 @subsection Bar lines
1344 @cindex measure lines
1348 Bar lines delimit measures, but are also used to indicate repeats.
1349 Normally, they are inserted automatically. Line breaks may only
1350 happen on bar lines.
1352 Special types of bar lines can be forced with the @code{\bar} command
1354 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1358 The following bar types are available
1359 @lilypondfile[raggedright,quote]{bar-lines.ly}
1361 For allowing line breaks, there is a special command,
1365 This will insert an invisible bar line, and allow line breaks at this
1368 In scores with many staves, a @code{\bar} command in one staff is
1369 automatically applied to all staves. The resulting bar lines are
1370 connected between different staves of a @internalsref{StaffGroup}
1372 @lilypond[quote,raggedright,fragment,verbatim]
1374 \context StaffGroup <<
1380 \new Staff { \clef bass c4 g e g }
1382 \new Staff { \clef bass c2 c2 }
1387 The command @code{\bar }@var{bartype} is a short cut for doing
1388 @code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
1389 is set to a string, a bar line of that type is created.
1391 A bar line is created whenever the @code{whichBar} property is set.
1392 At the start of a measure it is set to the contents of
1393 @code{Timing.defaultBarType}. The contents of @code{repeatCommands} are used
1394 to override default measure bars.
1396 @cindex @code{whichBar}
1397 @cindex @code{repeatCommands}
1398 @cindex @code{defaultBarType}
1400 You are encouraged to use @code{\repeat} for repetitions. See
1407 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1410 Program reference: @internalsref{BarLine} (created at
1411 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1413 @cindex bar lines at start of system
1414 @cindex start of system
1418 Examples: @inputfileref{input/@/test,bar@/-lines@/.ly},
1421 @node Time administration
1422 @subsection Time administration
1424 Time is administered by the @internalsref{Time_signature_engraver},
1425 which usually lives in the @internalsref{Score} context.
1426 The bookkeeping deals with the following variables
1429 @item currentBarNumber
1433 The length of the measures in the current time signature. For a 4/4
1434 time this is@tie{}1, and for 6/8 it is 3/4.
1436 @item measurePosition
1437 The point within the measure where we currently are. This quantity
1438 is reset to@tie{}0 whenever it exceeds @code{measureLength}. When that
1439 happens, @code{currentBarNumber} is incremented.
1442 If set to true, the above variables are updated for every time
1443 step. When set to false, the engraver stays in the current measure
1447 Timing can be changed by setting any of these variables explicitly.
1448 In the next example, the 4/4 time signature is printed, but
1449 @code{measureLength} is set to 5/4. After a while, the measure is
1450 shortened by 1/8, by setting @code{measurePosition} to 7/8 at 2/4
1451 in the measure, so the next bar line will fall at 2/4 + 3/8. The
1452 3/8 arises because 5/4 normally has 10/8, but we have manually
1453 set the measure position to be 7/8 and 10/8 - 7/8 = 3/8.
1455 @lilypond[quote,raggedright,verbatim,relative,fragment]
1456 \set Score.measureLength = #(ly:make-moment 5 4)
1460 \set Score.measurePosition = #(ly:make-moment 7 8)
1466 @node Controlling formatting of prefatory matter
1467 @subsection Controlling formatting of prefatory matter
1469 @c This section will be moved to somewhere else soon. -gp
1470 This example demonstrates how to place prefatory matter
1471 (such as the clef and key signature) at the end of a line.
1473 @lilypond[quote,verbatim]
1475 \override Staff.Clef
1476 #'break-visibility = #end-of-line-visible
1477 \override Staff.KeySignature
1478 #'break-visibility = #end-of-line-visible
1479 \set Staff.explicitClefVisibility = #end-of-line-visible
1480 \set Staff.explicitKeySignatureVisibility = #end-of-line-visible
1482 % We want the time sig to take space, otherwise there is not
1483 % enough white at the start of the line.
1485 \override Staff.TimeSignature #'transparent = ##t
1486 \set Score.defaultBarType = #"empty"
1503 @node System start delimiters
1504 @subsection System start delimiters
1506 Polyphonic scores consist of many staves. These staves can be
1507 constructed in three different ways
1509 @item The group is started with a brace at the left, and bar lines are
1510 connected. This is done with the @internalsref{GrandStaff} context.
1512 @lilypond[verbatim,raggedright,quote]
1521 @item The group is started with a bracket, and bar lines are connected.
1522 This is done with the
1523 @internalsref{StaffGroup} context
1525 @lilypond[verbatim,raggedright,quote]
1534 @item The group is started with a vertical line. Bar lines are not
1535 connected. This is the default for the score.
1537 @lilypond[verbatim,raggedright,quote]
1546 @cindex Staff, multiple
1547 @cindex bracket, vertical
1548 @cindex brace, vertical
1555 The bar lines at the start of each system are
1556 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1557 @internalsref{SystemStartBracket}. Only one of these types is created
1558 in every context, and that type is determined by the property
1559 @code{systemStartDelimiter}.
1561 @node Aligning to cadenzas
1562 @subsection Aligning to cadenzas
1565 In an orchestral context, cadenzas present a special problem:
1566 when constructing a score that includes a cadenza, all other
1567 instruments should skip just as many notes as the length of the
1568 cadenza, otherwise they will start too soon or too late.
1570 A solution to this problem are the functions @code{mmrest-of-length}
1571 and @code{skip-of-length}. These Scheme functions take a piece of music
1572 as argument, and generate a @code{\skip} or multi-rest, exactly as
1573 long as the piece. The use of @code{mmrest-of-length} is demonstrated
1574 in the following example.
1576 @lilypond[verbatim,raggedright,quote]
1577 cadenza = \relative c' {
1578 c4 d8 << { e f g } \\ { d4. } >>
1583 \new Staff { \cadenza c'4 }
1585 #(ly:export (mmrest-of-length cadenza))
1597 Polyphony in music refers to having more than one voice occuring in
1598 a piece of music. Polyphony in LilyPond refers to having more than
1599 one voice on the same staff.
1603 * Explicitly instantiating voices::
1604 * Collision Resolution::
1607 @node Basic polyphony
1608 @subsection Basic polyphony
1611 The easiest way to enter fragments with more than one voice on a staff
1612 is to enter each voice as a sequence (with @code{@{...@}}), and combine
1613 them simultaneously, separating the voices with @code{\\}
1617 @lilypond[quote,verbatim,fragment]
1618 \new Staff \relative c' {
1620 << { g4 f e | d2 e2 } \\
1621 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
1627 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
1628 voices are sometimes called ``layers'' in other notation packages}
1630 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
1631 each of these contexts, vertical direction of slurs, stems, etc., is set
1634 These voices are all seperate from the voice that contains the notes just
1635 outside the @code{<< \\ >>} construct. This should be noted when making
1636 changes at the voice level. This also means that slurs and ties cannot go
1637 into or out of a @code{<< \\ >>} construct.
1638 Conversely, parallel voices from separate @code{<< \\ >>} constructs on the
1639 same staff are the the same voice.
1640 Here is the same example, with different noteheads for each voice.
1641 Note that the change to the note-head style in the main voice does not affect
1642 the inside of the @code{<< \\ >>} constructs. Also, the change to the second
1643 voice in the first @code{<< \\ >>} construct is effective in the second
1644 @code{<< \\ >>}, and the voice is tied accross the two constructs.
1646 @lilypond[quote,verbatim,fragment]
1647 \new Staff \relative c' {
1648 \override NoteHead #'style = #'cross
1652 { \override NoteHead #'style = #'triangle
1658 { c8 b16 a b8 g ~ g2 } \\
1659 { \override NoteHead #'style = #'slash s4 b4 c2 }
1664 @node Explicitly instantiating voices
1665 @subsection Explicitly instantiating voices
1667 @internalsref{Voice} contexts can also also be instantiated manually
1668 inside a @code{<< >>} block to create polyphonic music, using
1669 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
1670 and a horizontal shift for each part.
1674 << \upper \\ \lower >>
1682 \context Voice = "1" @{ \voiceOne \upper @}
1683 \context Voice = "2" @{ \voiceTwo \lower @}
1687 @cindex @code{\voiceOne}
1688 @cindex @code{\voiceFour}
1690 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
1691 articulations, text annotations, augmentation dots of dotted
1692 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
1693 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
1694 make them point downwards.
1695 The command @code{\oneVoice} will revert back to the normal setting.
1696 @cindex @code{\oneVoice}
1698 An expression that appears directly inside a @code{<< >>} belongs to
1699 the main voice. This is useful when extra voices appear while the main
1700 voice is playing. Here is a more correct rendition of the example from
1701 the previous section. The crossed noteheads demonstrate that the main
1702 melody is now in a single voice context.
1704 @lilypond[quote,raggedright,verbatim]
1705 \new Staff \relative c' {
1706 \override NoteHead #'style = #'cross
1711 \context Voice="1" { \voiceTwo
1712 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
1715 \new Voice { \voiceThree
1724 The correct definition of the voices allows the melody to be slurred.
1725 @lilypond[quote,raggedright,verbatim]
1726 \new Staff \relative c' {
1731 \context Voice="1" { \voiceTwo
1732 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
1735 \new Voice { \voiceThree
1744 Avoiding the @code{\\} seperator also allows nesting polyphony
1745 constructs, which in some case might be a more natural way to typeset
1748 @lilypond[quote,raggedright,verbatim]
1749 \new Staff \relative c' {
1754 \context Voice="1" { \voiceTwo
1757 {c8 b16 a b8 g ~ g2}
1758 \new Voice { \voiceThree
1770 @node Collision Resolution
1771 @subsection Collision Resolution
1773 Normally, note heads with a different number of dots are not merged, but
1774 when the object property @code{merge-differently-dotted} is set in
1775 the @internalsref{NoteCollision} object, they are merged
1776 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
1779 \override Staff.NoteCollision
1780 #'merge-differently-dotted = ##t
1782 } \\ { g8.[ f16] g8.[ f16] } >>
1785 Similarly, you can merge half note heads with eighth notes, by setting
1786 @code{merge-differently-headed}
1787 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
1790 \override Staff.NoteCollision
1791 #'merge-differently-headed = ##t
1792 c8 c4. } \\ { c2 c2 } >>
1795 LilyPond also vertically shifts rests that are opposite of a stem,
1798 @lilypond[quote,raggedright,fragment,verbatim]
1799 \context Voice << c''4 \\ r4 >>
1807 @cindex @code{\oneVoice}
1809 @cindex @code{\voiceOne}
1811 @cindex @code{\voiceTwo}
1813 @cindex @code{\voiceThree}
1815 @cindex @code{\voiceFour}
1820 @cindex @code{\shiftOn}
1822 @cindex @code{\shiftOnn}
1824 @cindex @code{\shiftOnnn}
1826 @cindex @code{\shiftOff}
1827 @code{\shiftOff}: these commands specify in what chords of the current
1828 voice should be shifted. The outer voices (normally: voice one and
1829 two) have @code{\shiftOff}, while the inner voices (three and four)
1830 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
1831 further shift levels.
1834 When LilyPond cannot cope, the @code{force-hshift}
1835 property of the @internalsref{NoteColumn} object and pitched rests can
1836 be used to override typesetting decisions.
1838 @lilypond[quote,verbatim,raggedright]
1845 \once \override NoteColumn #'force-hshift = #1.7
1854 Program reference: the objects responsible for resolving collisions are
1855 @internalsref{NoteCollision} and @internalsref{RestCollision}.
1858 @inputfileref{input/@/regression,collision@/-dots@/.ly},
1859 @inputfileref{input/@/regression,collision@/-head-chords@/.ly},
1860 @inputfileref{input/@/regression,collision@/-heads@/.ly},
1861 @inputfileref{input/@/regression,collision@/-mesh@/.ly}, and
1862 @inputfileref{input/@/regression,collisions@/.ly}.
1868 When using @code{merge-differently-headed} with an upstem eighth or a
1869 shorter note, and a downstem half note, the eighth note gets the wrong
1872 There is no support for clusters where the same note occurs with
1873 different accidentals in the same chord. In this case, it is
1874 recommended to use enharmonic transcription, or to use special cluster
1875 notation (see @ref{Clusters}).
1880 @c todo: split this up; noBeaming and manual beams stay in basic;
1881 @c seting automatic beam behavior and beam formatting goes into
1884 Beams are used to group short notes into chunks that are aligned with
1885 the metrum. LilyPond normally inserts beams automatically, but if you
1886 wish you may control them manually or change how beams are automatically
1889 @cindex Automatic beams
1893 * Setting automatic beam behavior::
1897 @node Automatic beams
1898 @subsection Automatic beams
1900 LilyPond inserts beams automatically
1902 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1903 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1906 When these automatic decisions are not good enough, beaming can be
1907 entered explicitly. It is also possible to define beaming patterns
1908 that differ from the defaults.
1910 Individual notes may be marked with @code{\noBeam}, to prevent them
1913 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1914 \time 2/4 c8 c\noBeam c c
1920 Program reference: @internalsref{Beam}.
1924 @subsection Manual beams
1925 @cindex beams, manual
1929 In some cases it may be necessary to override the automatic beaming
1930 algorithm. For example, the autobeamer will not put beams over rests
1931 or bar lines. Such beams are specified manually by marking the begin
1932 and end point with @code{[} and @code{]}
1934 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
1936 r4 r8[ g' a r8] r8 g[ | a] r8
1940 @cindex @code{stemLeftBeamCount}
1942 Normally, beaming patterns within a beam are determined automatically.
1943 If necessary, the properties @code{stemLeftBeamCount} and
1944 @code{stemRightBeamCount} can be used to override the defaults. If
1945 either property is set, its value will be used only once, and then it
1948 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
1953 \set stemLeftBeamCount = #1
1957 @cindex @code{stemRightBeamCount}
1960 The property @code{subdivideBeams} can be set in order to subdivide
1961 all 16th or shorter beams at beat positions, as defined by the
1962 @code{beatLength} property.
1965 @lilypond[fragment,quote,relative=2,verbatim]
1967 \set subdivideBeams = ##t
1969 \set Score.beatLength = #(ly:make-moment 1 8)
1972 @cindex @code{subdivideBeams}
1974 Normally, line breaks are forbidden when beams cross bar lines. This
1975 behavior can be changed by setting @code{allowBeamBreak}.
1977 @cindex @code{allowBeamBreak}
1978 @cindex beams and line breaks
1980 @cindex beams, kneed
1982 @cindex auto-knee-gap
1987 User manual: @ref{Changing context properties on the fly} for the
1993 @cindex Frenched staves
1994 Kneed beams are inserted automatically, when a large gap is detected
1995 between the note heads. This behavior can be tuned through the object.
1998 Automatically kneed cross-staff beams cannot be used together with
1999 hidden staves. See @ref{Hiding staves}.
2001 Beams do not avoid collisions with symbols around the notes, such as
2002 texts and accidentals.
2007 @node Setting automatic beam behavior
2008 @subsection Setting automatic beam behavior
2010 @cindex @code{autoBeamSettings}
2011 @cindex @code{(end * * * *)}
2012 @cindex @code{(begin * * * *)}
2013 @cindex automatic beams, tuning
2014 @cindex tuning automatic beaming
2016 @c [TODO: use \applycontext]
2018 In normal time signatures, automatic beams can start on any note but can
2019 only end in a few positions within the measure: beams can end on a beat,
2020 or at durations specified by the properties in
2021 @code{autoBeamSettings}. The defaults for @code{autoBeamSettings}
2022 are defined in @file{scm/@/auto@/-beam@/.scm}.
2024 The value of @code{autoBeamSettings} is changed with three functions,
2026 #(override-auto-beam-setting
2027 '(@var{be} @var{p} @var{q} @var{n} @var{m}) @var{a} @var{b}
2029 #(score-override-auto-beam-setting
2030 '(@var{be} @var{p} @var{q} @var{n} @var{m}) @var{a} @var{b})
2031 #(revert-auto-beam-setting '(@var{be} @var{p} @var{q} @var{n} @var{m})
2034 Here, @var{be} is the symbol @code{begin} or @code{end}, and
2035 @var{context} is an optional context (default: @code{'Voice}). It
2036 determines whether the rule applies to begin or end-points. The
2037 quantity @var{p}/@var{q} refers to the length of the beamed notes (and
2038 `@code{* *}' designates notes of any length), @var{n}/@var{M} refers
2039 to a time signature (wildcards `@code{* *}' may be entered to
2040 designate all time signatures), @var{a}/@var{b} is a duration. By
2041 default, this command changes settings for the current voice. It is
2042 also possible to adjust settings at higher contexts, by adding a
2043 @var{context} argument. @code{score-override-auto-beam-setting} is
2044 equal to @code{override-auto-beam-setting} with the argument
2045 @var{context} set to @code{'Score}.
2047 For example, if automatic beams should end on every quarter note, use
2050 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
2052 Since the duration of a quarter note is 1/4 of a whole note, it is
2053 entered as @code{(ly:make-moment 1 4)}.
2055 The same syntax can be used to specify beam starting points. In this
2056 example, automatic beams can only end on a dotted quarter note
2058 #(override-auto-beam-setting '(end * * * *) 3 8)
2060 In 4/4 time signature, this means that automatic beams could end only on
2061 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
2062 3/8, has passed within the measure).
2064 Rules can also be restricted to specific time signatures. A rule that
2065 should only be applied in @var{N}/@var{M} time signature is formed by
2066 replacing the second asterisks by @var{N} and @var{M}. For example, a
2067 rule for 6/8 time exclusively looks like
2069 #(override-auto-beam-setting '(begin * * 6 8) @dots{})
2072 If a rule should be to applied only to certain types of beams, use the
2073 first pair of asterisks. Beams are classified according to the
2074 shortest note they contain. For a beam ending rule that only applies
2075 to beams with 32nd notes (and no shorter notes), use @code{(end 1 32 *
2078 @cindex automatic beam generation
2080 @cindex @code{autoBeaming}
2083 If beams are used to indicate melismata in songs, then automatic
2084 beaming should be switched off. This is done by setting
2085 @code{autoBeaming} to @code{#f}.
2089 @cindex @code{\autoBeamOff}
2090 @code{\autoBeamOff},
2091 @cindex @code{\autoBeamOn}
2097 If a score ends while an automatic beam has not been ended and is
2098 still accepting notes, this last beam will not be typeset at all. The
2099 same holds polyphonic voices, entered with @code{<< @dots{} \\ @dots{}
2100 >>}. If a polyphonic voice ends while an automatic beam is still
2101 accepting notes, it is not typeset.
2103 The rules for ending a beam depend on the shortest note in a beam.
2104 So, while it is possible to have different ending rules for eight
2105 beams and sixteenth beams, a beam that contains both eight and
2106 sixteenth notes will use the rules for the sixteenth beam.
2108 In the example below, the autobeamer makes eighth beams and sixteenth
2109 end at three eighths. The third beam can only be corrected by
2110 specifying manual beaming.
2112 @lilypond[quote,raggedright,fragment,relative=1]
2113 #(override-auto-beam-setting '(end * * * *) 3 8)
2114 % rather show case where it goes wrong
2115 %\time 12/8 c'8 c c c16 c c c c c c[ c c c] c8[ c] c4
2116 \time 12/8 c'8 c c c16 c c c c c c c c c c8 c c4
2118 It is not possible to specify beaming parameters that act differently in
2119 different parts of a measure. This means that it is not possible to use
2120 automatic beaming in irregular meters such as @code{5/8}.
2122 @node Beam formatting
2123 @subsection Beam formatting
2126 When a beam falls in the middle of the staff, the beams point normally
2127 down. However, this behaviour can be altered with the
2128 @code{neutral-direction} property.
2131 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
2134 \override Beam #'neutral-direction = #-1
2136 \override Beam #'neutral-direction = #1
2145 Repetition is a central concept in music, and multiple notations exist
2151 * Repeats and MIDI::
2152 * Manual repeat commands::
2154 * Tremolo subdivisions::
2159 @subsection Repeat types
2162 @cindex @code{\repeat}
2164 The following types of repetition are supported
2168 Repeated music is fully written (played) out. This is useful when
2169 entering repetitious music. This is the only kind of repeat that
2170 is included in MIDI output.
2173 Repeats are not written out, but alternative endings (volte) are
2174 printed, left to right with brackets. This is the standard notation
2175 for repeats with alternatives. These are not played in MIDI output by default.
2179 Alternative endings are written stacked. This has limited use but may be
2180 used to typeset two lines of lyrics in songs with repeats, see
2181 @inputfileref{input,star-spangled-banner@/.ly}.
2186 Make tremolo beams. These are not played in MIDI output by default.
2189 Make beat or measure repeats. These look like percent signs. These
2190 are not played in MIDI output by default. Percent repeats must be
2191 declared within a Voice context.
2196 @subsection Repeat syntax
2199 LilyPond has one syntactic construct for specifying different types of
2200 repeats. The syntax is
2203 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2206 If you have alternative endings, you may add
2207 @cindex @code{\alternative}
2209 \alternative @{ @var{alternative1}
2211 @var{alternative3} @dots{} @}
2213 where each @var{alternative} is a music expression. If you do not
2214 give enough alternatives for all of the repeats, the first alternative
2215 is assumed to be played more than once.
2217 Standard repeats are used like this
2218 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2220 \repeat volta 2 { c4 d e f }
2221 \repeat volta 2 { f e d c }
2224 With alternative endings
2225 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2227 \repeat volta 2 {c4 d e f}
2228 \alternative { {d2 d} {f f,} }
2232 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2235 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2236 \alternative { { g4 g g } { a | a a a a | b2. } }
2240 It is possible to shorten volta brackets
2241 by setting @code{voltaSpannerDuration}. In the next example, the
2242 bracket only lasts one measure, which is a duration of 3/4.
2246 @lilypond[verbatim,raggedright,quote]
2250 \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2251 \repeat "volta" 5 { d d d }
2252 \alternative { { e e e f f f }
2262 Brackets for the repeat are normally only printed over the topmost
2263 staff. This can be adjusted by setting the @code{voltaOnThisStaff}
2264 property; see @inputfileref{input/@/regression,volta@/-multi@/-staff@/.ly}.
2267 @c @inputfileref{input/@/regression,volta@/-chord@/-names@/.ly}.
2272 A nested repeat like
2281 is ambiguous, since it is is not clear to which @code{\repeat} the
2282 @code{\alternative} belongs. This ambiguity is resolved by always
2283 having the @code{\alternative} belong to the inner @code{\repeat}.
2284 For clarity, it is advisable to use braces in such situations.
2289 Timing information is not remembered at the start of an alternative,
2290 so after a repeat timing information must be reset by hand, for
2291 example by setting @code{Score.measurePosition} or entering
2292 @code{\partial}. Similarly, slurs or ties are also not repeated.
2297 @node Repeats and MIDI
2298 @subsection Repeats and MIDI
2300 @cindex expanding repeats
2302 With a little bit of tweaking, all types of repeats can be present
2303 in the MIDI output. This is achieved by applying the
2304 @code{\unfoldrepeats} music function. This functions changes all
2305 repeats to unfold repeats.
2307 @lilypond[quote,verbatim,fragment,linewidth=8.0\cm]
2309 \repeat tremolo 8 {c'32 e' }
2310 \repeat percent 2 { c''8 d'' }
2311 \repeat volta 2 {c'4 d' e' f'}
2320 When creating a score file using @code{\unfoldrepeats} for midi, then
2321 it is necessary to make two @code{\score} blocks. One for MIDI (with
2322 unfolded repeats) and one for notation (with volta, tremolo, and
2323 percent repeats). For example,
2331 \unfoldrepeats @var{..music..}
2336 @node Manual repeat commands
2337 @subsection Manual repeat commands
2339 @cindex @code{repeatCommands}
2341 The property @code{repeatCommands} can be used to control the layout of
2342 repeats. Its value is a Scheme list of repeat commands.
2345 @item @code{start-repeat}
2346 Print a @code{|:} bar line.
2348 @item @code{end-repeat}
2349 Print a @code{:|} bar line.
2351 @item @code{(volta @var{text})}
2352 Print a volta bracket saying @var{text}: The text can be specified as
2353 a text string or as a markup text, see @ref{Text markup}. Do not
2354 forget to change the font, as the default number font does not contain
2355 alphabetic characters;
2357 @item @code{(volta #f)}
2358 Stop a running volta bracket.
2361 @lilypond[quote,raggedright,verbatim,fragment,relative=2]
2363 \set Score.repeatCommands = #'((volta "93") end-repeat)
2365 \set Score.repeatCommands = #'((volta #f))
2373 Program reference: @internalsref{VoltaBracket}, @internalsref{RepeatedMusic},
2374 @internalsref{VoltaRepeatedMusic},
2375 @internalsref{UnfoldedRepeatedMusic}, and
2376 @internalsref{FoldedRepeatedMusic}.
2378 @node Tremolo repeats
2379 @subsection Tremolo repeats
2380 @cindex tremolo beams
2382 To place tremolo marks between notes, use @code{\repeat} with tremolo
2384 @lilypond[quote,verbatim,raggedright]
2385 \new Voice \relative c' {
2386 \repeat "tremolo" 8 { c16 d16 }
2387 \repeat "tremolo" 4 { c16 d16 }
2388 \repeat "tremolo" 2 { c16 d16 }
2392 Tremolo marks can also be put on a single note. In this case, the
2393 note should not be surrounded by braces.
2394 @lilypond[quote,verbatim,raggedright]
2395 \repeat "tremolo" 4 c'16
2398 Similar output is obtained using the tremolo subdivision, described in
2399 @ref{Tremolo subdivisions}.
2403 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
2405 Program reference: tremolo beams are @internalsref{Beam} objects. Single stem
2406 tremolos are @internalsref{StemTremolo} objects. The music expression is
2407 @internalsref{TremoloEvent}.
2409 Example files: @inputfileref{input/@/regression,chord@/-tremolo@/.ly},
2410 @inputfileref{input/@/regression,stem@/-tremolo@/.ly}.
2412 @node Tremolo subdivisions
2413 @subsection Tremolo subdivisions
2414 @cindex tremolo marks
2415 @cindex @code{tremoloFlags}
2417 Tremolo marks can be printed on a single note by adding
2418 `@code{:}[@var{number}]' after the note. The number indicates the
2419 duration of the subdivision, and it must be at least 8. A
2420 @var{length} value of 8 gives one line across the note stem. If the
2421 length is omitted, the last value (stored in @code{tremoloFlags}) is
2424 @lilypond[quote,raggedright,verbatim,fragment]
2425 c'2:8 c':32 | c': c': |
2428 @c [TODO: stok is te kort bij 32en]
2429 @c somebody want to translate that into English?
2430 @c `Stem is too short for 32nds' (wl)
2434 Tremolos entered in this way do not carry over into the MIDI output.
2438 In this manual: @ref{Tremolo repeats}.
2440 Elsewhere: @internalsref{StemTremolo}, @internalsref{TremoloEvent}.
2442 @node Measure repeats
2443 @subsection Measure repeats
2445 @cindex percent repeats
2446 @cindex measure repeats
2448 In the @code{percent} style, a note pattern can be repeated. It is
2449 printed once, and then the pattern is replaced with a special sign.
2450 Patterns of one and two measures are replaced by percent-like signs,
2451 patterns that divide the measure length are replaced by slashes.
2452 Percent repeats must be declared within a @code{Voice} context.
2454 @lilypond[quote,verbatim,raggedright]
2455 \new Voice \relative c' {
2456 \repeat "percent" 4 { c4 }
2457 \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
2463 Program reference: @internalsref{RepeatSlash}, @internalsref{PercentRepeat},
2464 @internalsref{PercentRepeatedMusic}, and
2465 @internalsref{DoublePercentRepeat}.
2468 @node Expressive marks
2469 @section Expressive marks
2472 @c todo: should change ordering
2473 @c where to put text spanners, metronome marks,
2476 Expressive marks help musicians to bring more to the music than simple
2484 * Fingering instructions::
2495 A slur indicates that notes are to be played bound or @emph{legato}.
2497 They are entered using parentheses
2498 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
2499 f( g a) a8 b( a4 g2 f4)
2503 The direction of a slur can be set with the
2507 \override Slur #'direction = #UP
2508 \slurUp % shortcut for the previous line
2512 However, there is a convenient shorthand for forcing slur
2513 directions. By adding @code{_} or @code{^} before the opening
2514 parentheses, the direction is also set. For example,
2516 @lilypond[relative=2,raggedright,quote,verbatim,fragment]
2520 Some composers write two slurs when they want legato chords. This can
2521 be achieved in LilyPond by setting @code{doubleSlurs},
2523 @lilypond[verbatim,raggedright,relative,fragment,quote]
2524 \set doubleSlurs = ##t
2525 <c e>4 ( <d f> <c e> <d f> )
2532 @cindex @code{\slurUp}
2534 @cindex @code{\slurDown}
2536 @cindex @code{\slurNeutral}
2537 @code{\slurNeutral},
2538 @cindex @code{\slurDashed}
2540 @cindex @code{\slurDotted}
2542 @cindex @code{\slurSolid}
2547 Program reference: @seeinternals{Slur}, and @internalsref{SlurEvent}.
2550 @node Phrasing slurs
2551 @subsection Phrasing slurs
2553 @cindex phrasing slurs
2554 @cindex phrasing marks
2556 A phrasing slur (or phrasing mark) connects chords and is used to
2557 indicate a musical sentence. It is written using @code{\(} and @code{\)}
2560 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
2561 \time 6/4 c'\( d( e) f( e) d\)
2564 Typographically, the phrasing slur behaves almost exactly like a
2565 normal slur. However, they are treated as different objects. A
2566 @code{\slurUp} will have no effect on a phrasing slur; instead, use
2567 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
2568 @code{\phrasingSlurNeutral}.
2570 The commands @code{\slurUp}, @code{\slurDown}, and @code{\slurNeutral}
2571 will only affect normal slurs and not phrasing slurs.
2575 @cindex @code{\phrasingSlurUp}
2576 @code{\phrasingSlurUp},
2577 @cindex @code{\phrasingSlurDown}
2578 @code{\phrasingSlurDown},
2579 @cindex @code{\phrasingSlurNeutral}
2580 @code{\phrasingSlurNeutral}.
2584 Program reference: see also @internalsref{PhrasingSlur}, and
2585 @internalsref{PhrasingSlurEvent}.
2589 Putting phrasing slurs over rests leads to spurious warnings.
2592 @subsection Breath marks
2594 Breath marks are entered using @code{\breathe}
2597 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2601 The glyph of the breath mark can be tuned by overriding the
2602 @code{text} property of the @code{BreathingSign} layout object with
2603 any markup text. For example,
2604 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
2606 \override BreathingSign #'text
2607 = #(make-musicglyph-markup "scripts.rvarcomma")
2614 Program reference: @internalsref{BreathingSign},
2615 @internalsref{BreathingSignEvent}.
2617 Examples: @inputfileref{input/@/regression,breathing@/-sign@/.ly}.
2620 @node Running trills
2621 @subsection Running trills
2623 Long running trills are made with @code{\startTrillSpan} and
2624 @code{\stopTrillSpan},
2627 @lilypond[verbatim,raggedright,relative=2,quote,fragment]
2629 << { c1 \startTrillSpan }
2630 { s2. \grace { d16[\stopTrillSpan e] } } >>
2636 @code{\startTrillSpan},
2637 @cindex @code{\startTrillSpan}
2638 @code{\stopTrillSpan}.
2639 @cindex @code{\stopTrillSpan}
2643 Program reference: @internalsref{TrillSpanner},
2644 @internalsref{TrillSpanEvent}.
2646 @node Fingering instructions
2647 @subsection Fingering instructions
2651 Fingering instructions can be entered using
2653 @var{note}-@var{digit}
2655 For finger changes, use markup texts
2657 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
2659 c^\markup { \finger "2-3" }
2662 @cindex finger change
2667 You can use the thumb-script to indicate that a note should be
2668 played with the thumb (e.g., in cello music)
2669 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
2670 <a_\thumb a'-3>8 <b_\thumb b'-3>
2673 Fingerings for chords can also be added to individual notes
2674 of the chord by adding them after the pitches
2675 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
2676 < c-1 e-2 g-3 b-5 >4
2680 In this case, setting @code{fingeringOrientations} will put fingerings next
2683 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
2684 \set fingeringOrientations = #'(left down)
2685 <c-1 es-2 g-4 bes-5 > 4
2686 \set fingeringOrientations = #'(up right down)
2687 <c-1 es-2 g-4 bes-5 > 4
2690 Using this feature, it is also possible to put fingering instructions
2691 very close to note heads in monophonic music,
2693 @lilypond[verbatim,raggedright,quote,fragment]
2694 \set fingeringOrientations = #'(right)
2701 Program reference: @internalsref{FingerEvent}, and @internalsref{Fingering}.
2703 Examples: @inputfileref{input/@/regression,finger@/-chords@/.ly}.
2709 @subsection Grace notes
2712 @c should have blurb about accaciatura / appogiatura
2714 @cindex @code{\grace}
2718 Grace notes are ornaments that are written out. The most common ones
2719 are acciaccatura, which should be played as very short. It is denoted
2720 by a slurred small note with a slashed stem. The appoggiatura is a
2721 grace note that takes a fixed fraction of the main note, and is
2722 denoted as a slurred note in small print without a slash. They
2723 are entered with the commands @code{\acciaccatura} and
2724 @code{\appoggiatura}, as demonstrated in the following example
2727 @cindex appoggiatura
2728 @cindex acciaccatura
2730 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
2731 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
2732 \acciaccatura { g16[ f] } e4
2735 Both are special forms of the @code{\grace} command. By prefixing this
2736 keyword to a music expression, a new one is formed, which will be
2737 printed in a smaller font and takes up no logical time in a measure.
2739 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
2741 \grace { c16[ d16] } c2 c4
2745 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
2746 @code{\grace} command does not start a slur.
2748 Internally, timing for grace notes is done using a second, `grace'
2749 timing. Every point in time consists of two rational numbers: one
2750 denotes the logical time, one denotes the grace timing. The above
2751 example is shown here with timing tuples
2753 @lilypond[quote,raggedright]
2756 c4 \grace c16 c4 \grace {
2759 \new Lyrics \lyricmode {
2760 \override LyricText #'font-family = #'typewriter
2764 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
2765 \markup { (\fraction 1 4 , 0 ) } 4
2767 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
2768 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
2770 \markup { ( \fraction 2 4 , 0 ) }
2776 The placement of grace notes is synchronized between different staves.
2777 In the following example, there are two sixteenth grace notes for
2778 every eighth grace note
2780 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
2781 << \new Staff { e4 \grace { c16[ d e f] } e4 }
2782 \new Staff { c4 \grace { g8[ b] } c4 } >>
2787 If you want to end a note with a grace, use the @code{\afterGrace}
2788 command. It takes two arguments: the main note, and the grace notes
2789 following the main note.
2791 @lilypond[raggedright, verbatim,relative=2,fragment]
2792 c1 \afterGrace d1 { c16[ d] } c4
2795 This will put the grace notes after a ``space'' lasting 3/4 of the
2796 length of the main note. The fraction 3/4 can be changed by setting
2797 @code{afterGraceFraction}, ie.
2800 afterGraceFraction = #(cons 7 8)
2804 will put the grace note at 7/8 of the main note.
2807 The same effect can be achieved manually by doing
2810 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2813 { s2 \grace { c16[ d] } } >>
2819 By adjusting the duration of the skip note (here it is a half-note),
2820 the space between the main-note and the grace is adjusted.
2825 A @code{\grace} section will introduce special typesetting settings,
2826 for example, to produce smaller type, and set directions. Hence, when
2827 introducing layout tweaks, they should be inside the grace section,
2829 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2841 The overrides should also be reverted inside the grace section.
2843 The layout of grace sections can be changed throughout the music using
2844 the function @code{add-grace-property}. The following example
2845 undefines the Stem direction for this grace, so stems do not always
2850 #(add-grace-property 'Voice 'Stem 'direction '())
2856 Another option is to change the variables @code{startGraceMusic},
2857 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2858 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2859 @code{stopAppoggiaturaMusic}. More information is in the file
2860 @file{ly/@/grace@/-init@/.ly}.
2865 Program reference: @internalsref{GraceMusic}.
2869 A score that starts with a @code{\grace} section needs an explicit
2870 @code{\context Voice} declaration, otherwise the main note and the grace
2871 note end up on different staves.
2873 Grace note synchronization can also lead to surprises. Staff notation,
2874 such as key signatures, bar lines, etc., are also synchronized. Take
2875 care when you mix staves with grace notes and staves without, for example,
2877 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
2878 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2879 \new Staff { c4 \bar "|:" d4 } >>
2883 This can be remedied by inserting grace skips, for the above example
2886 \new Staff @{ c4 \bar "|:" \grace s16 d4 @}
2889 Grace sections should only be used within sequential music
2890 expressions. Nesting or juxtaposing grace sections is not supported,
2891 and might produce crashes or other errors.
2895 @subsection Glissando
2898 @cindex @code{\glissando}
2900 A glissando is a smooth change in pitch. It is denoted by a line or a
2901 wavy line between two notes. It is requested by attaching
2902 @code{\glissando} to a note
2904 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2910 Program reference: @internalsref{Glissando}, and @internalsref{GlissandoEvent}.
2912 Example files: @file{input/@/regression/@/glissando@/.ly}.
2918 Printing text over the line (such as @emph{gliss.}) is not supported.
2922 @subsection Dynamics
2935 @cindex @code{\ffff}
2945 Absolute dynamic marks are specified using a command after a note
2946 @code{c4\ff}. The available dynamic marks are @code{\ppp},
2947 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2948 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2949 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}
2951 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
2952 c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2953 c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
2962 A crescendo mark is started with @code{\<} and terminated with
2963 @code{\!}. A decrescendo is started with @code{\>} and also terminated
2964 with @code{\!}. Because these marks are bound to notes, you must
2965 use spacer notes if multiple marks are needed during one note
2967 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2969 << f1 { s4 s4\< s4\! \> s4\! } >>
2971 This may give rise to very short hairpins. Use @code{minimum-length}
2972 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2976 \override Staff.Hairpin #'minimum-length = #5
2979 You can also use a text saying @emph{cresc.} instead of hairpins. Here
2980 is an example how to do it
2982 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2996 You can also supply your own texts
2997 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2998 \set crescendoText = \markup { \italic "cresc. poco" }
2999 \set crescendoSpanner = #'dashed-line
3005 To create new dynamic marks or text that should be aligned
3006 with dynamics, see @ref{New dynamic marks}.
3011 @cindex @code{\dynamicUp}
3013 @cindex @code{\dynamicDown}
3014 @code{\dynamicDown},
3015 @cindex @code{\dynamicNeutral}
3016 @code{\dynamicNeutral}.
3018 @cindex direction, of dynamics
3022 Program reference: @internalsref{CrescendoEvent},
3023 @internalsref{DecrescendoEvent}, and
3024 @internalsref{AbsoluteDynamicEvent}.
3026 Dynamics are @internalsref{DynamicText} and @internalsref{Hairpin}
3027 objects. Vertical positioning of these symbols is handled by the
3028 @internalsref{DynamicLineSpanner} object.