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::
946 @subsection Staff symbol
948 @cindex adjusting staff symbol
950 Notes, dynamic signs, etc., are grouped
951 with a set of horizontal lines, into a staff (plural `staves'). In our
952 system, these lines are drawn using a separate layout object called
956 @cindex staff lines, setting number of
957 @cindex staff lines, setting thickness of
958 @cindex thickness of staff lines, setting
959 @cindex number of staff lines, setting
963 Program reference: @internalsref{StaffSymbol}.
965 Examples: @inputfileref{input/@/test,staff@/-lines@/.ly},
966 @inputfileref{input/@/test,staff@/-size@/.ly}.
970 If a staff is ended halfway a piece, the staff symbol may not end
971 exactly on the bar line.
975 @subsection Key signature
976 @cindex Key signature
980 The key signature indicates the tonality in which a piece is played. It
981 is denoted by a set of alterations (flats or sharps) at the start of the
985 Setting or changing the key signature is done with the @code{\key}
988 @code{\key} @var{pitch} @var{type}
991 @cindex @code{\minor}
992 @cindex @code{\major}
993 @cindex @code{\minor}
994 @cindex @code{\ionian}
995 @cindex @code{\locrian}
996 @cindex @code{\aeolian}
997 @cindex @code{\mixolydian}
998 @cindex @code{\lydian}
999 @cindex @code{\phrygian}
1000 @cindex @code{\dorian}
1002 Here, @var{type} should be @code{\major} or @code{\minor} to get
1003 @var{pitch}-major or @var{pitch}-minor, respectively.
1004 The standard mode names @code{\ionian},
1005 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
1006 @code{\phrygian}, and @code{\dorian} are also defined.
1008 This command sets the context property
1009 @internalsref{Staff}.@code{keySignature}. Non-standard key signatures
1010 can be specified by setting this property directly.
1012 A natural sign is printed to cancel any previous accidentals. This
1013 can be suppressed by setting the @code{Staff.printKeyCancellation}
1016 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1022 \set Staff.printKeyCancellation = ##f
1030 Accidentals and key signatures often confuse new users, because
1031 unaltered notes get natural signs depending on the key signature. For
1032 more information, see @ref{More about pitches}.
1036 Program reference: @internalsref{KeyChangeEvent},
1037 @internalsref{KeyCancellation} and @internalsref{KeySignature}.
1039 @cindex @code{keySignature}
1044 @cindex @code{\clef}
1046 The clef indicates which lines of the staff correspond to which
1050 The clef can be set with the @code{\clef} command
1051 @lilypond[quote,raggedright,fragment,verbatim]
1052 { c''2 \clef alto g'2 }
1055 Supported clef-names include
1056 @c Moved standard clefs to the top /MB
1060 @item treble, violin, G, G2
1073 G clef on 1st line, so-called French violin clef
1075 @cindex soprano clef
1078 @cindex mezzosoprano clef
1081 @cindex baritone clef
1084 @cindex varbaritone clef
1087 @cindex subbass clef
1095 By adding @code{_8} or @code{^8} to the clef name, the clef is
1096 transposed one octave down or up, respectively, and @code{_15} and
1097 @code{^15} transposes by two octaves. The argument @var{clefname}
1098 must be enclosed in quotes when it contains underscores or digits. For
1102 @cindex choral tenor clef
1103 @lilypond[quote,raggedright,verbatim,fragment,relative=1]
1107 This command is equivalent to setting @code{clefGlyph},
1108 @code{clefPosition} (which controls the Y position of the clef),
1109 @code{middleCPosition} and @code{clefOctavation}. A clef is printed
1110 when any of these properties are changed. The following example shows
1111 possibilities when setting properties manually.
1113 @lilypond[quote,raggedright,verbatim]
1115 \set Staff.clefGlyph = #"clefs.F"
1116 \set Staff.clefPosition = #2
1118 \set Staff.clefGlyph = #"clefs.G"
1120 \set Staff.clefGlyph = #"clefs.C"
1122 \set Staff.clefOctavation = #7
1124 \set Staff.clefOctavation = #0
1125 \set Staff.clefPosition = #0
1129 \set Staff.middleCPosition = #4
1136 Program reference: @internalsref{Clef}.
1140 @node Ottava brackets
1141 @subsection Ottava brackets
1143 `Ottava' brackets introduce an extra transposition of an octave for
1144 the staff. They are created by invoking the function
1145 @code{set-octavation}
1151 @lilypond[quote,raggedright,verbatim,fragment]
1161 The @code{set-octavation} function also takes -1 (for 8va bassa) and 2
1162 (for 15ma) as arguments. Internally the function sets the properties
1163 @code{ottavation} (e.g., to @code{"8va"}) and
1164 @code{centralCPosition}. For overriding the text of the bracket, set
1165 @code{ottavation} after invoking @code{set-octavation}, i.e.,
1167 @lilypond[quote,raggedright,verbatim]
1170 \set Staff.ottavation = #"8"
1177 Program reference: @internalsref{OttavaBracket}.
1179 Examples: @inputfileref{input/@/regression,ottava@/.ly},
1180 @inputfileref{input/@/regression,ottava@/-broken@/.ly}.
1184 @code{set-octavation} will get confused when clef changes happen
1185 during an octavation bracket.
1190 @node Time signature
1191 @subsection Time signature
1192 @cindex Time signature
1194 @cindex @code{\time}
1196 Time signature indicates the metrum of a piece: a regular pattern of
1197 strong and weak beats. It is denoted by a fraction at the start of the
1201 The time signature is set or changed by the @code{\time}
1203 @lilypond[quote,raggedright,fragment,verbatim]
1204 \time 2/4 c'2 \time 3/4 c'2.
1207 The symbol that is printed can be customized with the @code{style}
1208 property. Setting it to @code{#'()} uses fraction style for 4/4 and
1211 @lilypond[fragment,quote,raggedright,verbatim]
1214 \override Staff.TimeSignature #'style = #'()
1221 There are many more options for its layout. See @ref{Ancient time
1222 signatures} for more examples.
1225 This command sets the property @code{timeSignatureFraction},
1226 @code{beatLength} and @code{measureLength} in the @code{Timing}
1227 context, which is normally aliased to @internalsref{Score}. The
1228 property @code{measureLength} determines where bar lines should be
1229 inserted, and how automatic beams should be generated. Changing the
1230 value of @code{timeSignatureFraction} also causes the symbol to be
1233 More options are available through the Scheme function
1234 @code{set-time-signature}. In combination with the
1235 @internalsref{Measure_grouping_engraver}, it will create
1236 @internalsref{MeasureGrouping} signs. Such signs ease reading
1237 rhythmically complex modern music. In the following example, the 9/8
1238 measure is subdivided in 2, 2, 2 and 3. This is passed to
1239 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1241 @lilypond[quote,raggedright,verbatim]
1244 #(set-time-signature 9 8 '(2 2 2 3))
1245 g8[ g] d[ d] g[ g] a8[( bes g]) |
1246 #(set-time-signature 5 8 '(3 2))
1252 \consists "Measure_grouping_engraver"
1260 Program reference: @internalsref{TimeSignature}, and @internalsref{Timing_engraver}.
1265 Automatic beaming does not use the measure grouping specified with
1266 @code{set-time-signature}.
1268 @node Partial measures
1269 @subsection Partial measures
1272 @cindex partial measure
1273 @cindex measure, partial
1274 @cindex shorten measures
1275 @cindex @code{\partial}
1277 Partial measures, for example in upsteps, are entered using the
1278 @code{\partial} command
1279 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1280 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1283 The syntax for this command is
1285 \partial @var{duration}
1287 This is internally translated into
1289 \set Timing.measurePosition = -@var{length of duration}
1292 The property @code{measurePosition} contains a rational number
1293 indicating how much of the measure has passed at this point.
1297 This command does not take into account grace notes at the start of
1298 the music. When a piece starts with graces notes in the pickup, then
1299 the @code{\partial} should follow the grace notes
1301 @lilypond[verbatim,quote,raggedright,relative,fragment]
1311 @node Unmetered music
1312 @subsection Unmetered music
1316 Bar lines and bar numbers are calculated automatically. For unmetered
1317 music (cadenzas, for example), this is not desirable. By setting
1318 @code{Score.timing} to false, this automatic timing can be switched
1319 off. Empty bar lines,
1326 indicate where line breaks can occur.
1330 @cindex @code{\cadenzaOn}
1332 @cindex @code{\cadenzaOff}
1339 @subsection Bar lines
1343 @cindex measure lines
1347 Bar lines delimit measures, but are also used to indicate repeats.
1348 Normally, they are inserted automatically. Line breaks may only
1349 happen on bar lines.
1351 Special types of bar lines can be forced with the @code{\bar} command
1353 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1357 The following bar types are available
1358 @lilypondfile[raggedright,quote]{bar-lines.ly}
1360 For allowing line breaks, there is a special command,
1364 This will insert an invisible bar line, and allow line breaks at this
1367 In scores with many staves, a @code{\bar} command in one staff is
1368 automatically applied to all staves. The resulting bar lines are
1369 connected between different staves of a @internalsref{StaffGroup}
1371 @lilypond[quote,raggedright,fragment,verbatim]
1373 \context StaffGroup <<
1379 \new Staff { \clef bass c4 g e g }
1381 \new Staff { \clef bass c2 c2 }
1386 The command @code{\bar }@var{bartype} is a short cut for doing
1387 @code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
1388 is set to a string, a bar line of that type is created.
1390 A bar line is created whenever the @code{whichBar} property is set.
1391 At the start of a measure it is set to the contents of
1392 @code{Timing.defaultBarType}. The contents of @code{repeatCommands} are used
1393 to override default measure bars.
1395 @cindex @code{whichBar}
1396 @cindex @code{repeatCommands}
1397 @cindex @code{defaultBarType}
1399 You are encouraged to use @code{\repeat} for repetitions. See
1406 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1409 Program reference: @internalsref{BarLine} (created at
1410 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1412 @cindex bar lines at start of system
1413 @cindex start of system
1417 Examples: @inputfileref{input/@/test,bar@/-lines@/.ly},
1420 @node Time administration
1421 @subsection Time administration
1423 Time is administered by the @internalsref{Time_signature_engraver},
1424 which usually lives in the @internalsref{Score} context.
1425 The bookkeeping deals with the following variables
1428 @item currentBarNumber
1432 The length of the measures in the current time signature. For a 4/4
1433 time this is@tie{}1, and for 6/8 it is 3/4.
1435 @item measurePosition
1436 The point within the measure where we currently are. This quantity
1437 is reset to@tie{}0 whenever it exceeds @code{measureLength}. When that
1438 happens, @code{currentBarNumber} is incremented.
1441 If set to true, the above variables are updated for every time
1442 step. When set to false, the engraver stays in the current measure
1446 Timing can be changed by setting any of these variables explicitly.
1447 In the next example, the 4/4 time signature is printed, but
1448 @code{measureLength} is set to 5/4. After a while, the measure is
1449 shortened by 1/8, by setting @code{measurePosition} to 7/8 at 2/4
1450 in the measure, so the next bar line will fall at 2/4 + 3/8. The
1451 3/8 arises because 5/4 normally has 10/8, but we have manually
1452 set the measure position to be 7/8 and 10/8 - 7/8 = 3/8.
1454 @lilypond[quote,raggedright,verbatim,relative,fragment]
1455 \set Score.measureLength = #(ly:make-moment 5 4)
1459 \set Score.measurePosition = #(ly:make-moment 7 8)
1465 @node Controlling formatting of prefatory matter
1466 @subsection Controlling formatting of prefatory matter
1468 @c This section will be moved to somewhere else soon. -gp
1469 This example demonstrates how to place prefatory matter
1470 (such as the clef and key signature) at the end of a line.
1472 @lilypond[quote,verbatim]
1474 \override Staff.Clef
1475 #'break-visibility = #end-of-line-visible
1476 \override Staff.KeySignature
1477 #'break-visibility = #end-of-line-visible
1478 \set Staff.explicitClefVisibility = #end-of-line-visible
1479 \set Staff.explicitKeySignatureVisibility = #end-of-line-visible
1481 % We want the time sig to take space, otherwise there is not
1482 % enough white at the start of the line.
1484 \override Staff.TimeSignature #'transparent = ##t
1485 \set Score.defaultBarType = #"empty"
1502 @node System start delimiters
1503 @subsection System start delimiters
1505 Polyphonic scores consist of many staves. These staves can be
1506 constructed in three different ways
1508 @item The group is started with a brace at the left, and bar lines are
1509 connected. This is done with the @internalsref{GrandStaff} context.
1511 @lilypond[verbatim,raggedright,quote]
1520 @item The group is started with a bracket, and bar lines are connected.
1521 This is done with the
1522 @internalsref{StaffGroup} context
1524 @lilypond[verbatim,raggedright,quote]
1533 @item The group is started with a vertical line. Bar lines are not
1534 connected. This is the default for the score.
1536 @lilypond[verbatim,raggedright,quote]
1545 @cindex Staff, multiple
1546 @cindex bracket, vertical
1547 @cindex brace, vertical
1554 The bar lines at the start of each system are
1555 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1556 @internalsref{SystemStartBracket}. Only one of these types is created
1557 in every context, and that type is determined by the property
1558 @code{systemStartDelimiter}.
1560 @node Aligning to cadenzas
1561 @subsection Aligning to cadenzas
1564 In an orchestral context, cadenzas present a special problem:
1565 when constructing a score that includes a cadenza, all other
1566 instruments should skip just as many notes as the length of the
1567 cadenza, otherwise they will start too soon or too late.
1569 A solution to this problem are the functions @code{mmrest-of-length}
1570 and @code{skip-of-length}. These Scheme functions take a piece of music
1571 as argument, and generate a @code{\skip} or multi-rest, exactly as
1572 long as the piece. The use of @code{mmrest-of-length} is demonstrated
1573 in the following example.
1575 @lilypond[verbatim,raggedright,quote]
1576 cadenza = \relative c' {
1577 c4 d8 << { e f g } \\ { d4. } >>
1582 \new Staff { \cadenza c'4 }
1584 #(ly:export (mmrest-of-length cadenza))
1596 Polyphony in music refers to having more than one voice occuring in
1597 a piece of music. Polyphony in LilyPond refers to having more than
1598 one voice on the same staff.
1602 * Explicitly instantiating voices::
1603 * Collision Resolution::
1606 @node Basic polyphony
1607 @subsection Basic polyphony
1610 The easiest way to enter fragments with more than one voice on a staff
1611 is to enter each voice as a sequence (with @code{@{...@}}), and combine
1612 them simultaneously, separating the voices with @code{\\}
1616 @lilypond[quote,verbatim,fragment]
1617 \new Staff \relative c' {
1619 << { g4 f e | d2 e2 } \\
1620 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
1626 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
1627 voices are sometimes called ``layers'' in other notation packages}
1629 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
1630 each of these contexts, vertical direction of slurs, stems, etc., is set
1633 These voices are all seperate from the voice that contains the notes just
1634 outside the @code{<< \\ >>} construct. This should be noted when making
1635 changes at the voice level. This also means that slurs and ties cannot go
1636 into or out of a @code{<< \\ >>} construct.
1637 Conversely, parallel voices from separate @code{<< \\ >>} constructs on the
1638 same staff are the the same voice.
1639 Here is the same example, with different noteheads for each voice.
1640 Note that the change to the note-head style in the main voice does not affect
1641 the inside of the @code{<< \\ >>} constructs. Also, the change to the second
1642 voice in the first @code{<< \\ >>} construct is effective in the second
1643 @code{<< \\ >>}, and the voice is tied accross the two constructs.
1645 @lilypond[quote,verbatim,fragment]
1646 \new Staff \relative c' {
1647 \override NoteHead #'style = #'cross
1651 { \override NoteHead #'style = #'triangle
1657 { c8 b16 a b8 g ~ g2 } \\
1658 { \override NoteHead #'style = #'slash s4 b4 c2 }
1663 @node Explicitly instantiating voices
1664 @subsection Explicitly instantiating voices
1666 @internalsref{Voice} contexts can also also be instantiated manually
1667 inside a @code{<< >>} block to create polyphonic music, using
1668 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
1669 and a horizontal shift for each part.
1673 << \upper \\ \lower >>
1681 \context Voice = "1" @{ \voiceOne \upper @}
1682 \context Voice = "2" @{ \voiceTwo \lower @}
1686 @cindex @code{\voiceOne}
1687 @cindex @code{\voiceFour}
1689 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
1690 articulations, text annotations, augmentation dots of dotted
1691 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
1692 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
1693 make them point downwards.
1694 The command @code{\oneVoice} will revert back to the normal setting.
1695 @cindex @code{\oneVoice}
1697 An expression that appears directly inside a @code{<< >>} belongs to
1698 the main voice. This is useful when extra voices appear while the main
1699 voice is playing. Here is a more correct rendition of the example from
1700 the previous section. The crossed noteheads demonstrate that the main
1701 melody is now in a single voice context.
1703 @lilypond[quote,raggedright,verbatim]
1704 \new Staff \relative c' {
1705 \override NoteHead #'style = #'cross
1710 \context Voice="1" { \voiceTwo
1711 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
1714 \new Voice { \voiceThree
1723 The correct definition of the voices allows the melody to be slurred.
1724 @lilypond[quote,raggedright,verbatim]
1725 \new Staff \relative c' {
1730 \context Voice="1" { \voiceTwo
1731 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
1734 \new Voice { \voiceThree
1743 Avoiding the @code{\\} seperator also allows nesting polyphony
1744 constructs, which in some case might be a more natural way to typeset
1747 @lilypond[quote,raggedright,verbatim]
1748 \new Staff \relative c' {
1753 \context Voice="1" { \voiceTwo
1756 {c8 b16 a b8 g ~ g2}
1757 \new Voice { \voiceThree
1769 @node Collision Resolution
1770 @subsection Collision Resolution
1772 Normally, note heads with a different number of dots are not merged, but
1773 when the object property @code{merge-differently-dotted} is set in
1774 the @internalsref{NoteCollision} object, they are merged
1775 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
1778 \override Staff.NoteCollision
1779 #'merge-differently-dotted = ##t
1781 } \\ { g8.[ f16] g8.[ f16] } >>
1784 Similarly, you can merge half note heads with eighth notes, by setting
1785 @code{merge-differently-headed}
1786 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
1789 \override Staff.NoteCollision
1790 #'merge-differently-headed = ##t
1791 c8 c4. } \\ { c2 c2 } >>
1794 LilyPond also vertically shifts rests that are opposite of a stem,
1797 @lilypond[quote,raggedright,fragment,verbatim]
1798 \context Voice << c''4 \\ r4 >>
1806 @cindex @code{\oneVoice}
1808 @cindex @code{\voiceOne}
1810 @cindex @code{\voiceTwo}
1812 @cindex @code{\voiceThree}
1814 @cindex @code{\voiceFour}
1819 @cindex @code{\shiftOn}
1821 @cindex @code{\shiftOnn}
1823 @cindex @code{\shiftOnnn}
1825 @cindex @code{\shiftOff}
1826 @code{\shiftOff}: these commands specify in what chords of the current
1827 voice should be shifted. The outer voices (normally: voice one and
1828 two) have @code{\shiftOff}, while the inner voices (three and four)
1829 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
1830 further shift levels.
1833 When LilyPond cannot cope, the @code{force-hshift}
1834 property of the @internalsref{NoteColumn} object and pitched rests can
1835 be used to override typesetting decisions.
1837 @lilypond[quote,verbatim,raggedright]
1844 \once \override NoteColumn #'force-hshift = #1.7
1853 Program reference: the objects responsible for resolving collisions are
1854 @internalsref{NoteCollision} and @internalsref{RestCollision}.
1857 @inputfileref{input/@/regression,collision@/-dots@/.ly},
1858 @inputfileref{input/@/regression,collision@/-head-chords@/.ly},
1859 @inputfileref{input/@/regression,collision@/-heads@/.ly},
1860 @inputfileref{input/@/regression,collision@/-mesh@/.ly}, and
1861 @inputfileref{input/@/regression,collisions@/.ly}.
1867 When using @code{merge-differently-headed} with an upstem eighth or a
1868 shorter note, and a downstem half note, the eighth note gets the wrong
1871 There is no support for clusters where the same note occurs with
1872 different accidentals in the same chord. In this case, it is
1873 recommended to use enharmonic transcription, or to use special cluster
1874 notation (see @ref{Clusters}).
1879 @c todo: split this up; noBeaming and manual beams stay in basic;
1880 @c seting automatic beam behavior and beam formatting goes into
1883 Beams are used to group short notes into chunks that are aligned with
1884 the metrum. LilyPond normally inserts beams automatically, but if you
1885 wish you may control them manually or change how beams are automatically
1888 @cindex Automatic beams
1892 * Setting automatic beam behavior::
1896 @node Automatic beams
1897 @subsection Automatic beams
1899 LilyPond inserts beams automatically
1901 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1902 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1905 When these automatic decisions are not good enough, beaming can be
1906 entered explicitly. It is also possible to define beaming patterns
1907 that differ from the defaults.
1909 Individual notes may be marked with @code{\noBeam}, to prevent them
1912 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1913 \time 2/4 c8 c\noBeam c c
1919 Program reference: @internalsref{Beam}.
1923 @subsection Manual beams
1924 @cindex beams, manual
1928 In some cases it may be necessary to override the automatic beaming
1929 algorithm. For example, the autobeamer will not put beams over rests
1930 or bar lines. Such beams are specified manually by marking the begin
1931 and end point with @code{[} and @code{]}
1933 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
1935 r4 r8[ g' a r8] r8 g[ | a] r8
1939 @cindex @code{stemLeftBeamCount}
1941 Normally, beaming patterns within a beam are determined automatically.
1942 If necessary, the properties @code{stemLeftBeamCount} and
1943 @code{stemRightBeamCount} can be used to override the defaults. If
1944 either property is set, its value will be used only once, and then it
1947 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
1952 \set stemLeftBeamCount = #1
1956 @cindex @code{stemRightBeamCount}
1959 The property @code{subdivideBeams} can be set in order to subdivide
1960 all 16th or shorter beams at beat positions, as defined by the
1961 @code{beatLength} property.
1964 @lilypond[fragment,quote,relative=2,verbatim]
1966 \set subdivideBeams = ##t
1968 \set Score.beatLength = #(ly:make-moment 1 8)
1971 @cindex @code{subdivideBeams}
1973 Normally, line breaks are forbidden when beams cross bar lines. This
1974 behavior can be changed by setting @code{allowBeamBreak}.
1976 @cindex @code{allowBeamBreak}
1977 @cindex beams and line breaks
1979 @cindex beams, kneed
1981 @cindex auto-knee-gap
1986 User manual: @ref{Changing context properties on the fly} for the
1992 @cindex Frenched staves
1993 Kneed beams are inserted automatically, when a large gap is detected
1994 between the note heads. This behavior can be tuned through the object.
1997 Automatically kneed cross-staff beams cannot be used together with
1998 hidden staves. See @ref{Hiding staves}.
2000 Beams do not avoid collisions with symbols around the notes, such as
2001 texts and accidentals.
2006 @node Setting automatic beam behavior
2007 @subsection Setting automatic beam behavior
2009 @cindex @code{autoBeamSettings}
2010 @cindex @code{(end * * * *)}
2011 @cindex @code{(begin * * * *)}
2012 @cindex automatic beams, tuning
2013 @cindex tuning automatic beaming
2015 @c [TODO: use \applycontext]
2017 In normal time signatures, automatic beams can start on any note but can
2018 only end in a few positions within the measure: beams can end on a beat,
2019 or at durations specified by the properties in
2020 @code{autoBeamSettings}. The defaults for @code{autoBeamSettings}
2021 are defined in @file{scm/@/auto@/-beam@/.scm}.
2023 The value of @code{autoBeamSettings} is changed with three functions,
2025 #(override-auto-beam-setting
2026 '(@var{be} @var{p} @var{q} @var{n} @var{m}) @var{a} @var{b}
2028 #(score-override-auto-beam-setting
2029 '(@var{be} @var{p} @var{q} @var{n} @var{m}) @var{a} @var{b})
2030 #(revert-auto-beam-setting '(@var{be} @var{p} @var{q} @var{n} @var{m})
2033 Here, @var{be} is the symbol @code{begin} or @code{end}, and
2034 @var{context} is an optional context (default: @code{'Voice}). It
2035 determines whether the rule applies to begin or end-points. The
2036 quantity @var{p}/@var{q} refers to the length of the beamed notes (and
2037 `@code{* *}' designates notes of any length), @var{n}/@var{M} refers
2038 to a time signature (wildcards `@code{* *}' may be entered to
2039 designate all time signatures), @var{a}/@var{b} is a duration. By
2040 default, this command changes settings for the current voice. It is
2041 also possible to adjust settings at higher contexts, by adding a
2042 @var{context} argument. @code{score-override-auto-beam-setting} is
2043 equal to @code{override-auto-beam-setting} with the argument
2044 @var{context} set to @code{'Score}.
2046 For example, if automatic beams should end on every quarter note, use
2049 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
2051 Since the duration of a quarter note is 1/4 of a whole note, it is
2052 entered as @code{(ly:make-moment 1 4)}.
2054 The same syntax can be used to specify beam starting points. In this
2055 example, automatic beams can only end on a dotted quarter note
2057 #(override-auto-beam-setting '(end * * * *) 3 8)
2059 In 4/4 time signature, this means that automatic beams could end only on
2060 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
2061 3/8, has passed within the measure).
2063 Rules can also be restricted to specific time signatures. A rule that
2064 should only be applied in @var{N}/@var{M} time signature is formed by
2065 replacing the second asterisks by @var{N} and @var{M}. For example, a
2066 rule for 6/8 time exclusively looks like
2068 #(override-auto-beam-setting '(begin * * 6 8) @dots{})
2071 If a rule should be to applied only to certain types of beams, use the
2072 first pair of asterisks. Beams are classified according to the
2073 shortest note they contain. For a beam ending rule that only applies
2074 to beams with 32nd notes (and no shorter notes), use @code{(end 1 32 *
2077 @cindex automatic beam generation
2079 @cindex @code{autoBeaming}
2082 If beams are used to indicate melismata in songs, then automatic
2083 beaming should be switched off. This is done by setting
2084 @code{autoBeaming} to @code{#f}.
2088 @cindex @code{\autoBeamOff}
2089 @code{\autoBeamOff},
2090 @cindex @code{\autoBeamOn}
2096 If a score ends while an automatic beam has not been ended and is
2097 still accepting notes, this last beam will not be typeset at all. The
2098 same holds polyphonic voices, entered with @code{<< @dots{} \\ @dots{}
2099 >>}. If a polyphonic voice ends while an automatic beam is still
2100 accepting notes, it is not typeset.
2102 The rules for ending a beam depend on the shortest note in a beam.
2103 So, while it is possible to have different ending rules for eight
2104 beams and sixteenth beams, a beam that contains both eight and
2105 sixteenth notes will use the rules for the sixteenth beam.
2107 In the example below, the autobeamer makes eighth beams and sixteenth
2108 end at three eighths. The third beam can only be corrected by
2109 specifying manual beaming.
2111 @lilypond[quote,raggedright,fragment,relative=1]
2112 #(override-auto-beam-setting '(end * * * *) 3 8)
2113 % rather show case where it goes wrong
2114 %\time 12/8 c'8 c c c16 c c c c c c[ c c c] c8[ c] c4
2115 \time 12/8 c'8 c c c16 c c c c c c c c c c8 c c4
2117 It is not possible to specify beaming parameters that act differently in
2118 different parts of a measure. This means that it is not possible to use
2119 automatic beaming in irregular meters such as @code{5/8}.
2121 @node Beam formatting
2122 @subsection Beam formatting
2125 When a beam falls in the middle of the staff, the beams point normally
2126 down. However, this behaviour can be altered with the
2127 @code{neutral-direction} property.
2130 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
2133 \override Beam #'neutral-direction = #-1
2135 \override Beam #'neutral-direction = #1
2144 Repetition is a central concept in music, and multiple notations exist
2150 * Repeats and MIDI::
2151 * Manual repeat commands::
2153 * Tremolo subdivisions::
2158 @subsection Repeat types
2161 @cindex @code{\repeat}
2163 The following types of repetition are supported
2167 Repeated music is fully written (played) out. This is useful when
2168 entering repetitious music. This is the only kind of repeat that
2169 is included in MIDI output.
2172 Repeats are not written out, but alternative endings (volte) are
2173 printed, left to right with brackets. This is the standard notation
2174 for repeats with alternatives. These are not played in MIDI output by default.
2178 Alternative endings are written stacked. This has limited use but may be
2179 used to typeset two lines of lyrics in songs with repeats, see
2180 @inputfileref{input,star-spangled-banner@/.ly}.
2185 Make tremolo beams. These are not played in MIDI output by default.
2188 Make beat or measure repeats. These look like percent signs. These
2189 are not played in MIDI output by default. Percent repeats must be
2190 declared within a Voice context.
2195 @subsection Repeat syntax
2198 LilyPond has one syntactic construct for specifying different types of
2199 repeats. The syntax is
2202 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2205 If you have alternative endings, you may add
2206 @cindex @code{\alternative}
2208 \alternative @{ @var{alternative1}
2210 @var{alternative3} @dots{} @}
2212 where each @var{alternative} is a music expression. If you do not
2213 give enough alternatives for all of the repeats, the first alternative
2214 is assumed to be played more than once.
2216 Standard repeats are used like this
2217 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2219 \repeat volta 2 { c4 d e f }
2220 \repeat volta 2 { f e d c }
2223 With alternative endings
2224 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2226 \repeat volta 2 {c4 d e f}
2227 \alternative { {d2 d} {f f,} }
2231 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2234 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2235 \alternative { { g4 g g } { a | a a a a | b2. } }
2239 It is possible to shorten volta brackets
2240 by setting @code{voltaSpannerDuration}. In the next example, the
2241 bracket only lasts one measure, which is a duration of 3/4.
2245 @lilypond[verbatim,raggedright,quote]
2249 \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2250 \repeat "volta" 5 { d d d }
2251 \alternative { { e e e f f f }
2261 Brackets for the repeat are normally only printed over the topmost
2262 staff. This can be adjusted by setting the @code{voltaOnThisStaff}
2263 property; see @inputfileref{input/@/regression,volta@/-multi@/-staff@/.ly}.
2266 @c @inputfileref{input/@/regression,volta@/-chord@/-names@/.ly}.
2271 A nested repeat like
2280 is ambiguous, since it is is not clear to which @code{\repeat} the
2281 @code{\alternative} belongs. This ambiguity is resolved by always
2282 having the @code{\alternative} belong to the inner @code{\repeat}.
2283 For clarity, it is advisable to use braces in such situations.
2288 Timing information is not remembered at the start of an alternative,
2289 so after a repeat timing information must be reset by hand, for
2290 example by setting @code{Score.measurePosition} or entering
2291 @code{\partial}. Similarly, slurs or ties are also not repeated.
2296 @node Repeats and MIDI
2297 @subsection Repeats and MIDI
2299 @cindex expanding repeats
2301 With a little bit of tweaking, all types of repeats can be present
2302 in the MIDI output. This is achieved by applying the
2303 @code{\unfoldrepeats} music function. This functions changes all
2304 repeats to unfold repeats.
2306 @lilypond[quote,verbatim,fragment,linewidth=8.0\cm]
2308 \repeat tremolo 8 {c'32 e' }
2309 \repeat percent 2 { c''8 d'' }
2310 \repeat volta 2 {c'4 d' e' f'}
2319 When creating a score file using @code{\unfoldrepeats} for midi, then
2320 it is necessary to make two @code{\score} blocks. One for MIDI (with
2321 unfolded repeats) and one for notation (with volta, tremolo, and
2322 percent repeats). For example,
2330 \unfoldrepeats @var{..music..}
2335 @node Manual repeat commands
2336 @subsection Manual repeat commands
2338 @cindex @code{repeatCommands}
2340 The property @code{repeatCommands} can be used to control the layout of
2341 repeats. Its value is a Scheme list of repeat commands.
2344 @item @code{start-repeat}
2345 Print a @code{|:} bar line.
2347 @item @code{end-repeat}
2348 Print a @code{:|} bar line.
2350 @item @code{(volta @var{text})}
2351 Print a volta bracket saying @var{text}: The text can be specified as
2352 a text string or as a markup text, see @ref{Text markup}. Do not
2353 forget to change the font, as the default number font does not contain
2354 alphabetic characters;
2356 @item @code{(volta #f)}
2357 Stop a running volta bracket.
2360 @lilypond[quote,raggedright,verbatim,fragment,relative=2]
2362 \set Score.repeatCommands = #'((volta "93") end-repeat)
2364 \set Score.repeatCommands = #'((volta #f))
2372 Program reference: @internalsref{VoltaBracket}, @internalsref{RepeatedMusic},
2373 @internalsref{VoltaRepeatedMusic},
2374 @internalsref{UnfoldedRepeatedMusic}, and
2375 @internalsref{FoldedRepeatedMusic}.
2377 @node Tremolo repeats
2378 @subsection Tremolo repeats
2379 @cindex tremolo beams
2381 To place tremolo marks between notes, use @code{\repeat} with tremolo
2383 @lilypond[quote,verbatim,raggedright]
2384 \new Voice \relative c' {
2385 \repeat "tremolo" 8 { c16 d16 }
2386 \repeat "tremolo" 4 { c16 d16 }
2387 \repeat "tremolo" 2 { c16 d16 }
2391 Tremolo marks can also be put on a single note. In this case, the
2392 note should not be surrounded by braces.
2393 @lilypond[quote,verbatim,raggedright]
2394 \repeat "tremolo" 4 c'16
2397 Similar output is obtained using the tremolo subdivision, described in
2398 @ref{Tremolo subdivisions}.
2402 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
2404 Program reference: tremolo beams are @internalsref{Beam} objects. Single stem
2405 tremolos are @internalsref{StemTremolo} objects. The music expression is
2406 @internalsref{TremoloEvent}.
2408 Example files: @inputfileref{input/@/regression,chord@/-tremolo@/.ly},
2409 @inputfileref{input/@/regression,stem@/-tremolo@/.ly}.
2411 @node Tremolo subdivisions
2412 @subsection Tremolo subdivisions
2413 @cindex tremolo marks
2414 @cindex @code{tremoloFlags}
2416 Tremolo marks can be printed on a single note by adding
2417 `@code{:}[@var{number}]' after the note. The number indicates the
2418 duration of the subdivision, and it must be at least 8. A
2419 @var{length} value of 8 gives one line across the note stem. If the
2420 length is omitted, the last value (stored in @code{tremoloFlags}) is
2423 @lilypond[quote,raggedright,verbatim,fragment]
2424 c'2:8 c':32 | c': c': |
2427 @c [TODO: stok is te kort bij 32en]
2428 @c somebody want to translate that into English?
2429 @c `Stem is too short for 32nds' (wl)
2433 Tremolos entered in this way do not carry over into the MIDI output.
2437 In this manual: @ref{Tremolo repeats}.
2439 Elsewhere: @internalsref{StemTremolo}, @internalsref{TremoloEvent}.
2441 @node Measure repeats
2442 @subsection Measure repeats
2444 @cindex percent repeats
2445 @cindex measure repeats
2447 In the @code{percent} style, a note pattern can be repeated. It is
2448 printed once, and then the pattern is replaced with a special sign.
2449 Patterns of one and two measures are replaced by percent-like signs,
2450 patterns that divide the measure length are replaced by slashes.
2451 Percent repeats must be declared within a @code{Voice} context.
2453 @lilypond[quote,verbatim,raggedright]
2454 \new Voice \relative c' {
2455 \repeat "percent" 4 { c4 }
2456 \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
2462 Program reference: @internalsref{RepeatSlash}, @internalsref{PercentRepeat},
2463 @internalsref{PercentRepeatedMusic}, and
2464 @internalsref{DoublePercentRepeat}.
2467 @node Expressive marks
2468 @section Expressive marks
2471 @c todo: should change ordering
2472 @c where to put text spanners, metronome marks,
2475 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.