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,ragged-right,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,ragged-right,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,ragged-right,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,ragged-right,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,ragged-right,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 "
190 Text marks may be aligned with notation objects other than
193 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
198 \set Score.rehearsalMarkAlignSymbol = #'key-signature
202 \set Score.rehearsalMarkAlignSymbol = #'clef
212 Program reference: @internalsref{RehearsalMark}.
216 @subsection Text markup
223 Use @code{\markup} to typeset text. Commands are entered with the
224 backslash @code{\}. To enter @code{\} and @code{#}, use double
227 @lilypond[quote,verbatim,fragment,relative=1]
229 c1_\markup { hi there }
230 c1^\markup { hi \bold there, is \italic anyone home? }
231 c1_\markup { "\special #characters" }
235 See @ref{Overview of text markup commands} for a list of all
238 @code{\markup} is primarily used for @internalsref{TextScript}s,
239 but it can also be used anywhere text is called in lilypond
241 @lilypond[quote,verbatim]
242 \header{ title = \markup{ \bold { foo \italic { bar! } } } }
245 \override Score.RehearsalMark
246 #'break-visibility = #begin-of-line-invisible
247 \override Score.RehearsalMark #'self-alignment-X = #right
249 \set Staff.instrument = \markup{ \column{ Alto solo } }
250 c2^\markup{ don't be \flat }
251 \override TextSpanner #'edge-text = #(cons (markup #:italic "rit" ) "")
253 a2\mark \markup{ \large \bold Fine }
257 \addlyrics { bar, foo \markup{ \italic bar! } }
261 Text can also be placed on its own, away from any @code{\score}
262 block. This is primarily used in a @code{\book} (see
263 @ref{Multiple movements}).
265 @lilypond[quote,ragged-right,verbatim]
266 \markup{ Here is some text. }
269 @cindex font switching
271 The markup in the example demonstrates font switching commands. The
272 command @code{\bold} and @code{\italic} apply to the first following
273 word only; to apply a command to more than one word, enclose the
277 \markup @{ \bold @{ hi there @} @}
281 For clarity, you can also do this for single arguments, e.g.,
284 \markup @{ is \italic @{ anyone @} home @}
287 In markup mode you can compose expressions, similar to mathematical
288 expressions, XML documents, and music expressions. You can stack
289 expressions grouped vertically with the command @code{\column}.
290 Similarly, @code{\center-align} aligns texts by their center lines:
292 @lilypond[quote,verbatim,fragment,relative=1]
293 c1^\markup { \column { a bbbb \line { c d } } }
294 c1^\markup { \center-align { a bbbb c } }
295 c1^\markup { \line { a b c } }
298 Lists with no previous command are not kept distinct. The expression
301 \center-align @{ @{ a b @} @{ c d @} @}
309 \center-align @{ a b c d @}
314 To keep lists of words distinct, please use quotes @code{"} or
315 the @code{\line} command
317 @lilypond[quote,verbatim,fragment,relative=1]
319 c4^\markup{ \center-align { on three lines } }
320 c4^\markup{ \center-align { "all one line" } }
321 c4^\markup{ \center-align { { on three lines } } }
322 c4^\markup{ \center-align { \line { on one line } } }
325 Markups can be stored in variables and these variables
326 may be attached to notes, like
328 allegro = \markup @{ \bold \large @{ Allegro @} @}
329 @{ a^\allegro b c d @}
332 Some objects have alignment procedures of their own, which cancel out
333 any effects of alignments applied to their markup arguments as a
334 whole. For example, the @internalsref{RehearsalMark} is horizontally
335 centered, so using @code{\mark \markup @{ \left-align .. @}} has no
338 In addition, vertical placement is performed after creating the
339 text markup object. If you wish to move an entire piece of markup,
340 you need to use the #'padding property or create an "anchor" point
341 inside the markup (generally with @code{\hspace #0}).
343 @lilypond[quote,verbatim,fragment,relative=1]
345 c'4^\markup{ \raise #5 "not raised" }
346 \once \override TextScript #'padding = #3
347 c'4^\markup{ raised }
348 c'4^\markup{ \hspace #0 \raise #1.5 raised }
354 This manual: @ref{Overview of text markup commands}.
356 Program reference: @internalsref{TextScript}.
358 Init files: @file{scm/@/new@/-markup@/.scm}.
363 Kerning or generation of ligatures is only done when the @TeX{}
364 backend is used. In this case, LilyPond does not account for them so
365 texts will be spaced slightly too wide.
367 Syntax errors for markup mode are confusing.
371 @subsection Text encoding
373 LilyPond uses the Pango library to format multi-lingual texts, and
374 does not perform any input-encoding conversions. This means that any
375 text, be it title, lyric text, or musical instruction containing
376 non-ASCII characters, must be utf-8. Easiest to enter such texts is
377 by using a Unicode-aware editor, and save using utf-8 encoding. Most
378 popular modern editors have utf-8 support, for example, vim, Emacs,
381 Depending on the fonts installed, the following fragment shows Hebrew
388 @lilypondfile[fontload]{utf-8.ly}
390 The @TeX{} backend does not handle encoding specially at all. Strings
391 in the input are put in the output as-is. Extents of text items in the
392 @TeX{} backend, are determined by reading a file created via the
393 @file{texstr} backend,
396 lilypond -b texstr input/les-nereides.ly
397 latex les-nereides.texstr
400 The last command produces @file{les-nereides.textmetrics}, which is
401 read when you execute
404 lilypond -b tex input/les-nereides.ly
407 Both @file{les-nereides.texstr} and @file{les-nereides.tex} need
408 suitable LaTeX wrappers to load appropriate La@TeX{} packages for
409 interpreting non-ASCII strings.
411 To use a Unicode escape sequence, use
414 #(ly:export (ly:wide-char->utf-8 #x2014))
420 @inputfileref{input/regression,utf-8.ly}
424 @subsection Nested scores
426 It is possible to nest music inside markups, by adding a @code{\score}
427 block to a markup expression. Such a score must contain a @code{\layout}
430 @lilypond[quote,verbatim,ragged-right]
434 \relative { c4 d e f }
443 @node Overview of text markup commands
444 @subsection Overview of text markup commands
446 The following commands can all be used inside @code{\markup @{ @}}.
448 @include markup-commands.tely
452 @subsection Font selection
454 @cindex font selection
455 @cindex font magnification
456 @cindex @code{font-interface}
458 By setting the object properties described below, you can select a
459 font from the preconfigured font families. LilyPond has default
460 support for the feta music fonts. Text fonts are selected through
461 Pango/FontConfig. The serif font defaults to New Century Schoolbook,
462 the sans and typewriter to whatever the Pango installation defaults
467 @item @code{font-encoding}
468 is a symbol that sets layout of the glyphs. This should only be set to
469 select different types of non-text fonts, eg.
471 @code{fetaBraces} for piano staff braces, @code{fetaMusic} the
472 standard music font, including ancient glyphs, @code{fetaDynamic} for
473 dynamic signs and @code{fetaNumber} for the number font.
475 @item @code{font-family}
476 is a symbol indicating the general class of the typeface. Supported are
477 @code{roman} (Computer Modern), @code{sans}, and @code{typewriter}.
479 @item @code{font-shape}
480 is a symbol indicating the shape of the font. There are typically
481 several font shapes available for each font family. Choices are
482 @code{italic}, @code{caps}, and @code{upright}.
484 @item @code{font-series}
485 is a symbol indicating the series of the font. There are typically
486 several font series for each font family and shape. Choices are
487 @code{medium} and @code{bold}.
491 Fonts selected in the way sketched above come from a predefined style
492 sheet. If you want to use a font from outside the style sheet,
494 @code{font-name} property,
496 @lilypond[fragment,verbatim]
498 \override Staff.TimeSignature #'font-name = #"Charter"
499 \override Staff.TimeSignature #'font-size = #2
502 \override #'(font-name . "Vera Bold")
503 { This text is in Vera Bold }
509 Any font can be used, as long as it is available to Pango/FontConfig.
511 The size of the font may be set with the @code{font-size}
512 property. The resulting size is taken relative to the
513 @code{text-font-size} as defined in the @code{\paper} block.
516 @cindex font magnification
519 It is also possible to change the default font family for the entire
520 document. This is done by calling the @code{make-pango-font-tree} from
521 within the @code{\paper} block. The function takes names for the font
522 families to use for roman, sans serif and monospaced text. For
525 @cindex font families, setting
534 (make-pango-font-tree "Times New Roman"
541 c'^\markup { roman: foo \sans bla \typewriter bar }
545 @c we don't do Helvetica / Courier, since GS incorrectly loads
552 Examples: @file{ly/@/font@/-family@/-override.ly}
555 @node New dynamic marks
556 @subsection New dynamic marks
558 It is possible to print new dynamic marks or text that should be aligned
559 with dynamics. Use @code{make-dynamic-script} to create these marks.
561 @cindex make-dynamic-script
563 @lilypond[quote,verbatim,ragged-right]
564 sfzp = #(make-dynamic-script "sfzp")
570 @cindex Dynamics, editorial
571 @cindex Dynamics, parenthesis
573 It is also possible to print dynamics in round parenthesis or square
574 brackets. These are often used for adding editorial dynamics.
576 @lilypond[quote,verbatim,ragged-right]
577 rndf = \markup{ \center-align {\line { \bold{\italic (}
578 \dynamic f \bold{\italic )} }} }
579 boxf = \markup{ \bracket { \dynamic f } }
580 { c'1_\rndf c'1_\boxf }
585 @node Preparing parts
586 @section Preparing parts
588 This section describes various notation that are useful for preparing
592 * Multi measure rests::
597 * Instrument transpositions::
599 * Different editions from one source::
603 @node Multi measure rests
604 @subsection Multi measure rests
606 @cindex multi measure rests
607 @cindex full measure rests
608 @cindex Rests, multi measure
609 @cindex Rests, full measure
610 @cindex whole rests for a full measure
613 Rests for one full measure (or many bars) are entered using `@code{R}'. It
614 is specifically meant for full bar rests and for entering parts: the rest
615 can expand to fill a score with rests, or it can be printed as a single
616 multi-measure rest. This expansion is controlled by the property
617 @code{Score.skipBars}. If this is set to true, empty measures will not
618 be expanded, and the appropriate number is added automatically
620 @lilypond[quote,ragged-right,fragment,verbatim]
621 \time 4/4 r1 | R1 | R1*2
622 \set Score.skipBars = ##t R1*17 R1*4
625 The @code{1} in @code{R1} is similar to the duration notation used for
626 notes. Hence, for time signatures other than 4/4, you must enter other
627 durations. This can be done with augmentation dots or fractions
629 @lilypond[quote,ragged-right,fragment,verbatim]
630 \set Score.skipBars = ##t
639 An @code{R} spanning a single measure is printed as either a whole rest
640 or a breve, centered in the measure regardless of the time signature.
642 If there are only a few measures of rest, LilyPond prints ``church rests''
643 (a series of rectangles) in the staff. To replace that with a simple
644 rest, use @code{MultiMeasureRest.expand-limit}.
646 @lilypond[quote,ragged-right,fragment,verbatim]
647 \set Score.skipBars = ##t
649 \override MultiMeasureRest #'expand-limit = 1
653 @cindex text on multi-measure rest
654 @cindex script on multi-measure rest
655 @cindex fermata on multi-measure rest
657 Texts can be added to multi-measure rests by using the
658 @var{note}-@code{markup} syntax @ref{Text markup}.
659 A variable (@code{\fermataMarkup}) is provided for
662 @lilypond[quote,ragged-right,verbatim,fragment]
663 \set Score.skipBars = ##t
665 R2.*10^\markup { \italic "ad lib." }
669 Warning! This text is created by @code{MultiMeasureRestText}, not
672 @lilypond[quote,ragged-right,verbatim,fragment]
673 \override TextScript #'padding = #5
675 \override MultiMeasureRestText #'padding = #5
679 If you want to have text on the left end of a multi-measure rest,
680 attach the text to a zero-length skip note, i.e.,
690 Program reference: @internalsref{MultiMeasureRestMusicGroup},
691 @internalsref{MultiMeasureRest}.
693 The layout object @internalsref{MultiMeasureRestNumber} is for the
694 default number, and @internalsref{MultiMeasureRestText} for user
700 It is not possible to use fingerings (e.g., @code{R1-4}) to put numbers
701 over multi-measure rests. And the pitch of multi-measure rests (or
702 staff-centered rests) can not be influenced.
704 @cindex condensing rests
706 There is no way to automatically condense multiple rests into a single
707 multi-measure rest. Multi-measure rests do not take part in rest
710 Be careful when entering multi-measure rests followed by whole
711 notes. The following will enter two notes lasting four measures each
715 When @code{skipBars} is set, the result will look OK, but the bar
716 numbering will be off.
719 @node Metronome marks
720 @subsection Metronome marks
723 @cindex beats per minute
724 @cindex metronome marking
726 Metronome settings can be entered as follows
728 \tempo @var{duration} = @var{per-minute}
731 In the MIDI output, they are interpreted as a tempo change. In the
732 layout output, a metronome marking is printed
733 @cindex @code{\tempo}
734 @lilypond[quote,ragged-right,verbatim,fragment]
741 To change the tempo in the MIDI output without printing anything, make
742 the metronome marking invisible
744 \once \override Score.MetronomeMark #'transparent = ##t
747 To print other metronome markings, use these markup commands
748 @lilypond[quote,ragged-right,verbatim,relative,fragment]
751 \smaller \general-align #Y #DOWN \note #"16." #1
753 \smaller \general-align #Y #DOWN \note #"8" #1
758 See @ref{Text markup} for more details.
763 Program reference: @internalsref{MetronomeMark}.
768 Collisions are not checked. If you have notes above the top line of
769 the staff (or notes with articulations, slurs, text, etc), then the
770 metronome marking may be printed on top of musical symbols. If this
771 occurs, increase the padding of the metronome mark to place it
772 further away from the staff.
775 \override Score.MetronomeMark #'padding = #2.5
779 @node Rehearsal marks
780 @subsection Rehearsal marks
782 @cindex Rehearsal marks
785 To print a rehearsal mark, use the @code{\mark} command
787 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
796 The letter@tie{}`I' is skipped in accordance with engraving traditions.
797 If you wish to include the letter `I', then use
800 \set Score.markFormatter = #format-mark-alphabet
803 The mark is incremented automatically if you use @code{\mark
804 \default}, but you can also use an integer argument to set the mark
805 manually. The value to use is stored in the property
806 @code{rehearsalMark}.
808 The style is defined by the property @code{markFormatter}. It is a
809 function taking the current mark (an integer) and the current context
810 as argument. It should return a markup object. In the following
811 example, @code{markFormatter} is set to a canned procedure. After a
812 few measures, it is set to function that produces a boxed number.
814 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
815 \set Score.markFormatter = #format-mark-numbers
818 \set Score.markFormatter = #format-mark-box-numbers
824 The file @file{scm/@/translation@/-functions@/.scm} contains the definitions
825 of @code{format-mark-numbers} (the default format), @code{format-mark-box-numbers},
826 @code{format-mark-letters} and @code{format-mark-box-letters}.
827 These can be used as inspiration for other formatting functions.
829 You may use @code{format-mark-barnumbers}, @code{format-mark-box-barnumbers},
830 and @code{format-mark-circle-barnumbers} to get bar numbers instead of
831 incremented numbers or letters.
836 Program reference: @internalsref{RehearsalMark}.
838 Init files: @file{scm/@/translation@/-functions@/.scm} contains the
839 definition of @code{format-mark-numbers} and
840 @code{format-mark-letters}. They can be used as inspiration for other
841 formatting functions.
843 Examples: @inputfileref{input/@/regression,rehearsal@/-mark@/-letter@/.ly},
845 @inputfileref{input/@/regression,rehearsal@/-mark@/-number@/.ly}.
849 @subsection Bar numbers
852 @cindex measure numbers
853 @cindex @code{currentBarNumber}
855 Bar numbers are printed by default at the start of the line. The
856 number itself is stored in the @code{currentBarNumber} property, which
857 is normally updated automatically for every measure.
859 Bar numbers can be typeset at regular intervals instead of at the
860 beginning of each line. This is illustrated in the following example,
861 whose source is available as
862 @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}
864 @lilypondfile[ragged-right,quote]{bar-number-regular-interval.ly}
866 Bar numbers can be typeset manually by tweaking the
867 @code{markFormatter} property
869 @lilypond[verbatim,ragged-right,quote]
871 \set Score.markFormatter
872 = #(lambda (mark context)
875 (number->string (ly:context-property context
876 'currentBarNumber)))))
878 c1 \bar "||" \mark \default c1 c1 \mark \default c1 \bar "|."
882 Bar numbers can be manually changed by setting the
883 @code{Staff.currentBarNumber} property
885 @lilypond[verbatim,ragged-right,quote]
887 \repeat unfold 4 {c4 c c c} \break
888 \set Score.currentBarNumber = #50
889 \repeat unfold 4 {c4 c c c}
896 Program reference: @internalsref{BarNumber}.
899 @inputfileref{input/@/test,bar@/-number@/-every@/-five@/-reset@/.ly},
900 and @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}.
905 Bar numbers can collide with the @internalsref{StaffGroup} bracket, if
906 there is one at the top. To solve this, the
907 @code{padding} property of @internalsref{BarNumber} can be
908 used to position the number correctly.
911 @node Instrument names
912 @subsection Instrument names
914 In an orchestral score, instrument names are printed at the left side
917 This can be achieved by setting @internalsref{Staff}.@code{instrument}
918 and @internalsref{Staff}.@code{instr}. This will print a string before
919 the start of the staff. For the first staff, @code{instrument} is
920 used, for the following ones, @code{instr} is used.
922 @lilypond[quote,verbatim,ragged-right,relative=1,fragment]
923 \set Staff.instrument = "Ploink "
924 \set Staff.instr = "Plk "
930 You can also use markup texts to construct more complicated instrument
933 @lilypond[quote,fragment,verbatim,ragged-right]
934 \set Staff.instrument = \markup {
935 \column { "Clarinetti"
936 \line { "in B" \smaller \flat } } }
940 If you wish to center the instrument names, you must center all of them
942 @lilypond[quote,verbatim,ragged-right]
945 \set Staff.instrument = \markup {
946 \center-align { "Clarinetti"
947 \line { "in B" \smaller \flat } } }
951 \set Staff.instrument = \markup{ \center-align { Vibraphone }}
958 For longer instrument names, it may be useful to increase the
959 @code{indent} setting in the @code{\layout} block.
963 Program reference: @internalsref{InstrumentName}.
967 When you put a name on a grand staff or piano staff, the width of the
968 brace is not taken into account. The following property setting can be
969 used to move the instrument names to the left, in such situations.
972 \override Score.InstrumentName #'space-alist = #'((left-edge extra-space . 2.0))
976 @node Instrument transpositions
977 @subsection Instrument transpositions
979 @cindex transposition, MIDI
980 @cindex transposition, instrument
982 The key of a transposing instrument can also be specified. This
983 applies to many wind instruments, for example, clarinets (B-flat, A, and
984 E-flat), horn (F) and trumpet (B-flat, C, D, and E-flat).
986 The transposition is entered after the keyword @code{\transposition}
989 \transposition bes %% B-flat clarinet
993 This command sets the property @code{instrumentTransposition}. The value of
994 this property is used for MIDI output and quotations. It does not
995 affect how notes are printed in the current staff. To change the printed
996 output, see @ref{Transpose}.
998 The pitch to use for @code{\transposition} should correspond to the
999 real sound heard when a @code{c'} written on the staff is played by the
1000 transposing instrument. For example, when entering a score in
1001 concert pitch, typically all voices are entered in C, so
1002 they should be entered as
1015 The command @code{\transposition} should be used when the music is
1016 entered from a (transposed) orchestral part. For example, in
1017 classical horn parts, the tuning of the instrument is often changed
1018 during a piece. When copying the notes from the part, use
1019 @code{\transposition}, e.g.,
1031 @node Ottava brackets
1032 @subsection Ottava brackets
1034 `Ottava' brackets introduce an extra transposition of an octave for
1035 the staff. They are created by invoking the function
1036 @code{set-octavation}
1042 @lilypond[quote,ragged-right,verbatim,fragment]
1052 The @code{set-octavation} function also takes -1 (for 8va bassa) and 2
1053 (for 15ma) as arguments. Internally the function sets the properties
1054 @code{ottavation} (e.g., to @code{"8va"}) and
1055 @code{centralCPosition}. For overriding the text of the bracket, set
1056 @code{ottavation} after invoking @code{set-octavation}, i.e.,
1058 @lilypond[quote,ragged-right,verbatim]
1061 \set Staff.ottavation = #"8"
1069 Program reference: @internalsref{OttavaBracket}.
1071 Examples: @inputfileref{input/@/regression,ottava@/.ly},
1072 @inputfileref{input/@/regression,ottava@/-broken@/.ly}.
1077 @code{set-octavation} will get confused when clef changes happen
1078 during an octavation bracket.
1081 @node Different editions from one source
1082 @subsection Different editions from one source
1087 The @code{\tag} command marks music expressions with a name. These
1088 tagged expressions can be filtered out later. With this mechanism it
1089 is possible to make different versions of the same music source.
1091 In the following example, we see two versions of a piece of music, one
1092 for the full score, and one with cue notes for the instrumental part
1108 The same can be applied to articulations, texts, etc.: they are
1111 -\tag #@var{your-tag}
1113 to an articulation, for example,
1118 This defines a note with a conditional fingering indication.
1121 @cindex removeWithTag
1122 By applying the @code{\keepWithTag} and @code{\removeWithTag}
1123 commands, tagged expressions can be filtered. For example,
1127 \keepWithTag #'score @var{the music}
1128 \keepWithTag #'part @var{the music}
1133 @lilypondfile[ragged-right,quote]{tag-filter.ly}
1135 The argument of the @code{\tag} command should be a symbol. It's
1136 possible to put multiple tags on a piece of music, with multiple
1137 @code{\tag} entries,
1139 \tag #'original-part \tag #'transposed-part @dots{}
1145 Examples: @inputfileref{input/@/regression,tag@/-filter@/.ly}.
1150 Multiple rests are not merged if you create the score with both tagged
1155 @node Orchestral music
1156 @section Orchestral music
1158 Orchestral music involves some special notation, both in the full
1159 score and the individual parts. This section explains how to tackle
1160 some common problems in orchestral music.
1163 * Automatic part combining::
1165 * Quoting other voices::
1166 * Formatting cue notes::
1167 * Aligning to cadenzas::
1171 @node Automatic part combining
1172 @subsection Automatic part combining
1173 @cindex automatic part combining
1174 @cindex part combiner
1176 Automatic part combining is used to merge two parts of music onto a
1177 staff. It is aimed at typesetting orchestral scores. When the two
1178 parts are identical for a period of time, only one is shown. In
1179 places where the two parts differ, they are typeset as separate
1180 voices, and stem directions are set automatically. Also, solo and
1181 @emph{a due} parts are identified and can be marked.
1183 The syntax for part combining is
1186 \partcombine @var{musicexpr1} @var{musicexpr2}
1190 The following example demonstrates the basic functionality of the part
1191 combiner: putting parts on one staff, and setting stem directions and
1194 @lilypond[quote,verbatim,ragged-right,fragment]
1195 \new Staff \partcombine
1196 \relative g' { g g a( b) c c r r }
1197 \relative g' { g g r4 r e e g g }
1200 The first @code{g} appears only once, although it was
1201 specified twice (once in each part). Stem, slur, and tie directions are
1202 set automatically, depending whether there is a solo or unisono. The
1203 first part (with context called @code{one}) always gets up stems, and
1204 `Solo', while the second (called @code{two}) always gets down stems and
1207 If you just want the merging parts, and not the textual markings, you
1208 may set the property @code{printPartCombineTexts} to false
1210 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
1212 \set Staff.printPartCombineTexts = ##f
1214 \relative g' { g a( b) r }
1215 \relative g' { g r4 r f }
1219 To change the text that is printed for solos or merging, you may
1220 set the @code{soloText}, @code{soloIIText}, and @code{aDueText}
1223 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
1225 \set Score.soloText = #"ichi"
1226 \set Score.soloIIText = #"ni"
1227 \set Score.aDueText = #"tachi"
1229 \relative g' { g4 g a( b) r }
1230 \relative g' { g4 g r r f }
1234 Both arguments to @code{\partcombine} will be interpreted as
1235 @internalsref{Voice} contexts. If using relative octaves,
1236 @code{\relative} should be specified for both music expressions, i.e.,
1240 \relative @dots{} @var{musicexpr1}
1241 \relative @dots{} @var{musicexpr2}
1245 A @code{\relative} section that is outside of @code{\partcombine} has
1246 no effect on the pitches of @var{musicexpr1} and @var{musicexpr2}.
1250 Program reference: @internalsref{PartCombineMusic}.
1254 When @code{printPartCombineTexts} is set, when the two voices play the
1255 same notes on and off, the part combiner may typeset @code{a2} more
1256 than once in a measure.
1258 @code{\partcombine} cannot be inside @code{\times}.
1260 @code{\partcombine} cannot be inside @code{\relative}.
1262 Internally, the @code{\partcombine} interprets both arguments as
1263 @code{Voice}s named @code{one} and @code{two}, and then decides when
1264 the parts can be combined. Consequently, if the arguments switch to
1265 differently named @internalsref{Voice} contexts, the events in those
1270 @subsection Hiding staves
1272 @cindex Frenched scores
1273 @cindex Hiding staves
1275 In orchestral scores, staff lines that only have rests are usually
1276 removed; this saves some space. This style is called `French Score'.
1277 For @internalsref{Lyrics},
1278 @internalsref{ChordNames} and @internalsref{FiguredBass}, this is
1279 switched on by default. When the lines of these contexts turn out
1280 empty after the line-breaking process, they are removed.
1282 For normal staves, a specialized @internalsref{Staff} context is
1283 available, which does the same: staves containing nothing (or only
1284 multi-measure rests) are removed. The context definition is stored in
1285 @code{\RemoveEmptyStaffContext} variable. Observe how the second staff
1286 in this example disappears in the second line
1288 @lilypond[quote,ragged-right,verbatim]
1290 \context { \RemoveEmptyStaffContext }
1295 \new Staff { e4 f g a \break c1 }
1296 \new Staff { c4 d e f \break R1 }
1301 The first system shows all staves in full. If empty staves should be
1302 removed from the first system too, set @code{remove-first} to true in
1303 @internalsref{VerticalAxisGroup}.
1306 \override Score.VerticalAxisGroup #'remove-first = ##t
1309 To remove other types of contexts, use @code{\AncientRemoveEmptyStaffContext}
1310 or @code{\RemoveEmptyRhythmicStaffContext}.
1312 Another application is making ossia sections, i.e., alternative
1313 melodies on a separate piece of staff, with help of a Frenched
1314 staff. See @inputfileref{input/@/test,ossia@/.ly} for an example.
1317 @node Quoting other voices
1318 @subsection Quoting other voices
1320 With quotations, fragments of other parts can be inserted into a part
1321 directly. Before a part can be quoted, it must be marked especially as
1322 quotable. This is done with the @code{\addquote} command.
1325 \addquote @var{name} @var{music}
1330 Here, @var{name} is an identifying string. The @var{music} is any kind
1331 of music. Here is an example of @code{\addquote}
1334 \addquote clarinet \relative c' @{
1339 This command must be entered at toplevel, i.e., outside any music
1342 After calling @code{\addquote}, the quotation may then be done with
1343 @code{\quoteDuring} or @code{\cueDuring},
1346 \quoteDuring #@var{name} @var{music}
1349 During a part, a piece of music can be quoted with the @code{\quoteDuring}
1353 \quoteDuring #"clarinet" @{ s2. @}
1356 This would cite three quarter notes (the duration of @code{s2.}) of
1357 the previously added @code{clarinet} voice.
1360 More precisely, it takes the current time-step of the part being
1361 printed, and extracts the notes at the corresponding point of the
1362 @code{\addquote}d voice. Therefore, the argument to @code{\addquote}
1363 should be the entire part of the voice to be quoted, including any
1364 rests at the beginning.
1366 Quotations take into account the transposition of both source and target
1367 instruments, if they are specified using the @code{\transposition} command.
1369 @lilypond[quote,ragged-right,verbatim]
1370 \addquote clarinet \relative c' {
1376 e'8 f'8 \quoteDuring #"clarinet" { s2 }
1380 The type of events that are present in cue notes can be trimmed with
1381 the @code{quotedEventTypes} property. The default value is
1382 @code{(note-event rest-event)}, which means that only notes and
1383 rests of the cued voice end up in the @code{\quoteDuring}.
1387 \set Staff.quotedEventTypes =
1388 #'(note-event articulation-event dynamic-event)
1392 will quote notes (but no rests), together with scripts and dynamics.
1396 Only the contents of the first @internalsref{Voice} occurring in an
1397 @code{\addquote} command will be considered for quotation, so
1398 @var{music} can not contain @code{\new} and @code{\context Voice}
1399 statements that would switch to a different Voice.
1401 Quoting grace notes is broken and can even cause LilyPond to crash.
1405 In this manual: @ref{Instrument transpositions}.
1407 Examples: @inputfileref{input/@/regression,quote@/.ly}
1408 @inputfileref{input/@/regression,quote@/-transposition@/.ly}
1410 Program reference: @internalsref{QuoteMusic}.
1413 @node Formatting cue notes
1414 @subsection Formatting cue notes
1416 The previous section deals with inserting notes from another voice.
1417 There is a more advanced music function called @code{\cueDuring},
1418 which makes formatting cue notes easier.
1423 \cueDuring #@var{name} #@var{updown} @var{music}
1426 This will insert notes from the part @var{name} into a
1427 @internalsref{Voice} called @code{cue}. This happens simultaneously
1428 with @var{music}, which usually is a rest. When the cue notes start,
1429 the staff in effect becomes polyphonic for a moment. The argument
1430 @var{updown} determines whether the cue notes should be notated as a
1431 first or second voice.
1434 @lilypond[verbatim,ragged-right]
1437 \override Stem #'length-fraction = #0.8
1438 \override Beam #'thickness = #0.384
1439 \override Beam #'length-fraction = #0.8
1442 \addquote clarinet \relative {
1447 \new Staff \relative <<
1449 % setup a context for cue notes.
1450 \new Voice = "cue" { \smaller \skip 1*21 }
1452 \set Score.skipBars = ##t
1456 \cueDuring #"clarinet" #1 {
1465 Here are a couple of hints for successful cue notes
1469 Cue notes have smaller font sizes.
1471 the cued part is marked with the instrument playing the cue.
1473 when the original part takes over again, this should be marked with
1474 the name of the original instrument.
1476 @c really? Are you sure about that last point? I'll check after 3.0 -gp
1478 @c Yes, this is good practice. Otherwise, the start of the original
1479 @c part can only be seen from the font size. This is not good enough
1480 @c for sight-reading. It is possilbe to use other
1481 @c markers (eg. a big close-bracket over the staff) to indicate the cue notes are
1486 Any other changes introduced by the cued part should also be
1487 undone. For example, if the cued instrument plays in a different clef,
1488 the original clef should be stated once again.
1493 @node Aligning to cadenzas
1494 @subsection Aligning to cadenzas
1496 In an orchestral context, cadenzas present a special problem:
1497 when constructing a score that includes a cadenza, all other
1498 instruments should skip just as many notes as the length of the
1499 cadenza, otherwise they will start too soon or too late.
1501 A solution to this problem are the functions @code{mmrest-of-length}
1502 and @code{skip-of-length}. These Scheme functions take a piece of music
1503 as argument, and generate a @code{\skip} or multi-rest, exactly as
1504 long as the piece. The use of @code{mmrest-of-length} is demonstrated
1505 in the following example.
1507 @lilypond[verbatim,ragged-right,quote]
1508 cadenza = \relative c' {
1509 c4 d8 << { e f g } \\ { d4. } >>
1514 \new Staff { \cadenza c'4 }
1516 #(ly:export (mmrest-of-length cadenza))
1525 @node Contemporary notation
1526 @section Contemporary notation
1528 In the 20th century, composers have greatly expanded the musical
1529 vocabulary. With this expansion, many innovations in musical notation
1530 have been tried. The book ``Music Notation in the 20th century'' by
1531 Kurt Stone gives a comprehensive overview (see @ref{Literature
1532 list}). In general, the use of new, innovative notation makes a piece
1533 harder to understand and perform and its use should therefore be
1534 avoided. For this reason, support for contemporary notation in
1535 LilyPond is limited.
1539 * Polymetric notation::
1540 * Time administration::
1541 * Proportional notation::
1543 * Special noteheads::
1549 @node Polymetric notation
1550 @subsection Polymetric notation
1552 Double time signatures are not supported explicitly, but they can be
1553 faked. In the next example, the markup for the time signature is
1554 created with a markup text. This markup text is inserted in the
1555 @internalsref{TimeSignature} grob.
1557 @lilypond[verbatim,ragged-right]
1562 \musicglyph #"scripts.stopped"
1563 \bracket \column { "5" "8" }
1568 \override Staff.TimeSignature #'stencil = #ly:text-interface::print
1569 \override Staff.TimeSignature #'text = #tsMarkup
1571 c'2 \bar ":" c'4 c'4.
1575 Each staff can also have its own time signature. This is done by
1576 moving the @internalsref{Timing_translator} to the @internalsref{Staff}
1582 \remove "Timing_translator"
1583 \remove "Default_bar_line_engraver"
1587 \consists "Timing_translator"
1588 \consists "Default_bar_line_engraver"
1595 Now, each staff has its own time signature.
1608 c4. c8 c c c4. c8 c c
1613 @lilypond[quote,ragged-right]
1617 \remove "Timing_translator"
1618 \remove "Default_bar_line_engraver"
1621 \consists "Timing_translator"
1622 \consists "Default_bar_line_engraver"
1637 c4. c8 c c c4. c8 c c
1643 A different form of polymetric notation is where note lengths have
1644 different values across staves.
1646 This notation can be created by setting a common time signature for
1647 each staff but replacing it manually using
1648 @code{timeSignatureFraction} to the desired fraction. Then the printed
1649 durations in each staff are scaled to the common time signature.
1650 The latter is done with @code{\compressMusic}, which is used similar
1651 to @code{\times}, but does not create a tuplet bracket. The syntax is
1653 \compressMusic #'(@var{numerator} . @var{denominator}) @var{musicexpr}
1658 In this example, music with the time signatures of 3/4, 9/8, and 10/8 are
1659 used in parallel. In the second staff, shown durations are multiplied by
1660 2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are
1661 multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
1663 @lilypond[quote,ragged-right,verbatim,fragment]
1671 \set Staff.timeSignatureFraction = #'(9 . 8)
1672 \compressMusic #'(2 . 3)
1673 \repeat unfold 6 { c8[ c c] }
1677 \set Staff.timeSignatureFraction = #'(10 . 8)
1678 \compressMusic #'(3 . 5) {
1679 \repeat unfold 2 { c8[ c c] }
1680 \repeat unfold 2 { c8[ c] }
1681 | c4. c4. \times 2/3 { c8 c c } c4
1692 When using different time signatures in parallel, the spacing is
1693 aligned vertically, but bar lines distort the regular spacing.
1696 @node Time administration
1697 @subsection Time administration
1699 @cindex Time administration
1701 Time is administered by the @internalsref{Time_signature_engraver},
1702 which usually lives in the @internalsref{Score} context. The
1703 bookkeeping deals with the following variables
1706 @item currentBarNumber
1710 The length of the measures in the current time signature. For a 4/4
1711 time this is@tie{}1, and for 6/8 it is 3/4.
1713 @item measurePosition
1714 The point within the measure where we currently are. This quantity
1715 is reset to@tie{}0 whenever it exceeds @code{measureLength}. When that
1716 happens, @code{currentBarNumber} is incremented.
1719 If set to true, the above variables are updated for every time
1720 step. When set to false, the engraver stays in the current measure
1724 Timing can be changed by setting any of these variables explicitly.
1725 In the next example, the 4/4 time signature is printed, but
1726 @code{measureLength} is set to 5/4. After a while, the measure is
1727 shortened by 1/8, by setting @code{measurePosition} to 7/8 at 2/4
1728 in the measure, so the next bar line will fall at 2/4 + 3/8. The
1729 3/8 arises because 5/4 normally has 10/8, but we have manually
1730 set the measure position to be 7/8 and 10/8 - 7/8 = 3/8.
1732 @lilypond[quote,ragged-right,verbatim,relative,fragment]
1733 \set Score.measureLength = #(ly:make-moment 5 4)
1737 \set Score.measurePosition = #(ly:make-moment 7 8)
1743 As the example illustrates, @code{make-moment n m} constructs
1744 a duration of n*m notes, where n is any integer and m is a
1748 @node Proportional notation
1749 @subsection Proportional notation
1750 @cindex Proportional notation
1752 Notes can be spaced proportional to their time-difference by
1753 assigning a duration to @code{proportionalNotationDuration}
1755 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
1757 \set Score.proportionalNotationDuration = #(ly:make-moment 1 16)
1758 \new Staff { c8[ c c c c c] c4 c2 r2 }
1759 \new Staff { c2 \times 2/3 { c8 c c } c4 c1 }
1765 @subsection Clusters
1769 A cluster indicates a continuous range of pitches to be played. They
1770 can be denoted as the envelope of a set of notes. They are entered by
1771 applying the function @code{makeClusters} to a sequence of
1773 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1774 \makeClusters { <c e > <b f'> }
1777 The following example (from
1778 @inputfileref{input/@/regression,cluster@/.ly}) shows what the result
1781 @lilypondfile[ragged-right,quote]{cluster.ly}
1783 Ordinary notes and clusters can be put together in the same staff,
1784 even simultaneously. In such a case no attempt is made to
1785 automatically avoid collisions between ordinary notes and clusters.
1789 Program reference: @internalsref{ClusterSpanner},
1790 @internalsref{ClusterSpannerBeacon},
1791 @internalsref{Cluster_spanner_engraver}.
1793 Examples: @inputfileref{input/@/regression,cluster@/.ly}.
1797 Music expressions like @code{<< @{ g8 e8 @} a4 >>} are not printed
1798 accurately. Use @code{<g a>8 <e a>8} instead.
1803 This is covered in articulation; does it really need its
1804 own doc section? -gp
1805 @n ode Special fermatas
1806 @s ubsection Special fermatas
1808 @c index fermatas, special
1810 In contemporary music notation, special fermata symbols denote breaks
1811 of differing lengths. The following fermatas are supported
1813 @li lypond[quote,ragged-right]
1836 \new Lyrics \lyricmode {
1837 \override LyricText #'font-family = #'typewriter
1838 "shortfermata" "fermata" "longfermata" "verylongfermata"
1843 See @ref{Articulations} for general instructions how to apply scripts
1844 such as fermatas to notes.
1849 @node Special noteheads
1850 @subsection Special noteheads
1852 Different noteheads are used by various instruments for various
1853 meanings -- crosses are used for ``parlato'' with vocalists, stopped
1854 notes on guitar; diamonds are used for harmonics on string instruments,
1855 etc. There is a shorthand (@code{\harmonic}) for diamond shapes; the
1856 other notehead styles are produced by tweaking the property
1858 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1860 \override NoteHead #'style = #'cross
1862 \revert NoteHead #'style
1863 e d <c f\harmonic> <d a'\harmonic>
1867 To see all notehead styles, please see
1868 @inputfileref{input/@/regression,note@/-head@/-style@/.ly}.
1873 Program reference: @internalsref{NoteHead}.
1876 @node Feathered beams
1877 @subsection Feathered beams
1879 Feathered beams are not supported natively, but they can be faked by
1880 forcing two beams to overlap. Here is an example,
1882 @c don't change relative setting witout changing positions!
1883 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1888 \once \override Voice.Beam #'positions = #'(0 . 0.5)
1893 \once \override Voice.Beam #'positions = #'(0 . -0.5)
1901 @subsection Improvisation
1903 Improvisation is sometimes denoted with slashed note heads. Such note
1904 heads can be created by adding a @internalsref{Pitch_squash_engraver}
1905 to the @internalsref{Staff} or @internalsref{Voice} context. Then, the
1909 \set squashedPosition = #0
1910 \override NoteHead #'style = #'slash
1914 switches on the slashes.
1916 There are shortcuts @code{\improvisationOn} (and an accompanying
1917 @code{\improvisationOff}) for this command sequence. They are used in
1918 the following example
1920 @lilypond[verbatim,ragged-right,quote]
1922 \consists Pitch_squash_engraver
1924 e8 e g a a16(bes)(a8) g \improvisationOn
1927 ~fis2 \improvisationOff a16(bes) a8 g e
1932 @node Educational use
1933 @section Educational use
1935 With the amount of control that LilyPond offers, one can make great
1936 teaching tools in addition to great musical scores.
1940 * Blank music sheet::
1942 * Shape note heads ::
1943 * Easy Notation note heads::
1944 * Analysis brackets::
1945 * Coloring objects::
1949 @subsection Balloon help
1951 Elements of notation can be marked and named with the help of a square
1952 balloon. The primary purpose of this feature is to explain notation.
1954 The following example demonstrates its use.
1956 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
1959 #(add-balloon-text 'NoteHead "heads, or tails?"
1966 The function @code{add-balloon-text} takes the name of a grob, the
1967 label to print, and the position where to put the label relative to
1968 the object. In the above example, the text ``heads or tails?'' ends
1969 3 spaces below and 1 space to the right of the marked head.
1972 @cindex notation, explaining
1976 Program reference: @internalsref{text-balloon-interface}.
1978 Examples: @inputfileref{input/@/regression,balloon@/.ly}.
1983 @node Blank music sheet
1984 @subsection Blank music sheet
1986 A blank music sheet can be produced also by using invisible notes, and
1987 removing @code{Bar_number_engraver}.
1990 @lilypond[quote,verbatim]
1992 \repeat unfold 2 % Change this for more lines.
1997 \override TimeSignature #'transparent = ##t
1998 defaultBarType = #""
1999 \remove Bar_number_engraver
2001 \new Staff \emptymusic
2002 \new TabStaff \emptymusic
2008 @subsection Hidden notes
2010 @cindex Hidden notes
2011 @cindex Invisible notes
2012 @cindex Transparent notes
2014 @cindex @code{\hideNotes}
2015 @cindex @code{\unHideNotes}
2016 Hidden (or invisible or transparent) notes can be useful in preparing theory
2017 or composition exercises.
2019 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
2027 Hidden notes are also great for performing weird tricks. For example,
2028 slurs cannot be attached to rests or spacer rests, but you may wish
2029 to include that in your score -- string instruments use this notation
2030 when doing pizzicato to indicate that the note should ring for as long
2033 @lilypond[quote,ragged-right,verbatim,relative=0,fragment]
2036 c4^"pizz"( \hideNotes c)
2037 \unHideNotes c( \hideNotes c)
2044 @node Shape note heads
2045 @subsection Shape note heads
2047 In shape note head notation, the shape of the note head corresponds
2048 to the harmonic function of a note in the scale. This notation was
2049 popular in the 19th century American song books.
2051 Shape note heads can be produced by setting @code{\aikenHeads} or
2052 @code{\sacredHarpHeads}, depending on the style desired.
2054 @lilypond[verbatim,relative=1,fragment]
2061 Shapes are determined on the step in the scale, where the base of the
2062 scale is determined by the @code{\key} command
2065 @findex shapeNoteStyles
2067 @findex \sacredHarpHeads
2069 Shape note heads are implemented through the @code{shapeNoteStyles}
2070 property. Its value is a vector of symbols. The k-th element indicates
2071 the style to use for the k-th step of the scale. Arbitrary
2072 combinations are possible, eg.,
2075 @lilypond[verbatim,relative=1,fragment]
2076 \set shapeNoteStyles = ##(cross triangle fa #f mensural xcircle diamond)
2081 @node Easy Notation note heads
2082 @subsection Easy Notation note heads
2084 @cindex easy notation
2087 The `easy play' note head includes a note name inside the head. It is
2088 used in music for beginners
2090 @lilypond[quote,ragged-right,verbatim,fragment,staffsize=26]
2095 The command @code{\setEasyHeads} overrides settings for the
2096 @internalsref{NoteHead} object. To make the letters readable, it has
2097 to be printed in a large font size. To print with a larger font, see
2098 @ref{Setting global staff size}.
2102 @cindex @code{\setEasyHeads}
2103 @code{\setEasyHeads}
2106 @node Analysis brackets
2107 @subsection Analysis brackets
2109 @cindex phrasing brackets
2110 @cindex musicological analysis
2111 @cindex note grouping bracket
2113 Brackets are used in musical analysis to indicate structure in musical
2114 pieces. LilyPond supports a simple form of nested horizontal
2115 brackets. To use this, add the @internalsref{Horizontal_bracket_engraver}
2116 to @internalsref{Staff} context. A bracket is started with
2117 @code{\startGroup} and closed with @code{\stopGroup}
2119 @lilypond[quote,ragged-right,verbatim]
2122 c4\startGroup\startGroup
2125 c4\stopGroup\stopGroup
2129 \Staff \consists "Horizontal_bracket_engraver"
2135 Program reference: @internalsref{HorizontalBracket}.
2137 Examples: @inputfileref{input/@/regression,note@/-group@/-bracket@/.ly}.
2140 @node Coloring objects
2141 @subsection Coloring objects
2143 Individual objects may be assigned colors. You may use the
2144 color names listed in the @ref{List of colors}.
2146 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
2147 \override NoteHead #'color = #red
2149 \override NoteHead #'color = #(x11-color 'LimeGreen)
2151 \override Stem #'color = #blue
2155 The full range of colors defined for X11 can be accessed by using the
2156 scheme function x11-color. The function takes one argument that can be a
2160 \override Beam #'color = #(x11-color 'MediumTurquoise)
2166 \override Beam #'color = #(x11-color "MediumTurquoise")
2169 The first form is quicker to write and is more efficient. However, using
2170 the second form it is possible to access X11 colors by the multi-word
2174 \override Beam #'color = #(x11-color "medium turquoise")
2177 If x11-color cannot make sense of the parameter then the color returned
2178 defaults to black. It should be obvious from the final score that
2181 This example, illustrates the use of x11-color. Notice that the stem
2182 color remains black after being set to (x11-color 'Boggle), which is
2183 deliberate nonsense.
2185 @lilypond[quote,ragged-right,verbatim]
2187 \override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
2188 \set Staff.instrument = \markup {
2189 \with-color #(x11-color 'navy) "Clarinet"
2193 \override Beam #'color = #(x11-color "medium turquoise")
2195 \override NoteHead #'color = #(x11-color "LimeGreen")
2197 \override Stem #'color = #(x11-color 'Boggle)
2205 Appendix: @ref{List of colors}.
2209 Not all x11 colors are distinguishable in a web browser. For web use
2210 normal colors are recommended.
2212 An x11 color is not necessarily exactly the same shade as a similarly
2216 @node Automatic notation
2217 @section Automatic notation
2219 This section describes how to change the way that accidentals and
2220 beams are automatically displayed.
2222 FIXME: this might get moved into Changing Defaults. Please send
2223 opinions to lilypond-devel. Thanks! :)
2226 * Automatic accidentals::
2227 * Setting automatic beam behavior::
2230 @node Automatic accidentals
2231 @subsection Automatic accidentals
2232 @cindex Automatic accidentals
2234 Common rules for typesetting accidentals have been placed in a
2235 function. This function is called as follows
2237 @cindex @code{set-accidental-style}
2239 #(set-accidental-style 'STYLE #('CONTEXT#))
2242 The function can take two arguments: the name of the accidental style,
2243 and an optional argument that denotes the context that should be
2244 changed. If no context name is supplied, @code{Staff} is the default,
2245 but you may wish to apply the accidental style to a single @code{Voice}
2248 The following accidental styles are supported
2251 This is the default typesetting behavior. It corresponds
2252 to 18th century common practice: Accidentals are
2253 remembered to the end of the measure in which they occur and
2254 only on their own octave.
2257 The normal behavior is to remember the accidentals on
2258 Staff-level. This variable, however, typesets accidentals
2259 individually for each voice. Apart from that, the rule is similar to
2262 As a result, accidentals from one voice do not get canceled in other
2263 voices, which is often an unwanted result
2265 @lilypond[quote,ragged-right,relative=1,fragment,verbatim]
2267 #(set-accidental-style 'voice)
2274 The @code{voice} option should be used if the voices
2275 are to be read solely by individual musicians. If the staff is to be
2276 used by one musician (e.g., a conductor) then
2277 @code{modern} or @code{modern-cautionary}
2278 should be used instead.
2281 @cindex @code{modern} style accidentals
2282 This rule corresponds to the common practice in the 20th century. This rule
2283 prints the same accidentals as @code{default}, but temporary
2284 accidentals also are canceled in other octaves. Furthermore,
2285 in the same octave, they also get canceled in the following
2288 @lilypond[quote,ragged-right,fragment,verbatim]
2289 #(set-accidental-style 'modern)
2290 cis' c'' cis'2 | c'' c'
2293 @item @code{modern-cautionary}
2294 @cindex @code{modern-cautionary}
2295 This rule is similar to @code{modern}, but the ``extra'' accidentals
2296 (the ones not typeset by @code{default}) are typeset as cautionary
2297 accidentals. They are printed in reduced size or with parentheses
2298 @lilypond[quote,ragged-right,fragment,verbatim]
2299 #(set-accidental-style 'modern-cautionary)
2300 cis' c'' cis'2 | c'' c'
2303 @cindex @code{modern-voice}
2305 This rule is used for multivoice accidentals to be read both by musicians
2306 playing one voice and musicians playing all voices. Accidentals are
2307 typeset for each voice, but they @emph{are} canceled across voices in
2308 the same @internalsref{Staff}.
2310 @cindex @code{modern-voice-cautionary}
2311 @item modern-voice-cautionary
2312 This rule is the same as @code{modern-voice}, but with the extra
2313 accidentals (the ones not typeset by @code{voice}) typeset
2314 as cautionaries. Even though all accidentals typeset by
2315 @code{default} @emph{are} typeset by this variable,
2316 some of them are typeset as cautionaries.
2319 @cindex @code{piano} accidentals
2320 This rule reflects 20th century practice for piano notation. Very similar to
2321 @code{modern} but accidentals also get canceled
2322 across the staves in the same @internalsref{GrandStaff} or
2323 @internalsref{PianoStaff}.
2325 @item piano-cautionary
2326 @cindex @code{#(set-accidental-style 'piano-cautionary)}
2327 Same as @code{#(set-accidental-style 'piano)} but with the extra
2328 accidentals typeset as cautionaries.
2331 @cindex @code{no-reset} accidental style
2332 This is the same as @code{default} but with accidentals lasting
2333 ``forever'' and not only until the next measure
2334 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2335 #(set-accidental-style 'no-reset)
2340 This is sort of the opposite of @code{no-reset}: Accidentals
2341 are not remembered at all---and hence all accidentals are
2342 typeset relative to the key signature, regardless of what was
2345 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2346 #(set-accidental-style 'forget)
2347 \key d\major c4 c cis cis d d dis dis
2354 Program reference: @internalsref{Accidental_engraver},
2355 @internalsref{Accidental}, and @internalsref{AccidentalPlacement}.
2360 Simultaneous notes are considered to be entered in sequential
2361 mode. This means that in a chord the accidentals are typeset as if the
2362 notes in the chord happened once at a time - in the order in which
2363 they appear in the input file.
2365 This is a problem when accidentals in a chord depend on each other,
2366 which does not happen for the default accidental style. The problem
2367 can be solved by manually inserting @code{!} and @code{?} for the
2371 @node Setting automatic beam behavior
2372 @subsection Setting automatic beam behavior
2374 @cindex @code{autoBeamSettings}
2375 @cindex @code{(end * * * *)}
2376 @cindex @code{(begin * * * *)}
2377 @cindex automatic beams, tuning
2378 @cindex tuning automatic beaming
2380 @c [TODO: use \applyContext]
2382 In normal time signatures, automatic beams can start on any note but can
2383 only end in a few positions within the measure: beams can end on a beat,
2384 or at durations specified by the properties in
2385 @code{autoBeamSettings}. The properties in @code{autoBeamSettings}
2386 consist of a list of rules for where beams can begin and end. The
2387 default @code{autoBeamSettings} rules are defined in
2388 @file{scm/@/auto@/-beam@/.scm}.
2390 In order to add a rule to the list, use
2392 #(override-auto-beam-setting '(be p q n m) a b [context])
2397 @item @code{be} is either "begin" or "end".
2399 @item @code{p/q} is the duration of the note for which you want
2400 to add a rule. A beam is considered to have the duration of its
2401 shortest note. Set @code{p} and @code{q} to @code{'*'} to
2402 have this apply to any beam.
2404 @item @code{n/m} is the time signature to which
2405 this rule should apply. Set @code{n} and @code{m} to @code{'*'}
2406 to have this apply in any time signature.
2408 @item @code{a/b} is the position in the bar at which the beam should begin/end.
2410 @item @code{context} is optional, and it specifies the context at which
2411 the change should be made. The default is @code{'Voice}.
2412 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
2413 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
2417 For example, if automatic beams should always end on the first quarter
2421 #(override-auto-beam-setting '(end * * * *) 1 4)
2424 You can force the beam settings to only take effect on beams whose shortest
2425 note is a certain duration
2427 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2429 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
2431 a32 a a a a16 a a a a a |
2432 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
2433 a32 a a a a16 a a a a a |
2436 You can force the beam settings to only take effect in certain time
2439 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2441 #(override-auto-beam-setting '(end * * 5 8) 2 8)
2449 You can also remove a previously set beam-ending rule by using
2452 #(revert-auto-beam-setting '(be p q n m) a b [context])
2456 be, p, q, n, m, a, b and context are the same as above. Note that the
2457 default rules are specified in @file{scm/@/auto@/-beam@/.scm},
2458 so you can revert rules that you did not explicitly create.
2460 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2462 a16 a a a a a a a a a a a a a a a
2463 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
2464 a16 a a a a a a a a a a a a a a a
2467 The rule in a revert-auto-beam-setting statement must exactly match the
2468 original rule. That is, no wildcard expansion is taken into account.
2470 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2472 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
2474 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
2476 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
2482 @c TODO: old material -- not covered by above stuff, I think.
2483 If automatic beams should end on every quarter in 5/4 time, specify
2486 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
2487 #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
2488 #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
2489 #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
2493 The same syntax can be used to specify beam starting points. In this
2494 example, automatic beams can only end on a dotted quarter note
2496 #(override-auto-beam-setting '(end * * * *) 3 8)
2497 #(override-auto-beam-setting '(end * * * *) 1 2)
2498 #(override-auto-beam-setting '(end * * * *) 7 8)
2500 In 4/4 time signature, this means that automatic beams could end only on
2501 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
2502 3/8, has passed within the measure).
2504 @cindex automatic beam generation
2506 @cindex @code{autoBeaming}
2509 If beams are used to indicate melismata in songs, then automatic
2510 beaming should be switched off with @code{\autoBeamOff}.
2515 @cindex @code{\autoBeamOff}
2516 @code{\autoBeamOff},
2517 @cindex @code{\autoBeamOn}
2523 If a score ends while an automatic beam has not been ended and is
2524 still accepting notes, this last beam will not be typeset at all. The
2525 same holds polyphonic voices, entered with @code{<< @dots{} \\ @dots{}
2526 >>}. If a polyphonic voice ends while an automatic beam is still
2527 accepting notes, it is not typeset.