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
31 @cindex Text, other languages
32 To write non-ascii text (such as characters from other languages), simply
33 insert the characters directly into the lilypond file. The file must be
34 saved as UTF-8. For more information, see @ref{Text encoding}.
42 * Overview of text markup commands::
49 @subsection Text scripts
52 @cindex text items, non-empty
53 @cindex non-empty texts
55 It is possible to place arbitrary strings of text or @ref{Text markup}
56 above or below notes by using a string @code{c^"text"}. By default,
57 these indications do not influence the note spacing, but by using the
58 command @code{\fatText}, the widths will be taken into account
60 @lilypond[quote,fragment,ragged-right,verbatim,relative=1]
61 c4^"longtext" \fatText c4_"longlongtext" c4
65 To prevent text from influencing spacing, use @code{\emptyText}.
67 More complex formatting may also be added to a note by using the
69 @lilypond[fragment,ragged-right,verbatim,quote]
70 c'4^\markup { bla \bold bla }
73 The @code{\markup} is described in more detail in
79 @cindex @code{\fatText}
81 @cindex @code{\emptyText}
87 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
90 \override Score.PaperColumn #'keep-inside-line = ##t
96 In this manual: @ref{Text markup}.
98 Program reference: @internalsref{TextScript}.
102 @subsection Text spanners
104 @cindex Text spanners
106 Some performance indications, e.g., @i{rallentando} or @i{accelerando},
107 are written as text and are extended over many measures with dotted
108 lines. Such texts are created using text spanners; attach
109 @code{\startTextSpan} and @code{\stopTextSpan} to the first and last
110 notes of the spanner.
112 The string to be printed, as well as the style, is set through object
115 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
118 \override TextSpanner #'edge-text = #'("rall " . "")
119 c2\startTextSpan b c\stopTextSpan a
122 \override TextSpanner #'edge-text = #(cons (markup #:italic "rit" ) "")
123 c2\startTextSpan b c\stopTextSpan a
128 @cindex textSpannerUp
129 @code{textSpannerUp},
130 @cindex textSpannerDown
131 @code{textSpannerDown},
132 @cindex textSpannerNeutral
133 @code{textSpannerNeutral}.
138 To print a solid line, use
141 \override TextSpanner #'dash-fraction = #'()
147 Program reference: @internalsref{TextSpanner}.
149 Examples: @inputfileref{input/@/regression,text@/-spanner@/.ly}.
153 @subsection Text marks
155 @cindex coda on bar line
156 @cindex segno on bar line
157 @cindex fermata on bar line
158 @cindex bar lines, symbols on
161 The @code{\mark} command is primarily used for
162 @ref{Rehearsal marks},
163 but it can also be used to put signs like coda,
164 segno, and fermata on a bar line. Use @code{\markup} to
165 access the appropriate symbol
167 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
168 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
173 @code{\mark} is only typeset above the top stave of the score. If
174 you specify the @code{\mark} command at a bar line, the resulting
175 mark is placed above the bar line. If you specify it in the middle
176 of a bar, the resulting mark is positioned between notes. If it is
177 specified before the beginning of a score line, it is placed
178 before the first note of the line. Finally, if the mark occurs at
179 a line break, the mark will be printed at the
180 beginning of the next line.
181 @c IMO this is a bug; hopefully it'll be fixed soon, so I can
182 @c delete this sentence. -gp
183 If there is no next line, then the mark will not be printed at all.
188 To print the mark at the end of the current line, use
191 \override Score.RehearsalMark
192 #'break-visibility = #begin-of-line-invisible
195 @code{\mark} is often useful for adding text to the end of bar. In
196 such cases, changing the @code{#'self-alignment} is very useful
198 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
199 \override Score.RehearsalMark
200 #'break-visibility = #begin-of-line-invisible
202 \once \override Score.RehearsalMark #'self-alignment-X = #right
203 \mark "D.S. al Fine "
206 Text marks may be aligned with notation objects other than
209 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
214 \override Score.RehearsalMark #'break-align-symbol = #'key-signature
218 \override Score.RehearsalMark #'break-align-symbol = #'clef
222 \override Score.RehearsalMark #'break-align-symbol = #'time-signature
231 Although text marks are normally only printed above the topmost
232 staff, you may alter this to print them on every staff,
234 @lilypond[quote,ragged-right,verbatim,relative=2]
237 \remove "Mark_engraver"
241 \consists "Mark_engraver"
243 { c''1 \mark "foo" c'' }
245 \consists "Mark_engraver"
247 { c'1 \mark "foo" c' }
255 Program reference: @internalsref{RehearsalMark}.
259 @subsection Text markup
266 Use @code{\markup} to typeset text. Commands are entered with the
267 backslash @code{\}. To enter @code{\} and @code{#}, use double
270 @lilypond[quote,verbatim,fragment,relative=1]
272 c1_\markup { hi there }
273 c1^\markup { hi \bold there, is \italic anyone home? }
274 c1_\markup { "\special #characters" }
278 See @ref{Overview of text markup commands} for a list of all
281 @code{\markup} is primarily used for @internalsref{TextScript}s,
282 but it can also be used anywhere text is called in lilypond
284 @lilypond[quote,verbatim]
285 \header{ title = \markup{ \bold { foo \italic { bar! } } } }
288 \override Score.RehearsalMark
289 #'break-visibility = #begin-of-line-invisible
290 \override Score.RehearsalMark #'self-alignment-X = #right
292 \set Staff.instrument = \markup{ \column{ Alto solo } }
293 c2^\markup{ don't be \flat }
294 \override TextSpanner #'edge-text = #(cons (markup #:italic "rit" ) "")
296 a2\mark \markup{ \large \bold Fine }
300 \addlyrics { bar, foo \markup{ \italic bar! } }
304 Text can also be placed on its own, away from any @code{\score}
305 block. This is primarily used in a @code{\book} (see
306 @ref{Multiple movements}).
308 @lilypond[quote,ragged-right,verbatim]
309 \markup{ Here is some text. }
312 @cindex font switching
314 The markup in the example demonstrates font switching commands. The
315 command @code{\bold} and @code{\italic} apply to the first following
316 word only; to apply a command to more than one word, enclose the
320 \markup @{ \bold @{ hi there @} @}
324 For clarity, you can also do this for single arguments, e.g.,
327 \markup @{ is \italic @{ anyone @} home @}
330 In markup mode you can compose expressions, similar to mathematical
331 expressions, XML documents, and music expressions. You can stack
332 expressions grouped vertically with the command @code{\column}.
333 Similarly, @code{\center-align} aligns texts by their center lines:
335 @lilypond[quote,verbatim,fragment,relative=1]
336 c1^\markup { \column { a bbbb \line { c d } } }
337 c1^\markup { \center-align { a bbbb c } }
338 c1^\markup { \line { a b c } }
341 Lists with no previous command are not kept distinct. The expression
344 \center-align @{ @{ a b @} @{ c d @} @}
352 \center-align @{ a b c d @}
357 To keep lists of words distinct, please use quotes @code{"} or
358 the @code{\line} command
360 @lilypond[quote,verbatim,fragment,relative=1]
362 c4^\markup{ \center-align { on three lines } }
363 c4^\markup{ \center-align { "all one line" } }
364 c4^\markup{ \center-align { { on three lines } } }
365 c4^\markup{ \center-align { \line { on one line } } }
368 Markups can be stored in variables and these variables
369 may be attached to notes, like
371 allegro = \markup @{ \bold \large @{ Allegro @} @}
372 @{ a^\allegro b c d @}
375 Some objects have alignment procedures of their own, which cancel out
376 any effects of alignments applied to their markup arguments as a
377 whole. For example, the @internalsref{RehearsalMark} is horizontally
378 centered, so using @code{\mark \markup @{ \left-align .. @}} has no
381 In addition, vertical placement is performed after creating the
382 text markup object. If you wish to move an entire piece of markup,
383 you need to use the #'padding property or create an "anchor" point
384 inside the markup (generally with @code{\hspace #0}).
386 @lilypond[quote,verbatim,fragment,relative=1]
388 c'4^\markup{ \raise #5 "not raised" }
389 \once \override TextScript #'padding = #3
390 c'4^\markup{ raised }
391 c'4^\markup{ \hspace #0 \raise #1.5 raised }
394 Some situations (such as dynamic marks) have preset font-related
395 properties. If you are creating text in such situations, it
396 is advisable to cancel those properties with
397 @code{normal-text}. See @ref{Overview of text markup commands}
403 This manual: @ref{Overview of text markup commands}.
405 Program reference: @internalsref{TextScript}.
407 Init files: @file{scm/@/new@/-markup@/.scm}.
412 Kerning or generation of ligatures is only done when the @TeX{}
413 backend is used. In this case, LilyPond does not account for them so
414 texts will be spaced slightly too wide.
416 Syntax errors for markup mode are confusing.
420 @subsection Nested scores
422 It is possible to nest music inside markups, by adding a @code{\score}
423 block to a markup expression. Such a score must contain a @code{\layout}
426 @lilypond[quote,verbatim,ragged-right]
430 \relative { c4 d e f }
439 @node Overview of text markup commands
440 @subsection Overview of text markup commands
442 The following commands can all be used inside @code{\markup @{ @}}.
444 @include markup-commands.tely
448 @subsection Font selection
450 @cindex font selection
451 @cindex font magnification
452 @cindex @code{font-interface}
454 By setting the object properties described below, you can select a
455 font from the preconfigured font families. LilyPond has default
456 support for the feta music fonts. Text fonts are selected through
457 Pango/FontConfig. The serif font defaults to New Century Schoolbook,
458 the sans and typewriter to whatever the Pango installation defaults
463 @item @code{font-encoding}
464 is a symbol that sets layout of the glyphs. This should only be set to
465 select different types of non-text fonts, e.g.
467 @code{fetaBraces} for piano staff braces, @code{fetaMusic} the
468 standard music font, including ancient glyphs, @code{fetaDynamic} for
469 dynamic signs and @code{fetaNumber} for the number font.
471 @item @code{font-family}
472 is a symbol indicating the general class of the typeface. Supported are
473 @code{roman} (Computer Modern), @code{sans}, and @code{typewriter}.
475 @item @code{font-shape}
476 is a symbol indicating the shape of the font. There are typically
477 several font shapes available for each font family. Choices are
478 @code{italic}, @code{caps}, and @code{upright}.
480 @item @code{font-series}
481 is a symbol indicating the series of the font. There are typically
482 several font series for each font family and shape. Choices are
483 @code{medium} and @code{bold}.
487 Fonts selected in the way sketched above come from a predefined style
488 sheet. If you want to use a font from outside the style sheet,
490 @code{font-name} property,
492 @lilypond[fragment,verbatim]
494 \override Staff.TimeSignature #'font-name = #"Charter"
495 \override Staff.TimeSignature #'font-size = #2
498 \override #'(font-name . "Vera Bold")
499 { This text is in Vera Bold }
505 Any font can be used, as long as it is available to Pango/FontConfig.
507 The size of the font may be set with the @code{font-size}
508 property. The resulting size is taken relative to the
509 @code{text-font-size} as defined in the @code{\paper} block.
512 @cindex font magnification
515 It is also possible to change the default font family for the entire
516 document. This is done by calling the @code{make-pango-font-tree} from
517 within the @code{\paper} block. The function takes names for the font
518 families to use for roman, sans serif and monospaced text. For
521 @cindex font families, setting
530 (make-pango-font-tree "Times New Roman"
537 c'^\markup { roman: foo \sans bla \typewriter bar }
541 @c we don't do Helvetica / Courier, since GS incorrectly loads
548 Examples: @inputfileref{input/@/regression,font@/-family@/-override.ly}.
551 @node New dynamic marks
552 @subsection New dynamic marks
554 It is possible to print new dynamic marks or text that should be aligned
555 with dynamics. Use @code{make-dynamic-script} to create these
556 marks. Note that the dynamic font only contains the characters
557 @code{f,m,p,r,s} and @code{z}.
559 Some situations (such as dynamic marks) have preset font-related
560 properties. If you are creating text in such situations, it
561 is advisable to cancel those properties with
562 @code{normal-text}. See @ref{Overview of text markup commands}
565 @cindex make-dynamic-script
567 @lilypond[quote,verbatim,ragged-right]
568 sfzp = #(make-dynamic-script "sfzp")
574 @cindex Dynamics, editorial
575 @cindex Dynamics, parenthesis
577 It is also possible to print dynamics in round parenthesis or square
578 brackets. These are often used for adding editorial dynamics.
580 @lilypond[quote,verbatim,ragged-right]
581 rndf = \markup{ \center-align {\line { \bold{\italic (}
582 \dynamic f \bold{\italic )} }} }
583 boxf = \markup{ \bracket { \dynamic f } }
584 { c'1_\rndf c'1_\boxf }
589 @node Preparing parts
590 @section Preparing parts
592 This section describes various notation that are useful for preparing
596 * Multi measure rests::
601 * Instrument transpositions::
603 * Different editions from one source::
607 @node Multi measure rests
608 @subsection Multi measure rests
610 @cindex multi measure rests
611 @cindex full measure rests
612 @cindex Rests, multi measure
613 @cindex Rests, full measure
614 @cindex whole rests for a full measure
617 Rests for one full measure (or many bars) are entered using `@code{R}'. It
618 is specifically meant for full bar rests and for entering parts: the rest
619 can expand to fill a score with rests, or it can be printed as a single
620 multi-measure rest. This expansion is controlled by the property
621 @code{Score.skipBars}. If this is set to true, empty measures will not
622 be expanded, and the appropriate number is added automatically
624 @lilypond[quote,ragged-right,fragment,verbatim]
625 \time 4/4 r1 | R1 | R1*2
626 \set Score.skipBars = ##t R1*17 R1*4
629 The @code{1} in @code{R1} is similar to the duration notation used for
630 notes. Hence, for time signatures other than 4/4, you must enter other
631 durations. This can be done with augmentation dots or fractions
633 @lilypond[quote,ragged-right,fragment,verbatim]
634 \set Score.skipBars = ##t
643 An @code{R} spanning a single measure is printed as either a whole rest
644 or a breve, centered in the measure regardless of the time signature.
646 If there are only a few measures of rest, LilyPond prints ``church rests''
647 (a series of rectangles) in the staff. To replace that with a simple
648 rest, use @code{MultiMeasureRest.expand-limit}.
650 @lilypond[quote,ragged-right,fragment,verbatim]
651 \set Score.skipBars = ##t
653 \override MultiMeasureRest #'expand-limit = 1
657 @cindex text on multi-measure rest
658 @cindex script on multi-measure rest
659 @cindex fermata on multi-measure rest
661 Texts can be added to multi-measure rests by using the
662 @var{note}-@code{markup} syntax @ref{Text markup}.
663 A variable (@code{\fermataMarkup}) is provided for
666 @lilypond[quote,ragged-right,verbatim,fragment]
667 \set Score.skipBars = ##t
669 R2.*10^\markup { \italic "ad lib." }
673 Warning! This text is created by @code{MultiMeasureRestText}, not
676 @lilypond[quote,ragged-right,verbatim,fragment]
677 \override TextScript #'padding = #5
679 \override MultiMeasureRestText #'padding = #5
683 If you want to have text on the left end of a multi-measure rest,
684 attach the text to a zero-length skip note, i.e.,
694 Program reference: @internalsref{MultiMeasureRestMusicGroup},
695 @internalsref{MultiMeasureRest}.
697 The layout object @internalsref{MultiMeasureRestNumber} is for the
698 default number, and @internalsref{MultiMeasureRestText} for user
704 It is not possible to use fingerings (e.g., @code{R1-4}) to put numbers
705 over multi-measure rests. And the pitch of multi-measure rests (or
706 staff-centered rests) can not be influenced.
708 @cindex condensing rests
710 There is no way to automatically condense multiple rests into a single
711 multi-measure rest. Multi-measure rests do not take part in rest
714 Be careful when entering multi-measure rests followed by whole
715 notes. The following will enter two notes lasting four measures each
719 When @code{skipBars} is set, the result will look OK, but the bar
720 numbering will be off.
723 @node Metronome marks
724 @subsection Metronome marks
727 @cindex beats per minute
728 @cindex metronome marking
730 Metronome settings can be entered as follows
732 \tempo @var{duration} = @var{per-minute}
735 In the MIDI output, they are interpreted as a tempo change. In the
736 layout output, a metronome marking is printed
737 @cindex @code{\tempo}
738 @lilypond[quote,ragged-right,verbatim,fragment]
745 To change the tempo in the MIDI output without printing anything, make
746 the metronome marking invisible
748 \once \override Score.MetronomeMark #'transparent = ##t
751 To print other metronome markings, use these markup commands
752 @lilypond[quote,ragged-right,verbatim,relative,fragment]
755 \smaller \general-align #Y #DOWN \note #"16." #1
757 \smaller \general-align #Y #DOWN \note #"8" #1
762 See @ref{Text markup} for more details.
767 Program reference: @internalsref{MetronomeMark}.
772 Collisions are not checked. If you have notes above the top line of
773 the staff (or notes with articulations, slurs, text, etc), then the
774 metronome marking may be printed on top of musical symbols. If this
775 occurs, increase the padding of the metronome mark to place it
776 further away from the staff.
779 \override Score.MetronomeMark #'padding = #2.5
783 @node Rehearsal marks
784 @subsection Rehearsal marks
786 @cindex Rehearsal marks
789 To print a rehearsal mark, use the @code{\mark} command
791 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
800 The letter@tie{}`I' is skipped in accordance with engraving traditions.
801 If you wish to include the letter `I', then use
804 \set Score.markFormatter = #format-mark-alphabet
807 The mark is incremented automatically if you use @code{\mark
808 \default}, but you can also use an integer argument to set the mark
809 manually. The value to use is stored in the property
810 @code{rehearsalMark}.
812 The style is defined by the property @code{markFormatter}. It is a
813 function taking the current mark (an integer) and the current context
814 as argument. It should return a markup object. In the following
815 example, @code{markFormatter} is set to a canned procedure. After a
816 few measures, it is set to function that produces a boxed number.
818 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
819 \set Score.markFormatter = #format-mark-numbers
822 \set Score.markFormatter = #format-mark-box-numbers
828 The file @file{scm/@/translation@/-functions@/.scm} contains the definitions
829 of @code{format-mark-numbers} (the default format), @code{format-mark-box-numbers},
830 @code{format-mark-letters} and @code{format-mark-box-letters}.
831 These can be used as inspiration for other formatting functions.
833 You may use @code{format-mark-barnumbers}, @code{format-mark-box-barnumbers},
834 and @code{format-mark-circle-barnumbers} to get bar numbers instead of
835 incremented numbers or letters.
840 Program reference: @internalsref{RehearsalMark}.
842 Init files: @file{scm/@/translation@/-functions@/.scm} contains the
843 definition of @code{format-mark-numbers} and
844 @code{format-mark-letters}. They can be used as inspiration for other
845 formatting functions.
847 Examples: @inputfileref{input/@/regression,rehearsal@/-mark@/-letter@/.ly},
849 @inputfileref{input/@/regression,rehearsal@/-mark@/-number@/.ly}.
853 @subsection Bar numbers
856 @cindex measure numbers
857 @cindex @code{currentBarNumber}
859 Bar numbers are printed by default at the start of the line. The
860 number itself is stored in the @code{currentBarNumber} property, which
861 is normally updated automatically for every measure.
863 Bar numbers can be typeset at regular intervals instead of at the
864 beginning of each line. This is illustrated in the following example,
865 whose source is available as
866 @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}
868 @lilypondfile[ragged-right,quote]{bar-number-regular-interval.ly}
870 Bar numbers can be typeset manually by tweaking the
871 @code{markFormatter} property
873 @lilypond[verbatim,ragged-right,quote]
875 \set Score.markFormatter
876 = #(lambda (mark context)
879 (number->string (ly:context-property context
880 'currentBarNumber)))))
882 c1 \bar "||" \mark \default c1 c1 \mark \default c1 \bar "|."
886 Bar numbers can be manually changed by setting the
887 @code{Staff.currentBarNumber} property
889 @lilypond[verbatim,ragged-right,quote]
891 \repeat unfold 4 {c4 c c c} \break
892 \set Score.currentBarNumber = #50
893 \repeat unfold 4 {c4 c c c}
897 Bar numbers can be removed entirely by removing the Bar number
898 engraver from the score.
900 @lilypond[verbatim,ragged-right,quote,relative=2]
904 \remove "Bar_number_engraver"
916 Program reference: @internalsref{BarNumber}.
919 @inputfileref{input/@/test,bar@/-number@/-every@/-five@/-reset@/.ly},
920 and @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}.
925 Bar numbers can collide with the @internalsref{StaffGroup} bracket, if
926 there is one at the top. To solve this, the
927 @code{padding} property of @internalsref{BarNumber} can be
928 used to position the number correctly.
931 @node Instrument names
932 @subsection Instrument names
934 In an orchestral score, instrument names are printed at the left side
937 This can be achieved by setting @internalsref{Staff}.@code{instrument}
938 and @internalsref{Staff}.@code{instr}. This will print a string before
939 the start of the staff. For the first staff, @code{instrument} is
940 used, for the following ones, @code{instr} is used.
942 @lilypond[quote,verbatim,ragged-right,relative=1,fragment]
943 \set Staff.instrument = "Ploink "
944 \set Staff.instr = "Plk "
950 You can also use markup texts to construct more complicated instrument
953 @lilypond[quote,fragment,verbatim,ragged-right]
954 \set Staff.instrument = \markup {
955 \column { "Clarinetti"
956 \line { "in B" \smaller \flat } } }
960 If you wish to center the instrument names, you must center all of them
962 @lilypond[quote,verbatim,ragged-right]
965 \set Staff.instrument = \markup {
966 \center-align { "Clarinetti"
967 \line { "in B" \smaller \flat } } }
971 \set Staff.instrument = \markup{ \center-align { Vibraphone }}
978 For longer instrument names, it may be useful to increase the
979 @code{indent} setting in the @code{\layout} block.
981 To center instrument names while leaving extra space to the right,
983 @lilypond[quote,verbatim,ragged-right]
984 \new StaffGroup \relative
987 \set Staff.instrument
988 = \markup { \hcenter-in #10 "blabla" }
992 \set Staff.instrument
993 = \markup { \hcenter-in #10 "blo" }
1002 Program reference: @internalsref{InstrumentName}.
1006 When you put a name on a grand staff or piano staff, the width of the
1007 brace is not taken into account. The following property setting can be
1008 used to move the instrument names to the left, in such situations.
1011 \override Score.InstrumentName #'space-alist = #'((left-edge extra-space . 2.0))
1015 @node Instrument transpositions
1016 @subsection Instrument transpositions
1018 @cindex transposition, MIDI
1019 @cindex transposition, instrument
1021 The key of a transposing instrument can also be specified. This
1022 applies to many wind instruments, for example, clarinets (B-flat, A, and
1023 E-flat), horn (F) and trumpet (B-flat, C, D, and E-flat).
1025 The transposition is entered after the keyword @code{\transposition}
1028 \transposition bes %% B-flat clarinet
1032 This command sets the property @code{instrumentTransposition}. The value of
1033 this property is used for MIDI output and quotations. It does not
1034 affect how notes are printed in the current staff. To change the printed
1035 output, see @ref{Transpose}.
1037 The pitch to use for @code{\transposition} should correspond to the
1038 real sound heard when a @code{c'} written on the staff is played by the
1039 transposing instrument. For example, when entering a score in
1040 concert pitch, typically all voices are entered in C, so
1041 they should be entered as
1054 The command @code{\transposition} should be used when the music is
1055 entered from a (transposed) orchestral part. For example, in
1056 classical horn parts, the tuning of the instrument is often changed
1057 during a piece. When copying the notes from the part, use
1058 @code{\transposition}, e.g.,
1070 @node Ottava brackets
1071 @subsection Ottava brackets
1073 `Ottava' brackets introduce an extra transposition of an octave for
1074 the staff. They are created by invoking the function
1075 @code{set-octavation}
1081 @lilypond[quote,ragged-right,verbatim,fragment]
1091 The @code{set-octavation} function also takes -1 (for 8va bassa) and 2
1092 (for 15ma) as arguments. Internally the function sets the properties
1093 @code{ottavation} (e.g., to @code{"8va"}) and
1094 @code{centralCPosition}. For overriding the text of the bracket, set
1095 @code{ottavation} after invoking @code{set-octavation}, i.e.,
1097 @lilypond[quote,ragged-right,verbatim]
1100 \set Staff.ottavation = #"8"
1108 Program reference: @internalsref{OttavaBracket}.
1110 Examples: @inputfileref{input/@/regression,ottava@/.ly},
1111 @inputfileref{input/@/regression,ottava@/-broken@/.ly}.
1116 @code{set-octavation} will get confused when clef changes happen
1117 during an octavation bracket.
1120 @node Different editions from one source
1121 @subsection Different editions from one source
1126 The @code{\tag} command marks music expressions with a name. These
1127 tagged expressions can be filtered out later. With this mechanism it
1128 is possible to make different versions of the same music source.
1130 In the following example, we see two versions of a piece of music, one
1131 for the full score, and one with cue notes for the instrumental part
1147 The same can be applied to articulations, texts, etc.: they are
1150 -\tag #@var{your-tag}
1152 to an articulation, for example,
1157 This defines a note with a conditional fingering indication.
1160 @cindex removeWithTag
1161 By applying the @code{\keepWithTag} and @code{\removeWithTag}
1162 commands, tagged expressions can be filtered. For example,
1166 \keepWithTag #'score @var{the music}
1167 \keepWithTag #'part @var{the music}
1172 @lilypondfile[ragged-right,quote]{tag-filter.ly}
1174 The arguments of the @code{\tag} command should be a symbol
1175 (such as @code{#'score} or @code{#'part}), followed by a
1176 music expression. It is possible to put multiple tags on
1177 a piece of music with multiple @code{\tag} entries,
1180 \tag #'original-part \tag #'transposed-part @dots{}
1186 Examples: @inputfileref{input/@/regression,tag@/-filter@/.ly}.
1191 Multiple rests are not merged if you create the score with both tagged
1196 @node Orchestral music
1197 @section Orchestral music
1199 Orchestral music involves some special notation, both in the full
1200 score and the individual parts. This section explains how to tackle
1201 some common problems in orchestral music.
1204 * Automatic part combining::
1206 * Quoting other voices::
1207 * Formatting cue notes::
1208 * Aligning to cadenzas::
1212 @node Automatic part combining
1213 @subsection Automatic part combining
1214 @cindex automatic part combining
1215 @cindex part combiner
1217 Automatic part combining is used to merge two parts of music onto a
1218 staff. It is aimed at typesetting orchestral scores. When the two
1219 parts are identical for a period of time, only one is shown. In
1220 places where the two parts differ, they are typeset as separate
1221 voices, and stem directions are set automatically. Also, solo and
1222 @emph{a due} parts are identified and can be marked.
1224 The syntax for part combining is
1227 \partcombine @var{musicexpr1} @var{musicexpr2}
1231 The following example demonstrates the basic functionality of the part
1232 combiner: putting parts on one staff, and setting stem directions and
1235 @lilypond[quote,verbatim,ragged-right,fragment]
1236 \new Staff \partcombine
1237 \relative g' { g g a( b) c c r r }
1238 \relative g' { g g r4 r e e g g }
1241 The first @code{g} appears only once, although it was
1242 specified twice (once in each part). Stem, slur, and tie directions are
1243 set automatically, depending whether there is a solo or unisono. The
1244 first part (with context called @code{one}) always gets up stems, and
1245 `Solo', while the second (called @code{two}) always gets down stems and
1248 If you just want the merging parts, and not the textual markings, you
1249 may set the property @code{printPartCombineTexts} to false
1251 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
1253 \set Staff.printPartCombineTexts = ##f
1255 \relative g' { g a( b) r }
1256 \relative g' { g r4 r f }
1260 To change the text that is printed for solos or merging, you may
1261 set the @code{soloText}, @code{soloIIText}, and @code{aDueText}
1264 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
1266 \set Score.soloText = #"ichi"
1267 \set Score.soloIIText = #"ni"
1268 \set Score.aDueText = #"tachi"
1270 \relative g' { g4 g a( b) r }
1271 \relative g' { g4 g r r f }
1275 Both arguments to @code{\partcombine} will be interpreted as
1276 @internalsref{Voice} contexts. If using relative octaves,
1277 @code{\relative} should be specified for both music expressions, i.e.,
1281 \relative @dots{} @var{musicexpr1}
1282 \relative @dots{} @var{musicexpr2}
1286 A @code{\relative} section that is outside of @code{\partcombine} has
1287 no effect on the pitches of @var{musicexpr1} and @var{musicexpr2}.
1291 Program reference: @internalsref{PartCombineMusic}.
1295 When @code{printPartCombineTexts} is set, when the two voices play the
1296 same notes on and off, the part combiner may typeset @code{a2} more
1297 than once in a measure.
1299 @code{\partcombine} cannot be inside @code{\times}.
1301 @code{\partcombine} cannot be inside @code{\relative}.
1303 Internally, the @code{\partcombine} interprets both arguments as
1304 @code{Voice}s named @code{one} and @code{two}, and then decides when
1305 the parts can be combined. Consequently, if the arguments switch to
1306 differently named @internalsref{Voice} contexts, the events in those
1311 @subsection Hiding staves
1313 @cindex Frenched scores
1314 @cindex Hiding staves
1316 In orchestral scores, staff lines that only have rests are usually
1317 removed; this saves some space. This style is called `French Score'.
1318 For @internalsref{Lyrics},
1319 @internalsref{ChordNames} and @internalsref{FiguredBass}, this is
1320 switched on by default. When the lines of these contexts turn out
1321 empty after the line-breaking process, they are removed.
1323 For normal staves, a specialized @internalsref{Staff} context is
1324 available, which does the same: staves containing nothing (or only
1325 multi-measure rests) are removed. The context definition is stored in
1326 @code{\RemoveEmptyStaffContext} variable. Observe how the second staff
1327 in this example disappears in the second line
1329 @lilypond[quote,ragged-right,verbatim]
1331 \context { \RemoveEmptyStaffContext }
1336 \new Staff { e4 f g a \break c1 }
1337 \new Staff { c4 d e f \break R1 }
1342 The first system shows all staves in full. If empty staves should be
1343 removed from the first system too, set @code{remove-first} to true in
1344 @internalsref{VerticalAxisGroup}.
1347 \override Score.VerticalAxisGroup #'remove-first = ##t
1350 To remove other types of contexts, use @code{\AncientRemoveEmptyStaffContext}
1351 or @code{\RemoveEmptyRhythmicStaffContext}.
1353 Another application is making ossia sections, i.e., alternative
1354 melodies on a separate piece of staff, with help of a Frenched
1355 staff. See @inputfileref{input/@/test,ossia@/.ly} for an example.
1358 @node Quoting other voices
1359 @subsection Quoting other voices
1361 With quotations, fragments of other parts can be inserted into a part
1362 directly. Before a part can be quoted, it must be marked especially as
1363 quotable. This is done with the @code{\addquote} command.
1366 \addquote @var{name} @var{music}
1371 Here, @var{name} is an identifying string. The @var{music} is any kind
1372 of music. Here is an example of @code{\addquote}
1375 \addquote clarinet \relative c' @{
1380 This command must be entered at toplevel, i.e., outside any music
1383 After calling @code{\addquote}, the quotation may then be done with
1384 @code{\quoteDuring} or @code{\cueDuring},
1387 \quoteDuring #@var{name} @var{music}
1390 During a part, a piece of music can be quoted with the @code{\quoteDuring}
1394 \quoteDuring #"clarinet" @{ s2. @}
1397 This would cite three quarter notes (the duration of @code{s2.}) of
1398 the previously added @code{clarinet} voice.
1401 More precisely, it takes the current time-step of the part being
1402 printed, and extracts the notes at the corresponding point of the
1403 @code{\addquote}d voice. Therefore, the argument to @code{\addquote}
1404 should be the entire part of the voice to be quoted, including any
1405 rests at the beginning.
1407 Quotations take into account the transposition of both source and target
1408 instruments, if they are specified using the @code{\transposition} command.
1410 @lilypond[quote,ragged-right,verbatim]
1411 \addquote clarinet \relative c' {
1417 e'8 f'8 \quoteDuring #"clarinet" { s2 }
1421 The type of events that are present in cue notes can be trimmed with
1422 the @code{quotedEventTypes} property. The default value is
1423 @code{(note-event rest-event)}, which means that only notes and
1424 rests of the cued voice end up in the @code{\quoteDuring}.
1428 \set Staff.quotedEventTypes =
1429 #'(note-event articulation-event dynamic-event)
1433 will quote notes (but no rests), together with scripts and dynamics.
1437 Only the contents of the first @internalsref{Voice} occurring in an
1438 @code{\addquote} command will be considered for quotation, so
1439 @var{music} can not contain @code{\new} and @code{\context Voice}
1440 statements that would switch to a different Voice.
1442 Quoting grace notes is broken and can even cause LilyPond to crash.
1446 In this manual: @ref{Instrument transpositions}.
1448 Examples: @inputfileref{input/@/regression,quote@/.ly}
1449 @inputfileref{input/@/regression,quote@/-transposition@/.ly}
1451 Program reference: @internalsref{QuoteMusic}.
1454 @node Formatting cue notes
1455 @subsection Formatting cue notes
1457 The previous section deals with inserting notes from another voice.
1458 There is a more advanced music function called @code{\cueDuring},
1459 which makes formatting cue notes easier.
1464 \cueDuring #@var{name} #@var{updown} @var{music}
1467 This will insert notes from the part @var{name} into a
1468 @internalsref{Voice} called @code{cue}. This happens simultaneously
1469 with @var{music}, which usually is a rest. When the cue notes start,
1470 the staff in effect becomes polyphonic for a moment. The argument
1471 @var{updown} determines whether the cue notes should be notated as a
1472 first or second voice.
1475 @lilypond[verbatim,ragged-right]
1478 \override Stem #'length-fraction = #0.8
1479 \override Beam #'thickness = #0.384
1480 \override Beam #'length-fraction = #0.8
1483 \addquote clarinet \relative {
1488 \new Staff \relative <<
1490 % setup a context for cue notes.
1491 \new Voice = "cue" { \smaller \skip 1*21 }
1493 \set Score.skipBars = ##t
1497 \cueDuring #"clarinet" #1 {
1506 Here are a couple of hints for successful cue notes
1510 Cue notes have smaller font sizes.
1512 the cued part is marked with the instrument playing the cue.
1514 when the original part takes over again, this should be marked with
1515 the name of the original instrument.
1517 @c really? Are you sure about that last point? I'll check after 3.0 -gp
1519 @c Yes, this is good practice. Otherwise, the start of the original
1520 @c part can only be seen from the font size. This is not good enough
1521 @c for sight-reading. It is possilbe to use other
1522 @c markers (e.g. a big close-bracket over the staff) to indicate the cue notes are
1527 Any other changes introduced by the cued part should also be
1528 undone. For example, if the cued instrument plays in a different clef,
1529 the original clef should be stated once again.
1534 @node Aligning to cadenzas
1535 @subsection Aligning to cadenzas
1537 In an orchestral context, cadenzas present a special problem:
1538 when constructing a score that includes a cadenza, all other
1539 instruments should skip just as many notes as the length of the
1540 cadenza, otherwise they will start too soon or too late.
1542 A solution to this problem are the functions @code{mmrest-of-length}
1543 and @code{skip-of-length}. These Scheme functions take a piece of music
1544 as argument, and generate a @code{\skip} or multi-rest, exactly as
1545 long as the piece. The use of @code{mmrest-of-length} is demonstrated
1546 in the following example.
1548 @lilypond[verbatim,ragged-right,quote]
1549 cadenza = \relative c' {
1550 c4 d8 << { e f g } \\ { d4. } >>
1555 \new Staff { \cadenza c'4 }
1557 #(ly:export (mmrest-of-length cadenza))
1566 @node Contemporary notation
1567 @section Contemporary notation
1569 In the 20th century, composers have greatly expanded the musical
1570 vocabulary. With this expansion, many innovations in musical notation
1571 have been tried. The book ``Music Notation in the 20th century'' by
1572 Kurt Stone gives a comprehensive overview (see @ref{Literature
1575 This section describes notation that does
1576 not fit into traditional notation categories, such as pitches,
1577 tuplet beams, and articulation. For contemporary notation
1578 that fits into traditional notation categories, such as
1579 microtones, nested tuplet beams, and unusual fermatas, please
1580 see those sections of the documentation.
1583 @c I don't think we should discourage modern composers who might
1584 @c want to sponsor new features. :)
1585 @c In general, the use of new, innovative notation makes a piece
1586 @c harder to understand and perform and its use should therefore be
1587 @c avoided. For this reason, support for contemporary notation in
1588 @c LilyPond is limited.
1592 * Polymetric notation::
1593 * Time administration::
1594 * Proportional notation::
1596 * Special noteheads::
1602 @node Polymetric notation
1603 @subsection Polymetric notation
1605 Double time signatures are not supported explicitly, but they can be
1606 faked. In the next example, the markup for the time signature is
1607 created with a markup text. This markup text is inserted in the
1608 @internalsref{TimeSignature} grob.
1610 @lilypond[verbatim,ragged-right]
1615 \musicglyph #"scripts.stopped"
1616 \bracket \column { "5" "8" }
1621 \override Staff.TimeSignature #'stencil = #ly:text-interface::print
1622 \override Staff.TimeSignature #'text = #tsMarkup
1624 c'2 \bar ":" c'4 c'4.
1628 Each staff can also have its own time signature. This is done by
1629 moving the @internalsref{Timing_translator} to the @internalsref{Staff}
1635 \remove "Timing_translator"
1636 \remove "Default_bar_line_engraver"
1640 \consists "Timing_translator"
1641 \consists "Default_bar_line_engraver"
1648 Now, each staff has its own time signature.
1661 c4. c8 c c c4. c8 c c
1666 @lilypond[quote,ragged-right]
1670 \remove "Timing_translator"
1671 \remove "Default_bar_line_engraver"
1674 \consists "Timing_translator"
1675 \consists "Default_bar_line_engraver"
1690 c4. c8 c c c4. c8 c c
1696 A different form of polymetric notation is where note lengths have
1697 different values across staves.
1699 This notation can be created by setting a common time signature for
1700 each staff but replacing it manually using
1701 @code{timeSignatureFraction} to the desired fraction. Then the printed
1702 durations in each staff are scaled to the common time signature.
1703 The latter is done with @code{\compressMusic}, which is used similar
1704 to @code{\times}, but does not create a tuplet bracket. The syntax is
1706 \compressMusic #'(@var{numerator} . @var{denominator}) @var{musicexpr}
1711 In this example, music with the time signatures of 3/4, 9/8, and 10/8 are
1712 used in parallel. In the second staff, shown durations are multiplied by
1713 2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are
1714 multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
1716 @lilypond[quote,ragged-right,verbatim,fragment]
1724 \set Staff.timeSignatureFraction = #'(9 . 8)
1725 \compressMusic #'(2 . 3)
1726 \repeat unfold 6 { c8[ c c] }
1730 \set Staff.timeSignatureFraction = #'(10 . 8)
1731 \compressMusic #'(3 . 5) {
1732 \repeat unfold 2 { c8[ c c] }
1733 \repeat unfold 2 { c8[ c] }
1734 | c4. c4. \times 2/3 { c8 c c } c4
1745 When using different time signatures in parallel, the spacing is
1746 aligned vertically, but bar lines distort the regular spacing.
1749 @node Time administration
1750 @subsection Time administration
1752 @cindex Time administration
1754 Time is administered by the @internalsref{Time_signature_engraver},
1755 which usually lives in the @internalsref{Score} context. The
1756 bookkeeping deals with the following variables
1759 @item currentBarNumber
1763 The length of the measures in the current time signature. For a 4/4
1764 time this is@tie{}1, and for 6/8 it is 3/4.
1766 @item measurePosition
1767 The point within the measure where we currently are. This quantity
1768 is reset to@tie{}0 whenever it exceeds @code{measureLength}. When that
1769 happens, @code{currentBarNumber} is incremented.
1772 If set to true, the above variables are updated for every time
1773 step. When set to false, the engraver stays in the current measure
1777 Timing can be changed by setting any of these variables explicitly.
1778 In the next example, the 4/4 time signature is printed, but
1779 @code{measureLength} is set to 5/4. After a while, the measure is
1780 shortened by 1/8, by setting @code{measurePosition} to 7/8 at 2/4
1781 in the measure, so the next bar line will fall at 2/4 + 3/8. The
1782 3/8 arises because 5/4 normally has 10/8, but we have manually
1783 set the measure position to be 7/8 and 10/8 - 7/8 = 3/8.
1785 @lilypond[quote,ragged-right,verbatim,relative,fragment]
1786 \set Score.measureLength = #(ly:make-moment 5 4)
1790 \set Score.measurePosition = #(ly:make-moment 7 8)
1796 As the example illustrates, @code{ly:make-moment n m} constructs a
1797 duration of n/m of a whole note. For example, @code{ly:make-moment 1 8} is an eighth
1798 note duration and @code{ly:make-moment 7 16} is the duration of
1799 seven sixteenths notes.
1802 @node Proportional notation
1803 @subsection Proportional notation
1804 @cindex Proportional notation
1806 Notes can be spaced proportional to their time-difference by
1807 assigning a duration to @code{proportionalNotationDuration}
1809 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
1811 \set Score.proportionalNotationDuration = #(ly:make-moment 1 16)
1812 \new Staff { c8[ c c c c c] c4 c2 r2 }
1813 \new Staff { c2 \times 2/3 { c8 c c } c4 c1 }
1819 @subsection Clusters
1823 A cluster indicates a continuous range of pitches to be played. They
1824 can be denoted as the envelope of a set of notes. They are entered by
1825 applying the function @code{makeClusters} to a sequence of
1827 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1828 \makeClusters { <c e > <b f'> }
1831 The following example (from
1832 @inputfileref{input/@/regression,cluster@/.ly}) shows what the result
1835 @lilypondfile[ragged-right,quote]{cluster.ly}
1837 Ordinary notes and clusters can be put together in the same staff,
1838 even simultaneously. In such a case no attempt is made to
1839 automatically avoid collisions between ordinary notes and clusters.
1843 Program reference: @internalsref{ClusterSpanner},
1844 @internalsref{ClusterSpannerBeacon},
1845 @internalsref{Cluster_spanner_engraver}.
1847 Examples: @inputfileref{input/@/regression,cluster@/.ly}.
1851 Music expressions like @code{<< @{ g8 e8 @} a4 >>} are not printed
1852 accurately. Use @code{<g a>8 <e a>8} instead.
1855 @node Special noteheads
1856 @subsection Special noteheads
1858 Different noteheads are used by various instruments for various
1859 meanings -- crosses are used for ``parlato'' with vocalists, stopped
1860 notes on guitar; diamonds are used for harmonics on string instruments,
1861 etc. There is a shorthand (@code{\harmonic}) for diamond shapes; the
1862 other notehead styles are produced by tweaking the property
1864 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1866 \override NoteHead #'style = #'cross
1868 \revert NoteHead #'style
1869 e d <c f\harmonic> <d a'\harmonic>
1873 To see all notehead styles, please see
1874 @inputfileref{input/@/regression,note@/-head@/-style@/.ly}.
1879 Program reference: @internalsref{NoteHead}.
1882 @node Feathered beams
1883 @subsection Feathered beams
1885 Feathered beams are not supported natively, but they can be faked by
1886 forcing two beams to overlap. Here is an example,
1888 @c don't change relative setting witout changing positions!
1889 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1894 \once \override Voice.Beam #'positions = #'(0 . 0.5)
1899 \once \override Voice.Beam #'positions = #'(0 . -0.5)
1907 @subsection Improvisation
1909 Improvisation is sometimes denoted with slashed note heads. Such note
1910 heads can be created by adding a @internalsref{Pitch_squash_engraver}
1911 to the @internalsref{Staff} or @internalsref{Voice} context. Then, the
1915 \set squashedPosition = #0
1916 \override NoteHead #'style = #'slash
1920 switches on the slashes.
1922 There are shortcuts @code{\improvisationOn} (and an accompanying
1923 @code{\improvisationOff}) for this command sequence. They are used in
1924 the following example
1926 @lilypond[verbatim,ragged-right,quote]
1928 \consists Pitch_squash_engraver
1930 e8 e g a a16(bes)(a8) g \improvisationOn
1933 ~fis2 \improvisationOff a16(bes) a8 g e
1938 @node Educational use
1939 @section Educational use
1941 With the amount of control that LilyPond offers, one can make great
1942 teaching tools in addition to great musical scores.
1946 * Blank music sheet::
1948 * Shape note heads ::
1949 * Easy Notation note heads::
1950 * Analysis brackets::
1951 * Coloring objects::
1955 @subsection Balloon help
1957 Elements of notation can be marked and named with the help of a square
1958 balloon. The primary purpose of this feature is to explain notation.
1960 The following example demonstrates its use.
1962 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
1965 #(add-balloon-text 'NoteHead "heads, or tails?"
1972 The function @code{add-balloon-text} takes the name of a grob, the
1973 label to print, and the position where to put the label relative to
1974 the object. In the above example, the text ``heads or tails?'' ends
1975 3 spaces below and 1 space to the right of the marked head.
1978 @cindex notation, explaining
1982 Program reference: @internalsref{text-balloon-interface}.
1984 Examples: @inputfileref{input/@/regression,balloon@/.ly}.
1989 @node Blank music sheet
1990 @subsection Blank music sheet
1992 @cindex Sheet music, empty
1993 @cindex Staves, blank sheet
1995 A blank music sheet can be produced also by using invisible notes, and
1996 removing @code{Bar_number_engraver}.
1999 @lilypond[quote,verbatim]
2001 \repeat unfold 2 % Change this for more lines.
2006 \override TimeSignature #'transparent = ##t
2007 defaultBarType = #""
2008 \remove Bar_number_engraver
2010 \new Staff \emptymusic
2011 \new TabStaff \emptymusic
2017 @subsection Hidden notes
2019 @cindex Hidden notes
2020 @cindex Invisible notes
2021 @cindex Transparent notes
2023 @cindex @code{\hideNotes}
2024 @cindex @code{\unHideNotes}
2025 Hidden (or invisible or transparent) notes can be useful in preparing theory
2026 or composition exercises.
2028 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
2037 @node Shape note heads
2038 @subsection Shape note heads
2040 In shape note head notation, the shape of the note head corresponds
2041 to the harmonic function of a note in the scale. This notation was
2042 popular in the 19th century American song books.
2044 Shape note heads can be produced by setting @code{\aikenHeads} or
2045 @code{\sacredHarpHeads}, depending on the style desired.
2047 @lilypond[verbatim,relative=1,fragment]
2054 Shapes are determined on the step in the scale, where the base of the
2055 scale is determined by the @code{\key} command
2058 @findex shapeNoteStyles
2060 @findex \sacredHarpHeads
2062 Shape note heads are implemented through the @code{shapeNoteStyles}
2063 property. Its value is a vector of symbols. The k-th element indicates
2064 the style to use for the k-th step of the scale. Arbitrary
2065 combinations are possible, e.g.
2067 @lilypond[verbatim,relative=1,fragment]
2068 \set shapeNoteStyles = ##(cross triangle fa #f mensural xcircle diamond)
2073 @node Easy Notation note heads
2074 @subsection Easy Notation note heads
2076 @cindex easy notation
2079 The `easy play' note head includes a note name inside the head. It is
2080 used in music for beginners
2082 @lilypond[quote,ragged-right,verbatim,fragment,staffsize=26]
2087 The command @code{\setEasyHeads} overrides settings for the
2088 @internalsref{NoteHead} object. To make the letters readable, it has
2089 to be printed in a large font size. To print with a larger font, see
2090 @ref{Setting global staff size}.
2094 @cindex @code{\setEasyHeads}
2095 @code{\setEasyHeads}
2098 @node Analysis brackets
2099 @subsection Analysis brackets
2101 @cindex phrasing brackets
2102 @cindex musicological analysis
2103 @cindex note grouping bracket
2105 Brackets are used in musical analysis to indicate structure in musical
2106 pieces. LilyPond supports a simple form of nested horizontal
2107 brackets. To use this, add the @internalsref{Horizontal_bracket_engraver}
2108 to @internalsref{Staff} context. A bracket is started with
2109 @code{\startGroup} and closed with @code{\stopGroup}
2111 @lilypond[quote,ragged-right,verbatim]
2114 c4\startGroup\startGroup
2117 c4\stopGroup\stopGroup
2121 \Staff \consists "Horizontal_bracket_engraver"
2127 Program reference: @internalsref{HorizontalBracket}.
2129 Examples: @inputfileref{input/@/regression,note@/-group@/-bracket@/.ly}.
2132 @node Coloring objects
2133 @subsection Coloring objects
2135 Individual objects may be assigned colors. You may use the
2136 color names listed in the @ref{List of colors}.
2138 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
2139 \override NoteHead #'color = #red
2141 \override NoteHead #'color = #(x11-color 'LimeGreen)
2143 \override Stem #'color = #blue
2147 The full range of colors defined for X11 can be accessed by using the
2148 scheme function x11-color. The function takes one argument that can be a
2152 \override Beam #'color = #(x11-color 'MediumTurquoise)
2158 \override Beam #'color = #(x11-color "MediumTurquoise")
2161 The first form is quicker to write and is more efficient. However, using
2162 the second form it is possible to access X11 colors by the multi-word
2166 \override Beam #'color = #(x11-color "medium turquoise")
2169 If x11-color cannot make sense of the parameter then the color returned
2170 defaults to black. It should be obvious from the final score that
2173 This example, illustrates the use of x11-color. Notice that the stem
2174 color remains black after being set to (x11-color 'Boggle), which is
2175 deliberate nonsense.
2177 @lilypond[quote,ragged-right,verbatim]
2179 \override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
2180 \set Staff.instrument = \markup {
2181 \with-color #(x11-color 'navy) "Clarinet"
2185 \override Beam #'color = #(x11-color "medium turquoise")
2187 \override NoteHead #'color = #(x11-color "LimeGreen")
2189 \override Stem #'color = #(x11-color 'Boggle)
2197 Appendix: @ref{List of colors}.
2201 Not all x11 colors are distinguishable in a web browser. For web use
2202 normal colors are recommended.
2204 An x11 color is not necessarily exactly the same shade as a similarly
2208 @node Automatic notation
2209 @section Automatic notation
2211 This section describes how to change the way that accidentals and
2212 beams are automatically displayed.
2214 FIXME: this might get moved into Changing Defaults. Please send
2215 opinions to lilypond-devel. Thanks! :)
2218 * Automatic accidentals::
2219 * Setting automatic beam behavior::
2222 @node Automatic accidentals
2223 @subsection Automatic accidentals
2224 @cindex Automatic accidentals
2226 Common rules for typesetting accidentals have been placed in a
2227 function. This function is called as follows
2229 @cindex @code{set-accidental-style}
2231 #(set-accidental-style 'STYLE #('CONTEXT#))
2234 The function can take two arguments: the name of the accidental style,
2235 and an optional argument that denotes the context that should be
2236 changed. If no context name is supplied, @code{Staff} is the default,
2237 but you may wish to apply the accidental style to a single @code{Voice}
2240 The following accidental styles are supported
2243 This is the default typesetting behavior. It corresponds
2244 to 18th century common practice: Accidentals are
2245 remembered to the end of the measure in which they occur and
2246 only on their own octave.
2249 The normal behavior is to remember the accidentals on
2250 Staff-level. This variable, however, typesets accidentals
2251 individually for each voice. Apart from that, the rule is similar to
2254 As a result, accidentals from one voice do not get canceled in other
2255 voices, which is often an unwanted result
2257 @lilypond[quote,ragged-right,relative=1,fragment,verbatim]
2259 #(set-accidental-style 'voice)
2266 The @code{voice} option should be used if the voices
2267 are to be read solely by individual musicians. If the staff is to be
2268 used by one musician (e.g., a conductor) then
2269 @code{modern} or @code{modern-cautionary}
2270 should be used instead.
2273 @cindex @code{modern} style accidentals
2274 This rule corresponds to the common practice in the 20th century. This rule
2275 prints the same accidentals as @code{default}, but temporary
2276 accidentals also are canceled in other octaves. Furthermore,
2277 in the same octave, they also get canceled in the following
2280 @lilypond[quote,ragged-right,fragment,verbatim]
2281 #(set-accidental-style 'modern)
2282 cis' c'' cis'2 | c'' c'
2285 @item @code{modern-cautionary}
2286 @cindex @code{modern-cautionary}
2287 This rule is similar to @code{modern}, but the ``extra'' accidentals
2288 (the ones not typeset by @code{default}) are typeset as cautionary
2289 accidentals. They are printed in reduced size or with parentheses
2290 @lilypond[quote,ragged-right,fragment,verbatim]
2291 #(set-accidental-style 'modern-cautionary)
2292 cis' c'' cis'2 | c'' c'
2295 @cindex @code{modern-voice}
2297 This rule is used for multivoice accidentals to be read both by musicians
2298 playing one voice and musicians playing all voices. Accidentals are
2299 typeset for each voice, but they @emph{are} canceled across voices in
2300 the same @internalsref{Staff}.
2302 @cindex @code{modern-voice-cautionary}
2303 @item modern-voice-cautionary
2304 This rule is the same as @code{modern-voice}, but with the extra
2305 accidentals (the ones not typeset by @code{voice}) typeset
2306 as cautionaries. Even though all accidentals typeset by
2307 @code{default} @emph{are} typeset by this variable,
2308 some of them are typeset as cautionaries.
2311 @cindex @code{piano} accidentals
2312 This rule reflects 20th century practice for piano notation. Very similar to
2313 @code{modern} but accidentals also get canceled
2314 across the staves in the same @internalsref{GrandStaff} or
2315 @internalsref{PianoStaff}.
2317 @item piano-cautionary
2318 @cindex @code{#(set-accidental-style 'piano-cautionary)}
2319 Same as @code{#(set-accidental-style 'piano)} but with the extra
2320 accidentals typeset as cautionaries.
2323 @cindex @code{no-reset} accidental style
2324 This is the same as @code{default} but with accidentals lasting
2325 ``forever'' and not only until the next measure
2326 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2327 #(set-accidental-style 'no-reset)
2332 This is sort of the opposite of @code{no-reset}: Accidentals
2333 are not remembered at all---and hence all accidentals are
2334 typeset relative to the key signature, regardless of what was
2337 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2338 #(set-accidental-style 'forget)
2339 \key d\major c4 c cis cis d d dis dis
2346 Program reference: @internalsref{Accidental_engraver},
2347 @internalsref{Accidental}, and @internalsref{AccidentalPlacement}.
2352 Simultaneous notes are considered to be entered in sequential
2353 mode. This means that in a chord the accidentals are typeset as if the
2354 notes in the chord happened once at a time - in the order in which
2355 they appear in the input file.
2357 This is a problem when accidentals in a chord depend on each other,
2358 which does not happen for the default accidental style. The problem
2359 can be solved by manually inserting @code{!} and @code{?} for the
2363 @node Setting automatic beam behavior
2364 @subsection Setting automatic beam behavior
2366 @cindex @code{autoBeamSettings}
2367 @cindex @code{(end * * * *)}
2368 @cindex @code{(begin * * * *)}
2369 @cindex automatic beams, tuning
2370 @cindex tuning automatic beaming
2372 @c [TODO: use \applyContext]
2374 In normal time signatures, automatic beams can start on any note but can
2375 only end in a few positions within the measure: beams can end on a beat,
2376 or at durations specified by the properties in
2377 @code{autoBeamSettings}. The properties in @code{autoBeamSettings}
2378 consist of a list of rules for where beams can begin and end. The
2379 default @code{autoBeamSettings} rules are defined in
2380 @file{scm/@/auto@/-beam@/.scm}.
2382 In order to add a rule to the list, use
2384 #(override-auto-beam-setting '(be p q n m) a b [context])
2389 @item @code{be} is either "begin" or "end".
2391 @item @code{p/q} is the duration of the note for which you want
2392 to add a rule. A beam is considered to have the duration of its
2393 shortest note. Set @code{p} and @code{q} to @code{'*'} to
2394 have this apply to any beam.
2396 @item @code{n/m} is the time signature to which
2397 this rule should apply. Set @code{n} and @code{m} to @code{'*'}
2398 to have this apply in any time signature.
2400 @item @code{a/b} is the position in the bar at which the beam should begin/end.
2402 @item @code{context} is optional, and it specifies the context at which
2403 the change should be made. The default is @code{'Voice}.
2404 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
2405 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
2409 For example, if automatic beams should always end on the first quarter
2413 #(override-auto-beam-setting '(end * * * *) 1 4)
2416 You can force the beam settings to only take effect on beams whose shortest
2417 note is a certain duration
2419 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2421 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
2423 a32 a a a a16 a a a a a |
2424 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
2425 a32 a a a a16 a a a a a |
2428 You can force the beam settings to only take effect in certain time
2431 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2433 #(override-auto-beam-setting '(end * * 5 8) 2 8)
2441 You can also remove a previously set beam-ending rule by using
2444 #(revert-auto-beam-setting '(be p q n m) a b [context])
2448 be, p, q, n, m, a, b and context are the same as above. Note that the
2449 default rules are specified in @file{scm/@/auto@/-beam@/.scm},
2450 so you can revert rules that you did not explicitly create.
2452 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2454 a16 a a a a a a a a a a a a a a a
2455 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
2456 a16 a a a a a a a a a a a a a a a
2459 The rule in a revert-auto-beam-setting statement must exactly match the
2460 original rule. That is, no wildcard expansion is taken into account.
2462 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2464 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
2466 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
2468 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
2474 @c TODO: old material -- not covered by above stuff, I think.
2475 If automatic beams should end on every quarter in 5/4 time, specify
2478 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
2479 #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
2480 #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
2481 #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
2485 The same syntax can be used to specify beam starting points. In this
2486 example, automatic beams can only end on a dotted quarter note
2488 #(override-auto-beam-setting '(end * * * *) 3 8)
2489 #(override-auto-beam-setting '(end * * * *) 1 2)
2490 #(override-auto-beam-setting '(end * * * *) 7 8)
2492 In 4/4 time signature, this means that automatic beams could end only on
2493 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
2494 3/8, has passed within the measure).
2496 @cindex automatic beam generation
2498 @cindex @code{autoBeaming}
2501 If beams are used to indicate melismata in songs, then automatic
2502 beaming should be switched off with @code{\autoBeamOff}.
2507 @cindex @code{\autoBeamOff}
2508 @code{\autoBeamOff},
2509 @cindex @code{\autoBeamOn}
2515 If a score ends while an automatic beam has not been ended and is
2516 still accepting notes, this last beam will not be typeset at all. The
2517 same holds polyphonic voices, entered with @code{<< @dots{} \\ @dots{}
2518 >>}. If a polyphonic voice ends while an automatic beam is still
2519 accepting notes, it is not typeset.