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 * Cautionary accidentals::
51 A note is printed by specifying its pitch and then its duration,
53 @lilypond[quote,verbatim,raggedright,fragment]
62 @cindex Note specification
64 @cindex entering notes
66 The most common syntax for pitch entry is used for standard notes and
67 @code{\chordmode} modes. In these modes, pitches may be designated by
68 names. The notes are specified by the letters @code{a} through
69 @code{g}. The octave is formed with notes ranging from @code{c}
70 to @code{b}. The pitch @code{c} is an octave below middle C and the
71 letters span the octave above that C
73 @lilypond[quote,fragment,verbatim]
75 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
81 The optional octave specification takes the form of a series of
82 single quote (`@code{'}') characters or a series of comma
83 (`@code{,}') characters. Each @code{'} raises the pitch by one
84 octave; each @code{,} lowers the pitch by an octave
86 @lilypond[quote,raggedright,fragment,verbatim]
87 c' c'' es' g' as' gisis' ais'
90 @cindex note names, Dutch
92 A sharp is formed by adding @code{-is} to the end of a pitch name and
93 a flat is formed by adding @code{-es}. Double sharps and double flats
94 are obtained by adding @code{-isis} or @code{-eses}. These
95 names are the Dutch note names. In Dutch, @code{aes} is contracted to
96 @code{as}, but both forms are accepted. Similarly, both
97 @code{es} and @code{ees} are accepted
99 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
107 In accordance with standard typsetting rules, a natural sign is printed
108 before a sharp or flat if a previous accidental needs to be
109 cancelled. To change this behaviour, use
110 @code{\set Staff.extraNatural = ##f}
112 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
114 \set Staff.extraNatural = ##f
118 There are predefined sets of note names for various other languages.
119 To use them, include the language specific init file. For
120 example: @code{\include "english.ly"}. The available language files
121 and the note names they define are
126 Note Names sharp flat
127 nederlands.ly c d e f g a bes b -is -es
128 english.ly c d e f g a bf b -s/-sharp -f/-flat
130 deutsch.ly c d e f g a b h -is -es
131 norsk.ly c d e f g a b h -iss/-is -ess/-es
132 svenska.ly c d e f g a b h -iss -ess
133 italiano.ly do re mi fa sol la sib si -d -b
134 catalan.ly do re mi fa sol la sib si -d/-s -b
135 espanol.ly do re mi fa sol la sib si -s -b
141 Program reference: @internalsref{NoteEvent},
142 @internalsref{LedgerLineSpanner}, and @internalsref{NoteHead}.
146 @node Cautionary accidentals
147 @subsection Cautionary accidentals
149 Normally accidentals are printed automatically, but you may also
150 print them manually. A reminder accidental
151 @cindex reminder accidental
153 can be forced by adding an exclamation mark @code{!}
154 after the pitch. A cautionary accidental
155 @cindex cautionary accidental
156 @cindex parenthesized accidental
158 (i.e., an accidental within parentheses) can be obtained by adding the
159 question mark `@code{?}' after the pitch.
161 @lilypond[quote,raggedright,fragment,verbatim]
162 cis' cis' cis'! cis'?
168 The automatic production of accidentals can be tuned in many
169 ways. For more information, refer to @ref{Automatic accidentals}.
174 @subsection Micro tones
176 Half-flats and half-sharps are formed by adding @code{-eh} and
177 @code{-ih}; the following is a series of Cs with increasing pitches
179 @cindex quarter tones
180 @cindex semi-flats, semi-sharps
182 @lilypond[verbatim,raggedright,quote,relative=2,fragment]
183 { ceseh ceh cih cisih }
186 Micro tones are also exported to the MIDI file
191 There are no generally accepted standards for denoting three quarter
192 flats, so LilyPond's symbol does not conform to any standard.
198 A chord is formed by a enclosing a set of pitches in @code{<} and
199 @code{>}. A chord may be followed by a duration, and a set of
200 articulations, just like simple notes
202 @lilypond[verbatim,raggedright,fragment,quote,relative=1]
206 For more information about chords, see @ref{Chord names}.
217 Rests are entered like notes, with the note name @code{r}
219 @lilypond[fragment,quote,raggedright,verbatim]
223 Whole bar rests, centered in middle of the bar,
224 must be done with multi-measure rests. They are discussed in
225 @ref{Multi measure rests}.
228 A rest's vertical position may be explicitly specified by entering a
229 note with the @code{\rest} keyword appended, the rest will be placed at
230 the note's place. This makes manual formatting in polyphonic music
231 easier. Automatic rest collision formatting will leave these rests
234 @lilypond[fragment,quote,raggedright,verbatim]
240 Program reference: @internalsref{RestEvent}, and @internalsref{Rest}.
247 @cindex Invisible rest
252 An invisible rest (also called a `skip') can be entered like a note
253 with note name `@code{s}' or with @code{\skip @var{duration}}
255 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
256 a4 a4 s4 a4 \skip 1 a4
259 The @code{s} syntax is only available in note mode and chord mode. In
260 other situations, for example, when entering lyrics, you should use
261 the @code{\skip} command
263 @lilypond[quote,raggedright,verbatim]
266 \new Lyrics \lyricmode { \skip 2 bla1 }
270 The skip command is merely an empty musical placeholder. It does not
271 produce any output, not even transparent output.
273 The @code{s} skip command does create @internalsref{Staff} and
274 @internalsref{Voice} when necessary, similar to note and rest
275 commands. For example, the following results in an empty staff.
277 @lilypond[quote,raggedright,verbatim]
281 The fragment @code{@{ \skip 4 @} } would produce an empty page.
285 Program reference: @internalsref{SkipEvent}, @internalsref{SkipMusic}.
290 @subsection Durations
294 @cindex @code{\longa}
295 @cindex @code{\breve}
296 @cindex @code{\maxima}
299 In Note, Chord, and Lyrics mode, durations are designated by numbers and
300 dots: durations are entered as their reciprocal values. For example, a
301 quarter note is entered using a @code{4} (since it is a 1/4 note), while
302 a half note is entered using a @code{2} (since it is a 1/2 note). For
303 notes longer than a whole you must use the variables @code{\longa} and
308 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
310 r1 r2 r4 r8 r16 r32 r64 r64
316 a\breve*1/2 \autoBeamOff
317 a1 a2 a4 a8 a16 a32 a64 a64
320 r\longa*1/4 r\breve *1/2
321 r1 r2 r4 r8 r16 r32 r64 r64
327 \remove "Clef_engraver"
328 \override StaffSymbol #'transparent = ##t
329 \override TimeSignature #'transparent = ##t
330 \override BarLine #'transparent = ##t
331 \consists "Pitch_squash_engraver"
337 If the duration is omitted then it is set to the previously entered
338 duration. The default for the first note is a quarter note.
340 @lilypond[quote,raggedright,verbatim,fragment]
341 { a a a2 a a4 a a1 a }
346 @node Augmentation dots
347 @subsection Augmentation dots
350 To obtain dotted note lenghts, simply add a dot (`@code{.}') to
351 the number. Double-dotted notes are produced in a similar way.
353 @lilypond[quote,raggedright,fragment,verbatim]
354 a'4 b' c''4. b'8 a'4. b'4.. c''8.
359 Dots are normally moved up to avoid staff lines, except in polyphonic
360 situations. The following commands may be used to force a particular
363 @cindex @code{\dotsUp}
365 @cindex @code{\dotsDown}
367 @cindex @code{\dotsNeutral}
372 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}.
380 @cindex @code{\times}
382 Tuplets are made out of a music expression by multiplying all durations
385 @cindex @code{\times}
387 \times @var{fraction} @var{musicexpr}
391 The duration of @var{musicexpr} will be multiplied by the fraction.
392 The fraction's denominator will be printed over the notes, optionally
393 with a bracket. The most common tuplet is the triplet in which 3
394 notes have the length of 2, so the notes are 2/3 of their written
397 @lilypond[quote,raggedright,fragment,verbatim]
398 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
401 The property @code{tupletSpannerDuration} specifies how long each
402 bracket should last. With this, you can make lots of tuplets while
403 typing @code{\times} only once, thus saving lots of typing. In the next
404 example, there are two triplets shown, while @code{\times} was only
407 @lilypond[quote,fragment,relative=1,raggedright,verbatim]
408 \set tupletSpannerDuration = #(ly:make-moment 1 4)
409 \times 2/3 { c'8 c c c c c }
412 The format of the number is determined by the property
413 @code{tupletNumberFormatFunction}. The default prints only the
414 denominator, but if it is set to the Scheme function
415 @code{fraction-tuplet-formatter}, @var{num}:@var{den} will be printed
418 @cindex @code{tupletNumberFormatFunction}
419 @cindex tuplet formatting
423 @cindex @code{\tupletUp}
425 @cindex @code{\tupletDown}
427 @cindex @code{\tupletNeutral}
428 @code{\tupletNeutral}.
432 User manual: @ref{Changing context properties on the fly} for the
436 Program reference: @internalsref{TupletBracket}, and @internalsref{TimeScaledMusic}.
438 Examples: @inputfileref{input/@/regression,tuplet@/-nest@/.ly}.
442 Nested tuplets are not formatted automatically. In this case, outer
443 tuplet brackets should be moved manually, which is demonstrated in
444 @inputfileref{input/@/regression,tuplet@/-nest@/.ly}.
447 @node Scaling durations
448 @subsection Scaling durations
450 You can alter the length of duration by a fraction @var{N/M}
451 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
452 will not affect the appearance of the notes or rests produced.
454 In the following example, the first three notes take up exactly two
455 beats, but no triplet bracket is printed.
456 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
458 a4*2/3 gis4*2/3 a4*2/3
466 This manual: @ref{Tuplets}
469 @node Easier music entry
470 @section Easier music entry
473 This section deals with tricks and features of the input language that
474 were added solely to help entering music and finding and correcting
475 mistakes. There are also external tools that make debugging easier.
476 See @ref{Point and click} for more information.
478 It is also possible to enter and edit music using other programs, such as
479 GUI interfaces or MIDI sequencers. Refer to the LilyPond
480 website for more information.
487 * Skipping corrected music::
488 * Automatic note splitting::
494 @node Relative octaves
495 @subsection Relative octaves
497 @cindex relative octave specification
499 Octaves are specified by adding @code{'} and @code{,} to pitch names.
500 When you copy existing music, it is easy to accidentally put a pitch
501 in the wrong octave and hard to find such an error. The relative
502 octave mode prevents these errors by making the mistakes much
503 larger: a single error puts the rest of the piece off by one octave
505 @cindex @code{\relative}
507 \relative @var{startpitch} @var{musicexpr}
514 \relative @var{musicexpr}
517 The octave of notes that appear in @var{musicexpr} are calculated as
518 follows: if no octave changing marks are used, the basic interval
519 between this and the last note is always taken to be a fourth or
520 less. This distance is determined without regarding alterations; a
521 @code{fisis} following a @code{ceses} will be put above the
522 @code{ceses}. In other words, a doubly-augmented fourth is considered
523 a smaller interval than a diminshed fifth, even though the fourth is
524 seven semitones while the fifth is only six semitones.
526 The octave changing marks @code{'} and @code{,} can be added to raise
527 or lower the pitch by an extra octave. Upon entering relative mode,
528 an absolute starting pitch can be specified that will act as the
529 predecessor of the first note of @var{musicexpr}. If no starting pitch
530 is specified, then middle C is used as a start.
532 Here is the relative mode shown in action
533 @lilypond[quote,fragment,raggedright,verbatim]
539 Octave changing marks are used for intervals greater than a fourth
540 @lilypond[quote,raggedright,fragment,verbatim]
546 If the preceding item is a chord, the first note of the chord is used
547 to determine the first note of the next chord
549 @lilypond[quote,raggedright,fragment,verbatim]
557 The pitch after the @code{\relative} contains a note name.
560 The relative conversion will not affect @code{\transpose},
561 @code{\chordmode} or @code{\relative} sections in its argument. To use
562 relative within transposed music, an additional @code{\relative} must
563 be placed inside @code{\transpose}.
566 @subsection Octave check
569 Octave checks make octave errors easier to correct: a note may be
570 followed by @code{=}@var{quotes} which indicates what its absolute
571 octave should be. In the following example,
573 \relative c'' @{ c='' b=' d,='' @}
577 @c take care with @code, adds confusing quotes.
578 the @code{d} will generate a warning, because a @code{d''} is expected
579 (because @code{b'} to @code{d''} is only a third), but a @code{d}' is
580 found. In the output, the octave is corrected to be a @code{d''} and
581 the next note is calculated relative to @code{d''} instead of @code{d'}.
585 There is also a syntax that is separate from the notes. The syntax
591 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
592 quotes) in \relative mode. If not, a warning is printed, and the
595 In the example below, the first check passes without incident, since
596 the @code{e} (in relative mode) is within a fifth of @code{a'}. However,
597 the second check produces a warning, since the @code{e} is not within
598 a fifth of @code{b'}. The warning message is printed, and the octave
599 is adjusted so that the following notes are in the correct octave
611 The octave of a note following an octave check is determined with
612 respect to the note preceding it. In the next fragment, the last note
613 is a @code{a'}, above middle C. That means that the @code{\octave}
614 check passes successfully, so the check could be deleted without changing
615 the output of the piece.
617 @lilypond[quote,raggedright,verbatim,fragment]
626 @subsection Bar check
630 @cindex @code{barCheckSynchronize}
633 Bar checks help detect errors in the durations. A bar check is
634 entered using the bar symbol, `@code{|}'. Whenever it is encountered
635 during interpretation, it should fall on a measure boundary. If it
636 does not, a warning is printed. In the next example, the second bar
637 check will signal an error
639 \time 3/4 c2 e4 | g2 |
642 Bar checks can also be used in lyrics, for example
647 Twin -- kle | Twin -- kle
652 @cindex @code{skipTypesetting}
654 Failed bar checks are caused by entering incorrect
655 durations. Incorrect durations often completely garble up the score,
656 especially if the score is polyphonic, so a good place to start correcting
657 input is by scanning for failed bar checks and incorrect durations. To
658 speed up this process, the @code{skipTypesetting} feature may be
659 used. It is described in the next section.
662 @cindex @code{pipeSymbol}
664 It is also possible to redefine the meaning of @code{|}. This is done
665 by assigning a music expression to @code{pipeSymbol},
667 @lilypond[quote,raggedright,verbatim]
668 pipeSymbol = \bar "||"
674 @node Skipping corrected music
675 @subsection Skipping corrected music
677 The property @code{Score.skipTypesetting} can be used to switch on and
678 off typesetting completely during the interpretation phase. When
679 typesetting is switched off, the music is processed much more
680 quickly. This can be used to skip over the parts of a score that
681 have already been checked for errors
683 @lilypond[quote,fragment,raggedright,verbatim]
686 \set Score.skipTypesetting = ##t
688 \set Score.skipTypesetting = ##f
692 In polyphonic music, @code{Score.skipTypesetting} will affect all
693 voices and staves, saving even more time.
695 @node Automatic note splitting
696 @subsection Automatic note splitting
698 Long notes can be converted automatically to tied notes. This is done
699 by replacing the @internalsref{Note_heads_engraver} by the
700 @internalsref{Completion_heads_engraver}.
701 In the following examples, notes crossing the bar line are split and tied.
704 @lilypond[quote,fragment,verbatim,relative=1,linewidth=12\cm]
706 \remove "Note_heads_engraver"
707 \consists "Completion_heads_engraver"
709 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
713 This engraver splits all running notes at the bar line, and inserts
714 ties. One of its uses is to debug complex scores: if the measures are
715 not entirely filled, then the ties exactly show how much each measure
720 Not all durations (especially those containing tuplets) can be
721 represented exactly with normal notes and dots, but the engraver will
724 @code{Completion_heads_engraver} only affects notes; it does not split
730 Examples: @inputfileref{input/@/regression,completion@/-heads@/.ly}.
734 Program reference: @internalsref{Completion_heads_engraver}.
740 @section Staff notation
742 This section describes music notation that occurs on staff level,
743 such as key signatures, clefs and time signatures.
745 @cindex Staff notation
755 * System start delimiters::
760 @subsection Staff symbol
762 @cindex adjusting staff symbol
764 Notes, dynamic signs, etc., are grouped
765 with a set of horizontal lines, into a staff (plural `staves'). In our
766 system, these lines are drawn using a separate layout object called
770 @cindex staff lines, setting number of
771 @cindex staff lines, setting thickness of
772 @cindex thickness of staff lines, setting
773 @cindex number of staff lines, setting
777 Program reference: @internalsref{StaffSymbol}.
779 Examples: @inputfileref{input/@/test,staff@/-lines@/.ly},
780 @inputfileref{input/@/test,staff@/-size@/.ly}.
784 If a staff is ended halfway a piece, the staff symbol may not end
785 exactly on the bar line.
789 @subsection Key signature
790 @cindex Key signature
794 The key signature indicates the tonality in which a piece is played. It
795 is denoted by a set of alterations (flats or sharps) at the start of the
799 Setting or changing the key signature is done with the @code{\key}
802 @code{\key} @var{pitch} @var{type}
805 @cindex @code{\minor}
806 @cindex @code{\major}
807 @cindex @code{\minor}
808 @cindex @code{\ionian}
809 @cindex @code{\locrian}
810 @cindex @code{\aeolian}
811 @cindex @code{\mixolydian}
812 @cindex @code{\lydian}
813 @cindex @code{\phrygian}
814 @cindex @code{\dorian}
816 Here, @var{type} should be @code{\major} or @code{\minor} to get
817 @var{pitch}-major or @var{pitch}-minor, respectively.
818 The standard mode names @code{\ionian},
819 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
820 @code{\phrygian}, and @code{\dorian} are also defined.
822 This command sets the context property
823 @internalsref{Staff}.@code{keySignature}. Non-standard key signatures
824 can be specified by setting this property directly.
826 A natural sign is printed to cancel any previous accidentals. This
827 can be suppressed by setting the @code{Staff.printKeyCancellation}
830 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
836 \set Staff.printKeyCancellation = ##f
844 Accidentals and key signatures often confuse new users, because
845 unaltered notes get natural signs depending on the key signature. For
846 more information, see @ref{More about pitches}.
850 Program reference: @internalsref{KeyChangeEvent},
851 @internalsref{KeyCancellation} and @internalsref{KeySignature}.
853 @cindex @code{keySignature}
860 The clef indicates which lines of the staff correspond to which
864 The clef can be set with the @code{\clef} command
865 @lilypond[quote,raggedright,fragment,verbatim]
866 { c''2 \clef alto g'2 }
869 Supported clef-names include
870 @c Moved standard clefs to the top /MB
874 @item treble, violin, G, G2
887 G clef on 1st line, so-called French violin clef
892 @cindex mezzosoprano clef
895 @cindex baritone clef
898 @cindex varbaritone clef
909 By adding @code{_8} or @code{^8} to the clef name, the clef is
910 transposed one octave down or up, respectively, and @code{_15} and
911 @code{^15} transposes by two octaves. The argument @var{clefname}
912 must be enclosed in quotes when it contains underscores or digits. For
916 @cindex choral tenor clef
917 @lilypond[quote,raggedright,verbatim,fragment,relative=1]
921 This command is equivalent to setting @code{clefGlyph},
922 @code{clefPosition} (which controls the Y position of the clef),
923 @code{middleCPosition} and @code{clefOctavation}. A clef is printed
924 when any of these properties are changed. The following example shows
925 possibilities when setting properties manually.
927 @lilypond[quote,raggedright,verbatim]
929 \set Staff.clefGlyph = #"clefs.F"
930 \set Staff.clefPosition = #2
932 \set Staff.clefGlyph = #"clefs.G"
934 \set Staff.clefGlyph = #"clefs.C"
936 \set Staff.clefOctavation = #7
938 \set Staff.clefOctavation = #0
939 \set Staff.clefPosition = #0
943 \set Staff.middleCPosition = #4
950 Program reference: @internalsref{Clef}.
957 @subsection Time signature
958 @cindex Time signature
962 Time signature indicates the metrum of a piece: a regular pattern of
963 strong and weak beats. It is denoted by a fraction at the start of the
967 The time signature is set or changed by the @code{\time}
969 @lilypond[quote,raggedright,fragment,verbatim]
970 \time 2/4 c'2 \time 3/4 c'2.
973 The symbol that is printed can be customized with the @code{style}
974 property. Setting it to @code{#'()} uses fraction style for 4/4 and
977 @lilypond[fragment,quote,raggedright,verbatim]
980 \override Staff.TimeSignature #'style = #'()
987 There are many more options for its layout. See @ref{Ancient time
988 signatures} for more examples.
991 This command sets the property @code{timeSignatureFraction},
992 @code{beatLength} and @code{measureLength} in the @code{Timing}
993 context, which is normally aliased to @internalsref{Score}. The
994 property @code{measureLength} determines where bar lines should be
995 inserted, and how automatic beams should be generated. Changing the
996 value of @code{timeSignatureFraction} also causes the symbol to be
999 More options are available through the Scheme function
1000 @code{set-time-signature}. In combination with the
1001 @internalsref{Measure_grouping_engraver}, it will create
1002 @internalsref{MeasureGrouping} signs. Such signs ease reading
1003 rhythmically complex modern music. In the following example, the 9/8
1004 measure is subdivided in 2, 2, 2 and 3. This is passed to
1005 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1007 @lilypond[quote,raggedright,verbatim]
1010 #(set-time-signature 9 8 '(2 2 2 3))
1011 g8[ g] d[ d] g[ g] a8[( bes g]) |
1012 #(set-time-signature 5 8 '(3 2))
1018 \consists "Measure_grouping_engraver"
1026 Program reference: @internalsref{TimeSignature}, and @internalsref{Timing_engraver}.
1031 Automatic beaming does not use the measure grouping specified with
1032 @code{set-time-signature}.
1034 @node Partial measures
1035 @subsection Partial measures
1038 @cindex partial measure
1039 @cindex measure, partial
1040 @cindex shorten measures
1041 @cindex @code{\partial}
1043 Partial measures, for example in upsteps, are entered using the
1044 @code{\partial} command
1045 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1046 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1049 The syntax for this command is
1051 \partial @var{duration}
1053 This is internally translated into
1055 \set Timing.measurePosition = -@var{length of duration}
1058 The property @code{measurePosition} contains a rational number
1059 indicating how much of the measure has passed at this point.
1063 This command does not take into account grace notes at the start of
1064 the music. When a piece starts with graces notes in the pickup, then
1065 the @code{\partial} should follow the grace notes
1067 @lilypond[verbatim,quote,raggedright,relative,fragment]
1077 @node Unmetered music
1078 @subsection Unmetered music
1082 Bar lines and bar numbers are calculated automatically. For unmetered
1083 music (cadenzas, for example), this is not desirable. By setting
1084 @code{Score.timing} to false, this automatic timing can be switched
1085 off. Empty bar lines,
1092 indicate where line breaks can occur.
1096 @cindex @code{\cadenzaOn}
1098 @cindex @code{\cadenzaOff}
1105 @subsection Bar lines
1109 @cindex measure lines
1113 Bar lines delimit measures, but are also used to indicate repeats.
1114 Normally, they are inserted automatically. Line breaks may only
1115 happen on bar lines.
1117 Special types of bar lines can be forced with the @code{\bar} command
1119 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1123 The following bar types are available
1124 @lilypondfile[raggedright,quote]{bar-lines.ly}
1126 For allowing line breaks, there is a special command,
1130 This will insert an invisible bar line, and allow line breaks at this
1133 In scores with many staves, a @code{\bar} command in one staff is
1134 automatically applied to all staves. The resulting bar lines are
1135 connected between different staves of a @internalsref{StaffGroup}
1137 @lilypond[quote,raggedright,fragment,verbatim]
1139 \context StaffGroup <<
1145 \new Staff { \clef bass c4 g e g }
1147 \new Staff { \clef bass c2 c2 }
1152 The command @code{\bar }@var{bartype} is a short cut for doing
1153 @code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
1154 is set to a string, a bar line of that type is created.
1156 A bar line is created whenever the @code{whichBar} property is set.
1157 At the start of a measure it is set to the contents of
1158 @code{Timing.defaultBarType}. The contents of @code{repeatCommands} are used
1159 to override default measure bars.
1161 @cindex @code{whichBar}
1162 @cindex @code{repeatCommands}
1163 @cindex @code{defaultBarType}
1165 You are encouraged to use @code{\repeat} for repetitions. See
1172 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1175 Program reference: @internalsref{BarLine} (created at
1176 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1178 @cindex bar lines at start of system
1179 @cindex start of system
1183 Examples: @inputfileref{input/@/test,bar@/-lines@/.ly},
1187 @node System start delimiters
1188 @subsection System start delimiters
1190 Many scores consist of more than one staff. These staves can be
1191 joined in three different ways
1193 @item The group is started with a brace at the left, and bar lines are
1194 connected. This is done with the @internalsref{GrandStaff} context.
1196 @lilypond[verbatim,raggedright,quote]
1205 @item The group is started with a bracket, and bar lines are connected.
1206 This is done with the
1207 @internalsref{StaffGroup} context
1209 @lilypond[verbatim,raggedright,quote]
1218 @item The group is started with a vertical line. Bar lines are not
1219 connected. This is the default for the score.
1221 @lilypond[verbatim,raggedright,quote]
1230 @cindex Staff, multiple
1231 @cindex bracket, vertical
1232 @cindex brace, vertical
1239 The bar lines at the start of each system are
1240 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1241 @internalsref{SystemStartBracket}. Only one of these types is created
1242 in every context, and that type is determined by the property
1243 @code{systemStartDelimiter}.
1246 @node More than notes
1247 @section More than notes
1248 @c silly title; should change.
1250 This section deals with notation that affects more than one note.
1257 * Fingering instructions::
1267 A tie connects two adjacent note heads of the same pitch. The tie in
1268 effect extends the length of a note. Ties should not be confused with
1269 slurs, which indicate articulation, or phrasing slurs, which indicate
1270 musical phrasing. A tie is entered using the tilde symbol `@code{~}'
1272 @lilypond[quote,raggedright,fragment,verbatim]
1273 e' ~ e' <c' e' g'> ~ <c' e' g'>
1276 When a tie is applied to a chord, all note heads whose pitches match
1277 are connected. When no note heads match, no ties will be created.
1279 A tie is just a way of extending a note duration, similar to the
1280 augmentation dot. The following example shows two ways of notating
1281 exactly the same concept
1283 @lilypond[quote,fragment,raggedright]
1284 \time 3/4 c'2. c'2 ~ c'4
1288 Ties are used either when the note crosses a bar line, or when dots
1289 cannot be used to denote the rhythm. When using ties, larger note
1290 values should be aligned to subdivisions of the measure, eg.
1292 @lilypond[fragment,quote,raggedright]
1294 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
1298 If you need to tie a lot of notes over bars, it may be easier to use
1299 automatic note splitting (see @ref{Automatic note splitting}). This
1300 mechanism automatically splits long notes, and ties them across bar
1303 Ties are sometimes used to write out arpeggios. In this case, two tied
1304 notes need not be consecutive. This can be achieved by setting the
1305 @code{tieWaitForNote} property to true. For example,
1307 @lilypond[fragment,verbatim,relative=1,raggedright]
1308 \set tieWaitForNote = ##t
1309 \grace { c16[~ e~ g]~ } <c, e g>4
1316 @cindex @code{\tieUp}
1318 @cindex @code{\tieDown}
1320 @cindex @code{\tieNeutral}
1322 @cindex @code{\tieDotted}
1324 @cindex @code{\tieSolid}
1329 In this manual: @ref{Automatic note splitting}.
1331 Program reference: @internalsref{TieEvent}, @internalsref{Tie}.
1336 Switching staves when a tie is active will not produce a slanted tie.
1338 Formatting of ties is a difficult subject. The results are often not
1342 @node Automatic beams
1343 @subsection Automatic beams
1345 LilyPond inserts beams automatically
1347 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1348 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1351 When these automatic decisions are not good enough, beaming can be
1352 entered explicitly. It is also possible to define beaming patterns
1353 that differ from the defaults.
1355 Individual notes may be marked with @code{\noBeam}, to prevent them
1358 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1359 \time 2/4 c8 c\noBeam c c
1365 Program reference: @internalsref{Beam}.
1369 @subsection Manual beams
1370 @cindex beams, manual
1374 In some cases it may be necessary to override the automatic beaming
1375 algorithm. For example, the autobeamer will not put beams over rests
1376 or bar lines. Such beams are specified manually by marking the begin
1377 and end point with @code{[} and @code{]}
1379 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
1381 r4 r8[ g' a r8] r8 g[ | a] r8
1385 @cindex @code{stemLeftBeamCount}
1387 Normally, beaming patterns within a beam are determined automatically.
1388 If necessary, the properties @code{stemLeftBeamCount} and
1389 @code{stemRightBeamCount} can be used to override the defaults. If
1390 either property is set, its value will be used only once, and then it
1393 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
1398 \set stemLeftBeamCount = #1
1402 @cindex @code{stemRightBeamCount}
1405 The property @code{subdivideBeams} can be set in order to subdivide
1406 all 16th or shorter beams at beat positions, as defined by the
1407 @code{beatLength} property.
1410 @lilypond[fragment,quote,relative=2,verbatim]
1412 \set subdivideBeams = ##t
1414 \set Score.beatLength = #(ly:make-moment 1 8)
1417 @cindex @code{subdivideBeams}
1419 Normally, line breaks are forbidden when beams cross bar lines. This
1420 behavior can be changed by setting @code{allowBeamBreak}.
1422 @cindex @code{allowBeamBreak}
1423 @cindex beams and line breaks
1425 @cindex beams, kneed
1427 @cindex auto-knee-gap
1432 User manual: @ref{Changing context properties on the fly} for the
1438 @cindex Frenched staves
1439 Kneed beams are inserted automatically, when a large gap is detected
1440 between the note heads. This behavior can be tuned through the object.
1443 Automatically kneed cross-staff beams cannot be used together with
1444 hidden staves. See @ref{Hiding staves}.
1446 Beams do not avoid collisions with symbols around the notes, such as
1447 texts and accidentals.
1453 @subsection Grace notes
1455 @cindex @code{\grace}
1459 Grace notes are ornaments that are written out. The most common ones
1460 are acciaccatura, which should be played as very short. It is denoted
1461 by a slurred small note with a slashed stem. The appoggiatura is a
1462 grace note that takes a fixed fraction of the main note, and is
1463 denoted as a slurred note in small print without a slash. They
1464 are entered with the commands @code{\acciaccatura} and
1465 @code{\appoggiatura}, as demonstrated in the following example
1468 @cindex appoggiatura
1469 @cindex acciaccatura
1471 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1472 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
1473 \acciaccatura { g16[ f] } e4
1476 Both are special forms of the @code{\grace} command. By prefixing this
1477 keyword to a music expression, a new one is formed, which will be
1478 printed in a smaller font and takes up no logical time in a measure.
1480 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1482 \grace { c16[ d16] } c2 c4
1486 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1487 @code{\grace} command does not start a slur.
1489 Internally, timing for grace notes is done using a second, `grace'
1490 timing. Every point in time consists of two rational numbers: one
1491 denotes the logical time, one denotes the grace timing. The above
1492 example is shown here with timing tuples
1494 @lilypond[quote,raggedright]
1497 c4 \grace c16 c4 \grace {
1500 \new Lyrics \lyricmode {
1501 \override LyricText #'font-family = #'typewriter
1505 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
1506 \markup { (\fraction 1 4 , 0 ) } 4
1508 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
1509 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
1511 \markup { ( \fraction 2 4 , 0 ) }
1517 The placement of grace notes is synchronized between different staves.
1518 In the following example, there are two sixteenth grace notes for
1519 every eighth grace note
1521 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1522 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1523 \new Staff { c4 \grace { g8[ b] } c4 } >>
1528 If you want to end a note with a grace, use the @code{\afterGrace}
1529 command. It takes two arguments: the main note, and the grace notes
1530 following the main note.
1532 @lilypond[raggedright, verbatim,relative=2,fragment]
1533 c1 \afterGrace d1 { c16[ d] } c4
1536 This will put the grace notes after a ``space'' lasting 3/4 of the
1537 length of the main note. The fraction 3/4 can be changed by setting
1538 @code{afterGraceFraction}, ie.
1541 afterGraceFraction = #(cons 7 8)
1545 will put the grace note at 7/8 of the main note.
1548 The same effect can be achieved manually by doing
1551 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1554 { s2 \grace { c16[ d] } } >>
1560 By adjusting the duration of the skip note (here it is a half-note),
1561 the space between the main-note and the grace is adjusted.
1566 A @code{\grace} section will introduce special typesetting settings,
1567 for example, to produce smaller type, and set directions. Hence, when
1568 introducing layout tweaks, they should be inside the grace section,
1570 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1582 The overrides should also be reverted inside the grace section.
1584 The layout of grace sections can be changed throughout the music using
1585 the function @code{add-grace-property}. The following example
1586 undefines the Stem direction for this grace, so stems do not always
1591 #(add-grace-property 'Voice 'Stem 'direction '())
1597 Another option is to change the variables @code{startGraceMusic},
1598 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
1599 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
1600 @code{stopAppoggiaturaMusic}. More information is in the file
1601 @file{ly/@/grace@/-init@/.ly}.
1606 Program reference: @internalsref{GraceMusic}.
1610 A score that starts with a @code{\grace} section needs an explicit
1611 @code{\context Voice} declaration, otherwise the main note and the grace
1612 note end up on different staves.
1614 Grace note synchronization can also lead to surprises. Staff notation,
1615 such as key signatures, bar lines, etc., are also synchronized. Take
1616 care when you mix staves with grace notes and staves without, for example,
1618 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1619 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1620 \new Staff { c4 \bar "|:" d4 } >>
1624 This can be remedied by inserting grace skips, for the above example
1627 \new Staff @{ c4 \bar "|:" \grace s16 d4 @}
1630 Grace sections should only be used within sequential music
1631 expressions. Nesting or juxtaposing grace sections is not supported,
1632 and might produce crashes or other errors.
1635 @node Fingering instructions
1636 @subsection Fingering instructions
1640 Fingering instructions can be entered using
1642 @var{note}-@var{digit}
1644 For finger changes, use markup texts
1646 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
1648 c^\markup { \finger "2-3" }
1651 @cindex finger change
1656 You can use the thumb-script to indicate that a note should be
1657 played with the thumb (e.g., in cello music)
1658 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
1659 <a_\thumb a'-3>8 <b_\thumb b'-3>
1662 Fingerings for chords can also be added to individual notes
1663 of the chord by adding them after the pitches
1664 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
1665 < c-1 e-2 g-3 b-5 >4
1669 In this case, setting @code{fingeringOrientations} will put fingerings next
1672 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
1673 \set fingeringOrientations = #'(left down)
1674 <c-1 es-2 g-4 bes-5 > 4
1675 \set fingeringOrientations = #'(up right down)
1676 <c-1 es-2 g-4 bes-5 > 4
1679 Using this feature, it is also possible to put fingering instructions
1680 very close to note heads in monophonic music,
1682 @lilypond[verbatim,raggedright,quote,fragment]
1683 \set fingeringOrientations = #'(right)
1690 Program reference: @internalsref{FingerEvent}, and @internalsref{Fingering}.
1692 Examples: @inputfileref{input/@/regression,finger@/-chords@/.ly}.
1697 @node Expressive marks
1698 @section Expressive marks
1700 Expressive marks help musicians to bring more to the music than simple
1719 A slur indicates that notes are to be played bound or @emph{legato}.
1721 They are entered using parentheses
1722 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1723 f( g a) a8 b( a4 g2 f4)
1727 The direction of a slur can be set with the
1731 \override Slur #'direction = #UP
1732 \slurUp % shortcut for the previous line
1736 However, there is a convenient shorthand for forcing slur
1737 directions. By adding @code{_} or @code{^} before the opening
1738 parentheses, the direction is also set. For example,
1740 @lilypond[relative=2,raggedright,quote,verbatim,fragment]
1744 Some composers write two slurs when they want legato chords. This can
1745 be achieved in LilyPond by setting @code{doubleSlurs},
1747 @lilypond[verbatim,raggedright,relative,fragment,quote]
1748 \set doubleSlurs = ##t
1749 <c e>4 ( <d f> <c e> <d f> )
1752 Only one slur can be printed at once. If you need to print a long
1753 slur over a few small slurs, please see @ref{Phrasing slurs}.
1759 @cindex @code{\slurUp}
1761 @cindex @code{\slurDown}
1763 @cindex @code{\slurNeutral}
1764 @code{\slurNeutral},
1765 @cindex @code{\slurDashed}
1767 @cindex @code{\slurDotted}
1769 @cindex @code{\slurSolid}
1774 Program reference: @seeinternals{Slur}, and @internalsref{SlurEvent}.
1777 @node Phrasing slurs
1778 @subsection Phrasing slurs
1780 @cindex phrasing slurs
1781 @cindex phrasing marks
1783 A phrasing slur (or phrasing mark) connects chords and is used to
1784 indicate a musical sentence. It is written using @code{\(} and @code{\)}
1787 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
1788 \time 6/4 c'\( d( e) f( e) d\)
1791 Typographically, the phrasing slur behaves almost exactly like a
1792 normal slur. However, they are treated as different objects. A
1793 @code{\slurUp} will have no effect on a phrasing slur; instead, use
1794 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1795 @code{\phrasingSlurNeutral}.
1797 The commands @code{\slurUp}, @code{\slurDown}, and @code{\slurNeutral}
1798 will only affect normal slurs and not phrasing slurs.
1800 You cannot have simultaneous phrasing slurs.
1804 @cindex @code{\phrasingSlurUp}
1805 @code{\phrasingSlurUp},
1806 @cindex @code{\phrasingSlurDown}
1807 @code{\phrasingSlurDown},
1808 @cindex @code{\phrasingSlurNeutral}
1809 @code{\phrasingSlurNeutral}.
1813 Program reference: see also @internalsref{PhrasingSlur}, and
1814 @internalsref{PhrasingSlurEvent}.
1818 Putting phrasing slurs over rests leads to spurious warnings.
1822 @subsection Articulations
1823 @cindex Articulations
1825 @cindex articulations
1829 A variety of symbols can appear above and below notes to indicate
1830 different characteristics of the performance. They are added to a note
1831 by adding a dash and the character signifying the
1832 articulation. They are demonstrated here
1834 @lilypondfile[quote,raggedright]{script-abbreviations.ly}
1836 The meanings of these shorthands can be changed. See
1837 @file{ly/@/script@/-init@/.ly} for examples.
1840 The script is automatically placed, but the direction can be forced as
1841 well. Like other pieces of LilyPond code, @code{_} will place them
1842 below the staff, and @code{^} will place them above.
1845 @lilypond[quote,raggedright,fragment,verbatim]
1849 Other symbols can be added using the syntax
1850 @var{note}@code{\}@var{name}. Again, they
1851 can be forced up or down using @code{^} and @code{_},
1854 @lilypond[quote,raggedright,verbatim,fragment,relative=2]
1855 c\fermata c^\fermata c_\fermata
1862 @cindex staccatissimo
1872 @cindex organ pedal marks
1881 @cindex prallmordent
1885 @cindex thumb marking
1890 Here is a chart showing all scripts available,
1892 @lilypondfile[raggedright,quote]{script-chart.ly}
1895 The vertical ordering of scripts is controlled with the
1896 @code{script-priority} property. The lower this number, the closer it
1897 will be put to the note. In this example, the
1898 @internalsref{TextScript} (the sharp symbol) first has the lowest
1899 priority, so it is put lowest in the first example. In the second, the
1900 prall trill (the @internalsref{Script}) has the lowest, so it is on the
1901 inside. When two objects have the same priority, the order in which
1902 they are entered decides which one comes first.
1905 @lilypond[verbatim,relative=3,raggedright,fragment,quote]
1906 \once \override TextScript #'script-priority = #-100
1907 a4^\prall^\markup { \sharp }
1909 \once \override Script #'script-priority = #-100
1910 a4^\prall^\markup { \sharp }
1918 Program reference: @internalsref{ScriptEvent}, and @internalsref{Script}.
1922 These signs appear in the printed output but have no effect on the
1923 MIDI rendering of the music.
1927 @subsection Dynamics
1940 @cindex @code{\ffff}
1950 Absolute dynamic marks are specified using a command after a note
1951 @code{c4\ff}. The available dynamic marks are @code{\ppp},
1952 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
1953 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
1954 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}
1956 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
1957 c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
1958 c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
1967 A crescendo mark is started with @code{\<} and terminated with
1968 @code{\!} or an absolute dynamic. A decrescendo is started with
1969 @code{\>} and is also terminated with @code{\!} or an absolute
1970 dynamic. Because these marks are bound to notes, you must
1971 use spacer notes if multiple marks are needed during one note
1973 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1975 << f1 { s4 s4\< s4\! \> s4\! } >>
1977 This may give rise to very short hairpins. Use @code{minimum-length}
1978 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
1982 \override Staff.Hairpin #'minimum-length = #5
1985 You can also use a text saying @emph{cresc.} instead of hairpins. Here
1986 is an example how to do it
1988 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2002 You can also supply your own texts
2003 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2004 \set crescendoText = \markup { \italic "cresc. poco" }
2005 \set crescendoSpanner = #'dashed-line
2011 To create new dynamic marks or text that should be aligned
2012 with dynamics, see @ref{New dynamic marks}.
2017 @cindex @code{\dynamicUp}
2019 @cindex @code{\dynamicDown}
2020 @code{\dynamicDown},
2021 @cindex @code{\dynamicNeutral}
2022 @code{\dynamicNeutral}.
2024 @cindex direction, of dynamics
2028 Program reference: @internalsref{CrescendoEvent},
2029 @internalsref{DecrescendoEvent}, and
2030 @internalsref{AbsoluteDynamicEvent}.
2032 Dynamics are @internalsref{DynamicText} and @internalsref{Hairpin}
2033 objects. Vertical positioning of these symbols is handled by the
2034 @internalsref{DynamicLineSpanner} object.
2037 @subsection Breath marks
2039 Breath marks are entered using @code{\breathe}
2042 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2046 The glyph of the breath mark can be tuned by overriding the
2047 @code{text} property of the @code{BreathingSign} layout object with
2048 any markup text. For example,
2049 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
2051 \override BreathingSign #'text
2052 = #(make-musicglyph-markup "scripts.rvarcomma")
2059 Program reference: @internalsref{BreathingSign},
2060 @internalsref{BreathingSignEvent}.
2062 Examples: @inputfileref{input/@/regression,breathing@/-sign@/.ly}.
2065 @node Running trills
2066 @subsection Running trills
2068 Long running trills are made with @code{\startTrillSpan} and
2069 @code{\stopTrillSpan},
2072 @lilypond[verbatim,raggedright,relative=2,quote,fragment]
2074 << { c1 \startTrillSpan }
2075 { s2. \grace { d16[\stopTrillSpan e] } } >>
2081 @code{\startTrillSpan},
2082 @cindex @code{\startTrillSpan}
2083 @code{\stopTrillSpan}.
2084 @cindex @code{\stopTrillSpan}
2088 Program reference: @internalsref{TrillSpanner},
2089 @internalsref{TrillSpanEvent}.
2095 @subsection Glissando
2098 @cindex @code{\glissando}
2100 A glissando is a smooth change in pitch. It is denoted by a line or a
2101 wavy line between two notes. It is requested by attaching
2102 @code{\glissando} to a note
2104 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2110 Program reference: @internalsref{Glissando}, and @internalsref{GlissandoEvent}.
2112 Example files: @file{input/@/regression/@/glissando@/.ly}.
2118 Printing text over the line (such as @emph{gliss.}) is not supported.
2122 @subsection Arpeggio
2125 @cindex broken chord
2126 @cindex @code{\arpeggio}
2128 You can specify an arpeggio sign (also known as broken chord) on a
2129 chord by attaching an @code{\arpeggio} to a chord
2132 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2136 When an arpeggio crosses staves, you attach an arpeggio to the chords
2137 in both staves, and set
2138 @internalsref{PianoStaff}.@code{connectArpeggios}
2140 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2141 \context PianoStaff <<
2142 \set PianoStaff.connectArpeggios = ##t
2143 \new Staff { <c' e g c>\arpeggio }
2144 \new Staff { \clef bass <c,, e g>\arpeggio }
2148 The direction of the arpeggio is sometimes denoted by adding an
2149 arrowhead to the wiggly line
2151 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2160 A square bracket on the left indicates that the player should not
2161 arpeggiate the chord
2163 @c todo: ugh, lousy typography. Look for real example. --hwn
2165 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2172 @cindex @code{\arpeggio}
2174 @cindex @code{\arpeggioUp}
2176 @cindex @code{\arpeggioDown}
2177 @code{\arpeggioDown},
2178 @cindex @code{\arpeggioNeutral}
2179 @code{\arpeggioNeutral},
2180 @cindex @code{\arpeggioBracket}
2181 @code{\arpeggioBracket}.
2185 Notation manual: @ref{Ties}, for writing out arpeggios.
2187 Program reference: @internalsref{ArpeggioEvent},
2188 @internalsref{Arpeggio}.
2194 It is not possible to mix connected arpeggios and unconnected
2195 arpeggios in one @internalsref{PianoStaff} at the same point in time.
2202 Polyphony in music refers to having more than one voice occuring in
2203 a piece of music. Polyphony in LilyPond refers to having more than
2204 one voice on the same staff.
2208 * Explicitly instantiating voices::
2209 * Collision Resolution::
2212 @node Basic polyphony
2213 @subsection Basic polyphony
2216 The easiest way to enter fragments with more than one voice on a staff
2217 is to enter each voice as a sequence (with @code{@{...@}}), and combine
2218 them simultaneously, separating the voices with @code{\\}
2222 @lilypond[quote,verbatim,fragment]
2223 \new Staff \relative c' {
2225 << { g4 f e | d2 e2 } \\
2226 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
2232 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
2233 voices are sometimes called ``layers'' in other notation packages}
2235 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
2236 each of these contexts, vertical direction of slurs, stems, etc., is set
2239 These voices are all seperate from the voice that contains the notes just
2240 outside the @code{<< \\ >>} construct. This should be noted when making
2241 changes at the voice level. This also means that slurs and ties cannot go
2242 into or out of a @code{<< \\ >>} construct.
2243 Conversely, parallel voices from separate @code{<< \\ >>} constructs on the
2244 same staff are the the same voice.
2245 Here is the same example, with different noteheads for each voice.
2246 Note that the change to the note-head style in the main voice does not affect
2247 the inside of the @code{<< \\ >>} constructs. Also, the change to the second
2248 voice in the first @code{<< \\ >>} construct is effective in the second
2249 @code{<< \\ >>}, and the voice is tied accross the two constructs.
2251 @lilypond[quote,verbatim,fragment]
2252 \new Staff \relative c' {
2253 \override NoteHead #'style = #'cross
2257 { \override NoteHead #'style = #'triangle
2263 { c8 b16 a b8 g ~ g2 } \\
2264 { \override NoteHead #'style = #'slash s4 b4 c2 }
2269 @node Explicitly instantiating voices
2270 @subsection Explicitly instantiating voices
2272 @internalsref{Voice} contexts can also also be instantiated manually
2273 inside a @code{<< >>} block to create polyphonic music, using
2274 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
2275 and a horizontal shift for each part.
2279 << \upper \\ \lower >>
2287 \context Voice = "1" @{ \voiceOne \upper @}
2288 \context Voice = "2" @{ \voiceTwo \lower @}
2292 @cindex @code{\voiceOne}
2293 @cindex @code{\voiceFour}
2295 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
2296 articulations, text annotations, augmentation dots of dotted
2297 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
2298 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
2299 make them point downwards.
2300 The command @code{\oneVoice} will revert back to the normal setting.
2301 @cindex @code{\oneVoice}
2303 An expression that appears directly inside a @code{<< >>} belongs to
2304 the main voice. This is useful when extra voices appear while the main
2305 voice is playing. Here is a more correct rendition of the example from
2306 the previous section. The crossed noteheads demonstrate that the main
2307 melody is now in a single voice context.
2309 @lilypond[quote,raggedright,verbatim]
2310 \new Staff \relative c' {
2311 \override NoteHead #'style = #'cross
2316 \context Voice="1" { \voiceTwo
2317 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2320 \new Voice { \voiceThree
2329 The correct definition of the voices allows the melody to be slurred.
2330 @lilypond[quote,raggedright,verbatim]
2331 \new Staff \relative c' {
2336 \context Voice="1" { \voiceTwo
2337 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2340 \new Voice { \voiceThree
2349 Avoiding the @code{\\} seperator also allows nesting polyphony
2350 constructs, which in some case might be a more natural way to typeset
2353 @lilypond[quote,raggedright,verbatim]
2354 \new Staff \relative c' {
2359 \context Voice="1" { \voiceTwo
2362 {c8 b16 a b8 g ~ g2}
2363 \new Voice { \voiceThree
2375 @node Collision Resolution
2376 @subsection Collision Resolution
2378 Normally, note heads with a different number of dots are not merged, but
2379 when the object property @code{merge-differently-dotted} is set in
2380 the @internalsref{NoteCollision} object, they are merged
2381 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
2384 \override Staff.NoteCollision
2385 #'merge-differently-dotted = ##t
2387 } \\ { g8.[ f16] g8.[ f16] } >>
2390 Similarly, you can merge half note heads with eighth notes, by setting
2391 @code{merge-differently-headed}
2392 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2395 \override Staff.NoteCollision
2396 #'merge-differently-headed = ##t
2397 c8 c4. } \\ { c2 c2 } >>
2400 LilyPond also vertically shifts rests that are opposite of a stem,
2403 @lilypond[quote,raggedright,fragment,verbatim]
2404 \context Voice << c''4 \\ r4 >>
2412 @cindex @code{\oneVoice}
2414 @cindex @code{\voiceOne}
2416 @cindex @code{\voiceTwo}
2418 @cindex @code{\voiceThree}
2420 @cindex @code{\voiceFour}
2425 @cindex @code{\shiftOn}
2427 @cindex @code{\shiftOnn}
2429 @cindex @code{\shiftOnnn}
2431 @cindex @code{\shiftOff}
2432 @code{\shiftOff}: these commands specify in what chords of the current
2433 voice should be shifted. The outer voices (normally: voice one and
2434 two) have @code{\shiftOff}, while the inner voices (three and four)
2435 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
2436 further shift levels.
2439 When LilyPond cannot cope, the @code{force-hshift}
2440 property of the @internalsref{NoteColumn} object and pitched rests can
2441 be used to override typesetting decisions.
2443 @lilypond[quote,verbatim,raggedright]
2450 \once \override NoteColumn #'force-hshift = #1.7
2459 Program reference: the objects responsible for resolving collisions are
2460 @internalsref{NoteCollision} and @internalsref{RestCollision}.
2463 @inputfileref{input/@/regression,collision@/-dots@/.ly},
2464 @inputfileref{input/@/regression,collision@/-head-chords@/.ly},
2465 @inputfileref{input/@/regression,collision@/-heads@/.ly},
2466 @inputfileref{input/@/regression,collision@/-mesh@/.ly}, and
2467 @inputfileref{input/@/regression,collisions@/.ly}.
2473 When using @code{merge-differently-headed} with an upstem eighth or a
2474 shorter note, and a downstem half note, the eighth note gets the wrong
2477 There is no support for clusters where the same note occurs with
2478 different accidentals in the same chord. In this case, it is
2479 recommended to use enharmonic transcription, or to use special cluster
2480 notation (see @ref{Clusters}).
2487 Repetition is a central concept in music, and multiple notations exist
2493 * Repeats and MIDI::
2494 * Manual repeat commands::
2496 * Tremolo subdivisions::
2501 @subsection Repeat types
2504 @cindex @code{\repeat}
2506 The following types of repetition are supported
2510 Repeated music is fully written (played) out. This is useful when
2511 entering repetitious music. This is the only kind of repeat that
2512 is included in MIDI output.
2515 Repeats are not written out, but alternative endings (volte) are
2516 printed, left to right with brackets. This is the standard notation
2517 for repeats with alternatives. These are not played in MIDI output by default.
2521 Alternative endings are written stacked. This has limited use but may be
2522 used to typeset two lines of lyrics in songs with repeats, see
2523 @inputfileref{input,star-spangled-banner@/.ly}.
2528 Make tremolo beams. These are not played in MIDI output by default.
2531 Make beat or measure repeats. These look like percent signs. These
2532 are not played in MIDI output by default. Percent repeats must be
2533 declared within a Voice context.
2538 @subsection Repeat syntax
2541 LilyPond has one syntactic construct for specifying different types of
2542 repeats. The syntax is
2545 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2548 If you have alternative endings, you may add
2549 @cindex @code{\alternative}
2551 \alternative @{ @var{alternative1}
2553 @var{alternative3} @dots{} @}
2555 where each @var{alternative} is a music expression. If you do not
2556 give enough alternatives for all of the repeats, the first alternative
2557 is assumed to be played more than once.
2559 Standard repeats are used like this
2560 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2562 \repeat volta 2 { c4 d e f }
2563 \repeat volta 2 { f e d c }
2566 With alternative endings
2567 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2569 \repeat volta 2 {c4 d e f}
2570 \alternative { {d2 d} {f f,} }
2574 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2577 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2578 \alternative { { g4 g g } { a | a a a a | b2. } }
2582 It is possible to shorten volta brackets
2583 by setting @code{voltaSpannerDuration}. In the next example, the
2584 bracket only lasts one measure, which is a duration of 3/4.
2588 @lilypond[verbatim,raggedright,quote]
2592 \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2593 \repeat "volta" 5 { d d d }
2594 \alternative { { e e e f f f }
2604 Brackets for the repeat are normally only printed over the topmost
2605 staff. This can be adjusted by setting the @code{voltaOnThisStaff}
2606 property; see @inputfileref{input/@/regression,volta@/-multi@/-staff@/.ly}.
2609 @c @inputfileref{input/@/regression,volta@/-chord@/-names@/.ly}.
2614 A nested repeat like
2623 is ambiguous, since it is is not clear to which @code{\repeat} the
2624 @code{\alternative} belongs. This ambiguity is resolved by always
2625 having the @code{\alternative} belong to the inner @code{\repeat}.
2626 For clarity, it is advisable to use braces in such situations.
2631 Timing information is not remembered at the start of an alternative,
2632 so after a repeat timing information must be reset by hand, for
2633 example by setting @code{Score.measurePosition} or entering
2634 @code{\partial}. Similarly, slurs or ties are also not repeated.
2639 @node Repeats and MIDI
2640 @subsection Repeats and MIDI
2642 @cindex expanding repeats
2644 With a little bit of tweaking, all types of repeats can be present
2645 in the MIDI output. This is achieved by applying the
2646 @code{\unfoldrepeats} music function. This functions changes all
2647 repeats to unfold repeats.
2649 @lilypond[quote,verbatim,fragment,linewidth=8.0\cm]
2651 \repeat tremolo 8 {c'32 e' }
2652 \repeat percent 2 { c''8 d'' }
2653 \repeat volta 2 {c'4 d' e' f'}
2662 When creating a score file using @code{\unfoldrepeats} for midi, then
2663 it is necessary to make two @code{\score} blocks. One for MIDI (with
2664 unfolded repeats) and one for notation (with volta, tremolo, and
2665 percent repeats). For example,
2673 \unfoldrepeats @var{..music..}
2678 @node Manual repeat commands
2679 @subsection Manual repeat commands
2681 @cindex @code{repeatCommands}
2683 The property @code{repeatCommands} can be used to control the layout of
2684 repeats. Its value is a Scheme list of repeat commands.
2687 @item @code{start-repeat}
2688 Print a @code{|:} bar line.
2690 @item @code{end-repeat}
2691 Print a @code{:|} bar line.
2693 @item @code{(volta @var{text})}
2694 Print a volta bracket saying @var{text}: The text can be specified as
2695 a text string or as a markup text, see @ref{Text markup}. Do not
2696 forget to change the font, as the default number font does not contain
2697 alphabetic characters;
2699 @item @code{(volta #f)}
2700 Stop a running volta bracket.
2703 @lilypond[quote,raggedright,verbatim,fragment,relative=2]
2705 \set Score.repeatCommands = #'((volta "93") end-repeat)
2707 \set Score.repeatCommands = #'((volta #f))
2715 Program reference: @internalsref{VoltaBracket}, @internalsref{RepeatedMusic},
2716 @internalsref{VoltaRepeatedMusic},
2717 @internalsref{UnfoldedRepeatedMusic}, and
2718 @internalsref{FoldedRepeatedMusic}.
2720 @node Tremolo repeats
2721 @subsection Tremolo repeats
2722 @cindex tremolo beams
2724 To place tremolo marks between notes, use @code{\repeat} with tremolo
2726 @lilypond[quote,verbatim,raggedright]
2727 \new Voice \relative c' {
2728 \repeat "tremolo" 8 { c16 d16 }
2729 \repeat "tremolo" 4 { c16 d16 }
2730 \repeat "tremolo" 2 { c16 d16 }
2734 Tremolo marks can also be put on a single note. In this case, the
2735 note should not be surrounded by braces.
2736 @lilypond[quote,verbatim,raggedright]
2737 \repeat "tremolo" 4 c'16
2740 Similar output is obtained using the tremolo subdivision, described in
2741 @ref{Tremolo subdivisions}.
2745 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
2747 Program reference: tremolo beams are @internalsref{Beam} objects. Single stem
2748 tremolos are @internalsref{StemTremolo} objects. The music expression is
2749 @internalsref{TremoloEvent}.
2751 Example files: @inputfileref{input/@/regression,chord@/-tremolo@/.ly},
2752 @inputfileref{input/@/regression,stem@/-tremolo@/.ly}.
2754 @node Tremolo subdivisions
2755 @subsection Tremolo subdivisions
2756 @cindex tremolo marks
2757 @cindex @code{tremoloFlags}
2759 Tremolo marks can be printed on a single note by adding
2760 `@code{:}[@var{number}]' after the note. The number indicates the
2761 duration of the subdivision, and it must be at least 8. A
2762 @var{length} value of 8 gives one line across the note stem. If the
2763 length is omitted, the last value (stored in @code{tremoloFlags}) is
2766 @lilypond[quote,raggedright,verbatim,fragment]
2767 c'2:8 c':32 | c': c': |
2770 @c [TODO: stok is te kort bij 32en]
2771 @c somebody want to translate that into English?
2772 @c `Stem is too short for 32nds' (wl)
2776 Tremolos entered in this way do not carry over into the MIDI output.
2780 In this manual: @ref{Tremolo repeats}.
2782 Elsewhere: @internalsref{StemTremolo}, @internalsref{TremoloEvent}.
2784 @node Measure repeats
2785 @subsection Measure repeats
2787 @cindex percent repeats
2788 @cindex measure repeats
2790 In the @code{percent} style, a note pattern can be repeated. It is
2791 printed once, and then the pattern is replaced with a special sign.
2792 Patterns of one and two measures are replaced by percent-like signs,
2793 patterns that divide the measure length are replaced by slashes.
2794 Percent repeats must be declared within a @code{Voice} context.
2796 @lilypond[quote,verbatim,raggedright]
2797 \new Voice \relative c' {
2798 \repeat "percent" 4 { c4 }
2799 \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
2805 Program reference: @internalsref{RepeatSlash}, @internalsref{PercentRepeat},
2806 @internalsref{PercentRepeatedMusic}, and
2807 @internalsref{DoublePercentRepeat}.