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. See also
1609 @inputfileref{input/@/test,compound@/-time@/.ly}).
1611 @lilypond[verbatim,ragged-right]
1614 \override #'(baseline-skip . 2) \number {
1617 \bracket \column { "5" "8" }
1622 \override Staff.TimeSignature #'stencil = #ly:text-interface::print
1623 \override Staff.TimeSignature #'text = #tsMarkup
1625 c'2 \bar ":" c'4 c'4.
1629 Each staff can also have its own time signature. This is done by
1630 moving the @internalsref{Timing_translator} to the @internalsref{Staff}
1636 \remove "Timing_translator"
1637 \remove "Default_bar_line_engraver"
1641 \consists "Timing_translator"
1642 \consists "Default_bar_line_engraver"
1649 Now, each staff has its own time signature.
1662 c4. c8 c c c4. c8 c c
1667 @lilypond[quote,ragged-right]
1671 \remove "Timing_translator"
1672 \remove "Default_bar_line_engraver"
1675 \consists "Timing_translator"
1676 \consists "Default_bar_line_engraver"
1691 c4. c8 c c c4. c8 c c
1697 A different form of polymetric notation is where note lengths have
1698 different values across staves.
1700 This notation can be created by setting a common time signature for
1701 each staff but replacing it manually using
1702 @code{timeSignatureFraction} to the desired fraction. Then the printed
1703 durations in each staff are scaled to the common time signature.
1704 The latter is done with @code{\compressMusic}, which is used similar
1705 to @code{\times}, but does not create a tuplet bracket. The syntax is
1707 \compressMusic #'(@var{numerator} . @var{denominator}) @var{musicexpr}
1712 In this example, music with the time signatures of 3/4, 9/8, and 10/8 are
1713 used in parallel. In the second staff, shown durations are multiplied by
1714 2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are
1715 multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
1717 @lilypond[quote,ragged-right,verbatim,fragment]
1725 \set Staff.timeSignatureFraction = #'(9 . 8)
1726 \compressMusic #'(2 . 3)
1727 \repeat unfold 6 { c8[ c c] }
1731 \set Staff.timeSignatureFraction = #'(10 . 8)
1732 \compressMusic #'(3 . 5) {
1733 \repeat unfold 2 { c8[ c c] }
1734 \repeat unfold 2 { c8[ c] }
1735 | c4. c4. \times 2/3 { c8 c c } c4
1746 When using different time signatures in parallel, the spacing is
1747 aligned vertically, but bar lines distort the regular spacing.
1750 @node Time administration
1751 @subsection Time administration
1753 @cindex Time administration
1755 Time is administered by the @internalsref{Time_signature_engraver},
1756 which usually lives in the @internalsref{Score} context. The
1757 bookkeeping deals with the following variables
1760 @item currentBarNumber
1764 The length of the measures in the current time signature. For a 4/4
1765 time this is@tie{}1, and for 6/8 it is 3/4.
1767 @item measurePosition
1768 The point within the measure where we currently are. This quantity
1769 is reset to@tie{}0 whenever it exceeds @code{measureLength}. When that
1770 happens, @code{currentBarNumber} is incremented.
1773 If set to true, the above variables are updated for every time
1774 step. When set to false, the engraver stays in the current measure
1778 Timing can be changed by setting any of these variables explicitly.
1779 In the next example, the 4/4 time signature is printed, but
1780 @code{measureLength} is set to 5/4. After a while, the measure is
1781 shortened by 1/8, by setting @code{measurePosition} to 7/8 at 2/4
1782 in the measure, so the next bar line will fall at 2/4 + 3/8. The
1783 3/8 arises because 5/4 normally has 10/8, but we have manually
1784 set the measure position to be 7/8 and 10/8 - 7/8 = 3/8.
1786 @lilypond[quote,ragged-right,verbatim,relative,fragment]
1787 \set Score.measureLength = #(ly:make-moment 5 4)
1791 \set Score.measurePosition = #(ly:make-moment 7 8)
1797 As the example illustrates, @code{ly:make-moment n m} constructs a
1798 duration of n/m of a whole note. For example, @code{ly:make-moment 1 8} is an eighth
1799 note duration and @code{ly:make-moment 7 16} is the duration of
1800 seven sixteenths notes.
1803 @node Proportional notation
1804 @subsection Proportional notation
1805 @cindex Proportional notation
1807 Notes can be spaced proportional to their time-difference by
1808 assigning a duration to @code{proportionalNotationDuration}
1810 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
1812 \set Score.proportionalNotationDuration = #(ly:make-moment 1 16)
1813 \new Staff { c8[ c c c c c] c4 c2 r2 }
1814 \new Staff { c2 \times 2/3 { c8 c c } c4 c1 }
1820 @subsection Clusters
1824 A cluster indicates a continuous range of pitches to be played. They
1825 can be denoted as the envelope of a set of notes. They are entered by
1826 applying the function @code{makeClusters} to a sequence of
1828 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1829 \makeClusters { <c e > <b f'> }
1832 The following example (from
1833 @inputfileref{input/@/regression,cluster@/.ly}) shows what the result
1836 @lilypondfile[ragged-right,quote]{cluster.ly}
1838 Ordinary notes and clusters can be put together in the same staff,
1839 even simultaneously. In such a case no attempt is made to
1840 automatically avoid collisions between ordinary notes and clusters.
1844 Program reference: @internalsref{ClusterSpanner},
1845 @internalsref{ClusterSpannerBeacon},
1846 @internalsref{Cluster_spanner_engraver}.
1848 Examples: @inputfileref{input/@/regression,cluster@/.ly}.
1852 Music expressions like @code{<< @{ g8 e8 @} a4 >>} are not printed
1853 accurately. Use @code{<g a>8 <e a>8} instead.
1856 @node Special noteheads
1857 @subsection Special noteheads
1859 Different noteheads are used by various instruments for various
1860 meanings -- crosses are used for ``parlato'' with vocalists, stopped
1861 notes on guitar; diamonds are used for harmonics on string instruments,
1862 etc. There is a shorthand (@code{\harmonic}) for diamond shapes; the
1863 other notehead styles are produced by tweaking the property
1865 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1867 \override NoteHead #'style = #'cross
1869 \revert NoteHead #'style
1870 e d <c f\harmonic> <d a'\harmonic>
1874 To see all notehead styles, please see
1875 @inputfileref{input/@/regression,note@/-head@/-style@/.ly}.
1880 Program reference: @internalsref{NoteHead}.
1883 @node Feathered beams
1884 @subsection Feathered beams
1886 Feathered beams are not supported natively, but they can be faked by
1887 forcing two beams to overlap. Here is an example,
1889 @c don't change relative setting witout changing positions!
1890 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1895 \once \override Voice.Beam #'positions = #'(0 . 0.5)
1900 \once \override Voice.Beam #'positions = #'(0 . -0.5)
1908 @subsection Improvisation
1910 Improvisation is sometimes denoted with slashed note heads. Such note
1911 heads can be created by adding a @internalsref{Pitch_squash_engraver}
1912 to the @internalsref{Staff} or @internalsref{Voice} context. Then, the
1916 \set squashedPosition = #0
1917 \override NoteHead #'style = #'slash
1921 switches on the slashes.
1923 There are shortcuts @code{\improvisationOn} (and an accompanying
1924 @code{\improvisationOff}) for this command sequence. They are used in
1925 the following example
1927 @lilypond[verbatim,ragged-right,quote]
1929 \consists Pitch_squash_engraver
1931 e8 e g a a16(bes)(a8) g \improvisationOn
1934 ~fis2 \improvisationOff a16(bes) a8 g e
1939 @node Educational use
1940 @section Educational use
1942 With the amount of control that LilyPond offers, one can make great
1943 teaching tools in addition to great musical scores.
1947 * Blank music sheet::
1949 * Shape note heads ::
1950 * Easy Notation note heads::
1951 * Analysis brackets::
1952 * Coloring objects::
1956 @subsection Balloon help
1958 Elements of notation can be marked and named with the help of a square
1959 balloon. The primary purpose of this feature is to explain notation.
1961 The following example demonstrates its use.
1963 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
1966 #(add-balloon-text 'NoteHead "heads, or tails?"
1973 The function @code{add-balloon-text} takes the name of a grob, the
1974 label to print, and the position where to put the label relative to
1975 the object. In the above example, the text ``heads or tails?'' ends
1976 3 spaces below and 1 space to the right of the marked head.
1979 @cindex notation, explaining
1983 Program reference: @internalsref{text-balloon-interface}.
1985 Examples: @inputfileref{input/@/regression,balloon@/.ly}.
1990 @node Blank music sheet
1991 @subsection Blank music sheet
1993 @cindex Sheet music, empty
1994 @cindex Staves, blank sheet
1996 A blank music sheet can be produced also by using invisible notes, and
1997 removing @code{Bar_number_engraver}.
2000 @lilypond[quote,verbatim]
2002 \repeat unfold 2 % Change this for more lines.
2007 \override TimeSignature #'transparent = ##t
2008 defaultBarType = #""
2009 \remove Bar_number_engraver
2011 \new Staff \emptymusic
2012 \new TabStaff \emptymusic
2018 @subsection Hidden notes
2020 @cindex Hidden notes
2021 @cindex Invisible notes
2022 @cindex Transparent notes
2024 @cindex @code{\hideNotes}
2025 @cindex @code{\unHideNotes}
2026 Hidden (or invisible or transparent) notes can be useful in preparing theory
2027 or composition exercises.
2029 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
2038 @node Shape note heads
2039 @subsection Shape note heads
2041 In shape note head notation, the shape of the note head corresponds
2042 to the harmonic function of a note in the scale. This notation was
2043 popular in the 19th century American song books.
2045 Shape note heads can be produced by setting @code{\aikenHeads} or
2046 @code{\sacredHarpHeads}, depending on the style desired.
2048 @lilypond[verbatim,relative=1,fragment]
2055 Shapes are determined on the step in the scale, where the base of the
2056 scale is determined by the @code{\key} command
2059 @findex shapeNoteStyles
2061 @findex \sacredHarpHeads
2063 Shape note heads are implemented through the @code{shapeNoteStyles}
2064 property. Its value is a vector of symbols. The k-th element indicates
2065 the style to use for the k-th step of the scale. Arbitrary
2066 combinations are possible, e.g.
2068 @lilypond[verbatim,relative=1,fragment]
2069 \set shapeNoteStyles = ##(cross triangle fa #f mensural xcircle diamond)
2074 @node Easy Notation note heads
2075 @subsection Easy Notation note heads
2077 @cindex easy notation
2080 The `easy play' note head includes a note name inside the head. It is
2081 used in music for beginners
2083 @lilypond[quote,ragged-right,verbatim,fragment,staffsize=26]
2088 The command @code{\setEasyHeads} overrides settings for the
2089 @internalsref{NoteHead} object. To make the letters readable, it has
2090 to be printed in a large font size. To print with a larger font, see
2091 @ref{Setting global staff size}.
2095 @cindex @code{\setEasyHeads}
2096 @code{\setEasyHeads}
2099 @node Analysis brackets
2100 @subsection Analysis brackets
2102 @cindex phrasing brackets
2103 @cindex musicological analysis
2104 @cindex note grouping bracket
2106 Brackets are used in musical analysis to indicate structure in musical
2107 pieces. LilyPond supports a simple form of nested horizontal
2108 brackets. To use this, add the @internalsref{Horizontal_bracket_engraver}
2109 to @internalsref{Staff} context. A bracket is started with
2110 @code{\startGroup} and closed with @code{\stopGroup}
2112 @lilypond[quote,ragged-right,verbatim]
2115 c4\startGroup\startGroup
2118 c4\stopGroup\stopGroup
2122 \Staff \consists "Horizontal_bracket_engraver"
2128 Program reference: @internalsref{HorizontalBracket}.
2130 Examples: @inputfileref{input/@/regression,note@/-group@/-bracket@/.ly}.
2133 @node Coloring objects
2134 @subsection Coloring objects
2136 Individual objects may be assigned colors. You may use the
2137 color names listed in the @ref{List of colors}.
2139 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
2140 \override NoteHead #'color = #red
2142 \override NoteHead #'color = #(x11-color 'LimeGreen)
2144 \override Stem #'color = #blue
2148 The full range of colors defined for X11 can be accessed by using the
2149 scheme function x11-color. The function takes one argument that can be a
2153 \override Beam #'color = #(x11-color 'MediumTurquoise)
2159 \override Beam #'color = #(x11-color "MediumTurquoise")
2162 The first form is quicker to write and is more efficient. However, using
2163 the second form it is possible to access X11 colors by the multi-word
2167 \override Beam #'color = #(x11-color "medium turquoise")
2170 If x11-color cannot make sense of the parameter then the color returned
2171 defaults to black. It should be obvious from the final score that
2174 This example, illustrates the use of x11-color. Notice that the stem
2175 color remains black after being set to (x11-color 'Boggle), which is
2176 deliberate nonsense.
2178 @lilypond[quote,ragged-right,verbatim]
2180 \override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
2181 \set Staff.instrument = \markup {
2182 \with-color #(x11-color 'navy) "Clarinet"
2186 \override Beam #'color = #(x11-color "medium turquoise")
2188 \override NoteHead #'color = #(x11-color "LimeGreen")
2190 \override Stem #'color = #(x11-color 'Boggle)
2198 Appendix: @ref{List of colors}.
2202 Not all x11 colors are distinguishable in a web browser. For web use
2203 normal colors are recommended.
2205 An x11 color is not necessarily exactly the same shade as a similarly
2209 @node Automatic notation
2210 @section Automatic notation
2212 This section describes how to change the way that accidentals and
2213 beams are automatically displayed.
2215 FIXME: this might get moved into Changing Defaults. Please send
2216 opinions to lilypond-devel. Thanks! :)
2219 * Automatic accidentals::
2220 * Setting automatic beam behavior::
2223 @node Automatic accidentals
2224 @subsection Automatic accidentals
2225 @cindex Automatic accidentals
2227 Common rules for typesetting accidentals have been placed in a
2228 function. This function is called as follows
2230 @cindex @code{set-accidental-style}
2232 #(set-accidental-style 'STYLE #('CONTEXT#))
2235 The function can take two arguments: the name of the accidental style,
2236 and an optional argument that denotes the context that should be
2237 changed. If no context name is supplied, @code{Staff} is the default,
2238 but you may wish to apply the accidental style to a single @code{Voice}
2241 The following accidental styles are supported
2244 This is the default typesetting behavior. It corresponds
2245 to 18th century common practice: Accidentals are
2246 remembered to the end of the measure in which they occur and
2247 only on their own octave.
2250 The normal behavior is to remember the accidentals on
2251 Staff-level. This variable, however, typesets accidentals
2252 individually for each voice. Apart from that, the rule is similar to
2255 As a result, accidentals from one voice do not get canceled in other
2256 voices, which is often an unwanted result
2258 @lilypond[quote,ragged-right,relative=1,fragment,verbatim]
2260 #(set-accidental-style 'voice)
2267 The @code{voice} option should be used if the voices
2268 are to be read solely by individual musicians. If the staff is to be
2269 used by one musician (e.g., a conductor) then
2270 @code{modern} or @code{modern-cautionary}
2271 should be used instead.
2274 @cindex @code{modern} style accidentals
2275 This rule corresponds to the common practice in the 20th century. This rule
2276 prints the same accidentals as @code{default}, but temporary
2277 accidentals also are canceled in other octaves. Furthermore,
2278 in the same octave, they also get canceled in the following
2281 @lilypond[quote,ragged-right,fragment,verbatim]
2282 #(set-accidental-style 'modern)
2283 cis' c'' cis'2 | c'' c'
2286 @item @code{modern-cautionary}
2287 @cindex @code{modern-cautionary}
2288 This rule is similar to @code{modern}, but the ``extra'' accidentals
2289 (the ones not typeset by @code{default}) are typeset as cautionary
2290 accidentals. They are printed in reduced size or with parentheses
2291 @lilypond[quote,ragged-right,fragment,verbatim]
2292 #(set-accidental-style 'modern-cautionary)
2293 cis' c'' cis'2 | c'' c'
2296 @cindex @code{modern-voice}
2298 This rule is used for multivoice accidentals to be read both by musicians
2299 playing one voice and musicians playing all voices. Accidentals are
2300 typeset for each voice, but they @emph{are} canceled across voices in
2301 the same @internalsref{Staff}.
2303 @cindex @code{modern-voice-cautionary}
2304 @item modern-voice-cautionary
2305 This rule is the same as @code{modern-voice}, but with the extra
2306 accidentals (the ones not typeset by @code{voice}) typeset
2307 as cautionaries. Even though all accidentals typeset by
2308 @code{default} @emph{are} typeset by this variable,
2309 some of them are typeset as cautionaries.
2312 @cindex @code{piano} accidentals
2313 This rule reflects 20th century practice for piano notation. Very similar to
2314 @code{modern} but accidentals also get canceled
2315 across the staves in the same @internalsref{GrandStaff} or
2316 @internalsref{PianoStaff}.
2318 @item piano-cautionary
2319 @cindex @code{#(set-accidental-style 'piano-cautionary)}
2320 Same as @code{#(set-accidental-style 'piano)} but with the extra
2321 accidentals typeset as cautionaries.
2324 @cindex @code{no-reset} accidental style
2325 This is the same as @code{default} but with accidentals lasting
2326 ``forever'' and not only until the next measure
2327 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2328 #(set-accidental-style 'no-reset)
2333 This is sort of the opposite of @code{no-reset}: Accidentals
2334 are not remembered at all---and hence all accidentals are
2335 typeset relative to the key signature, regardless of what was
2338 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2339 #(set-accidental-style 'forget)
2340 \key d\major c4 c cis cis d d dis dis
2347 Program reference: @internalsref{Accidental_engraver},
2348 @internalsref{Accidental}, and @internalsref{AccidentalPlacement}.
2353 Simultaneous notes are considered to be entered in sequential
2354 mode. This means that in a chord the accidentals are typeset as if the
2355 notes in the chord happened once at a time - in the order in which
2356 they appear in the input file.
2358 This is a problem when accidentals in a chord depend on each other,
2359 which does not happen for the default accidental style. The problem
2360 can be solved by manually inserting @code{!} and @code{?} for the
2364 @node Setting automatic beam behavior
2365 @subsection Setting automatic beam behavior
2367 @cindex @code{autoBeamSettings}
2368 @cindex @code{(end * * * *)}
2369 @cindex @code{(begin * * * *)}
2370 @cindex automatic beams, tuning
2371 @cindex tuning automatic beaming
2373 @c [TODO: use \applyContext]
2375 In normal time signatures, automatic beams can start on any note but can
2376 only end in a few positions within the measure: beams can end on a beat,
2377 or at durations specified by the properties in
2378 @code{autoBeamSettings}. The properties in @code{autoBeamSettings}
2379 consist of a list of rules for where beams can begin and end. The
2380 default @code{autoBeamSettings} rules are defined in
2381 @file{scm/@/auto@/-beam@/.scm}.
2383 In order to add a rule to the list, use
2385 #(override-auto-beam-setting '(be p q n m) a b [context])
2390 @item @code{be} is either "begin" or "end".
2392 @item @code{p/q} is the duration of the note for which you want
2393 to add a rule. A beam is considered to have the duration of its
2394 shortest note. Set @code{p} and @code{q} to @code{'*'} to
2395 have this apply to any beam.
2397 @item @code{n/m} is the time signature to which
2398 this rule should apply. Set @code{n} and @code{m} to @code{'*'}
2399 to have this apply in any time signature.
2401 @item @code{a/b} is the position in the bar at which the beam should begin/end.
2403 @item @code{context} is optional, and it specifies the context at which
2404 the change should be made. The default is @code{'Voice}.
2405 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
2406 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
2410 For example, if automatic beams should always end on the first quarter
2414 #(override-auto-beam-setting '(end * * * *) 1 4)
2417 You can force the beam settings to only take effect on beams whose shortest
2418 note is a certain duration
2420 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2422 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
2424 a32 a a a a16 a a a a a |
2425 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
2426 a32 a a a a16 a a a a a |
2429 You can force the beam settings to only take effect in certain time
2432 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2434 #(override-auto-beam-setting '(end * * 5 8) 2 8)
2442 You can also remove a previously set beam-ending rule by using
2445 #(revert-auto-beam-setting '(be p q n m) a b [context])
2449 be, p, q, n, m, a, b and context are the same as above. Note that the
2450 default rules are specified in @file{scm/@/auto@/-beam@/.scm},
2451 so you can revert rules that you did not explicitly create.
2453 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2455 a16 a a a a a a a a a a a a a a a
2456 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
2457 a16 a a a a a a a a a a a a a a a
2460 The rule in a revert-auto-beam-setting statement must exactly match the
2461 original rule. That is, no wildcard expansion is taken into account.
2463 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2465 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
2467 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
2469 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
2475 @c TODO: old material -- not covered by above stuff, I think.
2476 If automatic beams should end on every quarter in 5/4 time, specify
2479 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
2480 #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
2481 #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
2482 #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
2486 The same syntax can be used to specify beam starting points. In this
2487 example, automatic beams can only end on a dotted quarter note
2489 #(override-auto-beam-setting '(end * * * *) 3 8)
2490 #(override-auto-beam-setting '(end * * * *) 1 2)
2491 #(override-auto-beam-setting '(end * * * *) 7 8)
2493 In 4/4 time signature, this means that automatic beams could end only on
2494 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
2495 3/8, has passed within the measure).
2497 @cindex automatic beam generation
2499 @cindex @code{autoBeaming}
2502 If beams are used to indicate melismata in songs, then automatic
2503 beaming should be switched off with @code{\autoBeamOff}.
2508 @cindex @code{\autoBeamOff}
2509 @code{\autoBeamOff},
2510 @cindex @code{\autoBeamOn}
2516 If a score ends while an automatic beam has not been ended and is
2517 still accepting notes, this last beam will not be typeset at all. The
2518 same holds polyphonic voices, entered with @code{<< @dots{} \\ @dots{}
2519 >>}. If a polyphonic voice ends while an automatic beam is still
2520 accepting notes, it is not typeset.