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 @node Advanced notation
10 @chapter Advanced notation
12 This chapter deals with rarely-used and advanced notation.
18 * Contemporary notation::
20 * Automatic notation::
28 This section explains how to include text (with various formatting) in
38 * Overview of text markup commands::
45 @subsection Text scripts
48 @cindex text items, non-empty
49 @cindex non-empty texts
51 It is possible to place arbitrary strings of text or @ref{Text markup}
52 above or below notes by using a string @code{c^"text"}. By default,
53 these indications do not influence the note spacing, but by using the
54 command @code{\fatText}, the widths will be taken into account
56 @lilypond[quote,fragment,raggedright,verbatim,relative=1]
57 c4^"longtext" \fatText c4_"longlongtext" c4
60 More complex formatting may also be added to a note by using the
62 @lilypond[fragment,raggedright,verbatim,quote]
63 c'4^\markup { bla \bold bla }
66 The @code{\markup} is described in more detail in
72 @cindex @code{\fatText}
74 @cindex @code{\emptyText}
80 Checking to make sure that text scripts and lyrics are within the margins is a relatively large computational task. To speed up processing, lilypond does not perform such calculations by default; to enable it, use
83 \override Score.PaperColumn #'keep-inside-line = ##t
89 In this manual: @ref{Text markup}.
91 Program reference: @internalsref{TextScript}.
95 @subsection Text spanners
99 Some performance indications, e.g., @i{rallentando} or @i{accelerando},
100 are written as text and are extended over many measures with dotted
101 lines. Such texts are created using text spanners; attach
102 @code{\startTextSpan} and @code{\stopTextSpan} to the first and last
103 notes of the spanner.
105 The string to be printed, as well as the style, is set through object
108 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
111 \override TextSpanner #'edge-text = #'("rall " . "")
112 c2\startTextSpan b c\stopTextSpan a
115 \override TextSpanner #'edge-text = #(cons (markup #:italic "rit" ) "")
116 c2\startTextSpan b c\stopTextSpan a
121 @cindex textSpannerUp
122 @code{textSpannerUp},
123 @cindex textSpannerDown
124 @code{textSpannerDown},
125 @cindex textSpannerNeutral
126 @code{textSpannerNeutral}.
131 Program reference: @internalsref{TextSpanner}.
133 Examples: @inputfileref{input/@/regression,text@/-spanner@/.ly}.
137 @subsection Text marks
139 @cindex coda on bar line
140 @cindex segno on bar line
141 @cindex fermata on bar line
142 @cindex bar lines, symbols on
145 The @code{\mark} command is primarily used for
146 @ref{Rehearsal marks},
147 but it can also be used to put signs like coda,
148 segno, and fermata on a bar line. Use @code{\markup} to
149 access the appropriate symbol
151 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
152 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
157 @code{\mark} is only typeset above the top stave of the score. If
158 you specify the @code{\mark} command at a bar line, the resulting
159 mark is placed above the bar line. If you specify it in the middle
160 of a bar, the resulting mark is positioned between notes. If it is
161 specified before the beginning of a score line, it is placed
162 before the first note of the line. Finally, if the mark occurs at
163 a line break, the mark will be printed at the
164 beginning of the next line.
165 @c IMO this is a bug; hopefully it'll be fixed soon, so I can
166 @c delete this sentence. -gp
167 If there is no next line, then the mark will not be printed at all.
172 To print the mark at the end of the current line, use
175 \override Score.RehearsalMark
176 #'break-visibility = #begin-of-line-invisible
179 @code{\mark} is often useful for adding text to the end of bar. In
180 such cases, changing the @code{#'self-alignment} is very useful
182 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
183 \override Score.RehearsalMark
184 #'break-visibility = #begin-of-line-invisible
186 \once \override Score.RehearsalMark #'self-alignment-X = #right
187 \mark "D.S. al Fine "
193 Program reference: @internalsref{RehearsalMark}.
197 @subsection Text markup
204 Use @code{\markup} to typeset text. Commands are entered with the
207 @lilypond[quote,verbatim,fragment,relative=1]
209 c1_\markup { hi there }
210 c1^\markup { hi \bold there, is \italic anyone home? }
214 See @ref{Overview of text markup commands} for a list of all
217 @code{\markup} is primarily used for @internalsref{TextScript}s,
218 but it can also be used anywhere text is called in lilypond
220 @lilypond[quote,verbatim]
221 \header{ title = \markup{ \bold { foo \italic { bar! } } } }
224 \override Score.RehearsalMark
225 #'break-visibility = #begin-of-line-invisible
226 \override Score.RehearsalMark #'self-alignment-X = #right
228 \set Staff.instrument = \markup{ \column{ Alto solo } }
229 c2^\markup{ don't be \flat }
230 \override TextSpanner #'edge-text = #(cons (markup #:italic "rit" ) "")
232 a2\mark \markup{ \large \bold Fine }
236 \addlyrics { bar, foo \markup{ \italic bar! } }
240 Text can also be placed on its own, away from any @code{\score}
241 block. This is primarily used in a @code{\book} (see
242 @ref{Multiple movements}).
244 @lilypond[quote,raggedright,verbatim]
245 \markup{ Here is some text. }
248 @cindex font switching
250 The markup in the example demonstrates font switching commands. The
251 command @code{\bold} and @code{\italic} apply to the first following
252 word only; to apply a command to more than one word, enclose the
256 \markup @{ \bold @{ hi there @} @}
260 For clarity, you can also do this for single arguments, e.g.,
263 \markup @{ is \italic @{ anyone @} home @}
266 In markup mode you can compose expressions, similar to mathematical
267 expressions, XML documents, and music expressions. You can stack
268 expressions grouped vertically with the command @code{\column}.
269 Similarly, @code{\center-align} aligns texts by their center lines:
271 @lilypond[quote,verbatim,fragment,relative=1]
272 c1^\markup { \column { a bbbb \line { c d } } }
273 c1^\markup { \center-align { a bbbb c } }
274 c1^\markup { \line { a b c } }
277 Lists with no previous command are not kept distinct. The expression
280 \center-align @{ @{ a b @} @{ c d @} @}
288 \center-align @{ a b c d @}
293 To keep lists of words distinct, please use quotes @code{"} or
294 the @code{\line} command
296 @lilypond[quote,verbatim,fragment,relative=1]
298 c4^\markup{ \center-align { on three lines } }
299 c4^\markup{ \center-align { "all one line" } }
300 c4^\markup{ \center-align { { on three lines } } }
301 c4^\markup{ \center-align { \line { on one line } } }
304 Markups can be stored in variables and these variables
305 may be attached to notes, like
307 allegro = \markup @{ \bold \large @{ Allegro @} @}
308 @{ a^\allegro b c d @}
311 Some objects have alignment procedures of their own, which cancel out
312 any effects of alignments applied to their markup arguments as a
313 whole. For example, the @internalsref{RehearsalMark} is horizontally
314 centered, so using @code{\mark \markup @{ \left-align .. @}} has no
317 In addition, vertical placement is performed after creating the
318 text markup object. If you wish to move an entire piece of markup,
319 you need to use the #'padding property or create an "anchor" point
320 inside the markup (generally with @code{\hspace #0}).
322 @lilypond[quote,verbatim,fragment,relative=1]
324 c'4^\markup{ \raise #5 "not raised" }
325 \once \override TextScript #'padding = #3
326 c'4^\markup{ raised }
327 c'4^\markup{ \hspace #0 \raise #1.5 raised }
333 This manual: @ref{Overview of text markup commands}.
335 Program reference: @internalsref{TextScript}.
337 Init files: @file{scm/@/new@/-markup@/.scm}.
342 Kerning or generation of ligatures is only done when the @TeX{}
343 backend is used. In this case, LilyPond does not account for them so
344 texts will be spaced slightly too wide.
346 Syntax errors for markup mode are confusing.
350 @subsection Text encoding
352 LilyPond uses the Pango library to format multi-lingual texts, and
353 does not perform any input-encoding conversions. This means that any
354 text, be it title, lyric text, or musical instruction containing
355 non-ASCII characters, must be utf-8. Easiest to enter such texts is
356 by using a Unicode-aware editor, and save using utf-8 encoding. Most
357 popular modern editors have utf-8 support, for example, vim, Emacs,
360 Depending on the fonts installed, the following fragment shows Hebrew
367 @lilypondfile[fontload]{utf-8.ly}
369 The @TeX{} backend does not handle encoding specially at all. Strings
370 in the input are put in the output as-is. Extents of text items in the
371 @TeX{} backend, are determined by reading a file created via the
372 @file{texstr} backend,
375 lilypond -b texstr input/les-nereides.ly
376 latex les-nereides.texstr
379 The last command produces @file{les-nereides.textmetrics}, which is
380 read when you execute
383 lilypond -b tex input/les-nereides.ly
386 Both @file{les-nereides.texstr} and @file{les-nereides.tex} need
387 suitable LaTeX wrappers to load appropriate La@TeX{} packages for
388 interpreting non-ASCII strings.
390 To use a Unicode escape sequence, use
393 #(ly:export (ly:wide-char->utf-8 #x2014))
399 @inputfileref{input/regression,utf-8.ly}
403 @subsection Nested scores
405 It is possible to nest music inside markups, by adding a @code{\score}
406 block to a markup expression. Such a score must contain a @code{\layout}
409 @lilypond[quote,verbatim,raggedright]
413 \relative { c4 d e f }
422 @node Overview of text markup commands
423 @subsection Overview of text markup commands
425 The following commands can all be used inside @code{\markup @{ @}}.
427 @include markup-commands.tely
431 @subsection Font selection
433 @cindex font selection
434 @cindex font magnification
435 @cindex @code{font-interface}
437 By setting the object properties described below, you can select a
438 font from the preconfigured font families. LilyPond has default
439 support for the feta music fonts. Text fonts are selected through
440 Pango/FontConfig. The serif font defaults to New Century Schoolbook,
441 the sans and typewriter to whatever the Pango installation defaults
446 @item @code{font-encoding}
447 is a symbol that sets layout of the glyphs. This should only be set to
448 select different types of non-text fonts, eg.
450 @code{fetaBraces} for piano staff braces, @code{fetaMusic} the
451 standard music font, including ancient glyphs, @code{fetaDynamic} for
452 dynamic signs and @code{fetaNumber} for the number font.
454 @item @code{font-family}
455 is a symbol indicating the general class of the typeface. Supported are
456 @code{roman} (Computer Modern), @code{sans}, and @code{typewriter}.
458 @item @code{font-shape}
459 is a symbol indicating the shape of the font. There are typically
460 several font shapes available for each font family. Choices are
461 @code{italic}, @code{caps}, and @code{upright}.
463 @item @code{font-series}
464 is a symbol indicating the series of the font. There are typically
465 several font series for each font family and shape. Choices are
466 @code{medium} and @code{bold}.
470 Fonts selected in the way sketched above come from a predefined style
471 sheet. If you want to use a font from outside the style sheet,
473 @code{font-name} property,
475 @lilypond[fragment,verbatim]
477 \override Staff.TimeSignature #'font-name = #"Charter"
478 \override Staff.TimeSignature #'font-size = #2
481 \override #'(font-name . "Vera Bold")
482 { This text is in Vera Bold }
488 Any font can be used, as long as it is available to Pango/FontConfig.
490 The size of the font may be set with the @code{font-size}
491 property. The resulting size is taken relative to the
492 @code{text-font-size} as defined in the @code{\paper} block.
495 @cindex font magnification
498 It is also possible to change the default font family for the entire
499 document. This is done by calling the @code{make-pango-font-tree} from
500 within the @code{\paper} block. The function takes names for the font
501 families to use for roman, sans serif and monospaced text. For
504 @cindex font families, setting
513 (make-pango-font-tree "Times New Roman"
520 c'^\markup { roman: foo \sans bla \typewriter bar }
524 @c we don't do Helvetica / Courier, since GS incorrectly loads
531 Examples: @file{ly/@/font@/-family@/-override.ly}
534 @node New dynamic marks
535 @subsection New dynamic marks
537 It is possible to print new dynamic marks or text that should be aligned
538 with dynamics. Use @code{make-dynamic-script} to create these marks.
540 @cindex make-dynamic-script
542 @lilypond[quote,verbatim,raggedright]
543 sfzp = #(make-dynamic-script "sfzp")
549 @cindex Dynamics, editorial
550 @cindex Dynamics, parenthesis
552 It is also possible to print dynamics in round parenthesis or square
553 brackets. These are often used for adding editorial dynamics.
555 @lilypond[quote,verbatim,raggedright]
556 rndf = \markup{ \center-align {\line { \bold{\italic (}
557 \dynamic f \bold{\italic )} }} }
558 boxf = \markup{ \bracket { \dynamic f } }
559 { c'1_\rndf c'1_\boxf }
564 @node Preparing parts
565 @section Preparing parts
567 This section describes various notation that are useful for preparing
571 * Multi measure rests::
576 * Instrument transpositions::
578 * Different editions from one source::
582 @node Multi measure rests
583 @subsection Multi measure rests
585 @cindex multi measure rests
586 @cindex full measure rests
587 @cindex Rests, multi measure
588 @cindex Rests, full measure
589 @cindex whole rests for a full measure
592 Rests for one full measure (or many bars) are entered using `@code{R}'. It
593 is specifically meant for full bar rests and for entering parts: the rest
594 can expand to fill a score with rests, or it can be printed as a single
595 multi-measure rest. This expansion is controlled by the property
596 @code{Score.skipBars}. If this is set to true, empty measures will not
597 be expanded, and the appropriate number is added automatically
599 @lilypond[quote,raggedright,fragment,verbatim]
600 \time 4/4 r1 | R1 | R1*2
601 \set Score.skipBars = ##t R1*17 R1*4
604 The @code{1} in @code{R1} is similar to the duration notation used for
605 notes. Hence, for time signatures other than 4/4, you must enter other
606 durations. This can be done with augmentation dots or fractions
608 @lilypond[quote,raggedright,fragment,verbatim]
609 \set Score.skipBars = ##t
618 An @code{R} spanning a single measure is printed as either a whole rest
619 or a breve, centered in the measure regardless of the time signature.
621 If there are only a few measures of rest, LilyPond prints ``church rests''
622 (a series of rectangles) in the staff. To replace that with a simple
623 rest, use @code{MultiMeasureRest.expand-limit}.
625 @lilypond[quote,raggedright,fragment,verbatim]
626 \set Score.skipBars = ##t
628 \override MultiMeasureRest #'expand-limit = 1
632 @cindex text on multi-measure rest
633 @cindex script on multi-measure rest
634 @cindex fermata on multi-measure rest
636 Texts can be added to multi-measure rests by using the
637 @var{note}-@code{markup} syntax @ref{Text markup}.
638 A variable (@code{\fermataMarkup}) is provided for
641 @lilypond[quote,raggedright,verbatim,fragment]
642 \set Score.skipBars = ##t
644 R2.*10^\markup { \italic "ad lib." }
648 Warning! This text is created by @code{MultiMeasureRestText}, not
651 @lilypond[quote,raggedright,verbatim,fragment]
652 \override TextScript #'padding = #5
654 \override MultiMeasureRestText #'padding = #5
658 If you want to have text on the left end of a multi-measure rest,
659 attach the text to a zero-length skip note, i.e.,
669 Program reference: @internalsref{MultiMeasureRestMusicGroup},
670 @internalsref{MultiMeasureRest}.
672 The layout object @internalsref{MultiMeasureRestNumber} is for the
673 default number, and @internalsref{MultiMeasureRestText} for user
679 It is not possible to use fingerings (e.g., @code{R1-4}) to put numbers
680 over multi-measure rests. And the pitch of multi-measure rests (or
681 staff-centered rests) can not be influenced.
683 @cindex condensing rests
685 There is no way to automatically condense multiple rests into a single
686 multi-measure rest. Multi-measure rests do not take part in rest
689 Be careful when entering multi-measure rests followed by whole
690 notes. The following will enter two notes lasting four measures each
694 When @code{skipBars} is set, the result will look OK, but the bar
695 numbering will be off.
698 @node Metronome marks
699 @subsection Metronome marks
702 @cindex beats per minute
703 @cindex metronome marking
705 Metronome settings can be entered as follows
707 \tempo @var{duration} = @var{per-minute}
710 In the MIDI output, they are interpreted as a tempo change. In the
711 layout output, a metronome marking is printed
712 @cindex @code{\tempo}
713 @lilypond[quote,raggedright,verbatim,fragment]
720 To change the tempo in the MIDI output without printing anything, make
721 the metronome marking invisible
723 \once \override Score.MetronomeMark #'transparent = ##t
726 To print other metronome markings, use these markup commands
727 @lilypond[quote,raggedright,verbatim,relative,fragment]
730 \smaller \general-align #Y #DOWN \note #"16." #1
732 \smaller \general-align #Y #DOWN \note #"8" #1
737 See @ref{Text markup} for more details.
742 Program reference: @internalsref{MetronomeMark}.
747 Collisions are not checked. If you have notes above the top line of
748 the staff (or notes with articulations, slurs, text, etc), then the
749 metronome marking may be printed on top of musical symbols. If this
750 occurs, increase the padding of the metronome mark to place it
751 further away from the staff.
754 \override Score.MetronomeMark #'padding = #2.5
758 @node Rehearsal marks
759 @subsection Rehearsal marks
761 @cindex Rehearsal marks
764 To print a rehearsal mark, use the @code{\mark} command
766 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
775 The letter@tie{}`I' is skipped in accordance with engraving traditions.
776 If you wish to include the letter `I', then use
779 \set Score.markFormatter = #format-mark-alphabet
782 The mark is incremented automatically if you use @code{\mark
783 \default}, but you can also use an integer argument to set the mark
784 manually. The value to use is stored in the property
785 @code{rehearsalMark}.
787 The style is defined by the property @code{markFormatter}. It is a
788 function taking the current mark (an integer) and the current context
789 as argument. It should return a markup object. In the following
790 example, @code{markFormatter} is set to a canned procedure. After a
791 few measures, it is set to function that produces a boxed number.
793 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
794 \set Score.markFormatter = #format-mark-numbers
797 \set Score.markFormatter = #format-mark-box-numbers
803 The file @file{scm/@/translation@/-functions@/.scm} contains the definitions
804 of @code{format-mark-numbers} (the default format), @code{format-mark-box-numbers},
805 @code{format-mark-letters} and @code{format-mark-box-letters}.
806 These can be used as inspiration for other formatting functions.
811 Program reference: @internalsref{RehearsalMark}.
813 Init files: @file{scm/@/translation@/-functions@/.scm} contains the
814 definition of @code{format-mark-numbers} and
815 @code{format-mark-letters}. They can be used as inspiration for other
816 formatting functions.
818 Examples: @inputfileref{input/@/regression,rehearsal@/-mark@/-letter@/.ly},
820 @inputfileref{input/@/regression,rehearsal@/-mark@/-number@/.ly}.
824 @subsection Bar numbers
827 @cindex measure numbers
828 @cindex @code{currentBarNumber}
830 Bar numbers are printed by default at the start of the line. The
831 number itself is stored in the @code{currentBarNumber} property, which
832 is normally updated automatically for every measure.
834 Bar numbers can be typeset at regular intervals instead of at the
835 beginning of each line. This is illustrated in the following example,
836 whose source is available as
837 @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}
839 @lilypondfile[raggedright,quote]{bar-number-regular-interval.ly}
841 Bar numbers can be typeset manually by tweaking the
842 @code{markFormatter} property
844 @lilypond[verbatim,raggedright,quote]
846 \set Score.markFormatter
847 = #(lambda (mark context)
850 (number->string (ly:context-property context
851 'currentBarNumber)))))
853 c1 \bar "||" \mark \default c1 c1 \mark \default c1 \bar "|."
857 Bar numbers can be manually changed by setting the
858 @code{Staff.currentBarNumber} property
860 @lilypond[verbatim,raggedright,quote]
862 \repeat unfold 4 {c4 c c c} \break
863 \set Score.currentBarNumber = #50
864 \repeat unfold 4 {c4 c c c}
871 Program reference: @internalsref{BarNumber}.
874 @inputfileref{input/@/test,bar@/-number@/-every@/-five@/-reset@/.ly},
875 and @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}.
880 Bar numbers can collide with the @internalsref{StaffGroup} bracket, if
881 there is one at the top. To solve this, the
882 @code{padding} property of @internalsref{BarNumber} can be
883 used to position the number correctly.
886 @node Instrument names
887 @subsection Instrument names
889 In an orchestral score, instrument names are printed at the left side
892 This can be achieved by setting @internalsref{Staff}.@code{instrument}
893 and @internalsref{Staff}.@code{instr}. This will print a string before
894 the start of the staff. For the first staff, @code{instrument} is
895 used, for the following ones, @code{instr} is used.
897 @lilypond[quote,verbatim,raggedright,relative=1,fragment]
898 \set Staff.instrument = "Ploink "
899 \set Staff.instr = "Plk "
905 You can also use markup texts to construct more complicated instrument
908 @lilypond[quote,fragment,verbatim,raggedright]
909 \set Staff.instrument = \markup {
910 \column { "Clarinetti"
911 \line { "in B" \smaller \flat } } }
915 If you wish to center the instrument names, you must center all of them
917 @lilypond[quote,verbatim,raggedright]
920 \set Staff.instrument = \markup {
921 \center-align { "Clarinetti"
922 \line { "in B" \smaller \flat } } }
926 \set Staff.instrument = \markup{ \center-align { Vibraphone }}
933 For longer instrument names, it may be useful to increase the
934 @code{indent} setting in the @code{\layout} block.
938 Program reference: @internalsref{InstrumentName}.
942 When you put a name on a grand staff or piano staff, the width of the
943 brace is not taken into account. The following property setting can be
944 used to move the instrument names to the left, in such situations.
947 \override Score.InstrumentName #'space-alist = #'((left-edge extra-space . 2.0))
951 @node Instrument transpositions
952 @subsection Instrument transpositions
954 @cindex transposition, MIDI
955 @cindex transposition, instrument
957 The key of a transposing instrument can also be specified. This
958 applies to many wind instruments, for example, clarinets (B-flat, A, and
959 E-flat), horn (F) and trumpet (B-flat, C, D, and E-flat).
961 The transposition is entered after the keyword @code{\transposition}
964 \transposition bes %% B-flat clarinet
968 This command sets the property @code{instrumentTransposition}. The value of
969 this property is used for MIDI output and quotations. It does not
970 affect how notes are printed in the current staff. To change the printed
971 output, see @ref{Transpose}.
973 The pitch to use for @code{\transposition} should correspond to the
974 real sound heard when a @code{c'} written on the staff is played by the
975 transposing instrument. For example, when entering a score in
976 concert pitch, typically all voices are entered in C, so
977 they should be entered as
990 The command @code{\transposition} should be used when the music is
991 entered from a (transposed) orchestral part. For example, in
992 classical horn parts, the tuning of the instrument is often changed
993 during a piece. When copying the notes from the part, use
994 @code{\transposition}, e.g.,
1006 @node Ottava brackets
1007 @subsection Ottava brackets
1009 `Ottava' brackets introduce an extra transposition of an octave for
1010 the staff. They are created by invoking the function
1011 @code{set-octavation}
1017 @lilypond[quote,raggedright,verbatim,fragment]
1027 The @code{set-octavation} function also takes -1 (for 8va bassa) and 2
1028 (for 15ma) as arguments. Internally the function sets the properties
1029 @code{ottavation} (e.g., to @code{"8va"}) and
1030 @code{centralCPosition}. For overriding the text of the bracket, set
1031 @code{ottavation} after invoking @code{set-octavation}, i.e.,
1033 @lilypond[quote,raggedright,verbatim]
1036 \set Staff.ottavation = #"8"
1044 Program reference: @internalsref{OttavaBracket}.
1046 Examples: @inputfileref{input/@/regression,ottava@/.ly},
1047 @inputfileref{input/@/regression,ottava@/-broken@/.ly}.
1052 @code{set-octavation} will get confused when clef changes happen
1053 during an octavation bracket.
1056 @node Different editions from one source
1057 @subsection Different editions from one source
1062 The @code{\tag} command marks music expressions with a name. These
1063 tagged expressions can be filtered out later. With this mechanism it
1064 is possible to make different versions of the same music source.
1066 In the following example, we see two versions of a piece of music, one
1067 for the full score, and one with cue notes for the instrumental part
1083 The same can be applied to articulations, texts, etc.: they are
1086 -\tag #@var{your-tag}
1088 to an articulation, for example,
1093 This defines a note with a conditional fingering indication.
1096 @cindex removeWithTag
1097 By applying the @code{\keepWithTag} and @code{\removeWithTag}
1098 commands, tagged expressions can be filtered. For example,
1102 \keepWithTag #'score @var{the music}
1103 \keepWithTag #'part @var{the music}
1108 @lilypondfile[raggedright,quote]{tag-filter.ly}
1110 The argument of the @code{\tag} command should be a symbol. It's
1111 possible to put multiple tags on a piece of music, with multiple
1112 @code{\tag} entries,
1114 \tag #'original-part \tag #'transposed-part @dots{}
1120 Examples: @inputfileref{input/@/regression,tag@/-filter@/.ly}.
1125 Multiple rests are not merged if you create the score with both tagged
1130 @node Orchestral music
1131 @section Orchestral music
1133 Orchestral music involves some special notation, both in the full
1134 score and the individual parts. This section explains how to tackle
1135 some common problems in orchestral music.
1138 * Automatic part combining::
1140 * Quoting other voices::
1141 * Formatting cue notes::
1142 * Aligning to cadenzas::
1146 @node Automatic part combining
1147 @subsection Automatic part combining
1148 @cindex automatic part combining
1149 @cindex part combiner
1151 Automatic part combining is used to merge two parts of music onto a
1152 staff. It is aimed at typesetting orchestral scores. When the two
1153 parts are identical for a period of time, only one is shown. In
1154 places where the two parts differ, they are typeset as separate
1155 voices, and stem directions are set automatically. Also, solo and
1156 @emph{a due} parts are identified and can be marked.
1158 The syntax for part combining is
1161 \partcombine @var{musicexpr1} @var{musicexpr2}
1165 The following example demonstrates the basic functionality of the part
1166 combiner: putting parts on one staff, and setting stem directions and
1169 @lilypond[quote,verbatim,raggedright,fragment]
1170 \new Staff \partcombine
1171 \relative g' { g g a( b) c c r r }
1172 \relative g' { g g r4 r e e g g }
1175 The first @code{g} appears only once, although it was
1176 specified twice (once in each part). Stem, slur, and tie directions are
1177 set automatically, depending whether there is a solo or unisono. The
1178 first part (with context called @code{one}) always gets up stems, and
1179 `Solo', while the second (called @code{two}) always gets down stems and
1182 If you just want the merging parts, and not the textual markings, you
1183 may set the property @code{printPartCombineTexts} to false
1185 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
1187 \set Staff.printPartCombineTexts = ##f
1189 \relative g' { g a( b) r }
1190 \relative g' { g r4 r f }
1194 To change the text that is printed for solos or merging, you may
1195 set the @code{soloText}, @code{soloIIText}, and @code{aDueText}
1198 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
1200 \set Score.soloText = #"ichi"
1201 \set Score.soloIIText = #"ni"
1202 \set Score.aDueText = #"tachi"
1204 \relative g' { g4 g a( b) r }
1205 \relative g' { g4 g r r f }
1209 Both arguments to @code{\partcombine} will be interpreted as
1210 @internalsref{Voice} contexts. If using relative octaves,
1211 @code{\relative} should be specified for both music expressions, i.e.,
1215 \relative @dots{} @var{musicexpr1}
1216 \relative @dots{} @var{musicexpr2}
1220 A @code{\relative} section that is outside of @code{\partcombine} has
1221 no effect on the pitches of @var{musicexpr1} and @var{musicexpr2}.
1225 Program reference: @internalsref{PartCombineMusic}.
1229 When @code{printPartCombineTexts} is set, when the two voices play the
1230 same notes on and off, the part combiner may typeset @code{a2} more
1231 than once in a measure.
1233 @code{\partcombine} cannot be inside @code{\times}.
1235 @code{\partcombine} cannot be inside @code{\relative}.
1237 Internally, the @code{\partcombine} interprets both arguments as
1238 @code{Voice}s named @code{one} and @code{two}, and then decides when
1239 the parts can be combined. Consequently, if the arguments switch to
1240 differently named @internalsref{Voice} contexts, the events in those
1245 @subsection Hiding staves
1247 @cindex Frenched scores
1248 @cindex Hiding staves
1250 In orchestral scores, staff lines that only have rests are usually
1251 removed; this saves some space. This style is called `French Score'.
1252 For @internalsref{Lyrics},
1253 @internalsref{ChordNames} and @internalsref{FiguredBass}, this is
1254 switched on by default. When the lines of these contexts turn out
1255 empty after the line-breaking process, they are removed.
1257 For normal staves, a specialized @internalsref{Staff} context is
1258 available, which does the same: staves containing nothing (or only
1259 multi-measure rests) are removed. The context definition is stored in
1260 @code{\RemoveEmptyStaffContext} variable. Observe how the second staff
1261 in this example disappears in the second line
1263 @lilypond[quote,raggedright,verbatim]
1265 \context { \RemoveEmptyStaffContext }
1270 \new Staff { e4 f g a \break c1 }
1271 \new Staff { c4 d e f \break R1 }
1276 The first system shows all staves in full. If empty staves should be
1277 removed from the first system too, set @code{remove-first} to true in
1278 @internalsref{VerticalAxisGroup}.
1281 \override Score.VerticalAxisGroup #'remove-first = ##t
1284 To remove other types of contexts, use @code{\AncientRemoveEmptyStaffContext}
1285 or @code{\RemoveEmptyRhythmicStaffContext}.
1287 Another application is making ossia sections, i.e., alternative
1288 melodies on a separate piece of staff, with help of a Frenched
1289 staff. See @inputfileref{input/@/test,ossia@/.ly} for an example.
1292 @node Quoting other voices
1293 @subsection Quoting other voices
1295 With quotations, fragments of other parts can be inserted into a part
1296 directly. Before a part can be quoted, it must be marked especially as
1297 quotable. This is done with the @code{\addquote} command.
1300 \addquote @var{name} @var{music}
1305 Here, @var{name} is an identifying string. The @var{music} is any kind
1306 of music. Here is an example of @code{\addquote}
1309 \addquote clarinet \relative c' @{
1314 This command must be entered at toplevel, i.e., outside any music
1317 After calling @code{\addquote}, the quotation may then be done with
1318 @code{\quoteDuring} or @code{\cueDuring},
1321 \quoteDuring #@var{name} @var{music}
1324 During a part, a piece of music can be quoted with the @code{\quoteDuring}
1328 \quoteDuring #"clarinet" @{ s2. @}
1331 This would cite three quarter notes (the duration of @code{s2.}) of
1332 the previously added @code{clarinet} voice.
1335 More precisely, it takes the current time-step of the part being
1336 printed, and extracts the notes at the corresponding point of the
1337 @code{\addquote}d voice. Therefore, the argument to @code{\addquote}
1338 should be the entire part of the voice to be quoted, including any
1339 rests at the beginning.
1341 Quotations take into account the transposition of both source and target
1342 instruments, if they are specified using the @code{\transposition} command.
1344 @lilypond[quote,raggedright,verbatim]
1345 \addquote clarinet \relative c' {
1351 e'8 f'8 \quoteDuring #"clarinet" { s2 }
1355 The type of events that are present in cue notes can be trimmed with
1356 the @code{quotedEventTypes} property. The default value is
1357 @code{(note-event rest-event)}, which means that only notes and
1358 rests of the cued voice end up in the @code{\quoteDuring}.
1362 \set Staff.quotedEventTypes =
1363 #'(note-event articulation-event dynamic-event)
1367 will quote notes (but no rests), together with scripts and dynamics.
1371 Only the contents of the first @internalsref{Voice} occurring in an
1372 @code{\addquote} command will be considered for quotation, so
1373 @var{music} can not contain @code{\new} and @code{\context Voice}
1374 statements that would switch to a different Voice.
1376 Quoting grace notes is broken and can even cause LilyPond to crash.
1380 In this manual: @ref{Instrument transpositions}.
1382 Examples: @inputfileref{input/@/regression,quote@/.ly}
1383 @inputfileref{input/@/regression,quote@/-transposition@/.ly}
1385 Program reference: @internalsref{QuoteMusic}.
1388 @node Formatting cue notes
1389 @subsection Formatting cue notes
1391 The previous section deals with inserting notes from another voice.
1392 There is a more advanced music function called @code{\cueDuring},
1393 which makes formatting cue notes easier.
1398 \cueDuring #@var{name} #@var{updown} @var{music}
1401 This will insert notes from the part @var{name} into a
1402 @internalsref{Voice} called @code{cue}. This happens simultaneously
1403 with @var{music}, which usually is a rest. When the cue notes start,
1404 the staff in effect becomes polyphonic for a moment. The argument
1405 @var{updown} determines whether the cue notes should be notated as a
1406 first or second voice.
1409 @lilypond[verbatim,raggedright]
1412 \override Stem #'length-fraction = #0.8
1413 \override Beam #'thickness = #0.384
1414 \override Beam #'length-fraction = #0.8
1417 \addquote clarinet \relative {
1422 \new Staff \relative <<
1424 % setup a context for cue notes.
1425 \context Voice = cue { \smaller \skip 1*21 }
1427 \set Score.skipBars = ##t
1431 \cueDuring #"clarinet" #1 {
1440 Here are a couple of hints for successful cue notes
1444 Cue notes have smaller font sizes.
1446 the cued part is marked with the instrument playing the cue.
1448 when the original part takes over again, this should be marked with
1449 the name of the original instrument.
1451 @c really? Are you sure about that last point? I'll check after 3.0 -gp
1453 @c Yes, this is good practice. Otherwise, the start of the original
1454 @c part can only be seen from the font size. This is not good enough
1455 @c for sight-reading. It is possilbe to use other
1456 @c markers (eg. a big close-bracket over the staff) to indicate the cue notes are
1461 Any other changes introduced by the cued part should also be
1462 undone. For example, if the cued instrument plays in a different clef,
1463 the original clef should be stated once again.
1468 @node Aligning to cadenzas
1469 @subsection Aligning to cadenzas
1471 In an orchestral context, cadenzas present a special problem:
1472 when constructing a score that includes a cadenza, all other
1473 instruments should skip just as many notes as the length of the
1474 cadenza, otherwise they will start too soon or too late.
1476 A solution to this problem are the functions @code{mmrest-of-length}
1477 and @code{skip-of-length}. These Scheme functions take a piece of music
1478 as argument, and generate a @code{\skip} or multi-rest, exactly as
1479 long as the piece. The use of @code{mmrest-of-length} is demonstrated
1480 in the following example.
1482 @lilypond[verbatim,raggedright,quote]
1483 cadenza = \relative c' {
1484 c4 d8 << { e f g } \\ { d4. } >>
1489 \new Staff { \cadenza c'4 }
1491 #(ly:export (mmrest-of-length cadenza))
1500 @node Contemporary notation
1501 @section Contemporary notation
1503 In the 20th century, composers have greatly expanded the musical
1504 vocabulary. With this expansion, many innovations in musical notation
1505 have been tried. The book ``Music Notation in the 20th century'' by
1506 Kurt Stone gives a comprehensive overview (see @ref{Literature
1507 list}). In general, the use of new, innovative notation makes a piece
1508 harder to understand and perform and its use should therefore be
1509 avoided. For this reason, support for contemporary notation in
1510 LilyPond is limited.
1514 * Polymetric notation::
1515 * Time administration::
1517 * Special fermatas::
1518 * Special noteheads::
1525 @node Polymetric notation
1526 @subsection Polymetric notation
1528 Double time signatures are not supported explicitly, but they can be
1529 faked. In the next example, the markup for the time signature is
1530 created with a markup text. This markup text is inserted in the
1531 @internalsref{TimeSignature} grob.
1533 @lilypond[verbatim,raggedright]
1538 \musicglyph #"scripts.stopped"
1539 \bracket \column { "5" "8" }
1544 \override Staff.TimeSignature #'stencil = #Text_interface::print
1545 \override Staff.TimeSignature #'text = #tsMarkup
1547 c'2 \bar ":" c'4 c'4.
1551 Each staff can also have its own time signature. This is done by
1552 moving the @internalsref{Timing_translator} to the @internalsref{Staff}
1558 \remove "Timing_translator"
1559 \remove "Default_bar_line_engraver"
1563 \consists "Timing_translator"
1564 \consists "Default_bar_line_engraver"
1571 Now, each staff has its own time signature.
1584 c4. c8 c c c4. c8 c c
1589 @lilypond[quote,raggedright]
1593 \remove "Timing_translator"
1594 \remove "Default_bar_line_engraver"
1597 \consists "Timing_translator"
1598 \consists "Default_bar_line_engraver"
1613 c4. c8 c c c4. c8 c c
1619 A different form of polymetric notation is where note lengths have
1620 different values across staves.
1622 This notation can be created by setting a common time signature for
1623 each staff but replacing it manually using
1624 @code{timeSignatureFraction} to the desired fraction. Then the printed
1625 durations in each staff are scaled to the common time signature.
1626 The latter is done with @code{\compressMusic}, which is used similar
1627 to @code{\times}, but does not create a tuplet bracket. The syntax is
1629 \compressMusic #'(@var{numerator} . @var{denominator}) @var{musicexpr}
1634 In this example, music with the time signatures of 3/4, 9/8, and 10/8 are
1635 used in parallel. In the second staff, shown durations are multiplied by
1636 2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are
1637 multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
1639 @lilypond[quote,raggedright,verbatim,fragment]
1647 \set Staff.timeSignatureFraction = #'(9 . 8)
1648 \compressMusic #'(2 . 3)
1649 \repeat unfold 6 { c8[ c c] }
1653 \set Staff.timeSignatureFraction = #'(10 . 8)
1654 \compressMusic #'(3 . 5) {
1655 \repeat unfold 2 { c8[ c c] }
1656 \repeat unfold 2 { c8[ c] }
1657 | c4. c4. \times 2/3 { c8 c c } c4
1668 When using different time signatures in parallel, the spacing is
1669 aligned vertically, but bar lines distort the regular spacing.
1672 @node Time administration
1673 @subsection Time administration
1675 @cindex Time administration
1677 Time is administered by the @internalsref{Time_signature_engraver},
1678 which usually lives in the @internalsref{Score} context. The
1679 bookkeeping deals with the following variables
1682 @item currentBarNumber
1686 The length of the measures in the current time signature. For a 4/4
1687 time this is@tie{}1, and for 6/8 it is 3/4.
1689 @item measurePosition
1690 The point within the measure where we currently are. This quantity
1691 is reset to@tie{}0 whenever it exceeds @code{measureLength}. When that
1692 happens, @code{currentBarNumber} is incremented.
1695 If set to true, the above variables are updated for every time
1696 step. When set to false, the engraver stays in the current measure
1700 Timing can be changed by setting any of these variables explicitly.
1701 In the next example, the 4/4 time signature is printed, but
1702 @code{measureLength} is set to 5/4. After a while, the measure is
1703 shortened by 1/8, by setting @code{measurePosition} to 7/8 at 2/4
1704 in the measure, so the next bar line will fall at 2/4 + 3/8. The
1705 3/8 arises because 5/4 normally has 10/8, but we have manually
1706 set the measure position to be 7/8 and 10/8 - 7/8 = 3/8.
1708 @lilypond[quote,raggedright,verbatim,relative,fragment]
1709 \set Score.measureLength = #(ly:make-moment 5 4)
1713 \set Score.measurePosition = #(ly:make-moment 7 8)
1721 @subsection Clusters
1725 A cluster indicates a continuous range of pitches to be played. They
1726 can be denoted as the envelope of a set of notes. They are entered by
1727 applying the function @code{makeClusters} to a sequence of
1729 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1730 \makeClusters { <c e > <b f'> }
1733 The following example (from
1734 @inputfileref{input/@/regression,cluster@/.ly}) shows what the result
1737 @lilypondfile[raggedright,quote]{cluster.ly}
1739 Ordinary notes and clusters can be put together in the same staff,
1740 even simultaneously. In such a case no attempt is made to
1741 automatically avoid collisions between ordinary notes and clusters.
1745 Program reference: @internalsref{ClusterSpanner},
1746 @internalsref{ClusterSpannerBeacon},
1747 @internalsref{Cluster_spanner_engraver}.
1749 Examples: @inputfileref{input/@/regression,cluster@/.ly}.
1753 Music expressions like @code{<< @{ g8 e8 @} a4 >>} are not printed
1754 accurately. Use @code{<g a>8 <e a>8} instead.
1758 @node Special fermatas
1759 @subsection Special fermatas
1761 @cindex fermatas, special
1763 In contemporary music notation, special fermata symbols denote breaks
1764 of differing lengths. The following fermatas are supported
1766 @lilypond[quote,raggedright]
1789 \context Lyrics \lyricmode {
1790 \override LyricText #'font-family = #'typewriter
1791 "shortfermata" "fermata" "longfermata" "verylongfermata"
1796 See @ref{Articulations} for general instructions how to apply scripts
1797 such as fermatas to notes.
1800 @node Special noteheads
1801 @subsection Special noteheads
1803 Different noteheads are used by various instruments for various
1804 meanings -- crosses are used for ``parlato'' with vocalists, stopped
1805 notes on guitar; diamonds are used for harmonics on string instruments,
1806 etc. There is a shorthand (@code{\harmonic}) for diamond shapes; the
1807 other notehead styles are produced by tweaking the property
1809 @lilypond[raggedright,relative=1,fragment,verbatim,quote]
1811 \override NoteHead #'style = #'cross
1813 \revert NoteHead #'style
1814 e d <c f\harmonic> <d a'\harmonic>
1818 To see all notehead styles, please see
1819 @inputfileref{input/@/regression,note@/-head@/-style@/.ly}.
1824 Program reference: @internalsref{NoteHead}.
1826 @node Pitched trills
1827 @subsection Pitched trills
1829 Trills that should be executed on an explicitly specified pitch can be
1830 typeset with the command @code{pitchedTrill},
1832 @lilypond[raggedright,verbatim,fragment]
1833 \pitchedTrill c'4\startTrillSpan fis
1837 The first argument is the main note. The absolute pitch of the second
1838 is printed as a stemless note head in parentheses.
1840 @node Feathered beams
1841 @subsection Feathered beams
1843 Feathered beams are not supported natively, but they can be faked by
1844 forcing two beams to overlap. Here is an example,
1846 @c don't change relative setting witout changing positions!
1847 @lilypond[raggedright,relative=1,fragment,verbatim,quote]
1852 \once \override Voice.Beam #'positions = #'(0 . 0.5)
1857 \once \override Voice.Beam #'positions = #'(0 . -0.5)
1865 @subsection Improvisation
1867 Improvisation is sometimes denoted with slashed note heads. Such note
1868 heads can be created by adding a @internalsref{Pitch_squash_engraver}
1869 to the @internalsref{Staff} or @internalsref{Voice} context. Then, the
1873 \set squashedPosition = #0
1874 \override NoteHead #'style = #'slash
1878 switches on the slashes.
1880 There are shortcuts @code{\improvisationOn} (and an accompanying
1881 @code{\improvisationOff}) for this command sequence. They are used in
1882 the following example
1884 @lilypond[verbatim,raggedright,quote]
1886 \consists Pitch_squash_engraver
1888 e8 e g a a16(bes)(a8) g \improvisationOn
1891 ~fis2 \improvisationOff a16(bes) a8 g e
1896 @node Educational use
1897 @section Educational use
1899 With the amount of control that LilyPond offers, one can make great
1900 teaching tools in addition to great musical scores.
1904 * Blank music sheet::
1906 * Shape note heads ::
1907 * Easy Notation note heads::
1908 * Analysis brackets::
1909 * Coloring objects::
1913 @subsection Balloon help
1915 Elements of notation can be marked and named with the help of a square
1916 balloon. The primary purpose of this feature is to explain notation.
1918 The following example demonstrates its use.
1920 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
1923 #(add-balloon-text 'NoteHead "heads, or tails?"
1930 The function @code{add-balloon-text} takes the name of a grob, the
1931 label to print, and the position where to put the label relative to
1932 the object. In the above example, the text ``heads or tails?'' ends
1933 3 spaces below and 1 space to the right of the marked head.
1936 @cindex notation, explaining
1940 Program reference: @internalsref{text-balloon-interface}.
1942 Examples: @inputfileref{input/@/regression,balloon@/.ly}.
1947 @node Blank music sheet
1948 @subsection Blank music sheet
1950 A blank music sheet can be produced also by using invisible notes, and
1951 removing @code{Bar_number_engraver}.
1954 @lilypond[quote,verbatim]
1956 \repeat unfold 2 % Change this for more lines.
1961 \override TimeSignature #'transparent = ##t
1962 defaultBarType = #""
1963 \remove Bar_number_engraver
1965 \context Staff \emptymusic
1966 \context TabStaff \emptymusic
1972 @subsection Hidden notes
1974 @cindex Hidden notes
1975 @cindex Invisible notes
1976 @cindex Transparent notes
1978 @cindex @code{\hideNotes}
1979 @cindex @code{\unHideNotes}
1980 Hidden (or invisible or transparent) notes can be useful in preparing theory
1981 or composition exercises.
1983 @lilypond[quote,raggedright,verbatim,relative=2,fragment]
1991 Hidden notes are also great for performing weird tricks. For example,
1992 slurs cannot be attached to rests or spacer rests, but you may wish
1993 to include that in your score -- string instruments use this notation
1994 when doing pizzicato to indicate that the note should ring for as long
1997 @lilypond[quote,raggedright,verbatim,relative=0,fragment]
2000 c4^"pizz"( \hideNotes c)
2001 \unHideNotes c( \hideNotes c)
2008 @node Shape note heads
2009 @subsection Shape note heads
2011 In shape note head notation, the shape of the note head corresponds
2012 to the harmonic function of a note in the scale. This notation was
2013 popular in the 19th century American song books.
2015 Shape note heads can be produced by setting @code{\aikenHeads} or
2016 @code{\sacredHarpHeads}, depending on the style desired.
2018 @lilypond[verbatim,relative=1,fragment]
2025 Shapes are determined on the step in the scale, where the base of the
2026 scale is determined by the @code{\key} command
2029 @findex shapeNoteStyles
2031 @findex \sacredHarpHeads
2033 Shape note heads are implemented through the @code{shapeNoteStyles}
2034 property. Its value is a vector of symbols. The k-th element indicates
2035 the style to use for the k-th step of the scale. Arbitrary
2036 combinations are possible, eg.,
2039 @lilypond[verbatim,relative=1,fragment]
2040 \set shapeNoteStyles = ##(cross triangle fa #f mensural xcircle diamond)
2045 @node Easy Notation note heads
2046 @subsection Easy Notation note heads
2048 @cindex easy notation
2051 The `easy play' note head includes a note name inside the head. It is
2052 used in music for beginners
2054 @lilypond[quote,raggedright,verbatim,fragment,staffsize=26]
2059 The command @code{\setEasyHeads} overrides settings for the
2060 @internalsref{NoteHead} object. To make the letters readable, it has
2061 to be printed in a large font size. To print with a larger font, see
2062 @ref{Setting global staff size}.
2066 @cindex @code{\setEasyHeads}
2067 @code{\setEasyHeads}
2070 @node Analysis brackets
2071 @subsection Analysis brackets
2073 @cindex phrasing brackets
2074 @cindex musicological analysis
2075 @cindex note grouping bracket
2077 Brackets are used in musical analysis to indicate structure in musical
2078 pieces. LilyPond supports a simple form of nested horizontal
2079 brackets. To use this, add the @internalsref{Horizontal_bracket_engraver}
2080 to @internalsref{Staff} context. A bracket is started with
2081 @code{\startGroup} and closed with @code{\stopGroup}
2083 @lilypond[quote,raggedright,verbatim]
2086 c4\startGroup\startGroup
2089 c4\stopGroup\stopGroup
2093 \Staff \consists "Horizontal_bracket_engraver"
2099 Program reference: @internalsref{HorizontalBracket}.
2101 Examples: @inputfileref{input/@/regression,note@/-group@/-bracket@/.ly}.
2104 @node Coloring objects
2105 @subsection Coloring objects
2107 Individual objects may be assigned colors. You may use the
2108 color names listed in the @ref{List of colors}.
2110 @lilypond[quote,raggedright,verbatim,fragment,relative=1]
2111 \override NoteHead #'color = #red
2113 \override NoteHead #'color = #(x11-color 'LimeGreen)
2115 \override Stem #'color = #blue
2119 The full range of colors defined for X11 can be accessed by using the
2120 scheme function x11-color. The function takes one argument that can be a
2124 \override Beam #'color = #(x11-color 'MediumTurquoise)
2130 \override Beam #'color = #(x11-color "MediumTurquoise")
2133 The first form is quicker to write and is more efficient. However, using
2134 the second form it is possible to access X11 colors by the multi-word
2138 \override Beam #'color = #(x11-color "medium turquoise")
2141 If x11-color cannot make sense of the parameter then the color returned
2142 defaults to black. It should be obvious from the final score that
2145 This example, illustrates the use of x11-color. Notice that the stem
2146 color remains black after being set to (x11-color 'Boggle), which is
2147 deliberate nonsense.
2149 @lilypond[quote,raggedright,verbatim]
2151 \override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
2152 \set Staff.instrument = \markup {
2153 \with-color #(x11-color 'navy) "Clarinet"
2157 \override Beam #'color = #(x11-color "medium turquoise")
2159 \override NoteHead #'color = #(x11-color "LimeGreen")
2161 \override Stem #'color = #(x11-color 'Boggle)
2169 Appendix: @ref{List of colors}.
2173 Not all x11 colors are distinguishable in a web browser. For web use
2174 normal colors are recommended.
2176 An x11 color is not necessarily exactly the same shade as a similarly
2180 @node Automatic notation
2181 @section Automatic notation
2183 This section describes how to change the way that accidentals and
2184 beams are automatically displayed.
2186 FIXME: this might get moved into Changing Defaults. Please send
2187 opinions to lilypond-devel. Thanks! :)
2190 * Automatic accidentals::
2191 * Setting automatic beam behavior::
2194 @node Automatic accidentals
2195 @subsection Automatic accidentals
2196 @cindex Automatic accidentals
2198 Common rules for typesetting accidentals have been placed in a
2199 function. This function is called as follows
2201 @cindex @code{set-accidental-style}
2203 #(set-accidental-style 'STYLE #('CONTEXT#))
2206 The function can take two arguments: the name of the accidental style,
2207 and an optional argument that denotes the context that should be
2208 changed. If no context name is supplied, @code{Staff} is the default,
2209 but you may wish to apply the accidental style to a single @code{Voice}
2212 The following accidental styles are supported
2215 This is the default typesetting behavior. It corresponds
2216 to 18th century common practice: Accidentals are
2217 remembered to the end of the measure in which they occur and
2218 only on their own octave.
2221 The normal behavior is to remember the accidentals on
2222 Staff-level. This variable, however, typesets accidentals
2223 individually for each voice. Apart from that, the rule is similar to
2226 As a result, accidentals from one voice do not get canceled in other
2227 voices, which is often an unwanted result
2229 @lilypond[quote,raggedright,relative=1,fragment,verbatim]
2231 #(set-accidental-style 'voice)
2238 The @code{voice} option should be used if the voices
2239 are to be read solely by individual musicians. If the staff is to be
2240 used by one musician (e.g., a conductor) then
2241 @code{modern} or @code{modern-cautionary}
2242 should be used instead.
2245 @cindex @code{modern} style accidentals
2246 This rule corresponds to the common practice in the 20th century. This rule
2247 prints the same accidentals as @code{default}, but temporary
2248 accidentals also are canceled in other octaves. Furthermore,
2249 in the same octave, they also get canceled in the following
2252 @lilypond[quote,raggedright,fragment,verbatim]
2253 #(set-accidental-style 'modern)
2254 cis' c'' cis'2 | c'' c'
2257 @item @code{modern-cautionary}
2258 @cindex @code{modern-cautionary}
2259 This rule is similar to @code{modern}, but the ``extra'' accidentals
2260 (the ones not typeset by @code{default}) are typeset as cautionary
2261 accidentals. They are printed in reduced size or with parentheses
2262 @lilypond[quote,raggedright,fragment,verbatim]
2263 #(set-accidental-style 'modern-cautionary)
2264 cis' c'' cis'2 | c'' c'
2267 @cindex @code{modern-voice}
2269 This rule is used for multivoice accidentals to be read both by musicians
2270 playing one voice and musicians playing all voices. Accidentals are
2271 typeset for each voice, but they @emph{are} canceled across voices in
2272 the same @internalsref{Staff}.
2274 @cindex @code{modern-voice-cautionary}
2275 @item modern-voice-cautionary
2276 This rule is the same as @code{modern-voice}, but with the extra
2277 accidentals (the ones not typeset by @code{voice}) typeset
2278 as cautionaries. Even though all accidentals typeset by
2279 @code{default} @emph{are} typeset by this variable,
2280 some of them are typeset as cautionaries.
2283 @cindex @code{piano} accidentals
2284 This rule reflects 20th century practice for piano notation. Very similar to
2285 @code{modern} but accidentals also get canceled
2286 across the staves in the same @internalsref{GrandStaff} or
2287 @internalsref{PianoStaff}.
2289 @item piano-cautionary
2290 @cindex @code{#(set-accidental-style 'piano-cautionary)}
2291 Same as @code{#(set-accidental-style 'piano)} but with the extra
2292 accidentals typeset as cautionaries.
2295 @cindex @code{no-reset} accidental style
2296 This is the same as @code{default} but with accidentals lasting
2297 ``forever'' and not only until the next measure
2298 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
2299 #(set-accidental-style 'no-reset)
2304 This is sort of the opposite of @code{no-reset}: Accidentals
2305 are not remembered at all---and hence all accidentals are
2306 typeset relative to the key signature, regardless of what was
2309 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
2310 #(set-accidental-style 'forget)
2311 \key d\major c4 c cis cis d d dis dis
2318 Program reference: @internalsref{Accidental_engraver},
2319 @internalsref{Accidental}, and @internalsref{AccidentalPlacement}.
2324 Simultaneous notes are considered to be entered in sequential
2325 mode. This means that in a chord the accidentals are typeset as if the
2326 notes in the chord happened once at a time - in the order in which
2327 they appear in the input file.
2329 This is a problem when accidentals in a chord depend on each other,
2330 which does not happen for the default accidental style. The problem
2331 can be solved by manually inserting @code{!} and @code{?} for the
2335 @node Setting automatic beam behavior
2336 @subsection Setting automatic beam behavior
2338 @cindex @code{autoBeamSettings}
2339 @cindex @code{(end * * * *)}
2340 @cindex @code{(begin * * * *)}
2341 @cindex automatic beams, tuning
2342 @cindex tuning automatic beaming
2344 @c [TODO: use \applyContext]
2346 In normal time signatures, automatic beams can start on any note but can
2347 only end in a few positions within the measure: beams can end on a beat,
2348 or at durations specified by the properties in
2349 @code{autoBeamSettings}. The properties in @code{autoBeamSettings}
2350 consist of a list of rules for where beams can begin and end. The
2351 default @code{autoBeamSettings} rules are defined in
2352 @file{scm/@/auto@/-beam@/.scm}.
2354 In order to add a rule to the list, use
2356 #(override-auto-beam-setting '(be p q n m) a b [context])
2361 @item @code{be} is either "begin" or "end".
2363 @item @code{p/q} is the duration of the note for which you want
2364 to add a rule. A beam is considered to have the duration of its
2365 shortest note. Set @code{p} and @code{q} to @code{'*'} to
2366 have this apply to any beam.
2368 @item @code{n/m} is the time signature to which
2369 this rule should apply. Set @code{n} and @code{m} to @code{'*'}
2370 to have this apply in any time signature.
2372 @item @code{a/b} is the position in the bar at which the beam should begin/end.
2374 @item @code{context} is optional, and it specifies the context at which
2375 the change should be made. The default is @code{'Voice}.
2376 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
2377 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
2381 For example, if automatic beams should always end on the first quarter
2385 #(override-auto-beam-setting '(end * * * *) 1 4)
2388 You can force the beam settings to only take effect on beams whose shortest
2389 note is a certain duration
2391 @lilypond[quote,fragment,raggedright,verbatim,relative=2]
2393 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
2395 a32 a a a a16 a a a a a |
2396 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
2397 a32 a a a a16 a a a a a |
2400 You can force the beam settings to only take effect in certain time
2403 @lilypond[quote,fragment,raggedright,verbatim,relative=2]
2405 #(override-auto-beam-setting '(end * * 5 8) 2 8)
2413 You can also remove a previously set beam-ending rule by using
2416 #(revert-auto-beam-setting '(be p q n m) a b [context])
2420 be, p, q, n, m, a, b and context are the same as above. Note that the
2421 default rules are specified in @file{scm/@/auto@/-beam@/.scm},
2422 so you can revert rules that you did not explicitly create.
2424 @lilypond[quote,fragment,raggedright,verbatim,relative=2]
2426 a16 a a a a a a a a a a a a a a a
2427 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
2428 a16 a a a a a a a a a a a a a a a
2431 The rule in a revert-auto-beam-setting statement must exactly match the
2432 original rule. That is, no wildcard expansion is taken into account.
2434 @lilypond[quote,fragment,raggedright,verbatim,relative=2]
2436 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
2438 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
2440 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
2446 @c TODO: old material -- not covered by above stuff, I think.
2447 If automatic beams should end on every quarter in 5/4 time, specify
2450 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
2451 #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
2452 #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
2453 #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
2457 The same syntax can be used to specify beam starting points. In this
2458 example, automatic beams can only end on a dotted quarter note
2460 #(override-auto-beam-setting '(end * * * *) 3 8)
2461 #(override-auto-beam-setting '(end * * * *) 1 2)
2462 #(override-auto-beam-setting '(end * * * *) 7 8)
2464 In 4/4 time signature, this means that automatic beams could end only on
2465 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
2466 3/8, has passed within the measure).
2468 @cindex automatic beam generation
2470 @cindex @code{autoBeaming}
2473 If beams are used to indicate melismata in songs, then automatic
2474 beaming should be switched off with @code{\autoBeamOff}.
2479 @cindex @code{\autoBeamOff}
2480 @code{\autoBeamOff},
2481 @cindex @code{\autoBeamOn}
2487 If a score ends while an automatic beam has not been ended and is
2488 still accepting notes, this last beam will not be typeset at all. The
2489 same holds polyphonic voices, entered with @code{<< @dots{} \\ @dots{}
2490 >>}. If a polyphonic voice ends while an automatic beam is still
2491 accepting notes, it is not typeset.