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
10 @chapter Basic notation
12 This chapter explains how to use all basic notation features.
16 * 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::
50 @cindex Note specification
51 @cindex entering notes
53 A note is printed by specifying its pitch and then its duration,
55 @lilypond[quote,verbatim,raggedright,fragment]
61 @ref{Pitches}, @ref{Durations}
70 The most common syntax for pitch entry is used for standard notes and
71 @code{\chordmode} modes. In these modes, pitches may be designated by
72 names. The notes are specified by the letters @code{a} through
73 @code{g}. The octave is formed with notes ranging from @code{c}
74 to @code{b}. The pitch @code{c} is an octave below middle C and the
75 letters span the octave above that C
77 @lilypond[quote,fragment,verbatim,raggedright]
79 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
85 The optional octave specification takes the form of a series of
86 single quote (`@code{'}') characters or a series of comma
87 (`@code{,}') characters. Each @code{'} raises the pitch by one
88 octave; each @code{,} lowers the pitch by an octave
90 @lilypond[quote,raggedright,fragment,verbatim]
94 @cindex note names, Dutch
96 A sharp is formed by adding @code{-is} to the end of a pitch name and
97 a flat is formed by adding @code{-es}. Double sharps and double flats
98 are obtained by adding @code{-isis} or @code{-eses}. These
99 names are the Dutch note names. In Dutch, @code{aes} is contracted to
100 @code{as}, but both forms are accepted. Similarly, both
101 @code{es} and @code{ees} are accepted
103 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
111 There are predefined sets of note names for various other languages.
112 To use them, include the language specific init file. For
113 example: @code{\include "english.ly"}. The available language files
114 and the note names they define are
119 Note Names sharp flat
120 nederlands.ly c d e f g a bes b -is -es
121 english.ly c d e f g a bf b -s/-sharp -f/-flat
123 deutsch.ly c d e f g a b h -is -es
124 norsk.ly c d e f g a b h -iss/-is -ess/-es
125 svenska.ly c d e f g a b h -iss -ess
126 italiano.ly do re mi fa sol la sib si -d -b
127 catalan.ly do re mi fa sol la sib si -d/-s -b
128 espanol.ly do re mi fa sol la sib si -s -b
134 Program reference: @internalsref{NoteEvent},
135 @internalsref{LedgerLineSpanner}, and @internalsref{NoteHead}.
140 In accordance with standard typsetting rules, a natural sign is printed
141 before a sharp or flat if a previous accidental needs to be
142 cancelled. To change this behaviour, use
143 @code{\set Staff.extraNatural = ##f}
145 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
147 \set Staff.extraNatural = ##f
152 @node Cautionary accidentals
153 @subsection Cautionary accidentals
155 @cindex reminder accidental
157 @cindex cautionary accidental
158 @cindex parenthesized accidental
161 Normally accidentals are printed automatically, but you may also
162 print them manually. A reminder accidental
163 can be forced by adding an exclamation mark @code{!}
164 after the pitch. A cautionary accidental
165 (i.e., an accidental within parentheses) can be obtained by adding the
166 question mark `@code{?}' after the pitch.
168 @lilypond[quote,raggedright,fragment,verbatim]
169 cis' cis' cis'! cis'?
175 The automatic production of accidentals can be tuned in many
176 ways. For more information, refer to @ref{Automatic accidentals}.
181 @subsection Micro tones
183 @cindex quarter tones
184 @cindex semi-flats, semi-sharps
186 Half-flats and half-sharps are formed by adding @code{-eh} and
187 @code{-ih}; the following is a series of Cs with increasing pitches
189 @lilypond[verbatim,raggedright,quote,relative=2,fragment]
190 \set Staff.extraNatural = ##f
194 Micro tones are also exported to the MIDI file.
199 There are no generally accepted standards for denoting three quarter
200 flats, so LilyPond's symbol does not conform to any standard.
208 A chord is formed by a enclosing a set of pitches in @code{<} and
209 @code{>}. A chord may be followed by a duration, and a set of
210 articulations, just like simple notes
212 @lilypond[verbatim,raggedright,fragment,quote,relative=1]
216 For more information about chords, see @ref{Chord names}.
227 Rests are entered like notes with the note name @code{r}
229 @lilypond[fragment,quote,raggedright,verbatim]
233 Whole bar rests, centered in middle of the bar,
234 must be done with multi-measure rests. They are discussed in
235 @ref{Multi measure rests}.
238 A rest's vertical position may be explicitly specified by entering a
239 note with the @code{\rest} keyword appended, the rest will be placed at
240 the note's place. This makes manual formatting in polyphonic music
241 easier. Automatic rest collision formatting will leave these rests
244 @lilypond[fragment,quote,raggedright,verbatim]
250 Program reference: @internalsref{RestEvent}, and @internalsref{Rest}.
257 @cindex Invisible rest
262 An invisible rest (also called a `skip') can be entered like a note
263 with note name `@code{s}' or with @code{\skip @var{duration}}
265 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
266 a4 a4 s4 a4 \skip 1 a4
269 The @code{s} syntax is only available in note mode and chord mode. In
270 other situations, for example, when entering lyrics, you should use
271 the @code{\skip} command
273 @lilypond[quote,raggedright,verbatim]
276 \new Lyrics \lyricmode { \skip 2 bla2 }
280 The skip command is merely an empty musical placeholder. It does not
281 produce any output, not even transparent output.
283 The @code{s} skip command does create @internalsref{Staff} and
284 @internalsref{Voice} when necessary, similar to note and rest
285 commands. For example, the following results in an empty staff.
287 @lilypond[quote,raggedright,verbatim]
291 The fragment @code{@{ \skip 4 @} } would produce an empty page.
295 Program reference: @internalsref{SkipEvent}, @internalsref{SkipMusic}.
299 @subsection Durations
302 @cindex @code{\longa}
303 @cindex @code{\breve}
304 @cindex @code{\maxima}
306 In Note, Chord, and Lyrics mode, durations are designated by numbers and
307 dots: durations are entered as their reciprocal values. For example, a
308 quarter note is entered using a @code{4} (since it is a 1/4 note), while
309 a half note is entered using a @code{2} (since it is a 1/2 note). For
310 notes longer than a whole you must use the variables @code{\longa} and
315 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
317 r1 r2 r4 r8 r16 r32 r64 r64
323 a\breve*1/2 \autoBeamOff
324 a1 a2 a4 a8 a16 a32 a64 a64
327 r\longa*1/4 r\breve *1/2
328 r1 r2 r4 r8 r16 r32 r64 r64
334 \remove "Clef_engraver"
335 \override StaffSymbol #'transparent = ##t
336 \override TimeSignature #'transparent = ##t
337 \override BarLine #'transparent = ##t
338 \consists "Pitch_squash_engraver"
344 If the duration is omitted then it is set to the previously entered
345 duration. The default for the first note is a quarter note.
347 @lilypond[quote,raggedright,verbatim,fragment]
348 { a a a2 a a4 a a1 a }
352 @node Augmentation dots
353 @subsection Augmentation dots
357 To obtain dotted note lenghts, simply add a dot (`@code{.}') to
358 the number. Double-dotted notes are produced in a similar way.
360 @lilypond[quote,raggedright,fragment,verbatim]
361 a'4 b' c''4. b'8 a'4. b'4.. c''8.
366 Dots are normally moved up to avoid staff lines, except in polyphonic
367 situations. The following commands may be used to force a particular
370 @cindex @code{\dotsUp}
372 @cindex @code{\dotsDown}
374 @cindex @code{\dotsNeutral}
379 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}.
387 @cindex @code{\times}
389 Tuplets are made out of a music expression by multiplying all durations
393 \times @var{fraction} @var{musicexpr}
397 The duration of @var{musicexpr} will be multiplied by the fraction.
398 The fraction's denominator will be printed over the notes, optionally
399 with a bracket. The most common tuplet is the triplet in which 3
400 notes have the length of 2, so the notes are 2/3 of their written
403 @lilypond[quote,raggedright,fragment,verbatim]
404 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
409 @cindex @code{\tupletUp}
411 @cindex @code{\tupletDown}
413 @cindex @code{\tupletNeutral}
414 @code{\tupletNeutral}.
419 Program reference: @internalsref{TupletBracket}, and @internalsref{TimeScaledMusic}.
421 @c FIXME: will be deleted or moved; not suitable for basic-notation.
423 Examples: @inputfileref{input/@/regression,tuplet@/-nest@/.ly}.
424 User manual: @ref{Changing context properties on the fly} for the
431 @cindex @code{tupletNumberFormatFunction}
432 @cindex tuplet formatting
434 The property @code{tupletSpannerDuration} specifies how long each
435 bracket should last. With this, you can make lots of tuplets while
436 typing @code{\times} only once, thus saving lots of typing. In the next
437 example, there are two triplets shown, while @code{\times} was only
440 @lilypond[quote,fragment,relative=1,raggedright,verbatim]
441 \set tupletSpannerDuration = #(ly:make-moment 1 4)
442 \times 2/3 { c'8 c c c c c }
445 The format of the number is determined by the property
446 @code{tupletNumberFormatFunction}. The default prints only the
447 denominator, but if it is set to the Scheme function
448 @code{fraction-tuplet-formatter}, @var{num}:@var{den} will be printed
454 Nested tuplets are not formatted automatically. In this case, outer
455 tuplet brackets should be moved manually, which is demonstrated in
456 @inputfileref{input/@/regression,tuplet@/-nest@/.ly}.
459 @node Scaling durations
460 @subsection Scaling durations
462 You can alter the length of duration by a fraction @var{N/M}
463 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
464 will not affect the appearance of the notes or rests produced.
466 In the following example, the first three notes take up exactly two
467 beats, but no triplet bracket is printed.
468 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
470 a4*2/3 gis4*2/3 a4*2/3
478 This manual: @ref{Tuplets}
481 @node Easier music entry
482 @section Easier music entry
485 This section deals with tricks and features of the input language that
486 were added solely to help entering music and finding and correcting
487 mistakes. There are also external tools that make debugging easier.
488 See @ref{Point and click} for more information.
490 It is also possible to enter and edit music using other programs, such as
491 GUI interfaces or MIDI sequencers. Refer to the LilyPond
492 website for more information.
499 * Skipping corrected music::
500 * Automatic note splitting::
506 @node Relative octaves
507 @subsection Relative octaves
509 @cindex relative octave specification
511 Octaves are specified by adding @code{'} and @code{,} to pitch names.
512 When you copy existing music, it is easy to accidentally put a pitch
513 in the wrong octave and hard to find such an error. The relative
514 octave mode prevents these errors by making the mistakes much
515 larger: a single error puts the rest of the piece off by one octave
517 @cindex @code{\relative}
519 \relative @var{startpitch} @var{musicexpr}
526 \relative @var{musicexpr}
529 The octave of notes that appear in @var{musicexpr} are calculated as
530 follows: if no octave changing marks are used, the basic interval
531 between this and the last note is always taken to be a fourth or
532 less. This distance is determined without regarding alterations; a
533 @code{fisis} following a @code{ceses} will be put above the
534 @code{ceses}. In other words, a doubly-augmented fourth is considered
535 a smaller interval than a diminshed fifth, even though the fourth is
536 seven semitones while the fifth is only six semitones.
538 The octave changing marks @code{'} and @code{,} can be added to raise
539 or lower the pitch by an extra octave. Upon entering relative mode,
540 an absolute starting pitch can be specified that will act as the
541 predecessor of the first note of @var{musicexpr}. If no starting pitch
542 is specified, then middle C is used as a start.
544 Here is the relative mode shown in action
545 @lilypond[quote,fragment,raggedright,verbatim]
551 Octave changing marks are used for intervals greater than a fourth
552 @lilypond[quote,raggedright,fragment,verbatim]
558 If the preceding item is a chord, the first note of the chord is used
559 to determine the first note of the next chord
561 @lilypond[quote,raggedright,fragment,verbatim]
569 The pitch after the @code{\relative} contains a note name.
572 The relative conversion will not affect @code{\transpose},
573 @code{\chordmode} or @code{\relative} sections in its argument. To use
574 relative within transposed music, an additional @code{\relative} must
575 be placed inside @code{\transpose}.
578 @subsection Octave check
581 Octave checks make octave errors easier to correct: a note may be
582 followed by @code{=}@var{quotes} which indicates what its absolute
583 octave should be. In the following example,
585 \relative c'' @{ c='' b=' d,='' @}
589 @c take care with @code, adds confusing quotes.
590 the @code{d} will generate a warning, because a @code{d''} is expected
591 (because @code{b'} to @code{d''} is only a third), but a @code{d}' is
592 found. In the output, the octave is corrected to be a @code{d''} and
593 the next note is calculated relative to @code{d''} instead of @code{d'}.
597 There is also a syntax that is separate from the notes. The syntax
603 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
604 quotes) in \relative mode. If not, a warning is printed, and the
607 In the example below, the first check passes without incident, since
608 the @code{e} (in relative mode) is within a fifth of @code{a'}. However,
609 the second check produces a warning, since the @code{e} is not within
610 a fifth of @code{b'}. The warning message is printed, and the octave
611 is adjusted so that the following notes are in the correct octave
623 The octave of a note following an octave check is determined with
624 respect to the note preceding it. In the next fragment, the last note
625 is a @code{a'}, above middle C. That means that the @code{\octave}
626 check passes successfully, so the check could be deleted without changing
627 the output of the piece.
629 @lilypond[quote,raggedright,verbatim,fragment]
638 @subsection Bar check
642 @cindex @code{barCheckSynchronize}
645 Bar checks help detect errors in the durations. A bar check is
646 entered using the bar symbol, `@code{|}'. Whenever it is encountered
647 during interpretation, it should fall on a measure boundary. If it
648 does not, a warning is printed. In the next example, the second bar
649 check will signal an error
651 \time 3/4 c2 e4 | g2 |
654 Bar checks can also be used in lyrics, for example
659 Twin -- kle | Twin -- kle
664 @cindex @code{skipTypesetting}
666 Failed bar checks are caused by entering incorrect
667 durations. Incorrect durations often completely garble up the score,
668 especially if the score is polyphonic, so a good place to start correcting
669 input is by scanning for failed bar checks and incorrect durations. To
670 speed up this process, the @code{skipTypesetting} feature may be
671 used. It is described in the next section.
674 @cindex @code{pipeSymbol}
676 It is also possible to redefine the meaning of @code{|}. This is done
677 by assigning a music expression to @code{pipeSymbol},
679 @lilypond[quote,raggedright,verbatim]
680 pipeSymbol = \bar "||"
686 @node Skipping corrected music
687 @subsection Skipping corrected music
689 The property @code{Score.skipTypesetting} can be used to switch on and
690 off typesetting completely during the interpretation phase. When
691 typesetting is switched off, the music is processed much more
692 quickly. This can be used to skip over the parts of a score that
693 have already been checked for errors
695 @lilypond[quote,fragment,raggedright,verbatim]
698 \set Score.skipTypesetting = ##t
700 \set Score.skipTypesetting = ##f
704 In polyphonic music, @code{Score.skipTypesetting} will affect all
705 voices and staves, saving even more time.
707 @node Automatic note splitting
708 @subsection Automatic note splitting
710 Long notes can be converted automatically to tied notes. This is done
711 by replacing the @internalsref{Note_heads_engraver} by the
712 @internalsref{Completion_heads_engraver}.
713 In the following examples, notes crossing the bar line are split and tied.
716 @lilypond[quote,fragment,verbatim,relative=1,linewidth=12\cm]
718 \remove "Note_heads_engraver"
719 \consists "Completion_heads_engraver"
721 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
725 This engraver splits all running notes at the bar line, and inserts
726 ties. One of its uses is to debug complex scores: if the measures are
727 not entirely filled, then the ties exactly show how much each measure
732 Not all durations (especially those containing tuplets) can be
733 represented exactly with normal notes and dots, but the engraver will
736 @code{Completion_heads_engraver} only affects notes; it does not split
742 Examples: @inputfileref{input/@/regression,completion@/-heads@/.ly}.
746 Program reference: @internalsref{Completion_heads_engraver}.
752 @section Staff notation
754 This section describes music notation that occurs on staff level,
755 such as key signatures, clefs and time signatures.
757 @cindex Staff notation
767 * System start delimiters::
772 @subsection Staff symbol
774 @cindex adjusting staff symbol
776 Notes, dynamic signs, etc., are grouped
777 with a set of horizontal lines, into a staff (plural `staves'). In our
778 system, these lines are drawn using a separate layout object called
781 The staff symbol may be tuned in the number, thickness and distannce
782 of lines, using properties. This is demonstrated in the example files
783 @inputfileref{input/@/test,staff@/-lines@/.ly},
784 @inputfileref{input/@/test,staff@/-size@/.ly}.
786 In addition, staves may be started and stopped at will. This is done
787 with @code{\startStaff} and @code{\stopStaff}.
789 @lilypond[verbatim,relative=2,fragment]
791 \override Staff.StaffSymbol #'line-count = 2
792 \stopStaff \startStaff
794 \revert Staff.StaffSymbol #'line-count
795 \stopStaff \startStaff
799 In combination with Frenched staves, this may be used to typeset ossia
800 sections. An example is in @inputfileref{input/@/test@/,ossia.ly},
805 @lilypondfile{ossia.ly}
807 @cindex staff lines, setting number of
808 @cindex staff lines, setting thickness of
809 @cindex thickness of staff lines, setting
810 @cindex number of staff lines, setting
814 Program reference: @internalsref{StaffSymbol}, @internalsref{StaffSpanEvent}.
816 Examples: @inputfileref{input/@/test,staff@/-lines@/.ly},
817 @inputfileref{input/@/test@/,ossia.ly},
818 @inputfileref{input/@/test,staff@/-size@/.ly}.
822 @subsection Key signature
823 @cindex Key signature
827 The key signature indicates the tonality in which a piece is played. It
828 is denoted by a set of alterations (flats or sharps) at the start of the
832 Setting or changing the key signature is done with the @code{\key}
835 @code{\key} @var{pitch} @var{type}
838 @cindex @code{\minor}
839 @cindex @code{\major}
840 @cindex @code{\minor}
841 @cindex @code{\ionian}
842 @cindex @code{\locrian}
843 @cindex @code{\aeolian}
844 @cindex @code{\mixolydian}
845 @cindex @code{\lydian}
846 @cindex @code{\phrygian}
847 @cindex @code{\dorian}
849 Here, @var{type} should be @code{\major} or @code{\minor} to get
850 @var{pitch}-major or @var{pitch}-minor, respectively.
851 The standard mode names @code{\ionian},
852 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
853 @code{\phrygian}, and @code{\dorian} are also defined.
855 This command sets the context property
856 @internalsref{Staff}.@code{keySignature}. Non-standard key signatures
857 can be specified by setting this property directly.
859 A natural sign is printed to cancel any previous accidentals. This
860 can be suppressed by setting the @code{Staff.printKeyCancellation}
863 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
869 \set Staff.printKeyCancellation = ##f
877 Accidentals and key signatures often confuse new users, because
878 unaltered notes get natural signs depending on the key signature. For
879 more information, see @ref{More about pitches}.
883 Program reference: @internalsref{KeyChangeEvent},
884 @internalsref{KeyCancellation} and @internalsref{KeySignature}.
886 @cindex @code{keySignature}
893 The clef indicates which lines of the staff correspond to which
897 The clef can be set with the @code{\clef} command
898 @lilypond[quote,raggedright,fragment,verbatim]
899 { c''2 \clef alto g'2 }
902 Supported clef-names include
903 @c Moved standard clefs to the top /MB
907 @item treble, violin, G, G2
920 G clef on 1st line, so-called French violin clef
925 @cindex mezzosoprano clef
928 @cindex baritone clef
931 @cindex varbaritone clef
942 By adding @code{_8} or @code{^8} to the clef name, the clef is
943 transposed one octave down or up, respectively, and @code{_15} and
944 @code{^15} transposes by two octaves. The argument @var{clefname}
945 must be enclosed in quotes when it contains underscores or digits. For
949 @cindex choral tenor clef
950 @lilypond[quote,raggedright,verbatim,fragment,relative=1]
954 This command is equivalent to setting @code{clefGlyph},
955 @code{clefPosition} (which controls the Y position of the clef),
956 @code{middleCPosition} and @code{clefOctavation}. A clef is printed
957 when any of these properties are changed. The following example shows
958 possibilities when setting properties manually.
960 @lilypond[quote,raggedright,verbatim]
962 \set Staff.clefGlyph = #"clefs.F"
963 \set Staff.clefPosition = #2
965 \set Staff.clefGlyph = #"clefs.G"
967 \set Staff.clefGlyph = #"clefs.C"
969 \set Staff.clefOctavation = #7
971 \set Staff.clefOctavation = #0
972 \set Staff.clefPosition = #0
976 \set Staff.middleCPosition = #4
983 Program reference: @internalsref{Clef}.
990 @subsection Time signature
991 @cindex Time signature
995 Time signature indicates the metrum of a piece: a regular pattern of
996 strong and weak beats. It is denoted by a fraction at the start of the
1000 The time signature is set or changed by the @code{\time}
1002 @lilypond[quote,raggedright,fragment,verbatim]
1003 \time 2/4 c'2 \time 3/4 c'2.
1006 The symbol that is printed can be customized with the @code{style}
1007 property. Setting it to @code{#'()} uses fraction style for 4/4 and
1010 @lilypond[fragment,quote,raggedright,verbatim]
1013 \override Staff.TimeSignature #'style = #'()
1020 There are many more options for its layout. See @ref{Ancient time
1021 signatures} for more examples.
1024 This command sets the property @code{timeSignatureFraction},
1025 @code{beatLength} and @code{measureLength} in the @code{Timing}
1026 context, which is normally aliased to @internalsref{Score}. The
1027 property @code{measureLength} determines where bar lines should be
1028 inserted, and how automatic beams should be generated. Changing the
1029 value of @code{timeSignatureFraction} also causes the symbol to be
1032 More options are available through the Scheme function
1033 @code{set-time-signature}. In combination with the
1034 @internalsref{Measure_grouping_engraver}, it will create
1035 @internalsref{MeasureGrouping} signs. Such signs ease reading
1036 rhythmically complex modern music. In the following example, the 9/8
1037 measure is subdivided in 2, 2, 2 and 3. This is passed to
1038 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1040 @lilypond[quote,raggedright,verbatim]
1043 #(set-time-signature 9 8 '(2 2 2 3))
1044 g8[ g] d[ d] g[ g] a8[( bes g]) |
1045 #(set-time-signature 5 8 '(3 2))
1051 \consists "Measure_grouping_engraver"
1059 Program reference: @internalsref{TimeSignature}, and @internalsref{Timing_engraver}.
1064 Automatic beaming does not use the measure grouping specified with
1065 @code{set-time-signature}.
1067 @node Partial measures
1068 @subsection Partial measures
1071 @cindex partial measure
1072 @cindex measure, partial
1073 @cindex shorten measures
1074 @cindex @code{\partial}
1076 Partial measures, for example in upsteps, are entered using the
1077 @code{\partial} command
1078 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1079 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1082 The syntax for this command is
1084 \partial @var{duration}
1086 This is internally translated into
1088 \set Timing.measurePosition = -@var{length of duration}
1091 The property @code{measurePosition} contains a rational number
1092 indicating how much of the measure has passed at this point.
1096 This command does not take into account grace notes at the start of
1097 the music. When a piece starts with graces notes in the pickup, then
1098 the @code{\partial} should follow the grace notes
1100 @lilypond[verbatim,quote,raggedright,relative,fragment]
1110 @node Unmetered music
1111 @subsection Unmetered music
1115 Bar lines and bar numbers are calculated automatically. For unmetered
1116 music (cadenzas, for example), this is not desirable. By setting
1117 @code{Score.timing} to false, this automatic timing can be switched
1118 off. Empty bar lines,
1125 indicate where line breaks can occur.
1129 @cindex @code{\cadenzaOn}
1131 @cindex @code{\cadenzaOff}
1138 @subsection Bar lines
1142 @cindex measure lines
1146 Bar lines delimit measures, but are also used to indicate repeats.
1147 Normally, they are inserted automatically. Line breaks may only
1148 happen on bar lines.
1150 Special types of bar lines can be forced with the @code{\bar} command
1152 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1156 The following bar types are available
1157 @lilypondfile[raggedright,quote]{bar-lines.ly}
1159 For allowing line breaks, there is a special command,
1163 This will insert an invisible bar line, and allow line breaks at this
1166 In scores with many staves, a @code{\bar} command in one staff is
1167 automatically applied to all staves. The resulting bar lines are
1168 connected between different staves of a @internalsref{StaffGroup}
1170 @lilypond[quote,raggedright,fragment,verbatim]
1172 \context StaffGroup <<
1178 \new Staff { \clef bass c4 g e g }
1180 \new Staff { \clef bass c2 c2 }
1185 The command @code{\bar }@var{bartype} is a short cut for doing
1186 @code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
1187 is set to a string, a bar line of that type is created.
1189 A bar line is created whenever the @code{whichBar} property is set.
1190 At the start of a measure it is set to the contents of
1191 @code{Timing.defaultBarType}. The contents of @code{repeatCommands} are used
1192 to override default measure bars.
1194 @cindex @code{whichBar}
1195 @cindex @code{repeatCommands}
1196 @cindex @code{defaultBarType}
1198 You are encouraged to use @code{\repeat} for repetitions. See
1205 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1208 Program reference: @internalsref{BarLine} (created at
1209 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1211 @cindex bar lines at start of system
1212 @cindex start of system
1216 Examples: @inputfileref{input/@/test,bar@/-lines@/.ly},
1220 @node System start delimiters
1221 @subsection System start delimiters
1223 Many scores consist of more than one staff. These staves can be
1224 joined in three different ways
1226 @item The group is started with a brace at the left, and bar lines are
1227 connected. This is done with the @internalsref{GrandStaff} context.
1229 @lilypond[verbatim,raggedright,quote]
1238 @item The group is started with a bracket, and bar lines are connected.
1239 This is done with the
1240 @internalsref{StaffGroup} context
1242 @lilypond[verbatim,raggedright,quote]
1251 @item The group is started with a vertical line. Bar lines are not
1252 connected. This is the default for the score.
1254 @lilypond[verbatim,raggedright,quote]
1263 @cindex Staff, multiple
1264 @cindex bracket, vertical
1265 @cindex brace, vertical
1272 The bar lines at the start of each system are
1273 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1274 @internalsref{SystemStartBracket}. Only one of these types is created
1275 in every context, and that type is determined by the property
1276 @code{systemStartDelimiter}.
1279 @node More than notes
1280 @section More than notes
1281 @c silly title; should change.
1283 This section deals with notation that affects more than one note.
1290 * Fingering instructions::
1300 A tie connects two adjacent note heads of the same pitch. The tie in
1301 effect extends the length of a note. Ties should not be confused with
1302 slurs, which indicate articulation, or phrasing slurs, which indicate
1303 musical phrasing. A tie is entered using the tilde symbol `@code{~}'
1305 @lilypond[quote,raggedright,fragment,verbatim]
1306 e' ~ e' <c' e' g'> ~ <c' e' g'>
1309 When a tie is applied to a chord, all note heads whose pitches match
1310 are connected. When no note heads match, no ties will be created.
1312 A tie is just a way of extending a note duration, similar to the
1313 augmentation dot. The following example shows two ways of notating
1314 exactly the same concept
1316 @lilypond[quote,fragment,raggedright]
1317 \time 3/4 c'2. c'2 ~ c'4
1321 Ties are used either when the note crosses a bar line, or when dots
1322 cannot be used to denote the rhythm. When using ties, larger note
1323 values should be aligned to subdivisions of the measure, eg.
1325 @lilypond[fragment,quote,raggedright]
1327 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
1331 If you need to tie a lot of notes over bars, it may be easier to use
1332 automatic note splitting (see @ref{Automatic note splitting}). This
1333 mechanism automatically splits long notes, and ties them across bar
1336 Ties are sometimes used to write out arpeggios. In this case, two tied
1337 notes need not be consecutive. This can be achieved by setting the
1338 @code{tieWaitForNote} property to true. For example,
1340 @lilypond[fragment,verbatim,relative=1,raggedright]
1341 \set tieWaitForNote = ##t
1342 \grace { c16[~ e~ g]~ } <c, e g>4
1349 @cindex @code{\tieUp}
1351 @cindex @code{\tieDown}
1353 @cindex @code{\tieNeutral}
1355 @cindex @code{\tieDotted}
1357 @cindex @code{\tieSolid}
1362 In this manual: @ref{Automatic note splitting}.
1364 Program reference: @internalsref{TieEvent}, @internalsref{Tie}.
1369 Switching staves when a tie is active will not produce a slanted tie.
1371 Formatting of ties is a difficult subject. The results are often not
1375 @node Automatic beams
1376 @subsection Automatic beams
1378 LilyPond inserts beams automatically
1380 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1381 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1384 When these automatic decisions are not good enough, beaming can be
1385 entered explicitly. It is also possible to define beaming patterns
1386 that differ from the defaults. See @ref{Setting automatic beam behavior}
1389 Individual notes may be marked with @code{\noBeam}, to prevent them
1392 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1393 \time 2/4 c8 c\noBeam c c
1399 Program reference: @internalsref{Beam}.
1403 @subsection Manual beams
1404 @cindex beams, manual
1408 In some cases it may be necessary to override the automatic beaming
1409 algorithm. For example, the autobeamer will not put beams over rests
1410 or bar lines. Such beams are specified manually by marking the begin
1411 and end point with @code{[} and @code{]}
1413 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
1415 r4 r8[ g' a r8] r8 g[ | a] r8
1419 @cindex @code{stemLeftBeamCount}
1421 Normally, beaming patterns within a beam are determined automatically.
1422 If necessary, the properties @code{stemLeftBeamCount} and
1423 @code{stemRightBeamCount} can be used to override the defaults. If
1424 either property is set, its value will be used only once, and then it
1427 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
1432 \set stemLeftBeamCount = #1
1436 @cindex @code{stemRightBeamCount}
1439 The property @code{subdivideBeams} can be set in order to subdivide
1440 all 16th or shorter beams at beat positions, as defined by the
1441 @code{beatLength} property.
1444 @lilypond[fragment,quote,relative=2,verbatim]
1446 \set subdivideBeams = ##t
1448 \set Score.beatLength = #(ly:make-moment 1 8)
1451 @cindex @code{subdivideBeams}
1453 Normally, line breaks are forbidden when beams cross bar lines. This
1454 behavior can be changed by setting @code{allowBeamBreak}.
1456 @cindex @code{allowBeamBreak}
1457 @cindex beams and line breaks
1459 @cindex beams, kneed
1461 @cindex auto-knee-gap
1466 User manual: @ref{Changing context properties on the fly} for the
1472 @cindex Frenched staves
1473 Kneed beams are inserted automatically, when a large gap is detected
1474 between the note heads. This behavior can be tuned through the object.
1477 Automatically kneed cross-staff beams cannot be used together with
1478 hidden staves. See @ref{Hiding staves}.
1480 Beams do not avoid collisions with symbols around the notes, such as
1481 texts and accidentals.
1487 @subsection Grace notes
1489 @cindex @code{\grace}
1493 Grace notes are ornaments that are written out. The most common ones
1494 are acciaccatura, which should be played as very short. It is denoted
1495 by a slurred small note with a slashed stem. The appoggiatura is a
1496 grace note that takes a fixed fraction of the main note, and is
1497 denoted as a slurred note in small print without a slash. They
1498 are entered with the commands @code{\acciaccatura} and
1499 @code{\appoggiatura}, as demonstrated in the following example
1502 @cindex appoggiatura
1503 @cindex acciaccatura
1505 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1506 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
1507 \acciaccatura { g16[ f] } e4
1510 Both are special forms of the @code{\grace} command. By prefixing this
1511 keyword to a music expression, a new one is formed, which will be
1512 printed in a smaller font and takes up no logical time in a measure.
1514 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1516 \grace { c16[ d16] } c2 c4
1520 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1521 @code{\grace} command does not start a slur.
1523 Internally, timing for grace notes is done using a second, `grace'
1524 timing. Every point in time consists of two rational numbers: one
1525 denotes the logical time, one denotes the grace timing. The above
1526 example is shown here with timing tuples
1528 @lilypond[quote,raggedright]
1531 c4 \grace c16 c4 \grace {
1534 \new Lyrics \lyricmode {
1535 \override LyricText #'font-family = #'typewriter
1539 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
1540 \markup { (\fraction 1 4 , 0 ) } 4
1542 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
1543 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
1545 \markup { ( \fraction 2 4 , 0 ) }
1551 The placement of grace notes is synchronized between different staves.
1552 In the following example, there are two sixteenth grace notes for
1553 every eighth grace note
1555 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1556 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1557 \new Staff { c4 \grace { g8[ b] } c4 } >>
1562 If you want to end a note with a grace, use the @code{\afterGrace}
1563 command. It takes two arguments: the main note, and the grace notes
1564 following the main note.
1566 @lilypond[raggedright, verbatim,relative=2,fragment]
1567 c1 \afterGrace d1 { c16[ d] } c4
1570 This will put the grace notes after a ``space'' lasting 3/4 of the
1571 length of the main note. The fraction 3/4 can be changed by setting
1572 @code{afterGraceFraction}, ie.
1575 afterGraceFraction = #(cons 7 8)
1579 will put the grace note at 7/8 of the main note.
1582 The same effect can be achieved manually by doing
1585 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1588 { s2 \grace { c16[ d] } } >>
1594 By adjusting the duration of the skip note (here it is a half-note),
1595 the space between the main-note and the grace is adjusted.
1600 A @code{\grace} section will introduce special typesetting settings,
1601 for example, to produce smaller type, and set directions. Hence, when
1602 introducing layout tweaks, they should be inside the grace section,
1604 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1616 The overrides should also be reverted inside the grace section.
1618 The layout of grace sections can be changed throughout the music using
1619 the function @code{add-grace-property}. The following example
1620 undefines the Stem direction for this grace, so stems do not always
1625 #(add-grace-property 'Voice 'Stem 'direction '())
1631 Another option is to change the variables @code{startGraceMusic},
1632 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
1633 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
1634 @code{stopAppoggiaturaMusic}. More information is in the file
1635 @file{ly/@/grace@/-init@/.ly}.
1640 Program reference: @internalsref{GraceMusic}.
1644 A score that starts with a @code{\grace} section needs an explicit
1645 @code{\context Voice} declaration, otherwise the main note and the grace
1646 note end up on different staves.
1648 Grace note synchronization can also lead to surprises. Staff notation,
1649 such as key signatures, bar lines, etc., are also synchronized. Take
1650 care when you mix staves with grace notes and staves without, for example,
1652 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1653 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1654 \new Staff { c4 \bar "|:" d4 } >>
1658 This can be remedied by inserting grace skips, for the above example
1661 \new Staff @{ c4 \bar "|:" \grace s16 d4 @}
1664 Grace sections should only be used within sequential music
1665 expressions. Nesting or juxtaposing grace sections is not supported,
1666 and might produce crashes or other errors.
1669 @node Fingering instructions
1670 @subsection Fingering instructions
1674 Fingering instructions can be entered using
1676 @var{note}-@var{digit}
1678 For finger changes, use markup texts
1680 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
1682 c^\markup { \finger "2-3" }
1685 @cindex finger change
1690 You can use the thumb-script to indicate that a note should be
1691 played with the thumb (e.g., in cello music)
1692 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
1693 <a_\thumb a'-3>8 <b_\thumb b'-3>
1696 Fingerings for chords can also be added to individual notes
1697 of the chord by adding them after the pitches
1698 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
1699 < c-1 e-2 g-3 b-5 >4
1703 In this case, setting @code{fingeringOrientations} will put fingerings next
1706 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
1707 \set fingeringOrientations = #'(left down)
1708 <c-1 es-2 g-4 bes-5 > 4
1709 \set fingeringOrientations = #'(up right down)
1710 <c-1 es-2 g-4 bes-5 > 4
1713 Using this feature, it is also possible to put fingering instructions
1714 very close to note heads in monophonic music,
1716 @lilypond[verbatim,raggedright,quote,fragment]
1717 \set fingeringOrientations = #'(right)
1724 Program reference: @internalsref{FingerEvent}, and @internalsref{Fingering}.
1726 Examples: @inputfileref{input/@/regression,finger@/-chords@/.ly}.
1731 @node Expressive marks
1732 @section Expressive marks
1734 Expressive marks help musicians to bring more to the music than simple
1753 A slur indicates that notes are to be played bound or @emph{legato}.
1755 They are entered using parentheses
1756 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1757 f( g a) a8 b( a4 g2 f4)
1761 The direction of a slur can be set with the
1765 \override Slur #'direction = #UP
1766 \slurUp % shortcut for the previous line
1770 However, there is a convenient shorthand for forcing slur
1771 directions. By adding @code{_} or @code{^} before the opening
1772 parentheses, the direction is also set. For example,
1774 @lilypond[relative=2,raggedright,quote,verbatim,fragment]
1778 Some composers write two slurs when they want legato chords. This can
1779 be achieved in LilyPond by setting @code{doubleSlurs},
1781 @lilypond[verbatim,raggedright,relative,fragment,quote]
1782 \set doubleSlurs = ##t
1783 <c e>4 ( <d f> <c e> <d f> )
1786 Only one slur can be printed at once. If you need to print a long
1787 slur over a few small slurs, please see @ref{Phrasing slurs}.
1793 @cindex @code{\slurUp}
1795 @cindex @code{\slurDown}
1797 @cindex @code{\slurNeutral}
1798 @code{\slurNeutral},
1799 @cindex @code{\slurDashed}
1801 @cindex @code{\slurDotted}
1803 @cindex @code{\slurSolid}
1808 Program reference: @seeinternals{Slur}, and @internalsref{SlurEvent}.
1811 @node Phrasing slurs
1812 @subsection Phrasing slurs
1814 @cindex phrasing slurs
1815 @cindex phrasing marks
1817 A phrasing slur (or phrasing mark) connects chords and is used to
1818 indicate a musical sentence. It is written using @code{\(} and @code{\)}
1821 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
1822 \time 6/4 c'\( d( e) f( e) d\)
1825 Typographically, the phrasing slur behaves almost exactly like a
1826 normal slur. However, they are treated as different objects. A
1827 @code{\slurUp} will have no effect on a phrasing slur; instead, use
1828 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1829 @code{\phrasingSlurNeutral}.
1831 The commands @code{\slurUp}, @code{\slurDown}, and @code{\slurNeutral}
1832 will only affect normal slurs and not phrasing slurs.
1834 You cannot have simultaneous phrasing slurs.
1838 @cindex @code{\phrasingSlurUp}
1839 @code{\phrasingSlurUp},
1840 @cindex @code{\phrasingSlurDown}
1841 @code{\phrasingSlurDown},
1842 @cindex @code{\phrasingSlurNeutral}
1843 @code{\phrasingSlurNeutral}.
1847 Program reference: see also @internalsref{PhrasingSlur}, and
1848 @internalsref{PhrasingSlurEvent}.
1852 Putting phrasing slurs over rests leads to spurious warnings.
1856 @subsection Articulations
1857 @cindex Articulations
1859 @cindex articulations
1863 A variety of symbols can appear above and below notes to indicate
1864 different characteristics of the performance. They are added to a note
1865 by adding a dash and the character signifying the
1866 articulation. They are demonstrated here
1868 @lilypondfile[quote,raggedright]{script-abbreviations.ly}
1870 The meanings of these shorthands can be changed. See
1871 @file{ly/@/script@/-init@/.ly} for examples.
1874 The script is automatically placed, but the direction can be forced as
1875 well. Like other pieces of LilyPond code, @code{_} will place them
1876 below the staff, and @code{^} will place them above.
1879 @lilypond[quote,raggedright,fragment,verbatim]
1883 Other symbols can be added using the syntax
1884 @var{note}@code{\}@var{name}. Again, they
1885 can be forced up or down using @code{^} and @code{_},
1888 @lilypond[quote,raggedright,verbatim,fragment,relative=2]
1889 c\fermata c^\fermata c_\fermata
1896 @cindex staccatissimo
1906 @cindex organ pedal marks
1915 @cindex prallmordent
1919 @cindex thumb marking
1924 Here is a chart showing all scripts available,
1926 @lilypondfile[raggedright,quote]{script-chart.ly}
1929 The vertical ordering of scripts is controlled with the
1930 @code{script-priority} property. The lower this number, the closer it
1931 will be put to the note. In this example, the
1932 @internalsref{TextScript} (the sharp symbol) first has the lowest
1933 priority, so it is put lowest in the first example. In the second, the
1934 prall trill (the @internalsref{Script}) has the lowest, so it is on the
1935 inside. When two objects have the same priority, the order in which
1936 they are entered decides which one comes first.
1939 @lilypond[verbatim,relative=3,raggedright,fragment,quote]
1940 \once \override TextScript #'script-priority = #-100
1941 a4^\prall^\markup { \sharp }
1943 \once \override Script #'script-priority = #-100
1944 a4^\prall^\markup { \sharp }
1952 Program reference: @internalsref{ScriptEvent}, and @internalsref{Script}.
1956 These signs appear in the printed output but have no effect on the
1957 MIDI rendering of the music.
1961 @subsection Dynamics
1974 @cindex @code{\ffff}
1984 Absolute dynamic marks are specified using a command after a note
1985 @code{c4\ff}. The available dynamic marks are @code{\ppp},
1986 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
1987 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
1988 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}
1990 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
1991 c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
1992 c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
2001 A crescendo mark is started with @code{\<} and terminated with
2002 @code{\!} or an absolute dynamic. A decrescendo is started with
2003 @code{\>} and is also terminated with @code{\!} or an absolute
2004 dynamic. Because these marks are bound to notes, you must
2005 use spacer notes if multiple marks are needed during one note
2007 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2009 << f1 { s4 s4\< s4\! \> s4\! } >>
2011 This may give rise to very short hairpins. Use @code{minimum-length}
2012 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2016 \override Staff.Hairpin #'minimum-length = #5
2019 You can also use a text saying @emph{cresc.} instead of hairpins. Here
2020 is an example how to do it
2022 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2036 You can also supply your own texts
2037 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2038 \set crescendoText = \markup { \italic "cresc. poco" }
2039 \set crescendoSpanner = #'dashed-line
2045 To create new dynamic marks or text that should be aligned
2046 with dynamics, see @ref{New dynamic marks}.
2051 @cindex @code{\dynamicUp}
2053 @cindex @code{\dynamicDown}
2054 @code{\dynamicDown},
2055 @cindex @code{\dynamicNeutral}
2056 @code{\dynamicNeutral}.
2058 @cindex direction, of dynamics
2062 Program reference: @internalsref{CrescendoEvent},
2063 @internalsref{DecrescendoEvent}, and
2064 @internalsref{AbsoluteDynamicEvent}.
2066 Dynamics are @internalsref{DynamicText} and @internalsref{Hairpin}
2067 objects. Vertical positioning of these symbols is handled by the
2068 @internalsref{DynamicLineSpanner} object.
2071 @subsection Breath marks
2073 Breath marks are entered using @code{\breathe}
2076 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2080 The glyph of the breath mark can be tuned by overriding the
2081 @code{text} property of the @code{BreathingSign} layout object with
2082 any markup text. For example,
2083 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
2085 \override BreathingSign #'text
2086 = #(make-musicglyph-markup "scripts.rvarcomma")
2093 Program reference: @internalsref{BreathingSign},
2094 @internalsref{BreathingSignEvent}.
2096 Examples: @inputfileref{input/@/regression,breathing@/-sign@/.ly}.
2099 @node Running trills
2100 @subsection Running trills
2102 Long running trills are made with @code{\startTrillSpan} and
2103 @code{\stopTrillSpan},
2106 @lilypond[verbatim,raggedright,relative=2,quote,fragment]
2108 << { c1 \startTrillSpan }
2109 { s2. \grace { d16[\stopTrillSpan e] } } >>
2115 @code{\startTrillSpan},
2116 @cindex @code{\startTrillSpan}
2117 @code{\stopTrillSpan}.
2118 @cindex @code{\stopTrillSpan}
2122 Program reference: @internalsref{TrillSpanner},
2123 @internalsref{TrillSpanEvent}.
2129 @subsection Glissando
2132 @cindex @code{\glissando}
2134 A glissando is a smooth change in pitch. It is denoted by a line or a
2135 wavy line between two notes. It is requested by attaching
2136 @code{\glissando} to a note
2138 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2144 Program reference: @internalsref{Glissando}, and @internalsref{GlissandoEvent}.
2146 Example files: @file{input/@/regression/@/glissando@/.ly}.
2152 Printing text over the line (such as @emph{gliss.}) is not supported.
2156 @subsection Arpeggio
2159 @cindex broken chord
2160 @cindex @code{\arpeggio}
2162 You can specify an arpeggio sign (also known as broken chord) on a
2163 chord by attaching an @code{\arpeggio} to a chord
2166 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2170 When an arpeggio crosses staves, you attach an arpeggio to the chords
2171 in both staves, and set
2172 @internalsref{PianoStaff}.@code{connectArpeggios}
2174 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2175 \context PianoStaff <<
2176 \set PianoStaff.connectArpeggios = ##t
2177 \new Staff { <c' e g c>\arpeggio }
2178 \new Staff { \clef bass <c,, e g>\arpeggio }
2182 The direction of the arpeggio is sometimes denoted by adding an
2183 arrowhead to the wiggly line
2185 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2194 A square bracket on the left indicates that the player should not
2195 arpeggiate the chord
2197 @c todo: ugh, lousy typography. Look for real example. --hwn
2199 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2207 @cindex @code{\arpeggioUp}
2209 @cindex @code{\arpeggioDown}
2210 @code{\arpeggioDown},
2211 @cindex @code{\arpeggioNeutral}
2212 @code{\arpeggioNeutral},
2213 @cindex @code{\arpeggioBracket}
2214 @code{\arpeggioBracket}.
2218 Notation manual: @ref{Ties}, for writing out arpeggios.
2220 Program reference: @internalsref{ArpeggioEvent},
2221 @internalsref{Arpeggio}.
2227 It is not possible to mix connected arpeggios and unconnected
2228 arpeggios in one @internalsref{PianoStaff} at the same point in time.
2235 Polyphony in music refers to having more than one voice occuring in
2236 a piece of music. Polyphony in LilyPond refers to having more than
2237 one voice on the same staff.
2241 * Explicitly instantiating voices::
2242 * Collision Resolution::
2245 @node Basic polyphony
2246 @subsection Basic polyphony
2249 The easiest way to enter fragments with more than one voice on a staff
2250 is to enter each voice as a sequence (with @code{@{...@}}), and combine
2251 them simultaneously, separating the voices with @code{\\}
2255 @lilypond[quote,verbatim,fragment]
2256 \new Staff \relative c' {
2258 << { g4 f e | d2 e2 } \\
2259 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
2265 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
2266 voices are sometimes called ``layers'' in other notation packages}
2268 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
2269 each of these contexts, vertical direction of slurs, stems, etc., is set
2272 These voices are all seperate from the voice that contains the notes just
2273 outside the @code{<< \\ >>} construct. This should be noted when making
2274 changes at the voice level. This also means that slurs and ties cannot go
2275 into or out of a @code{<< \\ >>} construct.
2276 Conversely, parallel voices from separate @code{<< \\ >>} constructs on the
2277 same staff are the the same voice.
2278 Here is the same example, with different noteheads for each voice.
2279 Note that the change to the note-head style in the main voice does not affect
2280 the inside of the @code{<< \\ >>} constructs. Also, the change to the second
2281 voice in the first @code{<< \\ >>} construct is effective in the second
2282 @code{<< \\ >>}, and the voice is tied accross the two constructs.
2284 @lilypond[quote,verbatim,fragment]
2285 \new Staff \relative c' {
2286 \override NoteHead #'style = #'cross
2290 { \override NoteHead #'style = #'triangle
2296 { c8 b16 a b8 g ~ g2 } \\
2297 { \override NoteHead #'style = #'slash s4 b4 c2 }
2302 Polyphony does not change the relationship of notes within a
2303 @code{\relative @{ @}} block. Each note is calculated relative
2304 to the note immediately preceding it.
2307 \relative @{ noteA << noteB \\ noteC >> noteD @}
2310 @code{noteC} is relative to @code{noteB}, not @code{noteA};
2311 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
2314 @node Explicitly instantiating voices
2315 @subsection Explicitly instantiating voices
2317 @internalsref{Voice} contexts can also also be instantiated manually
2318 inside a @code{<< >>} block to create polyphonic music, using
2319 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
2320 and a horizontal shift for each part.
2324 << \upper \\ \lower >>
2332 \context Voice = "1" @{ \voiceOne \upper @}
2333 \context Voice = "2" @{ \voiceTwo \lower @}
2337 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
2338 articulations, text annotations, augmentation dots of dotted
2339 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
2340 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
2341 make them point downwards.
2342 The command @code{\oneVoice} will revert back to the normal setting.
2344 An expression that appears directly inside a @code{<< >>} belongs to
2345 the main voice. This is useful when extra voices appear while the main
2346 voice is playing. Here is a more correct rendition of the example from
2347 the previous section. The crossed noteheads demonstrate that the main
2348 melody is now in a single voice context.
2350 @lilypond[quote,raggedright,verbatim]
2351 \new Staff \relative c' {
2352 \override NoteHead #'style = #'cross
2357 \context Voice="1" { \voiceTwo
2358 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2361 \new Voice { \voiceThree
2370 The correct definition of the voices allows the melody to be slurred.
2371 @lilypond[quote,raggedright,verbatim]
2372 \new Staff \relative c' {
2377 \context Voice="1" { \voiceTwo
2378 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2381 \new Voice { \voiceThree
2390 Avoiding the @code{\\} seperator also allows nesting polyphony
2391 constructs, which in some case might be a more natural way to typeset
2394 @lilypond[quote,raggedright,verbatim]
2395 \new Staff \relative c' {
2400 \context Voice="1" { \voiceTwo
2403 {c8 b16 a b8 g ~ g2}
2404 \new Voice { \voiceThree
2416 @node Collision Resolution
2417 @subsection Collision Resolution
2419 Normally, note heads with a different number of dots are not merged, but
2420 when the object property @code{merge-differently-dotted} is set in
2421 the @internalsref{NoteCollision} object, they are merged
2422 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
2425 \override Staff.NoteCollision
2426 #'merge-differently-dotted = ##t
2428 } \\ { g8.[ f16] g8.[ f16] } >>
2431 Similarly, you can merge half note heads with eighth notes, by setting
2432 @code{merge-differently-headed}
2433 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2436 \override Staff.NoteCollision
2437 #'merge-differently-headed = ##t
2438 c8 c4. } \\ { c2 c2 } >>
2441 LilyPond also vertically shifts rests that are opposite of a stem,
2444 @lilypond[quote,raggedright,fragment,verbatim]
2445 \context Voice << c''4 \\ r4 >>
2453 @cindex @code{\oneVoice}
2455 @cindex @code{\voiceOne}
2457 @cindex @code{\voiceTwo}
2459 @cindex @code{\voiceThree}
2461 @cindex @code{\voiceFour}
2466 @cindex @code{\shiftOn}
2468 @cindex @code{\shiftOnn}
2470 @cindex @code{\shiftOnnn}
2472 @cindex @code{\shiftOff}
2473 @code{\shiftOff}: these commands specify in what chords of the current
2474 voice should be shifted. The outer voices (normally: voice one and
2475 two) have @code{\shiftOff}, while the inner voices (three and four)
2476 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
2477 further shift levels.
2480 When LilyPond cannot cope, the @code{force-hshift}
2481 property of the @internalsref{NoteColumn} object and pitched rests can
2482 be used to override typesetting decisions.
2484 @lilypond[quote,verbatim,raggedright]
2491 \once \override NoteColumn #'force-hshift = #1.7
2500 Program reference: the objects responsible for resolving collisions are
2501 @internalsref{NoteCollision} and @internalsref{RestCollision}.
2504 @inputfileref{input/@/regression,collision@/-dots@/.ly},
2505 @inputfileref{input/@/regression,collision@/-head-chords@/.ly},
2506 @inputfileref{input/@/regression,collision@/-heads@/.ly},
2507 @inputfileref{input/@/regression,collision@/-mesh@/.ly}, and
2508 @inputfileref{input/@/regression,collisions@/.ly}.
2514 When using @code{merge-differently-headed} with an upstem eighth or a
2515 shorter note, and a downstem half note, the eighth note gets the wrong
2518 There is no support for clusters where the same note occurs with
2519 different accidentals in the same chord. In this case, it is
2520 recommended to use enharmonic transcription, or to use special cluster
2521 notation (see @ref{Clusters}).
2528 Repetition is a central concept in music, and multiple notations exist
2534 * Repeats and MIDI::
2535 * Manual repeat commands::
2537 * Tremolo subdivisions::
2542 @subsection Repeat types
2545 @cindex @code{\repeat}
2547 The following types of repetition are supported
2551 Repeated music is fully written (played) out. This is useful when
2552 entering repetitious music. This is the only kind of repeat that
2553 is included in MIDI output.
2556 Repeats are not written out, but alternative endings (volte) are
2557 printed, left to right with brackets. This is the standard notation
2558 for repeats with alternatives. These are not played in MIDI output by default.
2562 Alternative endings are written stacked. This has limited use but may be
2563 used to typeset two lines of lyrics in songs with repeats, see
2564 @inputfileref{input,star-spangled-banner@/.ly}.
2569 Make tremolo beams. These are not played in MIDI output by default.
2572 Make beat or measure repeats. These look like percent signs. These
2573 are not played in MIDI output by default. Percent repeats must be
2574 declared within a Voice context.
2579 @subsection Repeat syntax
2582 LilyPond has one syntactic construct for specifying different types of
2583 repeats. The syntax is
2586 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2589 If you have alternative endings, you may add
2590 @cindex @code{\alternative}
2592 \alternative @{ @var{alternative1}
2594 @var{alternative3} @dots{} @}
2596 where each @var{alternative} is a music expression. If you do not
2597 give enough alternatives for all of the repeats, the first alternative
2598 is assumed to be played more than once.
2600 Standard repeats are used like this
2601 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2603 \repeat volta 2 { c4 d e f }
2604 \repeat volta 2 { f e d c }
2607 With alternative endings
2608 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2610 \repeat volta 2 {c4 d e f}
2611 \alternative { {d2 d} {f f,} }
2615 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2618 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2619 \alternative { { g4 g g } { a | a a a a | b2. } }
2623 It is possible to shorten volta brackets
2624 by setting @code{voltaSpannerDuration}. In the next example, the
2625 bracket only lasts one measure, which is a duration of 3/4.
2629 @lilypond[verbatim,raggedright,quote]
2633 \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2634 \repeat "volta" 5 { d d d }
2635 \alternative { { e e e f f f }
2645 Brackets for the repeat are normally only printed over the topmost
2646 staff. This can be adjusted by setting the @code{voltaOnThisStaff}
2647 property; see @inputfileref{input/@/regression,volta@/-multi@/-staff@/.ly}.
2650 @c @inputfileref{input/@/regression,volta@/-chord@/-names@/.ly}.
2655 A nested repeat like
2664 is ambiguous, since it is is not clear to which @code{\repeat} the
2665 @code{\alternative} belongs. This ambiguity is resolved by always
2666 having the @code{\alternative} belong to the inner @code{\repeat}.
2667 For clarity, it is advisable to use braces in such situations.
2672 Timing information is not remembered at the start of an alternative,
2673 so after a repeat timing information must be reset by hand, for
2674 example by setting @code{Score.measurePosition} or entering
2675 @code{\partial}. Similarly, slurs or ties are also not repeated.
2680 @node Repeats and MIDI
2681 @subsection Repeats and MIDI
2683 @cindex expanding repeats
2685 With a little bit of tweaking, all types of repeats can be present
2686 in the MIDI output. This is achieved by applying the
2687 @code{\unfoldrepeats} music function. This functions changes all
2688 repeats to unfold repeats.
2690 @lilypond[quote,verbatim,fragment,linewidth=8.0\cm]
2692 \repeat tremolo 8 {c'32 e' }
2693 \repeat percent 2 { c''8 d'' }
2694 \repeat volta 2 {c'4 d' e' f'}
2703 When creating a score file using @code{\unfoldrepeats} for midi, then
2704 it is necessary to make two @code{\score} blocks. One for MIDI (with
2705 unfolded repeats) and one for notation (with volta, tremolo, and
2706 percent repeats). For example,
2714 \unfoldrepeats @var{..music..}
2719 @node Manual repeat commands
2720 @subsection Manual repeat commands
2722 @cindex @code{repeatCommands}
2724 The property @code{repeatCommands} can be used to control the layout of
2725 repeats. Its value is a Scheme list of repeat commands.
2728 @item @code{start-repeat}
2729 Print a @code{|:} bar line.
2731 @item @code{end-repeat}
2732 Print a @code{:|} bar line.
2734 @item @code{(volta @var{text})}
2735 Print a volta bracket saying @var{text}: The text can be specified as
2736 a text string or as a markup text, see @ref{Text markup}. Do not
2737 forget to change the font, as the default number font does not contain
2738 alphabetic characters;
2740 @item @code{(volta #f)}
2741 Stop a running volta bracket.
2744 @lilypond[quote,raggedright,verbatim,fragment,relative=2]
2746 \set Score.repeatCommands = #'((volta "93") end-repeat)
2748 \set Score.repeatCommands = #'((volta #f))
2756 Program reference: @internalsref{VoltaBracket}, @internalsref{RepeatedMusic},
2757 @internalsref{VoltaRepeatedMusic},
2758 @internalsref{UnfoldedRepeatedMusic}, and
2759 @internalsref{FoldedRepeatedMusic}.
2761 @node Tremolo repeats
2762 @subsection Tremolo repeats
2763 @cindex tremolo beams
2765 To place tremolo marks between notes, use @code{\repeat} with tremolo
2767 @lilypond[quote,verbatim,raggedright]
2768 \new Voice \relative c' {
2769 \repeat "tremolo" 8 { c16 d16 }
2770 \repeat "tremolo" 4 { c16 d16 }
2771 \repeat "tremolo" 2 { c16 d16 }
2775 Tremolo marks can also be put on a single note. In this case, the
2776 note should not be surrounded by braces.
2777 @lilypond[quote,verbatim,raggedright]
2778 \repeat "tremolo" 4 c'16
2781 Similar output is obtained using the tremolo subdivision, described in
2782 @ref{Tremolo subdivisions}.
2786 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
2788 Program reference: tremolo beams are @internalsref{Beam} objects. Single stem
2789 tremolos are @internalsref{StemTremolo} objects. The music expression is
2790 @internalsref{TremoloEvent}.
2792 Example files: @inputfileref{input/@/regression,chord@/-tremolo@/.ly},
2793 @inputfileref{input/@/regression,stem@/-tremolo@/.ly}.
2795 @node Tremolo subdivisions
2796 @subsection Tremolo subdivisions
2797 @cindex tremolo marks
2798 @cindex @code{tremoloFlags}
2800 Tremolo marks can be printed on a single note by adding
2801 `@code{:}[@var{number}]' after the note. The number indicates the
2802 duration of the subdivision, and it must be at least 8. A
2803 @var{length} value of 8 gives one line across the note stem. If the
2804 length is omitted, the last value (stored in @code{tremoloFlags}) is
2807 @lilypond[quote,raggedright,verbatim,fragment]
2808 c'2:8 c':32 | c': c': |
2811 @c [TODO: stok is te kort bij 32en]
2812 @c somebody want to translate that into English?
2813 @c `Stem is too short for 32nds' (wl)
2817 Tremolos entered in this way do not carry over into the MIDI output.
2821 In this manual: @ref{Tremolo repeats}.
2823 Elsewhere: @internalsref{StemTremolo}, @internalsref{TremoloEvent}.
2825 @node Measure repeats
2826 @subsection Measure repeats
2828 @cindex percent repeats
2829 @cindex measure repeats
2831 In the @code{percent} style, a note pattern can be repeated. It is
2832 printed once, and then the pattern is replaced with a special sign.
2833 Patterns of one and two measures are replaced by percent-like signs,
2834 patterns that divide the measure length are replaced by slashes.
2835 Percent repeats must be declared within a @code{Voice} context.
2837 @lilypond[quote,verbatim,raggedright]
2838 \new Voice \relative c' {
2839 \repeat "percent" 4 { c4 }
2840 \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
2846 Program reference: @internalsref{RepeatSlash}, @internalsref{PercentRepeat},
2847 @internalsref{PercentRepeatedMusic}, and
2848 @internalsref{DoublePercentRepeat}.