1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
4 @c A menu is needed before every deeper *section nesting of @node's; run
5 @c M-x texinfo-all-menus-update
6 @c to automatically fill in these menus before saving changes
9 @chapter Basic notation
11 This chapter explains how to use basic notation features.
16 * Multiple notes at once::
28 This section discusses how to specify the pitch of notes.
33 * Cautionary accidentals::
35 * Notes names in other languages::
45 @subsection Normal pitches
50 A pitch name is specified using lowercase letters @code{a} through @code{g}.
51 An ascending C-major scale is engraved with
53 @lilypond[quote,fragment,verbatim,ragged-right]
58 The note name @code{c} is engraved one octave below middle C.
60 @lilypond[quote,fragment,verbatim,ragged-right]
70 The optional octave specification takes the form of a series of
71 single quote (`@code{'}') characters or a series of comma
72 (`@code{,}') characters. Each @code{'} raises the pitch by one
73 octave; each @code{,} lowers the pitch by an octave.
75 @lilypond[quote,ragged-right,fragment,verbatim]
77 c' c'' e' g d'' d' d c
79 c, c,, e, g d,, d, d c
82 An alternate method may be used to declare which octave to
83 engrave a pitch; this method does not require as many
84 octave specifications (@code{'} and @code{,}). See
85 @ref{Relative octaves}.
89 @subsection Accidentals
91 @cindex note names, Dutch
92 @cindex note names, default
94 A sharp is formed by adding @code{-is} to the end of a pitch name and
95 a flat is formed by adding @code{-es}
97 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
101 Double sharps and double flats
102 are obtained by adding @code{-isis} or @code{-eses} to a note name. These
103 are the Dutch note names. In Dutch, @code{aes} is contracted to
104 @code{as}, but both forms are accepted. Similarly, both
105 @code{es} and @code{ees} are accepted
107 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
111 A natural will cancel the effect of an accidental or key signature.
112 However, naturals are not encoded into the note name syntax with a
113 suffix; a natural pitch is shown as a simple note name
115 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
122 In accordance with standard typesetting rules, a natural sign is printed
123 before a sharp or flat if a previous accidental needs to be
124 cancelled. To change this behavior, use
125 @code{\set Staff.extraNatural = ##f}
127 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
129 \set Staff.extraNatural = ##f
136 Program reference: @internalsref{LedgerLineSpanner},
137 @internalsref{NoteHead}.
140 @node Cautionary accidentals
141 @subsection Cautionary accidentals
143 @cindex accidental, reminder
144 @cindex accidental, cautionary
145 @cindex accidental, parenthesized
146 @cindex reminder accidental
148 @cindex cautionary accidental
149 @cindex parenthesized accidental
152 Normally accidentals are printed automatically, but you may also
153 print them manually. A reminder accidental
154 can be forced by adding an exclamation mark @code{!}
155 after the pitch. A cautionary accidental
156 (i.e., an accidental within parentheses) can be obtained by adding the
157 question mark `@code{?}' after the pitch. These extra accidentals
158 can be used to produce natural signs, too.
160 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
161 cis cis cis! cis? c c? c! c
167 The automatic production of accidentals can be tuned in many
168 ways. For more information, see @ref{Automatic accidentals}.
172 @subsection Micro tones
174 @cindex quarter tones
175 @cindex semi-flats, semi-sharps
177 Half-flats and half-sharps are formed by adding @code{-eh} and
178 @code{-ih}; the following is a series of Cs with increasing pitches
180 @lilypond[verbatim,ragged-right,quote,relative=2,fragment]
181 \set Staff.extraNatural = ##f
185 Micro tones are also exported to the MIDI file.
190 There are no generally accepted standards for denoting
191 three-quarter flats, so LilyPond's symbol does not conform to any
195 @node Notes names in other languages
196 @subsection Notes names in other languages
198 There are predefined sets of note names for various other languages.
199 To use them, include the language specific init file. For
200 example, add @code{\include "english.ly"} to the top of the input
201 file. The available language files
202 and the note names they define are
204 @c what about micro-tunes, double-sharps, and double-flats? add
205 @c more clumns to the table?
206 @c Oh, and should this be made into a multitable?
207 @cindex note names, other languages
209 Note Names sharp flat
210 nederlands.ly c d e f g a bes b -is -es
211 english.ly c d e f g a bf b -s/-sharp -f/-flat
213 deutsch.ly c d e f g a b h -is -es
214 norsk.ly c d e f g a b h -iss/-is -ess/-es
215 svenska.ly c d e f g a b h -iss -ess
216 italiano.ly do re mi fa sol la sib si -d -b
217 catalan.ly do re mi fa sol la sib si -d/-s -b
218 espanol.ly do re mi fa sol la sib si -s -b
222 @node Relative octaves
223 @subsection Relative octaves
226 @cindex Relative octave specification
229 Octaves are specified by adding @code{'} and @code{,} to pitch names.
230 When you copy existing music, it is easy to accidentally put a pitch
231 in the wrong octave and hard to find such an error. The relative
232 octave mode prevents these errors by making the mistakes much
233 larger: a single error puts the rest of the piece off by one octave
236 \relative @var{startpitch} @var{musicexpr}
243 \relative @var{musicexpr}
247 @code{c'} is used as the default if no starting pitch is defined.
249 The octave of notes that appear in @var{musicexpr} are calculated as
250 follows: if no octave changing marks are used, the basic interval
251 between this and the last note is always taken to be a fourth or
252 less. This distance is determined without regarding alterations; a
253 @code{fisis} following a @code{ceses} will be put above the
254 @code{ceses}. In other words, a doubly-augmented fourth is considered
255 a smaller interval than a diminished fifth, even though the
256 doubly-augmented fourth spans seven semitones while the diminished
257 fifth only spans six semitones.
259 The octave changing marks @code{'} and @code{,} can be added to raise
260 or lower the pitch by an extra octave. Upon entering relative mode,
261 an absolute starting pitch can be specified that will act as the
262 predecessor of the first note of @var{musicexpr}. If no starting pitch
263 is specified, then middle C is used as a start.
265 Here is the relative mode shown in action
266 @lilypond[quote,fragment,ragged-right,verbatim]
272 Octave changing marks are used for intervals greater than a fourth
273 @lilypond[quote,ragged-right,fragment,verbatim]
279 If the preceding item is a chord, the first note of the chord is used
280 to determine the first note of the next chord
282 @lilypond[quote,ragged-right,fragment,verbatim]
290 The pitch after the @code{\relative} contains a note name.
292 The relative conversion will not affect @code{\transpose},
293 @code{\chordmode} or @code{\relative} sections in its argument. To use
294 relative within transposed music, an additional @code{\relative} must
295 be placed inside @code{\transpose}.
299 @subsection Octave check
303 Octave checks make octave errors easier to correct: a note may be
304 followed by @code{=}@var{quotes} which indicates what its absolute
305 octave should be. In the following example,
308 \relative c'' @{ c='' b=' d,='' @}
312 the @code{d} will generate a warning, because a @code{d''} is expected
313 (because @code{b'} to @code{d''} is only a third), but a @code{d'} is
314 found. In the output, the octave is corrected to be a @code{d''} and
315 the next note is calculated relative to @code{d''} instead of @code{d'}.
317 There is also an octave check that produces no visible output. The syntax
323 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
324 quotes) in @code{\relative} mode. If not, a warning is printed, and the
325 octave is corrected. The @var{pitch} is not printed as a note.
327 In the example below, the first check passes without incident, since
328 the @code{e} (in relative mode) is within a fifth of @code{a'}. However,
329 the second check produces a warning, since the @code{e} is not within
330 a fifth of @code{b'}. The warning message is printed, and the octave
331 is adjusted so that the following notes are in the correct octave
343 The octave of a note following an octave check is determined with
344 respect to the note preceding it. In the next fragment, the last note
345 is an @code{a'}, above middle C. That means that the @code{\octave}
346 check passes successfully, so the check could be deleted without changing
347 the output of the piece.
349 @lilypond[quote,ragged-right,verbatim,fragment]
359 @subsection Transpose
362 @cindex Transposition of pitches
365 A music expression can be transposed with @code{\transpose}. The
368 \transpose @var{from} @var{to} @var{musicexpr}
371 This means that @var{musicexpr} is transposed by the interval between
372 the pitches @var{from} and @var{to}: any note with pitch @code{from}
373 is changed to @code{to}.
375 For example, consider a piece written in the key of D-major. If
376 this piece is a little too low for its performer, it can be
377 transposed up to E-major with
379 \transpose d e @dots{}
382 Consider a part written for violin (a C instrument). If
383 this part is to be played on the A clarinet (for which an
384 A is notated as a C, and which sounds a minor third lower
385 than notated), the following
386 transposition will produce the appropriate part
389 \transpose a c @dots{}
392 @code{\transpose} distinguishes between enharmonic pitches: both
393 @code{\transpose c cis} or @code{\transpose c des} will transpose up
394 half a tone. The first version will print sharps and the second
395 version will print flats
397 @lilypond[quote,ragged-right,verbatim]
398 mus = { \key d \major cis d fis g }
407 @code{\transpose} may also be used to input written notes for a
408 transposing instrument. Pitches are normally entered into LilyPond
409 in C (or ``concert pitch''), but they may be entered in another
410 key. For example, when entering music for a B-flat trumpet which
411 begins on concert D, one would write
414 \transpose c bes @{ e4 @dots{} @}
417 To print this music in B-flat again (i.e., producing a trumpet part,
418 instead of a concert pitch conductor's score) you would wrap the
419 existing music with another @code{transpose}
422 \transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @}
428 Program reference: @internalsref{TransposedMusic}.
433 If you want to use both @code{\transpose} and @code{\relative},
434 you must put @code{\transpose} outside of @code{\relative}, since
435 @code{\relative} will have no effect music that appears inside a
446 Rests are entered like notes with the note name @code{r}
448 @lilypond[fragment,quote,ragged-right,verbatim]
452 Whole bar rests, centered in middle of the bar,
453 must be done with multi-measure rests. They can be used for a
454 single bar as well as many bars, and are discussed in
455 @ref{Multi measure rests}.
457 To explicitly specify a rest's vertical position, write a note
458 followed by @code{\rest}. A rest will be placed in the position
459 where the note would appear,
461 @lilypond[fragment,quote,ragged-right,verbatim]
466 This makes manual formatting of
467 polyphonic music much easier, since the automatic rest collision
468 formatter will leave these rests alone.
472 Program reference: @internalsref{Rest}.
479 @cindex Invisible rest
484 An invisible rest (also called a `skip') can be entered like a note
485 with note name `@code{s}' or with @code{\skip @var{duration}}
487 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
488 a4 a4 s4 a4 \skip 1 a4
491 The @code{s} syntax is only available in note mode and chord mode. In
492 other situations, for example, when entering lyrics, you should use
493 the @code{\skip} command
495 @lilypond[quote,ragged-right,verbatim]
498 \new Lyrics \lyricmode { \skip 2 bla2 }
502 The skip command is merely an empty musical placeholder. It does not
503 produce any output, not even transparent output.
505 The @code{s} skip command does create @internalsref{Staff} and
506 @internalsref{Voice} when necessary, similar to note and rest
507 commands. For example, the following results in an empty staff.
509 @lilypond[quote,ragged-right,verbatim]
513 The fragment @code{@{ \skip 4 @} } would produce an empty page.
517 Program reference: @internalsref{SkipMusic}.
524 This section discusses rhythms, durations, and bars.
528 * Augmentation dots::
530 * Scaling durations::
533 * Automatic note splitting::
538 @subsection Durations
545 In Note, Chord, and Lyrics mode, durations are designated by numbers and
546 dots: durations are entered as their reciprocal values. For example, a
547 quarter note is entered using a @code{4} (since it is a 1/4 note), while
548 a half note is entered using a @code{2} (since it is a 1/2 note). For
549 notes longer than a whole you must use the variables @code{\longa} and
554 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
556 r1 r2 r4 r8 r16 r32 r64 r64
562 a\breve*1/2 \autoBeamOff
563 a1 a2 a4 a8 a16 a32 a64 a64
566 r\longa*1/4 r\breve *1/2
567 r1 r2 r4 r8 r16 r32 r64 r64
573 \remove "Clef_engraver"
574 \override StaffSymbol #'transparent = ##t
575 \override TimeSignature #'transparent = ##t
576 \override BarLine #'transparent = ##t
577 \consists "Pitch_squash_engraver"
583 If the duration is omitted then it is set to the previously entered
584 duration. The default for the first note is a quarter note.
586 @lilypond[quote,ragged-right,verbatim,fragment]
587 { a a a2 a a4 a a1 a }
591 @node Augmentation dots
592 @subsection Augmentation dots
596 To obtain dotted note lengths, simply add a dot (`@code{.}') to
597 the number. Double-dotted notes are produced in a similar way.
599 @lilypond[quote,ragged-right,fragment,verbatim]
600 a'4 b' c''4. b'8 a'4. b'4.. c''8.
605 Dots are normally moved up to avoid staff lines, except in polyphonic
606 situations. The following commands may be used to force a particular
613 @funindex \dotsNeutral
618 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}.
628 Tuplets are made out of a music expression by multiplying all durations
632 \times @var{fraction} @var{musicexpr}
636 The duration of @var{musicexpr} will be multiplied by the fraction.
637 The fraction's denominator will be printed over the notes, optionally
638 with a bracket. The most common tuplet is the triplet in which 3
639 notes have the length of 2, so the notes are 2/3 of their written
642 @lilypond[quote,ragged-right,fragment,verbatim]
643 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
646 Tuplets may be nested, for example,
648 @lilypond[fragment,ragged-right,verbatim,relative=2]
649 \set tupletNumberFormatFunction = #fraction-tuplet-formatter
652 \times 3/5 { a a a a a }
660 @funindex \tupletDown
662 @funindex \tupletNeutral
663 @code{\tupletNeutral}.
668 @funindex tupletNumberFormatFunction
669 @cindex tuplet formatting
671 The property @code{tupletSpannerDuration} specifies how long each
672 bracket should last. With this, you can make lots of tuplets while
673 typing @code{\times} only once, thus saving lots of typing. In the next
674 example, there are two triplets shown, while @code{\times} was only
677 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
678 \set tupletSpannerDuration = #(ly:make-moment 1 4)
679 \times 2/3 { c8 c c c c c }
683 For more information about @code{make-moment}, see
684 @ref{Time administration}.
686 The format of the number is determined by the property
687 @code{tupletNumberFormatFunction}. The default prints only the
688 denominator, but if it is set to the Scheme function
689 @code{fraction-tuplet-formatter}, @var{num}:@var{den} will be printed
692 To avoid printing tuplet numbers, use
694 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
695 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
696 \override TupletNumber #'transparent = ##t
697 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
703 Program reference: @internalsref{TupletBracket},
704 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
706 Examples: @inputfileref{input/@/regression,tuplet@/-nest@/.ly}.
710 @node Scaling durations
711 @subsection Scaling durations
713 You can alter the length of duration by a fraction @var{N/M}
714 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
715 will not affect the appearance of the notes or rests produced.
717 In the following example, the first three notes take up exactly two
718 beats, but no triplet bracket is printed.
719 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
721 a4*2/3 gis4*2/3 a4*2/3
729 This manual: @ref{Tuplets}
733 @subsection Bar check
736 @funindex barCheckSynchronize
739 Bar checks help detect errors in the durations. A bar check is
740 entered using the bar symbol, `@code{|}'. Whenever it is encountered
741 during interpretation, it should fall on a measure boundary. If it
742 does not, a warning is printed. In the next example, the second bar
743 check will signal an error
745 \time 3/4 c2 e4 | g2 |
748 Bar checks can also be used in lyrics, for example
753 Twin -- kle | Twin -- kle
757 Failed bar checks are caused by entering incorrect
758 durations. Incorrect durations often completely garble up the score,
759 especially if the score is polyphonic, so a good place to start correcting
760 input is by scanning for failed bar checks and incorrect durations.
765 It is also possible to redefine the meaning of @code{|}. This is done
766 by assigning a music expression to @code{pipeSymbol},
768 @lilypond[quote,ragged-right,verbatim]
769 pipeSymbol = \bar "||"
775 @node Barnumber check
776 @subsection Barnumber check
778 When copying large pieces of music, it can be helpful to check that
779 the LilyPond bar number corresponds to the original that you are
780 entering from. This can be checked with @code{\barNumberCheck}, for
788 will print a warning if the @code{currentBarNumber} is not 123 when it
792 @node Automatic note splitting
793 @subsection Automatic note splitting
795 Long notes can be converted automatically to tied notes. This is done
796 by replacing the @internalsref{Note_heads_engraver} by the
797 @internalsref{Completion_heads_engraver}.
798 In the following examples, notes crossing the bar line are split and tied.
800 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
802 \remove "Note_heads_engraver"
803 \consists "Completion_heads_engraver"
805 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
809 This engraver splits all running notes at the bar line, and inserts
810 ties. One of its uses is to debug complex scores: if the measures are
811 not entirely filled, then the ties exactly show how much each measure
817 Not all durations (especially those containing tuplets) can be
818 represented exactly with normal notes and dots, but the engraver will
821 @code{Completion_heads_engraver} only affects notes; it does not split
827 Examples: @inputfileref{input/@/regression,completion@/-heads@/.ly}.
831 Program reference: @internalsref{Completion_heads_engraver}.
834 @node Multiple notes at once
835 @section Multiple notes at once
837 Polyphony in music refers to having more than one voice occurring in
838 a piece of music. Polyphony in LilyPond refers to having more than
839 one voice on the same staff.
845 * Explicitly instantiating voices::
846 * Collision Resolution::
855 A chord is formed by a enclosing a set of pitches in @code{<} and
856 @code{>}. A chord may be followed by a duration, and a set of
857 articulations, just like simple notes
859 @lilypond[verbatim,ragged-right,fragment,quote,relative=1]
863 For more information about chords, see @ref{Chord names}.
869 Whenever a note is found, a @internalsref{Stem} object is created
870 automatically. For whole notes and rests, they are also created but
879 @funindex \stemNeutral
885 To change the direction of stems in the middle of the staff, use
887 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
889 \override Stem #'neutral-direction = #up
891 \override Stem #'neutral-direction = #down
896 @node Basic polyphony
897 @subsection Basic polyphony
901 The easiest way to enter fragments with more than one voice on a staff
902 is to enter each voice as a sequence (with @code{@{...@}}), and combine
903 them simultaneously, separating the voices with @code{\\}
907 @lilypond[quote,verbatim,fragment]
908 \new Staff \relative c' {
911 { g4 f e | d2 e2 } \\
912 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
918 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
919 voices are sometimes called ``layers'' in other notation packages}
921 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
922 each of these contexts, vertical direction of slurs, stems, etc., is set
925 These voices are all separate from the voice that contains the notes just
926 outside the @code{<< \\ >>} construct. This should be noted when making
927 changes at the voice level. This also means that slurs and ties cannot go
928 into or out of a @code{<< \\ >>} construct. Conversely, parallel voices
929 from separate @code{<< \\ >>} constructs on the same staff are the the
930 same voice. Here is the same example, with different noteheads for each
931 voice. Note that the change to the note-head style in the main voice does
933 the inside of the @code{<< \\ >>} constructs. Also, the change to the
935 voice in the first @code{<< \\ >>} construct is effective in the second
936 @code{<< \\ >>}, and the voice is tied across the two constructs.
938 @cindex note heads, styles
940 @lilypond[quote,verbatim,fragment]
941 \new Staff \relative c' {
942 \override NoteHead #'style = #'cross
946 { \override NoteHead #'style = #'triangle
951 { c8 b16 a b8 g ~ g2 } \\
952 { \override NoteHead #'style = #'slash s4 b4 c2 }
957 Polyphony does not change the relationship of notes within a
958 @code{\relative @{ @}} block. Each note is calculated relative
959 to the note immediately preceding it.
962 \relative @{ noteA << noteB \\ noteC >> noteD @}
965 @code{noteC} is relative to @code{noteB}, not @code{noteA};
966 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
969 @node Explicitly instantiating voices
970 @subsection Explicitly instantiating voices
972 @internalsref{Voice} contexts can also be instantiated manually
973 inside a @code{<< >>} block to create polyphonic music, using
974 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
975 and a horizontal shift for each part.
979 << \upper \\ \lower >>
987 \new Voice = "1" @{ \voiceOne \upper @}
988 \new Voice = "2" @{ \voiceTwo \lower @}
992 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
993 articulations, text annotations, augmentation dots of dotted
994 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
995 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
996 make them point downwards.
997 The command @code{\oneVoice} will revert back to the normal setting.
999 An expression that appears directly inside a @code{<< >>} belongs to
1000 the main voice. This is useful when extra voices appear while the main
1001 voice is playing. Here is a more correct rendition of the example from
1002 the previous section. The crossed noteheads demonstrate that the main
1003 melody is now in a single voice context.
1005 @lilypond[quote,ragged-right,verbatim]
1006 \new Staff \relative c' {
1007 \override NoteHead #'style = #'cross
1012 \new Voice="1" { \voiceTwo
1013 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
1016 \new Voice { \voiceThree
1025 The correct definition of the voices allows the melody to be slurred.
1026 @lilypond[quote,ragged-right,verbatim]
1027 \new Staff \relative c' {
1032 \context Voice="1" { \voiceTwo
1033 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
1036 \new Voice { \voiceThree
1045 Avoiding the @code{\\} separator also allows nesting polyphony
1046 constructs, which in some case might be a more natural way to typeset
1049 @lilypond[quote,ragged-right,verbatim]
1050 \new Staff \relative c' {
1055 \context Voice="1" { \voiceTwo
1058 {c8 b16 a b8 g ~ g2}
1059 \new Voice { \voiceThree
1072 @node Collision Resolution
1073 @subsection Collision Resolution
1075 Normally, note heads with a different number of dots are not merged, but
1076 when the object property @code{merge-differently-dotted} is set in
1077 the @internalsref{NoteCollision} object, they are merged
1078 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
1081 \override Staff.NoteCollision
1082 #'merge-differently-dotted = ##t
1084 } \\ { g8.[ f16] g8.[ f16] } >>
1087 Similarly, you can merge half note heads with eighth notes, by setting
1088 @code{merge-differently-headed}
1089 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
1092 \override Staff.NoteCollision
1093 #'merge-differently-headed = ##t
1094 c8 c4. } \\ { c2 c2 } >>
1097 LilyPond also vertically shifts rests that are opposite of a stem,
1100 @lilypond[quote,ragged-right,fragment,verbatim]
1101 \new Voice << c''4 \\ r4 >>
1113 @funindex \voiceThree
1115 @funindex \voiceFour
1122 @funindex \shiftOnnn
1125 @code{\shiftOff}: these commands specify in what chords of the current
1126 voice should be shifted. The outer voices (normally: voice one and
1127 two) have @code{\shiftOff}, while the inner voices (three and four)
1128 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
1129 further shift levels.
1131 When LilyPond cannot cope, the @code{force-hshift}
1132 property of the @internalsref{NoteColumn} object and pitched rests can
1133 be used to override typesetting decisions.
1135 @lilypond[quote,verbatim,ragged-right]
1142 \once \override NoteColumn #'force-hshift = #1.7
1150 Program reference: the objects responsible for resolving collisions are
1151 @internalsref{NoteCollision} and @internalsref{RestCollision}.
1154 @inputfileref{input/@/regression,collision@/-dots@/.ly},
1155 @inputfileref{input/@/regression,collision@/-head-chords@/.ly},
1156 @inputfileref{input/@/regression,collision@/-heads@/.ly},
1157 @inputfileref{input/@/regression,collision@/-mesh@/.ly}, and
1158 @inputfileref{input/@/regression,collisions@/.ly}.
1163 When using @code{merge-differently-headed} with an upstem eighth or a
1164 shorter note, and a downstem half note, the eighth note gets the wrong
1167 There is no support for clusters where the same note occurs with
1168 different accidentals in the same chord. In this case, it is
1169 recommended to use enharmonic transcription, or to use special cluster
1170 notation (see @ref{Clusters}).
1174 @node Staff notation
1175 @section Staff notation
1177 @cindex Staff notation
1179 This section describes music notation that occurs on staff level,
1180 such as key signatures, clefs and time signatures.
1186 * Partial measures::
1189 * System start delimiters::
1191 * Writing music in parallel::
1200 The clef indicates which lines of the staff correspond to which
1201 pitches. The clef is set with the @code{\clef} command
1203 @lilypond[quote,ragged-right,fragment,verbatim]
1204 { c''2 \clef alto g'2 }
1213 @cindex soprano clef
1214 @cindex mezzosoprano clef
1215 @cindex baritone clef
1216 @cindex varbaritone clef
1217 @cindex subbass clef
1219 Supported clefs include
1221 @multitable @columnfractions .33 .66
1222 @headitem Clef @tab Position
1223 @item @code{treble}, violin, G, G2 @tab
1225 @item @code{alto, C} @tab
1227 @item @code{tenor} @tab
1229 @item @code{bass, F} @tab
1231 @item @code{french} @tab
1232 G clef on 1st line, so-called French violin clef
1233 @item @code{soprano} @tab
1235 @item @code{mezzosoprano} @tab
1237 @item @code{baritone} @tab
1239 @item @code{varbaritone} @tab
1241 @item @code{subbass} @tab
1243 @item @code{percussion} @tab
1245 @item @code{tab} @tab
1249 By adding @code{_8} or @code{^8} to the clef name, the clef is
1250 transposed one octave down or up, respectively, and @code{_15} and
1251 @code{^15} transposes by two octaves. The argument @var{clefname}
1252 must be enclosed in quotes when it contains underscores or digits. For
1255 @cindex choral tenor clef
1256 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
1263 The command @code{\clef "treble_8"} is equivalent to setting
1265 @code{clefPosition} (which controls the Y position of the clef),
1266 @code{middleCPosition} and @code{clefOctavation}. A clef is printed
1267 when any of these properties are changed. The following example shows
1268 possibilities when setting properties manually.
1270 @lilypond[quote,ragged-right,verbatim]
1272 \set Staff.clefGlyph = #"clefs.F"
1273 \set Staff.clefPosition = #2
1275 \set Staff.clefGlyph = #"clefs.G"
1277 \set Staff.clefGlyph = #"clefs.C"
1279 \set Staff.clefOctavation = #7
1281 \set Staff.clefOctavation = #0
1282 \set Staff.clefPosition = #0
1286 \set Staff.middleCPosition = #4
1294 Program reference: @internalsref{Clef}.
1298 @subsection Key signature
1300 @cindex Key signature
1303 The key signature indicates the tonality in which a piece is played. It
1304 is denoted by a set of alterations (flats or sharps) at the start of the
1307 Setting or changing the key signature is done with the @code{\key}
1311 @code{\key} @var{pitch} @var{type}
1320 @funindex \mixolydian
1324 @cindex church modes
1326 Here, @var{type} should be @code{\major} or @code{\minor} to get
1327 @var{pitch}-major or @var{pitch}-minor, respectively. You may also
1328 use the standard mode names (also called ``church modes''): @code{\ionian},
1329 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
1330 @code{\phrygian}, and @code{\dorian}.
1332 This command sets the context property
1333 @code{Staff.keySignature}. Non-standard key signatures
1334 can be specified by setting this property directly.
1336 Accidentals and key signatures often confuse new users, because
1337 unaltered notes get natural signs depending on the key signature. For
1338 more information, see @ref{More about pitches}.
1343 A natural sign is printed to cancel any previous accidentals. This
1344 can be suppressed by setting the @code{Staff.printKeyCancellation}
1347 @lilypond[quote,fragment,ragged-right,fragment,verbatim,relative=2]
1352 \set Staff.printKeyCancellation = ##f
1362 Program reference: @internalsref{KeyCancellation},
1363 @internalsref{KeySignature}.
1366 @node Time signature
1367 @subsection Time signature
1369 @cindex Time signature
1373 Time signature indicates the metrum of a piece: a regular pattern of
1374 strong and weak beats. It is denoted by a fraction at the start of the
1377 The time signature is set with the @code{\time} command
1379 @lilypond[quote,ragged-right,fragment,verbatim]
1380 \time 2/4 c'2 \time 3/4 c'2.
1385 The symbol that is printed can be customized with the @code{style}
1386 property. Setting it to @code{#'()} uses fraction style for 4/4 and
1389 @lilypond[fragment,quote,ragged-right,verbatim]
1392 \override Staff.TimeSignature #'style = #'()
1397 There are many more options for its layout. See @ref{Ancient time
1398 signatures} for more examples.
1400 @code{\time} sets the property @code{timeSignatureFraction},
1401 @code{beatLength} and @code{measureLength} in the @code{Timing}
1402 context, which is normally aliased to @internalsref{Score}. The
1403 property @code{measureLength} determines where bar lines should be
1404 inserted, and how automatic beams should be generated. Changing the
1405 value of @code{timeSignatureFraction} also causes the symbol to be
1408 More options are available through the Scheme function
1409 @code{set-time-signature}. In combination with the
1410 @internalsref{Measure_grouping_engraver}, it will create
1411 @internalsref{MeasureGrouping} signs. Such signs ease reading
1412 rhythmically complex modern music. In the following example, the 9/8
1413 measure is subdivided in 2, 2, 2 and 3. This is passed to
1414 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1416 @lilypond[quote,ragged-right,verbatim]
1419 #(set-time-signature 9 8 '(2 2 2 3))
1420 g8[ g] d[ d] g[ g] a8[( bes g]) |
1421 #(set-time-signature 5 8 '(3 2))
1427 \consists "Measure_grouping_engraver"
1436 Program reference: @internalsref{TimeSignature}, and
1437 @internalsref{Timing_translator}.
1439 Examples: @inputfileref{input/@/test,compound@/-time@/.ly}.
1444 Automatic beaming does not use the measure grouping specified with
1445 @code{set-time-signature}.
1448 @node Partial measures
1449 @subsection Partial measures
1453 @cindex partial measure
1454 @cindex measure, partial
1455 @cindex shorten measures
1458 Partial measures, such as an anacrusis or upbeat, are entered using the
1460 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1461 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1464 The syntax for this command is
1467 \partial @var{duration}
1470 This is internally translated into
1473 \set Timing.measurePosition = -@var{length of duration}
1476 The property @code{measurePosition} contains a rational number
1477 indicating how much of the measure has passed at this point. Note
1478 that this is a negative number; @code{\partial 4} is internally
1479 translated to mean ``there is a quarter note left in the bar''.
1484 This command does not take into account grace notes at the start of
1485 the music. When a piece starts with graces notes in the pickup, then
1486 the @code{\partial} should follow the grace notes
1488 @lilypond[verbatim,quote,ragged-right,relative,fragment]
1497 @subsection Bar lines
1501 @cindex measure lines
1504 Bar lines delimit measures, but are also used to indicate
1505 repeats. Normally they are inserted automatically. Line
1506 breaks may only happen on bar lines.
1508 Special types of bar lines can be forced with the @code{\bar} command
1510 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1514 The following bar types are available
1516 @lilypondfile[ragged-right,quote]{bar-lines.ly}
1518 In addition, you can specify @code{"||:"}, which is equivalent to
1519 @code{"|:"} except at line breaks, where it gives a double bar line at
1520 the end of the line and a start repeat at the beginning of the next
1523 To allow a line break where there is no visible bar line, use
1530 This will insert an invisible bar line and allow line breaks at this
1533 In scores with many staves, a @code{\bar} command in one staff is
1534 automatically applied to all staves. The resulting bar lines are
1535 connected between different staves of a StaffGroup
1537 @lilypond[quote,ragged-right,fragment,verbatim]
1545 \new Staff { \clef bass c4 g e g }
1547 \new Staff { \clef bass c2 c2 }
1555 @funindex repeatCommands
1556 @funindex defaultBarType
1558 The command @code{\bar }@var{bartype} is a short cut for doing
1559 @code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
1560 is set to a string, a bar line of that type is created.
1562 A bar line is created whenever the @code{whichBar} property is set.
1563 At the start of a measure it is set to the contents of
1564 @code{Timing.defaultBarType}. The contents of @code{repeatCommands} are
1566 to override default measure bars.
1568 You are encouraged to use @code{\repeat} for repetitions. See
1574 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1576 Program reference: @internalsref{BarLine} (created at
1577 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1579 Examples: @inputfileref{input/@/test,bar@/-lines@/.ly},
1582 @node Unmetered music
1583 @subsection Unmetered music
1586 @funindex \cadenzaOn
1587 @funindex \cadenzaOff
1589 Bar lines and bar numbers are calculated automatically. For unmetered
1590 music (cadenzas, for example), this is not desirable. To turn off
1591 automatic bar lines and bar numbers, use the commands @code{\cadenzaOn}
1592 and @code{\cadenzaOff}.
1594 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1606 LilyPond will only insert page breaks at a barline. Unless the unmetered
1607 music ends before the end of the staff line, you will need to insert
1615 to indicate where line breaks can occur.
1618 @node System start delimiters
1619 @subsection System start delimiters
1621 @cindex start of system
1622 @cindex Staff, multiple
1623 @cindex bracket, vertical
1624 @cindex brace, vertical
1627 @cindex staff, choir
1629 Many scores consist of more than one staff. These staves can be
1630 joined in four different ways
1633 @item The group is started with a brace at the left, and bar lines are
1634 connected. This is done with the @internalsref{GrandStaff} context.
1636 @lilypond[verbatim,ragged-right,quote]
1644 @item The group is started with a bracket, and bar lines are connected.
1645 This is done with the
1646 @internalsref{StaffGroup} context
1648 @lilypond[verbatim,ragged-right,quote]
1656 @item The group is started with a bracket, but bar lines are not
1657 connected. This is done with the @internalsref{ChoirStaff} context.
1659 @lilypond[verbatim,ragged-right,quote]
1667 @item The group is started with a vertical line. Bar lines are not
1668 connected. This is the default for the score.
1670 @lilypond[verbatim,ragged-right,quote]
1681 The bar lines at the start of each system are
1682 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1683 @internalsref{SystemStartBracket}. Only one of these types is created
1684 in every context, and that type is determined by the property
1685 @code{systemStartDelimiter}.
1689 @subsection Staff symbol
1691 @cindex adjusting staff symbol
1693 Notes, dynamic signs, etc., are grouped
1694 with a set of horizontal lines, called a staff (plural `staves'). In
1695 LilyPond, these lines are drawn using a separate layout object called
1698 The staff symbol may be tuned in the number, thickness and distance
1699 of lines, using properties. This is demonstrated in the example files
1700 @inputfileref{input/@/test,staff@/-lines@/.ly},
1701 @inputfileref{input/@/test,staff@/-size@/.ly}.
1703 In addition, staves may be started and stopped at will. This is done
1704 with @code{\startStaff} and @code{\stopStaff}.
1706 @lilypond[verbatim,relative=2,fragment]
1708 \override Staff.StaffSymbol #'line-count = 2
1709 \stopStaff \startStaff
1711 \revert Staff.StaffSymbol #'line-count
1712 \stopStaff \startStaff
1716 In combination with Frenched staves, this may be used to typeset ossia
1717 sections. An example is in @inputfileref{input/@/test@/,ossia.ly},
1722 @lilypondfile{ossia.ly}
1724 @cindex staff lines, setting number of
1725 @cindex staff lines, setting thickness of
1726 @cindex thickness of staff lines, setting
1727 @cindex number of staff lines, setting
1731 Program reference: @internalsref{StaffSymbol}.
1733 Examples: @inputfileref{input/@/test,staff@/-lines@/.ly},
1734 @inputfileref{input/@/test@/,ossia.ly},
1735 @inputfileref{input/@/test,staff@/-size@/.ly},
1736 @inputfileref{input/@/regression,staff@/-line@/-positions@/.ly}.
1739 @node Writing music in parallel
1740 @subsection Writing music in parallel
1742 @cindex Writing music in parallel
1743 @cindex Interleaved music
1745 Music for multiple parts can be interleaved
1747 @lilypond[quote,fragment,verbatim]
1748 \parallelMusic #'(voiceA voiceB) {
1749 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c'' e''] |
1751 r8 a'16[ d''] f''[ a' d'' f''] r8 a'16[ d''] f''[ a' d'' f''] |
1755 \new Staff \new Voice \voiceA
1756 \new Staff \new Voice \voiceB
1762 @node Connecting notes
1763 @section Connecting notes
1765 This section deals with notation that affects groups of notes.
1771 * Laissez vibrer ties::
1784 A tie connects two adjacent note heads of the same pitch. The tie in
1785 effect extends the length of a note. Ties should not be confused with
1786 slurs, which indicate articulation, or phrasing slurs, which indicate
1787 musical phrasing. A tie is entered using the tilde symbol `@code{~}'
1789 @lilypond[quote,ragged-right,fragment,verbatim]
1790 e' ~ e' <c' e' g'> ~ <c' e' g'>
1793 When a tie is applied to a chord, all note heads whose pitches match
1794 are connected. When no note heads match, no ties will be created.
1796 A tie is just a way of extending a note duration, similar to the
1797 augmentation dot. The following example shows two ways of notating
1798 exactly the same concept
1800 @lilypond[quote,fragment,ragged-right]
1801 \time 3/4 c'2. c'2 ~ c'4
1805 Ties are used either when the note crosses a bar line, or when dots
1806 cannot be used to denote the rhythm. When using ties, larger note
1807 values should be aligned to subdivisions of the measure, such as
1809 @lilypond[fragment,quote,ragged-right]
1811 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
1815 If you need to tie a lot of notes over bars, it may be easier to use
1816 automatic note splitting (see @ref{Automatic note splitting}). This
1817 mechanism automatically splits long notes, and ties them across bar
1820 When a second alternative of a repeat starts with a tied note, you
1821 have to repeat the tie. This can be achieved with @code{\repeatTie},
1823 @lilypond[fragment,quote,ragged-right,relative=2]
1827 @cindex repeating ties
1828 @cindex volta brackets and ties
1832 Ties are sometimes used to write out arpeggios. In this case, two tied
1833 notes need not be consecutive. This can be achieved by setting the
1834 @code{tieWaitForNote} property to true. The same feature is also useful,
1835 for example, to tie a tremolo to a chord. For example,
1837 @lilypond[fragment,verbatim,relative=1,ragged-right]
1838 \set tieWaitForNote = ##t
1839 \grace { c16[~ e~ g]~ } <c, e g>2
1840 \repeat "tremolo" 8 { c32~ c'~ } <c c,>1
1851 @funindex \tieNeutral
1853 @funindex \tieDotted
1855 @funindex \tieDashed
1863 In this manual: @ref{Automatic note splitting}.
1865 Program reference: @internalsref{Tie}.
1868 @inputfileref{input/@/regression,tie-arpeggio.ly}
1869 @inputfileref{input/@/regression,tie-manual.ly}
1876 Switching staves when a tie is active will not produce a slanted tie.
1884 A slur indicates that notes are to be played bound or
1885 @emph{legato}. They are entered using parentheses
1887 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1888 f( g a) a8 b( a4 g2 f4)
1892 The direction of a slur can be specified with
1893 @code{\slur@emph{DIR}}, where @code{@emph{DIR}} is
1894 either @code{Up}, @code{Down}, or @code{Neutral} (automatically
1897 However, there is a convenient shorthand for forcing slur
1898 directions. By adding @code{_} or @code{^} before the opening
1899 parentheses, the direction is also set. For example,
1901 @lilypond[relative=2,ragged-right,quote,verbatim,fragment]
1905 Only one slur can be printed at once. If you need to print a long
1906 slur over a few small slurs, please see @ref{Phrasing slurs}.
1911 Some composers write two slurs when they want legato chords. This can
1912 be achieved in LilyPond by setting @code{doubleSlurs},
1914 @lilypond[verbatim,ragged-right,relative,fragment,quote]
1915 \set doubleSlurs = ##t
1916 <c e>4 ( <d f> <c e> <d f> )
1926 @funindex \slurNeutral
1927 @code{\slurNeutral},
1928 @funindex \slurDashed
1930 @funindex \slurDotted
1932 @funindex \slurSolid
1937 Program reference: @seeinternals{Slur}.
1940 @node Phrasing slurs
1941 @subsection Phrasing slurs
1943 @cindex phrasing slurs
1944 @cindex phrasing marks
1946 A phrasing slur (or phrasing mark) connects notes and is used to
1947 indicate a musical sentence. It is written using @code{\(} and @code{\)}
1950 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
1951 \time 6/4 c'\( d( e) f( e) d\)
1954 Typographically, the phrasing slur behaves almost exactly like a
1955 normal slur. However, they are treated as different objects. A
1956 @code{\slurUp} will have no effect on a phrasing slur; instead, use
1957 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1958 @code{\phrasingSlurNeutral}.
1960 You cannot have simultaneous phrasing slurs.
1965 @funindex \phrasingSlurUp
1966 @code{\phrasingSlurUp},
1967 @funindex \phrasingSlurDown
1968 @code{\phrasingSlurDown},
1969 @funindex \phrasingSlurNeutral
1970 @code{\phrasingSlurNeutral}.
1975 Program reference: @internalsref{PhrasingSlur}.
1978 @node Laissez vibrer ties
1979 @subsection Laissez vibrer ties
1980 @cindex Laissez vibrer
1981 @cindex Ties, laissez vibrer
1983 L.v. ties (laissez vibrer) indicate that notes must not be damped at the
1984 end. It is used in notation for piano, harp and other string and
1985 percussion instruments. They can be entered using @code{\laissezVibrer},
1987 @lilypond[fragment,ragged-right,verbatim,relative=1]
1988 <c f g>\laissezVibrer
1994 @internalsref{LaissezVibrerTie}
1995 @internalsref{LaissezVibrerTieColumn}
1998 @inputfileref{input/regression,laissez-vibrer-tie.ly}
2001 @node Automatic beams
2002 @subsection Automatic beams
2004 LilyPond inserts beams automatically
2006 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2007 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
2010 When these automatic decisions are not good enough, beaming can be
2011 entered explicitly. It is also possible to define beaming patterns
2012 that differ from the defaults. See @ref{Setting automatic beam behavior}
2015 Individual notes may be marked with @code{\noBeam} to prevent them
2018 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2019 \time 2/4 c8 c\noBeam c c
2025 Program reference: @internalsref{Beam}.
2029 @subsection Manual beams
2031 @cindex beams, manual
2035 In some cases it may be necessary to override the automatic beaming
2036 algorithm. For example, the autobeamer will not put beams over rests
2037 or bar lines. Such beams are specified manually by marking the begin
2038 and end point with @code{[} and @code{]}
2040 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2042 r4 r8[ g' a r8] r8 g[ | a] r8
2049 @funindex stemLeftBeamCount
2050 @funindex stemRightBeamCount
2052 Normally, beaming patterns within a beam are determined automatically.
2053 If necessary, the properties @code{stemLeftBeamCount} and
2054 @code{stemRightBeamCount} can be used to override the defaults. If
2055 either property is set, its value will be used only once, and then it
2058 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2063 \set stemLeftBeamCount = #1
2068 The property @code{subdivideBeams} can be set in order to subdivide
2069 all 16th or shorter beams at beat positions, as defined by the
2070 @code{beatLength} property.
2072 @lilypond[fragment,quote,relative=2,verbatim]
2074 \set subdivideBeams = ##t
2076 \set Score.beatLength = #(ly:make-moment 1 8)
2079 @funindex subdivideBeams
2082 For more information about @code{make-moment}, see
2083 @ref{Time administration}.
2085 Line breaks are normally forbidden when beams cross bar lines. This
2086 behavior can be changed by setting @code{allowBeamBreak}.
2088 @funindex allowBeamBreak
2089 @cindex beams and line breaks
2090 @cindex beams, kneed
2092 @cindex auto-knee-gap
2097 Kneed beams are inserted automatically when a large gap is detected
2098 between the note heads. This behavior can be tuned through the object.
2100 Automatically kneed cross-staff beams cannot be used together with
2101 hidden staves. See @ref{Hiding staves}.
2103 Beams do not avoid collisions with symbols around the notes, such as
2104 texts and accidentals.
2108 @subsection Grace notes
2113 @cindex appoggiatura
2114 @cindex acciaccatura
2116 Grace notes are ornaments that are written out. The most common ones
2117 are acciaccatura, which should be played as very short. It is denoted
2118 by a slurred small note with a slashed stem. The appoggiatura is a
2119 grace note that takes a fixed fraction of the main note, and is
2120 denoted as a slurred note in small print without a slash. They
2121 are entered with the commands @code{\acciaccatura} and
2122 @code{\appoggiatura}, as demonstrated in the following example
2124 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2125 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
2126 \acciaccatura { g16[ f] } e4
2129 Both are special forms of the @code{\grace} command. By prefixing this
2130 keyword to a music expression, a new one is formed, which will be
2131 printed in a smaller font and takes up no logical time in a measure.
2133 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2135 \grace { c16[ d16] } c2 c4
2139 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
2140 @code{\grace} command does not start a slur.
2142 Internally, timing for grace notes is done using a second, `grace'
2143 timing. Every point in time consists of two rational numbers: one
2144 denotes the logical time, one denotes the grace timing. The above
2145 example is shown here with timing tuples
2147 @lilypond[quote,ragged-right]
2150 c4 \grace c16 c4 \grace {
2153 \new Lyrics \lyricmode {
2154 \override LyricText #'font-family = #'typewriter
2158 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
2159 \markup { (\fraction 1 4 , 0 ) } 4
2161 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
2162 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
2164 \markup { ( \fraction 2 4 , 0 ) }
2169 The placement of grace notes is synchronized between different staves.
2170 In the following example, there are two sixteenth grace notes for
2171 every eighth grace note
2173 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2174 << \new Staff { e4 \grace { c16[ d e f] } e4 }
2175 \new Staff { c4 \grace { g8[ b] } c4 } >>
2178 @funindex \afterGrace
2180 If you want to end a note with a grace, use the @code{\afterGrace}
2181 command. It takes two arguments: the main note, and the grace notes
2182 following the main note.
2184 @lilypond[ragged-right, verbatim,relative=2,fragment]
2185 c1 \afterGrace d1 { c16[ d] } c4
2188 This will put the grace notes after a ``space'' lasting 3/4 of the
2189 length of the main note. The fraction 3/4 can be changed by setting
2190 @code{afterGraceFraction}, ie.
2193 afterGraceFraction = #(cons 7 8)
2197 will put the grace note at 7/8 of the main note.
2199 The same effect can be achieved manually by doing
2201 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2204 { s2 \grace { c16[ d] } } >>
2210 By adjusting the duration of the skip note (here it is a half-note),
2211 the space between the main-note and the grace is adjusted.
2213 A @code{\grace} section will introduce special typesetting settings,
2214 for example, to produce smaller type, and set directions. Hence, when
2215 introducing layout tweaks, they should be inside the grace section,
2217 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2229 The overrides should also be reverted inside the grace section.
2231 The layout of grace sections can be changed throughout the music using
2232 the function @code{add-grace-property}. The following example
2233 undefines the Stem direction for this grace, so stems do not always
2238 #(add-grace-property 'Voice 'Stem 'direction '())
2244 Another option is to change the variables @code{startGraceMusic},
2245 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2246 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2247 @code{stopAppoggiaturaMusic}. More information is in the file
2248 @file{ly/@/grace@/-init@/.ly}.
2251 The slash through the stem in acciaccaturas can be obtained
2252 in other situations by @code{\override Stem #'stroke-style = #"grace"}.
2256 Program reference: @internalsref{GraceMusic}.
2261 A score that starts with a @code{\grace} section needs an explicit
2262 @code{\new Voice} declaration, otherwise the main note and the grace
2263 note end up on different staves.
2265 Grace note synchronization can also lead to surprises. Staff notation,
2266 such as key signatures, bar lines, etc., are also synchronized. Take
2267 care when you mix staves with grace notes and staves without, for example,
2269 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2270 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2271 \new Staff { c4 \bar "|:" d4 } >>
2275 This can be remedied by inserting grace skips of the corresponding
2276 durations in the other staves. For the above example
2279 \new Staff @{ c4 \bar "|:" \grace s16 d4 @}
2282 Grace sections should only be used within sequential music
2283 expressions. Nesting or juxtaposing grace sections is not supported,
2284 and might produce crashes or other errors.
2288 @node Expressive marks
2289 @section Expressive marks
2291 Expressive marks help musicians to bring more to the music than simple
2296 * Fingering instructions::
2306 @subsection Articulations
2308 @cindex Articulations
2312 A variety of symbols can appear above and below notes to indicate
2313 different characteristics of the performance. They are added to a note
2314 by adding a dash and the character signifying the
2315 articulation. They are demonstrated here
2317 @lilypondfile[quote,ragged-right]{script-abbreviations.ly}
2319 The meanings of these shorthands can be changed. See
2320 @file{ly/@/script@/-init@/.ly} for examples.
2322 The script is automatically placed, but the direction can be forced as
2323 well. Like other pieces of LilyPond code, @code{_} will place them
2324 below the staff, and @code{^} will place them above.
2326 @lilypond[quote,ragged-right,fragment,verbatim]
2330 Other symbols can be added using the syntax
2331 @var{note}@code{\}@var{name}. Again, they
2332 can be forced up or down using @code{^} and @code{_},
2335 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
2336 c\fermata c^\fermata c_\fermata
2341 @cindex staccatissimo
2351 @cindex organ pedal marks
2360 @cindex prallmordent
2364 @cindex thumb marking
2369 Here is a chart showing all scripts available,
2371 @lilypondfile[ragged-right,quote]{script-chart.ly}
2376 The vertical ordering of scripts is controlled with the
2377 @code{script-priority} property. The lower this number, the closer it
2378 will be put to the note. In this example, the
2379 @internalsref{TextScript} (the sharp symbol) first has the lowest
2380 priority, so it is put lowest in the first example. In the second, the
2381 prall trill (the @internalsref{Script}) has the lowest, so it is on the
2382 inside. When two objects have the same priority, the order in which
2383 they are entered decides which one comes first.
2385 @lilypond[verbatim,relative=3,ragged-right,fragment,quote]
2386 \once \override TextScript #'script-priority = #-100
2387 a4^\prall^\markup { \sharp }
2389 \once \override Script #'script-priority = #-100
2390 a4^\prall^\markup { \sharp }
2396 Program reference: @internalsref{Script}.
2401 These signs appear in the printed output but have no effect on the
2402 MIDI rendering of the music.
2405 @node Fingering instructions
2406 @subsection Fingering instructions
2409 @cindex finger change
2411 Fingering instructions can be entered using
2413 @var{note}-@var{digit}
2415 For finger changes, use markup texts
2417 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2419 c^\markup { \finger "2 - 3" }
2422 You can use the thumb-script to indicate that a note should be
2423 played with the thumb (e.g., in cello music)
2424 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2425 <a_\thumb a'-3>8 <b_\thumb b'-3>
2428 Fingerings for chords can also be added to individual notes
2429 of the chord by adding them after the pitches
2430 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2431 < c-1 e-2 g-3 b-5 >4
2437 You may exercise greater control over fingering chords by
2438 setting @code{fingeringOrientations}
2440 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2441 \set fingeringOrientations = #'(left down)
2442 <c-1 es-2 g-4 bes-5 > 4
2443 \set fingeringOrientations = #'(up right down)
2444 <c-1 es-2 g-4 bes-5 > 4
2447 Using this feature, it is also possible to put fingering instructions
2448 very close to note heads in monophonic music,
2450 @lilypond[verbatim,ragged-right,quote,fragment]
2451 \set fingeringOrientations = #'(right)
2458 Program reference: @internalsref{Fingering}.
2460 Examples: @inputfileref{input/@/regression,finger@/-chords@/.ly}.
2464 @subsection Dynamics
2485 Absolute dynamic marks are specified using a command after a note
2486 @code{c4\ff}. The available dynamic marks are @code{\ppppp},
2487 @code{\pppp}, @code{\ppp},
2488 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2489 @code{\fff}, @code{\ffff}, @code{\fp}, @code{\sf}, @code{\sff},
2490 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2492 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2493 c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2494 c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
2501 A crescendo mark is started with @code{\<} and terminated with
2502 @code{\!} or an absolute dynamic. A decrescendo is started with
2503 @code{\>} and is also terminated with @code{\!} or an absolute
2504 dynamic. @code{\cr} and @code{\decr} may be used instead of
2505 @code{\<} and @code{\>}. Because these marks are bound to notes, you must
2506 use spacer notes if multiple marks are needed during one note
2508 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2510 << f1 { s4 s4\< s4\! \> s4\! } >>
2514 A hairpin starts at the left edge of the beginning note and ends on the
2515 right edge of the ending note.
2517 In some situations the @code{\espressivo} articulation mark may
2518 be suitable to indicate a crescendo and decrescendo on the one note,
2520 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2521 c2 b4 a g1\espressivo
2524 This may give rise to very short hairpins. Use @code{minimum-length}
2525 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2529 \override Staff.Hairpin #'minimum-length = #5
2536 You can also use a text saying @emph{cresc.} instead of hairpins
2538 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2549 You can also supply your own texts
2550 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2551 \set crescendoText = \markup { \italic "cresc. poco" }
2552 \set crescendoSpanner = #'dashed-line
2556 To create new dynamic marks or text that should be aligned
2557 with dynamics, see @ref{New dynamic marks}.
2562 Dynamics that occur at, begin on, or end on, the same note
2563 will be vertically aligned. If you want to ensure that dynamics
2564 are aligned when they do not occur on the same note, you can
2565 increase the @code{staff-padding} property.
2568 \override DynamicLineSpanner #'staff-padding = #4
2571 You may also use this property if the dynamics are colliding
2572 with other notation.
2574 Crescendi and decrescendi that end on the first note of a
2575 new line are not printed. To change this behavior, use
2578 \override Score.Hairpin #'after-line-breaking = ##t
2581 Text style dynamic changes (such as cresc. and dim.) are printed with a
2582 dashed line showing their extent. To surpress printing this line, use
2585 \override DynamicTextSpanner #'dash-period = #-1.0
2591 @funindex \dynamicUp
2593 @funindex \dynamicDown
2594 @code{\dynamicDown},
2595 @funindex \dynamicNeutral
2596 @code{\dynamicNeutral}.
2601 Program reference: @internalsref{DynamicText}, @internalsref{Hairpin}.
2602 Vertical positioning of these symbols is handled by
2603 @internalsref{DynamicLineSpanner}.
2607 @subsection Breath marks
2609 Breath marks are entered using @code{\breathe}
2611 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2618 The glyph of the breath mark can be tuned by overriding the
2619 @code{text} property of the @code{BreathingSign} layout object with
2620 any markup text. For example,
2621 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2623 \override BreathingSign #'text
2624 = #(make-musicglyph-markup "scripts.rvarcomma")
2631 Program reference: @internalsref{BreathingSign}.
2633 Examples: @inputfileref{input/@/regression,breathing@/-sign@/.ly}.
2639 Short trills are printed like normal articulation; see @ref{Articulations}.
2641 Long running trills are made with @code{\startTrillSpan} and
2642 @code{\stopTrillSpan},
2644 @lilypond[verbatim,ragged-right,relative=2,quote,fragment]
2646 << { c1 \startTrillSpan }
2647 { s2. \grace { d16[\stopTrillSpan e] } } >>
2651 @cindex Pitched trills
2653 Trills that should be executed on an explicitly specified pitch can be
2654 typeset with the command @code{pitchedTrill},
2656 @lilypond[ragged-right,verbatim,fragment,relative=1]
2657 \pitchedTrill c4\startTrillSpan fis
2661 The first argument is the main note. The pitch of the second
2662 is printed as a stemless note head in parentheses.
2667 @code{\startTrillSpan},
2668 @funindex \startTrillSpan
2669 @code{\stopTrillSpan}.
2670 @funindex \stopTrillSpan
2675 Program reference: @internalsref{TrillSpanner}.
2679 @subsection Glissando
2682 @funindex \glissando
2684 A glissando is a smooth change in pitch. It is denoted by a line or a
2685 wavy line between two notes. It is requested by attaching
2686 @code{\glissando} to a note
2688 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2690 \override Glissando #'style = #'zigzag
2697 Program reference: @internalsref{Glissando}.
2699 Example files: @file{input/@/regression/@/glissando@/.ly}.
2704 Printing text over the line (such as @emph{gliss.}) is not supported.
2708 @subsection Arpeggio
2711 @cindex broken chord
2714 You can specify an arpeggio sign (also known as broken chord) on a
2715 chord by attaching an @code{\arpeggio} to a chord
2717 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2721 A square bracket on the left indicates that the player should not
2722 arpeggiate the chord
2724 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2729 The direction of the arpeggio is sometimes denoted by adding an
2730 arrowhead to the wiggly line
2732 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2744 When an arpeggio crosses staves, you may attach an arpeggio to the chords
2745 in both staves and set
2746 @internalsref{PianoStaff}.@code{connectArpeggios}
2748 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2750 \set PianoStaff.connectArpeggios = ##t
2751 \new Staff { <c' e g c>\arpeggio }
2752 \new Staff { \clef bass <c,, e g>\arpeggio }
2760 @funindex \arpeggioUp
2762 @funindex \arpeggioDown
2763 @code{\arpeggioDown},
2764 @funindex \arpeggioNeutral
2765 @code{\arpeggioNeutral},
2766 @funindex \arpeggioBracket
2767 @code{\arpeggioBracket}.
2772 Notation manual: @ref{Ties}, for writing out arpeggios.
2774 Program reference: @internalsref{Arpeggio}.
2779 It is not possible to mix connected arpeggios and unconnected
2780 arpeggios in one @internalsref{PianoStaff} at the same point in time.
2789 Repetition is a central concept in music, and multiple notations exist
2795 * Repeats and MIDI::
2796 * Manual repeat commands::
2798 * Tremolo subdivisions::
2804 @subsection Repeat types
2809 The following types of repetition are supported
2813 Repeated music is fully written (played) out. This is useful when
2814 entering repetitious music. This is the only kind of repeat that
2815 is included in MIDI output.
2818 Repeats are not written out, but alternative endings (volte) are
2819 printed, left to right with brackets. This is the standard notation
2820 for repeats with alternatives. These are not played in MIDI output by
2825 Alternative endings are written stacked. This has limited use but may be
2826 used to typeset two lines of lyrics in songs with repeats, see
2827 @inputfileref{input,star-spangled-banner@/.ly}.
2831 Make tremolo beams. These are not played in MIDI output by default.
2834 Make beat or measure repeats. These look like percent signs. These
2835 are not played in MIDI output by default. Percent repeats must be
2836 declared within a Voice context.
2842 @subsection Repeat syntax
2844 LilyPond has one syntactic construct for specifying different types of
2845 repeats. The syntax is
2848 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2851 If you have alternative endings, you may add
2852 @funindex \alternative
2863 where each @var{alternative} is a music expression. If you do not
2864 give enough alternatives for all of the repeats, the first alternative
2865 is assumed to be played more than once.
2867 Standard repeats are used like this
2868 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2870 \repeat volta 2 { c4 d e f }
2871 \repeat volta 2 { f e d c }
2874 With alternative endings
2875 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2877 \repeat volta 2 {c4 d e f}
2878 \alternative { {d2 d} {f f,} }
2881 In this example, the first ending is not a complete bar (it
2882 only had 3 beats). The beginning of the second ending
2883 contains the 4th beat from the first ending. This ``extra''
2884 beat in the second ending is due to the first time ending,
2885 and has nothing to do with the @code{\partial} at the
2886 beginning of the example.
2888 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2891 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2892 \alternative { { g4 g g } { a | a a a a | b2. } }
2896 It is possible to shorten volta brackets
2897 by setting @code{voltaSpannerDuration}. In the next example, the
2898 bracket only lasts one measure, which is a duration of 3/4.
2900 @lilypond[verbatim,ragged-right,quote]
2904 \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2905 \repeat "volta" 5 { d d d }
2906 \alternative { { e e e f f f }
2916 Brackets for the repeat are normally only printed over the topmost
2917 staff. This can be adjusted by setting the @code{voltaOnThisStaff}
2918 property; see @inputfileref{input/@/regression,volta@/-multi@/-staff@/.ly}.
2923 @cindex repeat, ambiguous
2925 A nested repeat like
2934 is ambiguous, since it is is not clear to which @code{\repeat} the
2935 @code{\alternative} belongs. This ambiguity is resolved by always
2936 having the @code{\alternative} belong to the inner @code{\repeat}.
2937 For clarity, it is advisable to use braces in such situations.
2939 Timing information is not remembered at the start of an alternative,
2940 so after a repeat timing information must be reset by hand, for
2941 example by setting @code{Score.measurePosition} or entering
2942 @code{\partial}. Similarly, slurs or ties are also not repeated.
2945 @node Repeats and MIDI
2946 @subsection Repeats and MIDI
2948 @cindex expanding repeats
2949 @funindex \unfoldRepeats
2951 With a little bit of tweaking, all types of repeats can be present
2952 in the MIDI output. This is achieved by applying the
2953 @code{\unfoldRepeats} music function. This functions changes all
2954 repeats to unfold repeats.
2956 @lilypond[quote,verbatim,fragment,line-width=8.0\cm]
2958 \repeat tremolo 8 {c'32 e' }
2959 \repeat percent 2 { c''8 d'' }
2960 \repeat volta 2 {c'4 d' e' f'}
2969 When creating a score file using @code{\unfoldRepeats} for midi, then
2970 it is necessary to make two @code{\score} blocks. One for MIDI (with
2971 unfolded repeats) and one for notation (with volta, tremolo, and
2972 percent repeats). For example,
2980 \unfoldRepeats @var{..music..}
2986 @node Manual repeat commands
2987 @subsection Manual repeat commands
2989 @funindex repeatCommands
2991 The property @code{repeatCommands} can be used to control the layout of
2992 repeats. Its value is a Scheme list of repeat commands.
2995 @item @code{start-repeat}
2996 Print a @code{|:} bar line.
2998 @item @code{end-repeat}
2999 Print a @code{:|} bar line.
3001 @item @code{(volta @var{text})}
3002 Print a volta bracket saying @var{text}: The text can be specified as
3003 a text string or as a markup text, see @ref{Text markup}. Do not
3004 forget to change the font, as the default number font does not contain
3005 alphabetic characters;
3007 @item @code{(volta #f)}
3008 Stop a running volta bracket.
3011 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
3013 \set Score.repeatCommands = #'((volta "93") end-repeat)
3015 \set Score.repeatCommands = #'((volta #f))
3022 Program reference: @internalsref{VoltaBracket},
3023 @internalsref{RepeatedMusic},
3024 @internalsref{VoltaRepeatedMusic},
3025 @internalsref{UnfoldedRepeatedMusic}, and
3026 @internalsref{FoldedRepeatedMusic}.
3029 @node Tremolo repeats
3030 @subsection Tremolo repeats
3032 @cindex tremolo beams
3034 To place tremolo marks between notes, use @code{\repeat} with tremolo
3036 @lilypond[quote,verbatim,ragged-right]
3037 \new Voice \relative c' {
3038 \repeat "tremolo" 8 { c16 d16 }
3039 \repeat "tremolo" 4 { c16 d16 }
3040 \repeat "tremolo" 2 { c16 d16 }
3044 Tremolo marks can also be put on a single note. In this case, the
3045 note should not be surrounded by braces.
3046 @lilypond[quote,verbatim,ragged-right]
3047 \repeat "tremolo" 4 c'16
3050 Similar output is obtained using the tremolo subdivision, described in
3051 @ref{Tremolo subdivisions}.
3056 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
3058 Program reference: @internalsref{Beam}, @internalsref{StemTremolo}.
3060 Example files: @inputfileref{input/@/regression,chord@/-tremolo@/.ly},
3061 @inputfileref{input/@/regression,stem@/-tremolo@/.ly}.
3064 @node Tremolo subdivisions
3065 @subsection Tremolo subdivisions
3067 @cindex tremolo marks
3068 @funindex tremoloFlags
3070 Tremolo marks can be printed on a single note by adding
3071 `@code{:}[@var{number}]' after the note. The number indicates the
3072 duration of the subdivision, and it must be at least 8. A
3073 @var{length} value of 8 gives one line across the note stem. If the
3074 length is omitted, the last value (stored in @code{tremoloFlags}) is
3077 @lilypond[quote,ragged-right,verbatim,fragment]
3078 c'2:8 c':32 | c': c': |
3084 Tremolos entered in this way do not carry over into the MIDI output.
3089 In this manual: @ref{Tremolo repeats}.
3091 Elsewhere: @internalsref{StemTremolo}.
3094 @node Measure repeats
3095 @subsection Measure repeats
3097 @cindex percent repeats
3098 @cindex measure repeats
3100 In the @code{percent} style, a note pattern can be repeated. It is
3101 printed once, and then the pattern is replaced with a special sign.
3102 Patterns of one and two measures are replaced by percent-like signs,
3103 patterns that divide the measure length are replaced by slashes.
3104 Percent repeats must be declared within a @code{Voice} context.
3106 @lilypond[quote,verbatim,ragged-right]
3107 \new Voice \relative c' {
3108 \repeat "percent" 4 { c4 }
3109 \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
3113 Measure repeats of more than 2 measures get a counter, if you switch
3114 on the @code{countPercentRepeats} property,
3116 @lilypond[relative=2,fragment,quote,verbatim,ragged-right]
3118 \set countPercentRepeats = ##t
3119 \repeat "percent" 4 { c1 }
3125 Isolated percents can also be printed. This is done by putting a multi
3126 measure rest with a different print function,
3128 @lilypond[fragment,verbatim]
3129 \override MultiMeasureRest #'stencil
3130 = #ly:multi-measure-rest::percent
3139 Program reference: @internalsref{RepeatSlash},
3140 @internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
3141 @internalsref{DoublePercentRepeatCounter},
3142 @internalsref{PercentRepeatCounter},
3143 @internalsref{PercentRepeatedMusic}.