1 @c -*- coding: utf-8; 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
10 @chapter Basic notation
12 This chapter explains how to use all basic notation features.
16 * Alternate music entry::
30 This section is about basic notation elements like notes, rests, and
31 related constructs, such as stems, tuplets and ties.
36 * Cautionary accidentals::
52 @cindex Note specification
53 @cindex entering notes
55 A note is printed by specifying its pitch and then its duration,
57 @lilypond[quote,verbatim,raggedright,fragment]
63 This manual: @ref{Pitches}, @ref{Durations}
72 The most common syntax for pitch entry is used for standard notes and
73 @code{\chordmode} modes. In these modes, pitches may be designated by
74 names. The notes are specified by the letters @code{a} through
75 @code{g}. The octave is formed with notes ranging from @code{c}
76 to @code{b}. The pitch @code{c} is an octave below middle C and the
77 letters span the octave above that C
79 @lilypond[quote,fragment,verbatim,raggedright]
81 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
87 The optional octave specification takes the form of a series of
88 single quote (`@code{'}') characters or a series of comma
89 (`@code{,}') characters. Each @code{'} raises the pitch by one
90 octave; each @code{,} lowers the pitch by an octave
92 @lilypond[quote,raggedright,fragment,verbatim]
96 @cindex note names, Dutch
98 A sharp is formed by adding @code{-is} to the end of a pitch name and
99 a flat is formed by adding @code{-es}. Double sharps and double flats
100 are obtained by adding @code{-isis} or @code{-eses}. These
101 names are the Dutch note names. In Dutch, @code{aes} is contracted to
102 @code{as}, but both forms are accepted. Similarly, both
103 @code{es} and @code{ees} are accepted
105 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
113 There are predefined sets of note names for various other languages.
114 To use them, include the language specific init file. For
115 example: @code{\include "english.ly"}. The available language files
116 and the note names they define are
121 Note Names sharp flat
122 nederlands.ly c d e f g a bes b -is -es
123 english.ly c d e f g a bf b -s/-sharp -f/-flat
125 deutsch.ly c d e f g a b h -is -es
126 norsk.ly c d e f g a b h -iss/-is -ess/-es
127 svenska.ly c d e f g a b h -iss -ess
128 italiano.ly do re mi fa sol la sib si -d -b
129 catalan.ly do re mi fa sol la sib si -d/-s -b
130 espanol.ly do re mi fa sol la sib si -s -b
136 In accordance with standard typsetting rules, a natural sign is printed
137 before a sharp or flat if a previous accidental needs to be
138 cancelled. To change this behaviour, use
139 @code{\set Staff.extraNatural = ##f}
141 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
143 \set Staff.extraNatural = ##f
150 Program reference: @internalsref{LedgerLineSpanner}, @internalsref{NoteHead}.
153 @node Cautionary accidentals
154 @subsection Cautionary accidentals
156 @cindex reminder accidental
158 @cindex cautionary accidental
159 @cindex parenthesized accidental
162 Normally accidentals are printed automatically, but you may also
163 print them manually. A reminder accidental
164 can be forced by adding an exclamation mark @code{!}
165 after the pitch. A cautionary accidental
166 (i.e., an accidental within parentheses) can be obtained by adding the
167 question mark `@code{?}' after the pitch. These extra accidentals
168 can be used to produce natural signs, too.
170 @lilypond[quote,raggedright,fragment,verbatim]
171 cis' cis' cis'! cis'? c c? c! c
177 The automatic production of accidentals can be tuned in many
178 ways. For more information, refer to @ref{Automatic accidentals}.
183 @subsection Micro tones
185 @cindex quarter tones
186 @cindex semi-flats, semi-sharps
188 Half-flats and half-sharps are formed by adding @code{-eh} and
189 @code{-ih}; the following is a series of Cs with increasing pitches
191 @lilypond[verbatim,raggedright,quote,relative=2,fragment]
192 \set Staff.extraNatural = ##f
196 Micro tones are also exported to the MIDI file.
201 There are no generally accepted standards for denoting three quarter
202 flats, so LilyPond's symbol does not conform to any standard.
210 A chord is formed by a enclosing a set of pitches in @code{<} and
211 @code{>}. A chord may be followed by a duration, and a set of
212 articulations, just like simple notes
214 @lilypond[verbatim,raggedright,fragment,quote,relative=1]
218 For more information about chords, see @ref{Chord names}.
229 Rests are entered like notes with the note name @code{r}
231 @lilypond[fragment,quote,raggedright,verbatim]
235 Whole bar rests, centered in middle of the bar,
236 must be done with multi-measure rests. They can be used for a
237 single bar as well as many bars, and are discussed in
238 @ref{Multi measure rests}.
241 A rest's vertical position may be explicitly specified by entering a
242 note with the @code{\rest} keyword appended, the rest will be placed at
243 the note's place. This makes manual formatting in polyphonic music
244 easier. Automatic rest collision formatting will leave these rests
247 @lilypond[fragment,quote,raggedright,verbatim]
253 Program reference: @internalsref{Rest}.
260 @cindex Invisible rest
265 An invisible rest (also called a `skip') can be entered like a note
266 with note name `@code{s}' or with @code{\skip @var{duration}}
268 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
269 a4 a4 s4 a4 \skip 1 a4
272 The @code{s} syntax is only available in note mode and chord mode. In
273 other situations, for example, when entering lyrics, you should use
274 the @code{\skip} command
276 @lilypond[quote,raggedright,verbatim]
279 \new Lyrics \lyricmode { \skip 2 bla2 }
283 The skip command is merely an empty musical placeholder. It does not
284 produce any output, not even transparent output.
286 The @code{s} skip command does create @internalsref{Staff} and
287 @internalsref{Voice} when necessary, similar to note and rest
288 commands. For example, the following results in an empty staff.
290 @lilypond[quote,raggedright,verbatim]
294 The fragment @code{@{ \skip 4 @} } would produce an empty page.
298 Program reference: @internalsref{SkipMusic}.
302 @subsection Durations
305 @cindex @code{\longa}
306 @cindex @code{\breve}
307 @cindex @code{\maxima}
309 In Note, Chord, and Lyrics mode, durations are designated by numbers and
310 dots: durations are entered as their reciprocal values. For example, a
311 quarter note is entered using a @code{4} (since it is a 1/4 note), while
312 a half note is entered using a @code{2} (since it is a 1/2 note). For
313 notes longer than a whole you must use the variables @code{\longa} and
318 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
320 r1 r2 r4 r8 r16 r32 r64 r64
326 a\breve*1/2 \autoBeamOff
327 a1 a2 a4 a8 a16 a32 a64 a64
330 r\longa*1/4 r\breve *1/2
331 r1 r2 r4 r8 r16 r32 r64 r64
337 \remove "Clef_engraver"
338 \override StaffSymbol #'transparent = ##t
339 \override TimeSignature #'transparent = ##t
340 \override BarLine #'transparent = ##t
341 \consists "Pitch_squash_engraver"
347 If the duration is omitted then it is set to the previously entered
348 duration. The default for the first note is a quarter note.
350 @lilypond[quote,raggedright,verbatim,fragment]
351 { a a a2 a a4 a a1 a }
355 @node Augmentation dots
356 @subsection Augmentation dots
360 To obtain dotted note lenghts, simply add a dot (`@code{.}') to
361 the number. Double-dotted notes are produced in a similar way.
363 @lilypond[quote,raggedright,fragment,verbatim]
364 a'4 b' c''4. b'8 a'4. b'4.. c''8.
369 Dots are normally moved up to avoid staff lines, except in polyphonic
370 situations. The following commands may be used to force a particular
373 @cindex @code{\dotsUp}
375 @cindex @code{\dotsDown}
377 @cindex @code{\dotsNeutral}
382 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}.
390 @cindex @code{\times}
392 Tuplets are made out of a music expression by multiplying all durations
396 \times @var{fraction} @var{musicexpr}
400 The duration of @var{musicexpr} will be multiplied by the fraction.
401 The fraction's denominator will be printed over the notes, optionally
402 with a bracket. The most common tuplet is the triplet in which 3
403 notes have the length of 2, so the notes are 2/3 of their written
406 @lilypond[quote,raggedright,fragment,verbatim]
407 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
410 Tuplets may be nested, for example,
412 @lilypond[fragment,raggedright,verbatim,relative=2]
413 \set tupletNumberFormatFunction = #fraction-tuplet-formatter
416 \times 3/5 { a a a a a }
422 @cindex @code{\tupletUp}
424 @cindex @code{\tupletDown}
426 @cindex @code{\tupletNeutral}
427 @code{\tupletNeutral}.
432 @cindex @code{tupletNumberFormatFunction}
433 @cindex tuplet formatting
435 The property @code{tupletSpannerDuration} specifies how long each
436 bracket should last. With this, you can make lots of tuplets while
437 typing @code{\times} only once, thus saving lots of typing. In the next
438 example, there are two triplets shown, while @code{\times} was only
441 @lilypond[quote,fragment,relative=2,raggedright,verbatim]
442 \set tupletSpannerDuration = #(ly:make-moment 1 4)
443 \times 2/3 { c8 c c c c c }
446 The format of the number is determined by the property
447 @code{tupletNumberFormatFunction}. The default prints only the
448 denominator, but if it is set to the Scheme function
449 @code{fraction-tuplet-formatter}, @var{num}:@var{den} will be printed
452 To avoid printing tuplet numbers, use
454 @lilypond[quote,fragment,relative=2,raggedright,verbatim]
455 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
456 \override TupletNumber #'transparent = ##t
457 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
463 Program reference: @internalsref{TupletBracket},
464 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
466 Examples: @inputfileref{input/@/regression,tuplet@/-nest@/.ly}.
470 @node Scaling durations
471 @subsection Scaling durations
473 You can alter the length of duration by a fraction @var{N/M}
474 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
475 will not affect the appearance of the notes or rests produced.
477 In the following example, the first three notes take up exactly two
478 beats, but no triplet bracket is printed.
479 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
481 a4*2/3 gis4*2/3 a4*2/3
489 This manual: @ref{Tuplets}
495 Whenever a note is found, a @internalsref{Stem} object is created
496 automatically. For whole notes and rests, they are also created but
501 @cindex @code{\stemUp}
503 @cindex @code{\stemDown}
505 @cindex @code{\stemNeutral}
509 @node Alternate music entry
510 @section Alternate music entry
513 This section deals with tricks and features of the input language that
514 were added solely to help entering music and finding and correcting
515 mistakes. There are also external tools that make debugging easier.
516 See @ref{Point and click} for more information.
518 It is also possible to enter and edit music using other programs, such as
519 GUI interfaces or MIDI sequencers. Refer to the LilyPond
520 website for more information.
528 * Skipping corrected music::
529 * Automatic note splitting::
533 @node Relative octaves
534 @subsection Relative octaves
537 @cindex Relative octave specification
538 @cindex @code{\relative}
540 Octaves are specified by adding @code{'} and @code{,} to pitch names.
541 When you copy existing music, it is easy to accidentally put a pitch
542 in the wrong octave and hard to find such an error. The relative
543 octave mode prevents these errors by making the mistakes much
544 larger: a single error puts the rest of the piece off by one octave
547 \relative @var{startpitch} @var{musicexpr}
554 \relative @var{musicexpr}
557 The octave of notes that appear in @var{musicexpr} are calculated as
558 follows: if no octave changing marks are used, the basic interval
559 between this and the last note is always taken to be a fourth or
560 less. This distance is determined without regarding alterations; a
561 @code{fisis} following a @code{ceses} will be put above the
562 @code{ceses}. In other words, a doubly-augmented fourth is considered
563 a smaller interval than a diminished fifth, even though the
564 doubly-augmented fourth spans seven semitones while the diminished
565 fifth only spans six semitones.
567 The octave changing marks @code{'} and @code{,} can be added to raise
568 or lower the pitch by an extra octave. Upon entering relative mode,
569 an absolute starting pitch can be specified that will act as the
570 predecessor of the first note of @var{musicexpr}. If no starting pitch
571 is specified, then middle C is used as a start.
573 Here is the relative mode shown in action
574 @lilypond[quote,fragment,raggedright,verbatim]
580 Octave changing marks are used for intervals greater than a fourth
581 @lilypond[quote,raggedright,fragment,verbatim]
587 If the preceding item is a chord, the first note of the chord is used
588 to determine the first note of the next chord
590 @lilypond[quote,raggedright,fragment,verbatim]
598 The pitch after the @code{\relative} contains a note name.
600 The relative conversion will not affect @code{\transpose},
601 @code{\chordmode} or @code{\relative} sections in its argument. To use
602 relative within transposed music, an additional @code{\relative} must
603 be placed inside @code{\transpose}.
607 @subsection Octave check
611 Octave checks make octave errors easier to correct: a note may be
612 followed by @code{=}@var{quotes} which indicates what its absolute
613 octave should be. In the following example,
616 \relative c'' @{ c='' b=' d,='' @}
620 the @code{d} will generate a warning, because a @code{d''} is expected
621 (because @code{b'} to @code{d''} is only a third), but a @code{d'} is
622 found. In the output, the octave is corrected to be a @code{d''} and
623 the next note is calculated relative to @code{d''} instead of @code{d'}.
625 There is also a syntax that is separate from the notes. The syntax
631 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
632 quotes) in \relative mode. If not, a warning is printed, and the
635 In the example below, the first check passes without incident, since
636 the @code{e} (in relative mode) is within a fifth of @code{a'}. However,
637 the second check produces a warning, since the @code{e} is not within
638 a fifth of @code{b'}. The warning message is printed, and the octave
639 is adjusted so that the following notes are in the correct octave
651 The octave of a note following an octave check is determined with
652 respect to the note preceding it. In the next fragment, the last note
653 is an @code{a'}, above middle C. That means that the @code{\octave}
654 check passes successfully, so the check could be deleted without changing
655 the output of the piece.
657 @lilypond[quote,raggedright,verbatim,fragment]
667 @subsection Transpose
670 @cindex transposition of pitches
671 @cindex @code{\transpose}
673 A music expression can be transposed with @code{\transpose}. The
676 \transpose @var{from} @var{to} @var{musicexpr}
679 This means that @var{musicexpr} is transposed by the interval between
680 the pitches @var{from} and @var{to}: any note with pitch @code{from}
681 is changed to @code{to}.
683 For example, consider a piece written in the key of D-major. If
684 this piece is a little too low for its performer, it can be
685 transposed up to E-major with
687 \transpose d e @dots{}
690 Consider a part written for violin (a C instrument). If
691 this part is to be played on the A clarinet, the following
692 transposition will produce the appropriate part
695 \transpose a c @dots{}
698 @code{\transpose} distinguishes between enharmonic pitches: both
699 @code{\transpose c cis} or @code{\transpose c des} will transpose up
700 half a tone. The first version will print sharps and the second
701 version will print flats
703 @lilypond[quote,raggedright,verbatim]
704 mus = { \key d \major cis d fis g }
713 @code{\transpose} may also be used to input written notes for a
714 transposing instrument. Pitches are normally entered into LilyPond
715 in C (or ``concert pitch''), but they may be entered in another
716 key. For example, when entering music for a B-flat trumpet which
717 begins on concert D, one would write
720 \transpose c bes @{ e4 @dots{} @}
723 To print this music in B-flat again (ie producing a trumpet part,
724 instead of a concert pitch conductor's score) you would wrap the
725 existing music with another @code{transpose}
728 \transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @}
734 Program reference: @internalsref{TransposedMusic}.
739 If you want to use both @code{\transpose} and @code{\relative},
740 you must put @code{\transpose} outside of @code{\relative}, since
741 @code{\relative} will have no effect music that appears inside a
746 @subsection Bar check
749 @cindex @code{barCheckSynchronize}
752 Bar checks help detect errors in the durations. A bar check is
753 entered using the bar symbol, `@code{|}'. Whenever it is encountered
754 during interpretation, it should fall on a measure boundary. If it
755 does not, a warning is printed. In the next example, the second bar
756 check will signal an error
758 \time 3/4 c2 e4 | g2 |
761 Bar checks can also be used in lyrics, for example
766 Twin -- kle | Twin -- kle
770 Failed bar checks are caused by entering incorrect
771 durations. Incorrect durations often completely garble up the score,
772 especially if the score is polyphonic, so a good place to start correcting
773 input is by scanning for failed bar checks and incorrect durations.
776 @cindex @code{pipeSymbol}
778 It is also possible to redefine the meaning of @code{|}. This is done
779 by assigning a music expression to @code{pipeSymbol},
781 @lilypond[quote,raggedright,verbatim]
782 pipeSymbol = \bar "||"
788 @node Barnumber check
789 @subsection Barnumber check
791 When copying large pieces of music, it can be helpful to check that
792 the LilyPond bar number corresponds to the original that you are
793 entering from. This can be checked with @code{\barNumberCheck}, for
801 will print a warning if the @code{currentBarNumber} is not 123 when it
805 @node Skipping corrected music
806 @subsection Skipping corrected music
809 @cindex @code{skipTypesetting}
810 @cindex @code{showLastLength}
812 When entering or copying music, only the music near the end (where you
813 are adding notes) is interesting to view and correct. To speed up
814 this correction process, it is possible to skip typesetting of all but
815 the last few measures. This is achieved by putting
818 showLastLength = R1*5
823 in your source file. This will render only the last 5 measures
824 (assuming 4/4 time signature) of every @code{\score} in the input
825 file. For longer pieces, rendering only a small part is often an order
826 of magnitude quicker than rendering it completely
828 Skipping parts of a score can be controlled in a more fine-grained
829 fashing with the property @code{Score.skipTypesetting}. When it is
830 set, no typesetting is performed at all.
832 @lilypond[quote,fragment,raggedright,verbatim]
835 \set Score.skipTypesetting = ##t
837 \set Score.skipTypesetting = ##f
841 In polyphonic music, @code{Score.skipTypesetting} will affect all
842 voices and staves, saving even more time.
845 @node Automatic note splitting
846 @subsection Automatic note splitting
848 Long notes can be converted automatically to tied notes. This is done
849 by replacing the @internalsref{Note_heads_engraver} by the
850 @internalsref{Completion_heads_engraver}.
851 In the following examples, notes crossing the bar line are split and tied.
853 @lilypond[quote,fragment,verbatim,relative=1,linewidth=12\cm]
855 \remove "Note_heads_engraver"
856 \consists "Completion_heads_engraver"
858 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
862 This engraver splits all running notes at the bar line, and inserts
863 ties. One of its uses is to debug complex scores: if the measures are
864 not entirely filled, then the ties exactly show how much each measure
870 Not all durations (especially those containing tuplets) can be
871 represented exactly with normal notes and dots, but the engraver will
874 @code{Completion_heads_engraver} only affects notes; it does not split
880 Examples: @inputfileref{input/@/regression,completion@/-heads@/.ly}.
884 Program reference: @internalsref{Completion_heads_engraver}.
889 @section Staff notation
891 @cindex Staff notation
893 This section describes music notation that occurs on staff level,
894 such as key signatures, clefs and time signatures.
903 * System start delimiters::
913 The clef indicates which lines of the staff correspond to which
914 pitches. The clef is set with the @code{\clef} command
916 @lilypond[quote,raggedright,fragment,verbatim]
917 { c''2 \clef alto g'2 }
927 @cindex mezzosoprano clef
928 @cindex baritone clef
929 @cindex varbaritone clef
932 Supported clefs finclude
934 @item treble, violin, G, G2
943 G clef on 1st line, so-called French violin clef
960 By adding @code{_8} or @code{^8} to the clef name, the clef is
961 transposed one octave down or up, respectively, and @code{_15} and
962 @code{^15} transposes by two octaves. The argument @var{clefname}
963 must be enclosed in quotes when it contains underscores or digits. For
966 @cindex choral tenor clef
967 @lilypond[quote,raggedright,verbatim,fragment,relative=1]
974 The command @code{\clef "treble_8"} is equivalent to setting @code{clefGlyph},
975 @code{clefPosition} (which controls the Y position of the clef),
976 @code{middleCPosition} and @code{clefOctavation}. A clef is printed
977 when any of these properties are changed. The following example shows
978 possibilities when setting properties manually.
980 @lilypond[quote,raggedright,verbatim]
982 \set Staff.clefGlyph = #"clefs.F"
983 \set Staff.clefPosition = #2
985 \set Staff.clefGlyph = #"clefs.G"
987 \set Staff.clefGlyph = #"clefs.C"
989 \set Staff.clefOctavation = #7
991 \set Staff.clefOctavation = #0
992 \set Staff.clefPosition = #0
996 \set Staff.middleCPosition = #4
1004 Program reference: @internalsref{Clef}.
1008 @subsection Key signature
1010 @cindex Key signature
1013 The key signature indicates the tonality in which a piece is played. It
1014 is denoted by a set of alterations (flats or sharps) at the start of the
1017 Setting or changing the key signature is done with the @code{\key}
1021 @code{\key} @var{pitch} @var{type}
1024 @cindex @code{\minor}
1025 @cindex @code{\major}
1026 @cindex @code{\minor}
1027 @cindex @code{\ionian}
1028 @cindex @code{\locrian}
1029 @cindex @code{\aeolian}
1030 @cindex @code{\mixolydian}
1031 @cindex @code{\lydian}
1032 @cindex @code{\phrygian}
1033 @cindex @code{\dorian}
1034 @cindex church modes
1036 Here, @var{type} should be @code{\major} or @code{\minor} to get
1037 @var{pitch}-major or @var{pitch}-minor, respectively. You may also
1038 use the standard mode names (also called ``church modes''): @code{\ionian},
1039 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
1040 @code{\phrygian}, and @code{\dorian}.
1042 This command sets the context property
1043 @code{Staff.keySignature}. Non-standard key signatures
1044 can be specified by setting this property directly.
1046 Accidentals and key signatures often confuse new users, because
1047 unaltered notes get natural signs depending on the key signature. For
1048 more information, see @ref{More about pitches}.
1053 A natural sign is printed to cancel any previous accidentals. This
1054 can be suppressed by setting the @code{Staff.printKeyCancellation}
1057 @lilypond[quote,fragment,raggedright,fragment,verbatim,relative=2]
1062 \set Staff.printKeyCancellation = ##f
1072 Program reference: @internalsref{KeyCancellation}, @internalsref{KeySignature}.
1075 @node Time signature
1076 @subsection Time signature
1078 @cindex Time signature
1080 @cindex @code{\time}
1082 Time signature indicates the metrum of a piece: a regular pattern of
1083 strong and weak beats. It is denoted by a fraction at the start of the
1086 The time signature is set with the @code{\time} command
1088 @lilypond[quote,raggedright,fragment,verbatim]
1089 \time 2/4 c'2 \time 3/4 c'2.
1094 The symbol that is printed can be customized with the @code{style}
1095 property. Setting it to @code{#'()} uses fraction style for 4/4 and
1098 @lilypond[fragment,quote,raggedright,verbatim]
1101 \override Staff.TimeSignature #'style = #'()
1106 There are many more options for its layout. See @ref{Ancient time
1107 signatures} for more examples.
1109 @code{\time} sets the property @code{timeSignatureFraction},
1110 @code{beatLength} and @code{measureLength} in the @code{Timing}
1111 context, which is normally aliased to @internalsref{Score}. The
1112 property @code{measureLength} determines where bar lines should be
1113 inserted, and how automatic beams should be generated. Changing the
1114 value of @code{timeSignatureFraction} also causes the symbol to be
1117 More options are available through the Scheme function
1118 @code{set-time-signature}. In combination with the
1119 @internalsref{Measure_grouping_engraver}, it will create
1120 @internalsref{MeasureGrouping} signs. Such signs ease reading
1121 rhythmically complex modern music. In the following example, the 9/8
1122 measure is subdivided in 2, 2, 2 and 3. This is passed to
1123 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1125 @lilypond[quote,raggedright,verbatim]
1128 #(set-time-signature 9 8 '(2 2 2 3))
1129 g8[ g] d[ d] g[ g] a8[( bes g]) |
1130 #(set-time-signature 5 8 '(3 2))
1136 \consists "Measure_grouping_engraver"
1144 Program reference: @internalsref{TimeSignature}, and @internalsref{Timing_translator}.
1149 Automatic beaming does not use the measure grouping specified with
1150 @code{set-time-signature}.
1153 @node Partial measures
1154 @subsection Partial measures
1158 @cindex partial measure
1159 @cindex measure, partial
1160 @cindex shorten measures
1161 @cindex @code{\partial}
1163 Partial measures, such as an anacrusis or upbeat, are entered using the
1165 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1166 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1169 The syntax for this command is
1172 \partial @var{duration}
1175 This is internally translated into
1178 \set Timing.measurePosition = -@var{length of duration}
1181 The property @code{measurePosition} contains a rational number
1182 indicating how much of the measure has passed at this point.
1187 This command does not take into account grace notes at the start of
1188 the music. When a piece starts with graces notes in the pickup, then
1189 the @code{\partial} should follow the grace notes
1191 @lilypond[verbatim,quote,raggedright,relative,fragment]
1200 @subsection Bar lines
1204 @cindex measure lines
1207 Bar lines delimit measures, but are also used to indicate
1208 repeats. Normally they are inserted automatically. Line
1209 breaks may only happen on bar lines.
1211 Special types of bar lines can be forced with the @code{\bar} command
1213 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1217 The following bar types are available
1219 @lilypondfile[raggedright,quote]{bar-lines.ly}
1221 To allow a line break where there is no visible bar line, use
1228 This will insert an invisible bar line and allow line breaks at this
1231 In scores with many staves, a @code{\bar} command in one staff is
1232 automatically applied to all staves. The resulting bar lines are
1233 connected between different staves of a StaffGroup
1235 @lilypond[quote,raggedright,fragment,verbatim]
1237 \context StaffGroup <<
1243 \new Staff { \clef bass c4 g e g }
1245 \new Staff { \clef bass c2 c2 }
1252 @cindex @code{whichBar}
1253 @cindex @code{repeatCommands}
1254 @cindex @code{defaultBarType}
1256 The command @code{\bar }@var{bartype} is a short cut for doing
1257 @code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
1258 is set to a string, a bar line of that type is created.
1260 A bar line is created whenever the @code{whichBar} property is set.
1261 At the start of a measure it is set to the contents of
1262 @code{Timing.defaultBarType}. The contents of @code{repeatCommands} are used
1263 to override default measure bars.
1265 You are encouraged to use @code{\repeat} for repetitions. See
1271 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1273 Program reference: @internalsref{BarLine} (created at
1274 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1276 Examples: @inputfileref{input/@/test,bar@/-lines@/.ly},
1279 @node Unmetered music
1280 @subsection Unmetered music
1283 @cindex @code{\cadenzaOn}
1284 @cindex @code{\cadenzaOff}
1286 Bar lines and bar numbers are calculated automatically. For unmetered
1287 music (cadenzas, for example), this is not desirable. To turn off
1288 automatic bar lines and bar numbers, use the commands @code{\cadenzaOn}
1289 and @code{\cadenzaOff}.
1291 @lilypond[verbatim,quote,raggedright,relative=2,fragment]
1303 LilyPond will only insert page breaks at a barline. Unless the unmetered
1304 music ends before the end of the staff line, you will need to insert
1312 to indicate where line breaks can occur.
1315 @node System start delimiters
1316 @subsection System start delimiters
1318 @cindex start of system
1319 @cindex Staff, multiple
1320 @cindex bracket, vertical
1321 @cindex brace, vertical
1324 @cindex staff, choir
1326 Many scores consist of more than one staff. These staves can be
1327 joined in four different ways
1330 @item The group is started with a brace at the left, and bar lines are
1331 connected. This is done with the @internalsref{GrandStaff} context.
1333 @lilypond[verbatim,raggedright,quote]
1341 @item The group is started with a bracket, and bar lines are connected.
1342 This is done with the
1343 @internalsref{StaffGroup} context
1345 @lilypond[verbatim,raggedright,quote]
1353 @item The group is started with a bracket, but bar lines are not
1354 connected. This is done with the @internalsref{ChoirStaff} context.
1356 @lilypond[verbatim,raggedright,quote]
1364 @item The group is started with a vertical line. Bar lines are not
1365 connected. This is the default for the score.
1367 @lilypond[verbatim,raggedright,quote]
1378 The bar lines at the start of each system are
1379 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1380 @internalsref{SystemStartBracket}. Only one of these types is created
1381 in every context, and that type is determined by the property
1382 @code{systemStartDelimiter}.
1386 @subsection Staff symbol
1388 @cindex adjusting staff symbol
1390 Notes, dynamic signs, etc., are grouped
1391 with a set of horizontal lines, called a staff (plural `staves'). In
1392 LilyPond, these lines are drawn using a separate layout object called
1395 The staff symbol may be tuned in the number, thickness and distance
1396 of lines, using properties. This is demonstrated in the example files
1397 @inputfileref{input/@/test,staff@/-lines@/.ly},
1398 @inputfileref{input/@/test,staff@/-size@/.ly}.
1400 In addition, staves may be started and stopped at will. This is done
1401 with @code{\startStaff} and @code{\stopStaff}.
1403 @lilypond[verbatim,relative=2,fragment]
1405 \override Staff.StaffSymbol #'line-count = 2
1406 \stopStaff \startStaff
1408 \revert Staff.StaffSymbol #'line-count
1409 \stopStaff \startStaff
1413 In combination with Frenched staves, this may be used to typeset ossia
1414 sections. An example is in @inputfileref{input/@/test@/,ossia.ly},
1419 @lilypondfile{ossia.ly}
1421 @cindex staff lines, setting number of
1422 @cindex staff lines, setting thickness of
1423 @cindex thickness of staff lines, setting
1424 @cindex number of staff lines, setting
1428 Program reference: @internalsref{StaffSymbol}.
1430 Examples: @inputfileref{input/@/test,staff@/-lines@/.ly},
1431 @inputfileref{input/@/test@/,ossia.ly},
1432 @inputfileref{input/@/test,staff@/-size@/.ly}.
1436 @node Connecting notes
1437 @section Connecting notes
1439 This section deals with notation that affects groups of notes.
1457 A tie connects two adjacent note heads of the same pitch. The tie in
1458 effect extends the length of a note. Ties should not be confused with
1459 slurs, which indicate articulation, or phrasing slurs, which indicate
1460 musical phrasing. A tie is entered using the tilde symbol `@code{~}'
1462 @lilypond[quote,raggedright,fragment,verbatim]
1463 e' ~ e' <c' e' g'> ~ <c' e' g'>
1466 When a tie is applied to a chord, all note heads whose pitches match
1467 are connected. When no note heads match, no ties will be created.
1469 A tie is just a way of extending a note duration, similar to the
1470 augmentation dot. The following example shows two ways of notating
1471 exactly the same concept
1473 @lilypond[quote,fragment,raggedright]
1474 \time 3/4 c'2. c'2 ~ c'4
1478 Ties are used either when the note crosses a bar line, or when dots
1479 cannot be used to denote the rhythm. When using ties, larger note
1480 values should be aligned to subdivisions of the measure, eg.
1482 @lilypond[fragment,quote,raggedright]
1484 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
1488 If you need to tie a lot of notes over bars, it may be easier to use
1489 automatic note splitting (see @ref{Automatic note splitting}). This
1490 mechanism automatically splits long notes, and ties them across bar
1496 Ties are sometimes used to write out arpeggios. In this case, two tied
1497 notes need not be consecutive. This can be achieved by setting the
1498 @code{tieWaitForNote} property to true. The same feature is also useful,
1499 for example, to tie a tremolo to a chord. For example,
1501 @lilypond[fragment,verbatim,relative=1,raggedright]
1502 \set tieWaitForNote = ##t
1503 \grace { c16[~ e~ g]~ } <c, e g>2
1504 \repeat "tremolo" 8 { c32~ c'~ } <c c,>1
1511 @cindex @code{\tieUp}
1513 @cindex @code{\tieDown}
1515 @cindex @code{\tieNeutral}
1517 @cindex @code{\tieDotted}
1519 @cindex @code{\tieDashed}
1521 @cindex @code{\tieSolid}
1527 In this manual: @ref{Automatic note splitting}.
1529 Program reference: @internalsref{Tie}.
1534 Switching staves when a tie is active will not produce a slanted tie.
1542 A slur indicates that notes are to be played bound or
1543 @emph{legato}. They are entered using parentheses
1545 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1546 f( g a) a8 b( a4 g2 f4)
1550 The direction of a slur can be specified with
1551 @code{\slur@emph{DIR}}, where @code{@emph{DIR}} is
1552 either @code{Up}, @code{Down}, or @code{Neutral} (automatically
1555 However, there is a convenient shorthand for forcing slur
1556 directions. By adding @code{_} or @code{^} before the opening
1557 parentheses, the direction is also set. For example,
1559 @lilypond[relative=2,raggedright,quote,verbatim,fragment]
1563 Only one slur can be printed at once. If you need to print a long
1564 slur over a few small slurs, please see @ref{Phrasing slurs}.
1569 Some composers write two slurs when they want legato chords. This can
1570 be achieved in LilyPond by setting @code{doubleSlurs},
1572 @lilypond[verbatim,raggedright,relative,fragment,quote]
1573 \set doubleSlurs = ##t
1574 <c e>4 ( <d f> <c e> <d f> )
1580 @cindex @code{\slurUp}
1582 @cindex @code{\slurDown}
1584 @cindex @code{\slurNeutral}
1585 @code{\slurNeutral},
1586 @cindex @code{\slurDashed}
1588 @cindex @code{\slurDotted}
1590 @cindex @code{\slurSolid}
1595 Program reference: @seeinternals{Slur}.
1598 @node Phrasing slurs
1599 @subsection Phrasing slurs
1601 @cindex phrasing slurs
1602 @cindex phrasing marks
1604 A phrasing slur (or phrasing mark) connects notes and is used to
1605 indicate a musical sentence. It is written using @code{\(} and @code{\)}
1608 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
1609 \time 6/4 c'\( d( e) f( e) d\)
1612 Typographically, the phrasing slur behaves almost exactly like a
1613 normal slur. However, they are treated as different objects. A
1614 @code{\slurUp} will have no effect on a phrasing slur; instead, use
1615 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1616 @code{\phrasingSlurNeutral}.
1618 You cannot have simultaneous phrasing slurs.
1623 @cindex @code{\phrasingSlurUp}
1624 @code{\phrasingSlurUp},
1625 @cindex @code{\phrasingSlurDown}
1626 @code{\phrasingSlurDown},
1627 @cindex @code{\phrasingSlurNeutral}
1628 @code{\phrasingSlurNeutral}.
1633 Program reference: @internalsref{PhrasingSlur}.
1636 @node Automatic beams
1637 @subsection Automatic beams
1639 LilyPond inserts beams automatically
1641 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1642 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1645 When these automatic decisions are not good enough, beaming can be
1646 entered explicitly. It is also possible to define beaming patterns
1647 that differ from the defaults. See @ref{Setting automatic beam behavior}
1650 Individual notes may be marked with @code{\noBeam} to prevent them
1653 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1654 \time 2/4 c8 c\noBeam c c
1660 Program reference: @internalsref{Beam}.
1664 @subsection Manual beams
1666 @cindex beams, manual
1670 In some cases it may be necessary to override the automatic beaming
1671 algorithm. For example, the autobeamer will not put beams over rests
1672 or bar lines. Such beams are specified manually by marking the begin
1673 and end point with @code{[} and @code{]}
1675 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
1677 r4 r8[ g' a r8] r8 g[ | a] r8
1684 @cindex @code{stemLeftBeamCount}
1685 @cindex @code{stemRightBeamCount}
1687 Normally, beaming patterns within a beam are determined automatically.
1688 If necessary, the properties @code{stemLeftBeamCount} and
1689 @code{stemRightBeamCount} can be used to override the defaults. If
1690 either property is set, its value will be used only once, and then it
1693 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
1698 \set stemLeftBeamCount = #1
1703 The property @code{subdivideBeams} can be set in order to subdivide
1704 all 16th or shorter beams at beat positions, as defined by the
1705 @code{beatLength} property.
1707 @lilypond[fragment,quote,relative=2,verbatim]
1709 \set subdivideBeams = ##t
1711 \set Score.beatLength = #(ly:make-moment 1 8)
1714 @cindex @code{subdivideBeams}
1716 Line breaks are normally forbidden when beams cross bar lines. This
1717 behavior can be changed by setting @code{allowBeamBreak}.
1719 @cindex @code{allowBeamBreak}
1720 @cindex beams and line breaks
1721 @cindex beams, kneed
1723 @cindex auto-knee-gap
1728 Kneed beams are inserted automatically when a large gap is detected
1729 between the note heads. This behavior can be tuned through the object.
1731 Automatically kneed cross-staff beams cannot be used together with
1732 hidden staves. See @ref{Hiding staves}.
1734 Beams do not avoid collisions with symbols around the notes, such as
1735 texts and accidentals.
1739 @subsection Grace notes
1741 @cindex @code{\grace}
1744 @cindex appoggiatura
1745 @cindex acciaccatura
1747 Grace notes are ornaments that are written out. The most common ones
1748 are acciaccatura, which should be played as very short. It is denoted
1749 by a slurred small note with a slashed stem. The appoggiatura is a
1750 grace note that takes a fixed fraction of the main note, and is
1751 denoted as a slurred note in small print without a slash. They
1752 are entered with the commands @code{\acciaccatura} and
1753 @code{\appoggiatura}, as demonstrated in the following example
1755 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1756 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
1757 \acciaccatura { g16[ f] } e4
1760 Both are special forms of the @code{\grace} command. By prefixing this
1761 keyword to a music expression, a new one is formed, which will be
1762 printed in a smaller font and takes up no logical time in a measure.
1764 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1766 \grace { c16[ d16] } c2 c4
1770 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1771 @code{\grace} command does not start a slur.
1773 Internally, timing for grace notes is done using a second, `grace'
1774 timing. Every point in time consists of two rational numbers: one
1775 denotes the logical time, one denotes the grace timing. The above
1776 example is shown here with timing tuples
1778 @lilypond[quote,raggedright]
1781 c4 \grace c16 c4 \grace {
1784 \new Lyrics \lyricmode {
1785 \override LyricText #'font-family = #'typewriter
1789 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
1790 \markup { (\fraction 1 4 , 0 ) } 4
1792 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
1793 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
1795 \markup { ( \fraction 2 4 , 0 ) }
1800 The placement of grace notes is synchronized between different staves.
1801 In the following example, there are two sixteenth grace notes for
1802 every eighth grace note
1804 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1805 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1806 \new Staff { c4 \grace { g8[ b] } c4 } >>
1809 @cindex @code{\afterGrace}
1811 If you want to end a note with a grace, use the @code{\afterGrace}
1812 command. It takes two arguments: the main note, and the grace notes
1813 following the main note.
1815 @lilypond[raggedright, verbatim,relative=2,fragment]
1816 c1 \afterGrace d1 { c16[ d] } c4
1819 This will put the grace notes after a ``space'' lasting 3/4 of the
1820 length of the main note. The fraction 3/4 can be changed by setting
1821 @code{afterGraceFraction}, ie.
1824 afterGraceFraction = #(cons 7 8)
1828 will put the grace note at 7/8 of the main note.
1830 The same effect can be achieved manually by doing
1832 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1835 { s2 \grace { c16[ d] } } >>
1841 By adjusting the duration of the skip note (here it is a half-note),
1842 the space between the main-note and the grace is adjusted.
1844 A @code{\grace} section will introduce special typesetting settings,
1845 for example, to produce smaller type, and set directions. Hence, when
1846 introducing layout tweaks, they should be inside the grace section,
1848 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1860 The overrides should also be reverted inside the grace section.
1862 The layout of grace sections can be changed throughout the music using
1863 the function @code{add-grace-property}. The following example
1864 undefines the Stem direction for this grace, so stems do not always
1869 #(add-grace-property 'Voice 'Stem 'direction '())
1875 Another option is to change the variables @code{startGraceMusic},
1876 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
1877 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
1878 @code{stopAppoggiaturaMusic}. More information is in the file
1879 @file{ly/@/grace@/-init@/.ly}.
1882 The slash through the stem in acciaccaturas can be obtained
1883 in other situations by @code{\override Stem #'stroke-style = #"grace"}.
1887 Program reference: @internalsref{GraceMusic}.
1892 A score that starts with a @code{\grace} section needs an explicit
1893 @code{\context Voice} declaration, otherwise the main note and the grace
1894 note end up on different staves.
1896 Grace note synchronization can also lead to surprises. Staff notation,
1897 such as key signatures, bar lines, etc., are also synchronized. Take
1898 care when you mix staves with grace notes and staves without, for example,
1900 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1901 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1902 \new Staff { c4 \bar "|:" d4 } >>
1906 This can be remedied by inserting grace skips of the corresponding
1907 durations in the other staves. For the above example
1910 \new Staff @{ c4 \bar "|:" \grace s16 d4 @}
1913 Grace sections should only be used within sequential music
1914 expressions. Nesting or juxtaposing grace sections is not supported,
1915 and might produce crashes or other errors.
1919 @node Expressive marks
1920 @section Expressive marks
1922 Expressive marks help musicians to bring more to the music than simple
1927 * Fingering instructions::
1937 @subsection Articulations
1939 @cindex Articulations
1943 A variety of symbols can appear above and below notes to indicate
1944 different characteristics of the performance. They are added to a note
1945 by adding a dash and the character signifying the
1946 articulation. They are demonstrated here
1948 @lilypondfile[quote,raggedright]{script-abbreviations.ly}
1950 The meanings of these shorthands can be changed. See
1951 @file{ly/@/script@/-init@/.ly} for examples.
1953 The script is automatically placed, but the direction can be forced as
1954 well. Like other pieces of LilyPond code, @code{_} will place them
1955 below the staff, and @code{^} will place them above.
1957 @lilypond[quote,raggedright,fragment,verbatim]
1961 Other symbols can be added using the syntax
1962 @var{note}@code{\}@var{name}. Again, they
1963 can be forced up or down using @code{^} and @code{_},
1966 @lilypond[quote,raggedright,verbatim,fragment,relative=2]
1967 c\fermata c^\fermata c_\fermata
1972 @cindex staccatissimo
1982 @cindex organ pedal marks
1991 @cindex prallmordent
1995 @cindex thumb marking
2000 Here is a chart showing all scripts available,
2002 @lilypondfile[raggedright,quote]{script-chart.ly}
2007 The vertical ordering of scripts is controlled with the
2008 @code{script-priority} property. The lower this number, the closer it
2009 will be put to the note. In this example, the
2010 @internalsref{TextScript} (the sharp symbol) first has the lowest
2011 priority, so it is put lowest in the first example. In the second, the
2012 prall trill (the @internalsref{Script}) has the lowest, so it is on the
2013 inside. When two objects have the same priority, the order in which
2014 they are entered decides which one comes first.
2016 @lilypond[verbatim,relative=3,raggedright,fragment,quote]
2017 \once \override TextScript #'script-priority = #-100
2018 a4^\prall^\markup { \sharp }
2020 \once \override Script #'script-priority = #-100
2021 a4^\prall^\markup { \sharp }
2027 Program reference: @internalsref{Script}.
2032 These signs appear in the printed output but have no effect on the
2033 MIDI rendering of the music.
2036 @node Fingering instructions
2037 @subsection Fingering instructions
2040 @cindex finger change
2042 Fingering instructions can be entered using
2044 @var{note}-@var{digit}
2046 For finger changes, use markup texts
2048 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
2050 c^\markup { \finger "2 - 3" }
2053 You can use the thumb-script to indicate that a note should be
2054 played with the thumb (e.g., in cello music)
2055 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
2056 <a_\thumb a'-3>8 <b_\thumb b'-3>
2059 Fingerings for chords can also be added to individual notes
2060 of the chord by adding them after the pitches
2061 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
2062 < c-1 e-2 g-3 b-5 >4
2068 You may exercise greater control over fingering chords by
2069 setting @code{fingeringOrientations}
2071 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
2072 \set fingeringOrientations = #'(left down)
2073 <c-1 es-2 g-4 bes-5 > 4
2074 \set fingeringOrientations = #'(up right down)
2075 <c-1 es-2 g-4 bes-5 > 4
2078 Using this feature, it is also possible to put fingering instructions
2079 very close to note heads in monophonic music,
2081 @lilypond[verbatim,raggedright,quote,fragment]
2082 \set fingeringOrientations = #'(right)
2089 Program reference: @internalsref{Fingering}.
2091 Examples: @inputfileref{input/@/regression,finger@/-chords@/.ly}.
2095 @subsection Dynamics
2106 @cindex @code{\ffff}
2115 Absolute dynamic marks are specified using a command after a note
2116 @code{c4\ff}. The available dynamic marks are @code{\ppp},
2117 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2118 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2119 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2121 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
2122 c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2123 c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
2130 A crescendo mark is started with @code{\<} and terminated with
2131 @code{\!} or an absolute dynamic. A decrescendo is started with
2132 @code{\>} and is also terminated with @code{\!} or an absolute
2133 dynamic. Because these marks are bound to notes, you must
2134 use spacer notes if multiple marks are needed during one note
2136 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2138 << f1 { s4 s4\< s4\! \> s4\! } >>
2142 A hairpin starts at the left edge of the beginning note and ends on the
2143 right edge of the ending note.
2145 This may give rise to very short hairpins. Use @code{minimum-length}
2146 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2150 \override Staff.Hairpin #'minimum-length = #5
2157 You can also use a text saying @emph{cresc.} instead of hairpins
2159 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2170 You can also supply your own texts
2171 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2172 \set crescendoText = \markup { \italic "cresc. poco" }
2173 \set crescendoSpanner = #'dashed-line
2177 To create new dynamic marks or text that should be aligned
2178 with dynamics, see @ref{New dynamic marks}.
2183 Dynamics that occur at, begin on, or end on, the same note
2184 will be vertically aligned. If you want to ensure that dynamics
2185 are aligned when they do not occur on the same note, you can
2186 increase the @code{staff-padding} property.
2189 \override DynamicLineSpanner #'staff-padding = #4
2192 You may also use this property if the dynamics are colliding
2193 with other notation.
2198 @cindex @code{\dynamicUp}
2200 @cindex @code{\dynamicDown}
2201 @code{\dynamicDown},
2202 @cindex @code{\dynamicNeutral}
2203 @code{\dynamicNeutral}.
2208 Program reference: @internalsref{DynamicText}, @internalsref{Hairpin}.
2209 Vertical positioning of these symbols is handled by
2210 @internalsref{DynamicLineSpanner}.
2214 @subsection Breath marks
2216 Breath marks are entered using @code{\breathe}
2218 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2225 The glyph of the breath mark can be tuned by overriding the
2226 @code{text} property of the @code{BreathingSign} layout object with
2227 any markup text. For example,
2228 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
2230 \override BreathingSign #'text
2231 = #(make-musicglyph-markup "scripts.rvarcomma")
2238 Program reference: @internalsref{BreathingSign}.
2240 Examples: @inputfileref{input/@/regression,breathing@/-sign@/.ly}.
2243 @node Running trills
2244 @subsection Running trills
2246 Long running trills are made with @code{\startTrillSpan} and
2247 @code{\stopTrillSpan},
2249 @lilypond[verbatim,raggedright,relative=2,quote,fragment]
2251 << { c1 \startTrillSpan }
2252 { s2. \grace { d16[\stopTrillSpan e] } } >>
2259 @code{\startTrillSpan},
2260 @cindex @code{\startTrillSpan}
2261 @code{\stopTrillSpan}.
2262 @cindex @code{\stopTrillSpan}
2267 This manual: @ref{Pitched trills}.
2269 Program reference: @internalsref{TrillSpanner}.
2273 @subsection Glissando
2276 @cindex @code{\glissando}
2278 A glissando is a smooth change in pitch. It is denoted by a line or a
2279 wavy line between two notes. It is requested by attaching
2280 @code{\glissando} to a note
2282 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2284 \override Glissando #'style = #'zigzag
2291 Program reference: @internalsref{Glissando}.
2293 Example files: @file{input/@/regression/@/glissando@/.ly}.
2298 Printing text over the line (such as @emph{gliss.}) is not supported.
2302 @subsection Arpeggio
2305 @cindex broken chord
2306 @cindex @code{\arpeggio}
2308 You can specify an arpeggio sign (also known as broken chord) on a
2309 chord by attaching an @code{\arpeggio} to a chord
2311 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2315 A square bracket on the left indicates that the player should not
2316 arpeggiate the chord
2318 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2323 The direction of the arpeggio is sometimes denoted by adding an
2324 arrowhead to the wiggly line
2326 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2338 When an arpeggio crosses staves, you may attach an arpeggio to the chords
2339 in both staves and set
2340 @internalsref{PianoStaff}.@code{connectArpeggios}
2342 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2343 \context PianoStaff <<
2344 \set PianoStaff.connectArpeggios = ##t
2345 \new Staff { <c' e g c>\arpeggio }
2346 \new Staff { \clef bass <c,, e g>\arpeggio }
2354 @cindex @code{\arpeggioUp}
2356 @cindex @code{\arpeggioDown}
2357 @code{\arpeggioDown},
2358 @cindex @code{\arpeggioNeutral}
2359 @code{\arpeggioNeutral},
2360 @cindex @code{\arpeggioBracket}
2361 @code{\arpeggioBracket}.
2366 Notation manual: @ref{Ties}, for writing out arpeggios.
2368 Program reference: @internalsref{Arpeggio}.
2373 It is not possible to mix connected arpeggios and unconnected
2374 arpeggios in one @internalsref{PianoStaff} at the same point in time.
2381 Polyphony in music refers to having more than one voice occuring in
2382 a piece of music. Polyphony in LilyPond refers to having more than
2383 one voice on the same staff.
2387 * Explicitly instantiating voices::
2388 * Collision Resolution::
2392 @node Basic polyphony
2393 @subsection Basic polyphony
2397 The easiest way to enter fragments with more than one voice on a staff
2398 is to enter each voice as a sequence (with @code{@{...@}}), and combine
2399 them simultaneously, separating the voices with @code{\\}
2403 @lilypond[quote,verbatim,fragment]
2404 \new Staff \relative c' {
2407 { g4 f e | d2 e2 } \\
2408 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
2414 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
2415 voices are sometimes called ``layers'' in other notation packages}
2417 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
2418 each of these contexts, vertical direction of slurs, stems, etc., is set
2421 These voices are all seperate from the voice that contains the notes just
2422 outside the @code{<< \\ >>} construct. This should be noted when making
2423 changes at the voice level. This also means that slurs and ties cannot go
2424 into or out of a @code{<< \\ >>} construct. Conversely, parallel voices
2425 from separate @code{<< \\ >>} constructs on the same staff are the the
2426 same voice. Here is the same example, with different noteheads for each
2427 voice. Note that the change to the note-head style in the main voice does not affect
2428 the inside of the @code{<< \\ >>} constructs. Also, the change to the second
2429 voice in the first @code{<< \\ >>} construct is effective in the second
2430 @code{<< \\ >>}, and the voice is tied accross the two constructs.
2432 @lilypond[quote,verbatim,fragment]
2433 \new Staff \relative c' {
2434 \override NoteHead #'style = #'cross
2438 { \override NoteHead #'style = #'triangle
2443 { c8 b16 a b8 g ~ g2 } \\
2444 { \override NoteHead #'style = #'slash s4 b4 c2 }
2449 Polyphony does not change the relationship of notes within a
2450 @code{\relative @{ @}} block. Each note is calculated relative
2451 to the note immediately preceding it.
2454 \relative @{ noteA << noteB \\ noteC >> noteD @}
2457 @code{noteC} is relative to @code{noteB}, not @code{noteA};
2458 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
2461 @node Explicitly instantiating voices
2462 @subsection Explicitly instantiating voices
2464 @internalsref{Voice} contexts can also be instantiated manually
2465 inside a @code{<< >>} block to create polyphonic music, using
2466 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
2467 and a horizontal shift for each part.
2471 << \upper \\ \lower >>
2479 \context Voice = "1" @{ \voiceOne \upper @}
2480 \context Voice = "2" @{ \voiceTwo \lower @}
2484 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
2485 articulations, text annotations, augmentation dots of dotted
2486 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
2487 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
2488 make them point downwards.
2489 The command @code{\oneVoice} will revert back to the normal setting.
2491 An expression that appears directly inside a @code{<< >>} belongs to
2492 the main voice. This is useful when extra voices appear while the main
2493 voice is playing. Here is a more correct rendition of the example from
2494 the previous section. The crossed noteheads demonstrate that the main
2495 melody is now in a single voice context.
2497 @lilypond[quote,raggedright,verbatim]
2498 \new Staff \relative c' {
2499 \override NoteHead #'style = #'cross
2504 \context Voice="1" { \voiceTwo
2505 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2508 \new Voice { \voiceThree
2517 The correct definition of the voices allows the melody to be slurred.
2518 @lilypond[quote,raggedright,verbatim]
2519 \new Staff \relative c' {
2524 \context Voice="1" { \voiceTwo
2525 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2528 \new Voice { \voiceThree
2537 Avoiding the @code{\\} seperator also allows nesting polyphony
2538 constructs, which in some case might be a more natural way to typeset
2541 @lilypond[quote,raggedright,verbatim]
2542 \new Staff \relative c' {
2547 \context Voice="1" { \voiceTwo
2550 {c8 b16 a b8 g ~ g2}
2551 \new Voice { \voiceThree
2564 @node Collision Resolution
2565 @subsection Collision Resolution
2567 Normally, note heads with a different number of dots are not merged, but
2568 when the object property @code{merge-differently-dotted} is set in
2569 the @internalsref{NoteCollision} object, they are merged
2570 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
2573 \override Staff.NoteCollision
2574 #'merge-differently-dotted = ##t
2576 } \\ { g8.[ f16] g8.[ f16] } >>
2579 Similarly, you can merge half note heads with eighth notes, by setting
2580 @code{merge-differently-headed}
2581 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2584 \override Staff.NoteCollision
2585 #'merge-differently-headed = ##t
2586 c8 c4. } \\ { c2 c2 } >>
2589 LilyPond also vertically shifts rests that are opposite of a stem,
2592 @lilypond[quote,raggedright,fragment,verbatim]
2593 \context Voice << c''4 \\ r4 >>
2599 @cindex @code{\oneVoice}
2601 @cindex @code{\voiceOne}
2603 @cindex @code{\voiceTwo}
2605 @cindex @code{\voiceThree}
2607 @cindex @code{\voiceFour}
2610 @cindex @code{\shiftOn}
2612 @cindex @code{\shiftOnn}
2614 @cindex @code{\shiftOnnn}
2616 @cindex @code{\shiftOff}
2617 @code{\shiftOff}: these commands specify in what chords of the current
2618 voice should be shifted. The outer voices (normally: voice one and
2619 two) have @code{\shiftOff}, while the inner voices (three and four)
2620 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
2621 further shift levels.
2623 When LilyPond cannot cope, the @code{force-hshift}
2624 property of the @internalsref{NoteColumn} object and pitched rests can
2625 be used to override typesetting decisions.
2627 @lilypond[quote,verbatim,raggedright]
2634 \once \override NoteColumn #'force-hshift = #1.7
2642 Program reference: the objects responsible for resolving collisions are
2643 @internalsref{NoteCollision} and @internalsref{RestCollision}.
2646 @inputfileref{input/@/regression,collision@/-dots@/.ly},
2647 @inputfileref{input/@/regression,collision@/-head-chords@/.ly},
2648 @inputfileref{input/@/regression,collision@/-heads@/.ly},
2649 @inputfileref{input/@/regression,collision@/-mesh@/.ly}, and
2650 @inputfileref{input/@/regression,collisions@/.ly}.
2655 When using @code{merge-differently-headed} with an upstem eighth or a
2656 shorter note, and a downstem half note, the eighth note gets the wrong
2659 There is no support for clusters where the same note occurs with
2660 different accidentals in the same chord. In this case, it is
2661 recommended to use enharmonic transcription, or to use special cluster
2662 notation (see @ref{Clusters}).
2669 Repetition is a central concept in music, and multiple notations exist
2675 * Repeats and MIDI::
2676 * Manual repeat commands::
2678 * Tremolo subdivisions::
2684 @subsection Repeat types
2687 @cindex @code{\repeat}
2689 The following types of repetition are supported
2693 Repeated music is fully written (played) out. This is useful when
2694 entering repetitious music. This is the only kind of repeat that
2695 is included in MIDI output.
2698 Repeats are not written out, but alternative endings (volte) are
2699 printed, left to right with brackets. This is the standard notation
2700 for repeats with alternatives. These are not played in MIDI output by default.
2704 Alternative endings are written stacked. This has limited use but may be
2705 used to typeset two lines of lyrics in songs with repeats, see
2706 @inputfileref{input,star-spangled-banner@/.ly}.
2710 Make tremolo beams. These are not played in MIDI output by default.
2713 Make beat or measure repeats. These look like percent signs. These
2714 are not played in MIDI output by default. Percent repeats must be
2715 declared within a Voice context.
2721 @subsection Repeat syntax
2723 LilyPond has one syntactic construct for specifying different types of
2724 repeats. The syntax is
2727 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2730 If you have alternative endings, you may add
2731 @cindex @code{\alternative}
2742 where each @var{alternative} is a music expression. If you do not
2743 give enough alternatives for all of the repeats, the first alternative
2744 is assumed to be played more than once.
2746 Standard repeats are used like this
2747 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2749 \repeat volta 2 { c4 d e f }
2750 \repeat volta 2 { f e d c }
2753 With alternative endings
2754 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2756 \repeat volta 2 {c4 d e f}
2757 \alternative { {d2 d} {f f,} }
2760 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2763 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2764 \alternative { { g4 g g } { a | a a a a | b2. } }
2768 It is possible to shorten volta brackets
2769 by setting @code{voltaSpannerDuration}. In the next example, the
2770 bracket only lasts one measure, which is a duration of 3/4.
2772 @lilypond[verbatim,raggedright,quote]
2776 \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2777 \repeat "volta" 5 { d d d }
2778 \alternative { { e e e f f f }
2788 Brackets for the repeat are normally only printed over the topmost
2789 staff. This can be adjusted by setting the @code{voltaOnThisStaff}
2790 property; see @inputfileref{input/@/regression,volta@/-multi@/-staff@/.ly}.
2795 @cindex repeat, ambiguous
2797 A nested repeat like
2806 is ambiguous, since it is is not clear to which @code{\repeat} the
2807 @code{\alternative} belongs. This ambiguity is resolved by always
2808 having the @code{\alternative} belong to the inner @code{\repeat}.
2809 For clarity, it is advisable to use braces in such situations.
2811 Timing information is not remembered at the start of an alternative,
2812 so after a repeat timing information must be reset by hand, for
2813 example by setting @code{Score.measurePosition} or entering
2814 @code{\partial}. Similarly, slurs or ties are also not repeated.
2817 @node Repeats and MIDI
2818 @subsection Repeats and MIDI
2820 @cindex expanding repeats
2821 @cindex @code{\unfoldRepeats}
2823 With a little bit of tweaking, all types of repeats can be present
2824 in the MIDI output. This is achieved by applying the
2825 @code{\unfoldRepeats} music function. This functions changes all
2826 repeats to unfold repeats.
2828 @lilypond[quote,verbatim,fragment,linewidth=8.0\cm]
2830 \repeat tremolo 8 {c'32 e' }
2831 \repeat percent 2 { c''8 d'' }
2832 \repeat volta 2 {c'4 d' e' f'}
2841 When creating a score file using @code{\unfoldRepeats} for midi, then
2842 it is necessary to make two @code{\score} blocks. One for MIDI (with
2843 unfolded repeats) and one for notation (with volta, tremolo, and
2844 percent repeats). For example,
2852 \unfoldRepeats @var{..music..}
2858 @node Manual repeat commands
2859 @subsection Manual repeat commands
2861 @cindex @code{repeatCommands}
2863 The property @code{repeatCommands} can be used to control the layout of
2864 repeats. Its value is a Scheme list of repeat commands.
2867 @item @code{start-repeat}
2868 Print a @code{|:} bar line.
2870 @item @code{end-repeat}
2871 Print a @code{:|} bar line.
2873 @item @code{(volta @var{text})}
2874 Print a volta bracket saying @var{text}: The text can be specified as
2875 a text string or as a markup text, see @ref{Text markup}. Do not
2876 forget to change the font, as the default number font does not contain
2877 alphabetic characters;
2879 @item @code{(volta #f)}
2880 Stop a running volta bracket.
2883 @lilypond[quote,raggedright,verbatim,fragment,relative=2]
2885 \set Score.repeatCommands = #'((volta "93") end-repeat)
2887 \set Score.repeatCommands = #'((volta #f))
2894 Program reference: @internalsref{VoltaBracket}, @internalsref{RepeatedMusic},
2895 @internalsref{VoltaRepeatedMusic},
2896 @internalsref{UnfoldedRepeatedMusic}, and
2897 @internalsref{FoldedRepeatedMusic}.
2900 @node Tremolo repeats
2901 @subsection Tremolo repeats
2903 @cindex tremolo beams
2905 To place tremolo marks between notes, use @code{\repeat} with tremolo
2907 @lilypond[quote,verbatim,raggedright]
2908 \new Voice \relative c' {
2909 \repeat "tremolo" 8 { c16 d16 }
2910 \repeat "tremolo" 4 { c16 d16 }
2911 \repeat "tremolo" 2 { c16 d16 }
2915 Tremolo marks can also be put on a single note. In this case, the
2916 note should not be surrounded by braces.
2917 @lilypond[quote,verbatim,raggedright]
2918 \repeat "tremolo" 4 c'16
2921 Similar output is obtained using the tremolo subdivision, described in
2922 @ref{Tremolo subdivisions}.
2927 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
2929 Program reference: @internalsref{Beam}, @internalsref{StemTremolo}.
2931 Example files: @inputfileref{input/@/regression,chord@/-tremolo@/.ly},
2932 @inputfileref{input/@/regression,stem@/-tremolo@/.ly}.
2935 @node Tremolo subdivisions
2936 @subsection Tremolo subdivisions
2938 @cindex tremolo marks
2939 @cindex @code{tremoloFlags}
2941 Tremolo marks can be printed on a single note by adding
2942 `@code{:}[@var{number}]' after the note. The number indicates the
2943 duration of the subdivision, and it must be at least 8. A
2944 @var{length} value of 8 gives one line across the note stem. If the
2945 length is omitted, the last value (stored in @code{tremoloFlags}) is
2948 @lilypond[quote,raggedright,verbatim,fragment]
2949 c'2:8 c':32 | c': c': |
2955 Tremolos entered in this way do not carry over into the MIDI output.
2960 In this manual: @ref{Tremolo repeats}.
2962 Elsewhere: @internalsref{StemTremolo}.
2965 @node Measure repeats
2966 @subsection Measure repeats
2968 @cindex percent repeats
2969 @cindex measure repeats
2971 In the @code{percent} style, a note pattern can be repeated. It is
2972 printed once, and then the pattern is replaced with a special sign.
2973 Patterns of one and two measures are replaced by percent-like signs,
2974 patterns that divide the measure length are replaced by slashes.
2975 Percent repeats must be declared within a @code{Voice} context.
2977 @lilypond[quote,verbatim,raggedright]
2978 \new Voice \relative c' {
2979 \repeat "percent" 4 { c4 }
2980 \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
2984 Measure repeats of more than 2 measures get a counter, if you switch
2985 on the @code{countPercentRepeats} property,
2987 @lilypond[relative=2,fragment,quote,verbatim,raggedright]
2988 \set countPercentRepeats = ##t
2990 \repeat "percent" 4 { c1 }
2995 Isolated percents can also be printed. This is done by putting a multi
2996 measure rest with a different print function,
2998 @lilypond[fragment,verbatim]
2999 \override MultiMeasureRest #'stencil
3000 = #Multi_measure_rest::percent
3009 Program reference: @internalsref{RepeatSlash},
3010 @internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
3011 @internalsref{DoublePercentRepeatCounter},
3012 @internalsref{PercentRepeatCounter},
3013 @internalsref{PercentRepeatedMusic}, and