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
64 More complex formatting may also be added to a note by using the
66 @lilypond[fragment,ragged-right,verbatim,quote]
67 c'4^\markup { bla \bold bla }
70 The @code{\markup} is described in more detail in
76 @cindex @code{\fatText}
78 @cindex @code{\emptyText}
84 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
87 \override Score.PaperColumn #'keep-inside-line = ##t
93 In this manual: @ref{Text markup}.
95 Program reference: @internalsref{TextScript}.
99 @subsection Text spanners
101 @cindex Text spanners
103 Some performance indications, e.g., @i{rallentando} or @i{accelerando},
104 are written as text and are extended over many measures with dotted
105 lines. Such texts are created using text spanners; attach
106 @code{\startTextSpan} and @code{\stopTextSpan} to the first and last
107 notes of the spanner.
109 The string to be printed, as well as the style, is set through object
112 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
115 \override TextSpanner #'edge-text = #'("rall " . "")
116 c2\startTextSpan b c\stopTextSpan a
119 \override TextSpanner #'edge-text = #(cons (markup #:italic "rit" ) "")
120 c2\startTextSpan b c\stopTextSpan a
125 @cindex textSpannerUp
126 @code{textSpannerUp},
127 @cindex textSpannerDown
128 @code{textSpannerDown},
129 @cindex textSpannerNeutral
130 @code{textSpannerNeutral}.
135 Program reference: @internalsref{TextSpanner}.
137 Examples: @inputfileref{input/@/regression,text@/-spanner@/.ly}.
141 @subsection Text marks
143 @cindex coda on bar line
144 @cindex segno on bar line
145 @cindex fermata on bar line
146 @cindex bar lines, symbols on
149 The @code{\mark} command is primarily used for
150 @ref{Rehearsal marks},
151 but it can also be used to put signs like coda,
152 segno, and fermata on a bar line. Use @code{\markup} to
153 access the appropriate symbol
155 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
156 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
161 @code{\mark} is only typeset above the top stave of the score. If
162 you specify the @code{\mark} command at a bar line, the resulting
163 mark is placed above the bar line. If you specify it in the middle
164 of a bar, the resulting mark is positioned between notes. If it is
165 specified before the beginning of a score line, it is placed
166 before the first note of the line. Finally, if the mark occurs at
167 a line break, the mark will be printed at the
168 beginning of the next line.
169 @c IMO this is a bug; hopefully it'll be fixed soon, so I can
170 @c delete this sentence. -gp
171 If there is no next line, then the mark will not be printed at all.
176 To print the mark at the end of the current line, use
179 \override Score.RehearsalMark
180 #'break-visibility = #begin-of-line-invisible
183 @code{\mark} is often useful for adding text to the end of bar. In
184 such cases, changing the @code{#'self-alignment} is very useful
186 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
187 \override Score.RehearsalMark
188 #'break-visibility = #begin-of-line-invisible
190 \once \override Score.RehearsalMark #'self-alignment-X = #right
191 \mark "D.S. al Fine "
194 Text marks may be aligned with notation objects other than
197 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
202 \set Score.rehearsalMarkAlignSymbol = #'key-signature
206 \set Score.rehearsalMarkAlignSymbol = #'clef
216 Program reference: @internalsref{RehearsalMark}.
220 @subsection Text markup
227 Use @code{\markup} to typeset text. Commands are entered with the
228 backslash @code{\}. To enter @code{\} and @code{#}, use double
231 @lilypond[quote,verbatim,fragment,relative=1]
233 c1_\markup { hi there }
234 c1^\markup { hi \bold there, is \italic anyone home? }
235 c1_\markup { "\special #characters" }
239 See @ref{Overview of text markup commands} for a list of all
242 @code{\markup} is primarily used for @internalsref{TextScript}s,
243 but it can also be used anywhere text is called in lilypond
245 @lilypond[quote,verbatim]
246 \header{ title = \markup{ \bold { foo \italic { bar! } } } }
249 \override Score.RehearsalMark
250 #'break-visibility = #begin-of-line-invisible
251 \override Score.RehearsalMark #'self-alignment-X = #right
253 \set Staff.instrument = \markup{ \column{ Alto solo } }
254 c2^\markup{ don't be \flat }
255 \override TextSpanner #'edge-text = #(cons (markup #:italic "rit" ) "")
257 a2\mark \markup{ \large \bold Fine }
261 \addlyrics { bar, foo \markup{ \italic bar! } }
265 Text can also be placed on its own, away from any @code{\score}
266 block. This is primarily used in a @code{\book} (see
267 @ref{Multiple movements}).
269 @lilypond[quote,ragged-right,verbatim]
270 \markup{ Here is some text. }
273 @cindex font switching
275 The markup in the example demonstrates font switching commands. The
276 command @code{\bold} and @code{\italic} apply to the first following
277 word only; to apply a command to more than one word, enclose the
281 \markup @{ \bold @{ hi there @} @}
285 For clarity, you can also do this for single arguments, e.g.,
288 \markup @{ is \italic @{ anyone @} home @}
291 In markup mode you can compose expressions, similar to mathematical
292 expressions, XML documents, and music expressions. You can stack
293 expressions grouped vertically with the command @code{\column}.
294 Similarly, @code{\center-align} aligns texts by their center lines:
296 @lilypond[quote,verbatim,fragment,relative=1]
297 c1^\markup { \column { a bbbb \line { c d } } }
298 c1^\markup { \center-align { a bbbb c } }
299 c1^\markup { \line { a b c } }
302 Lists with no previous command are not kept distinct. The expression
305 \center-align @{ @{ a b @} @{ c d @} @}
313 \center-align @{ a b c d @}
318 To keep lists of words distinct, please use quotes @code{"} or
319 the @code{\line} command
321 @lilypond[quote,verbatim,fragment,relative=1]
323 c4^\markup{ \center-align { on three lines } }
324 c4^\markup{ \center-align { "all one line" } }
325 c4^\markup{ \center-align { { on three lines } } }
326 c4^\markup{ \center-align { \line { on one line } } }
329 Markups can be stored in variables and these variables
330 may be attached to notes, like
332 allegro = \markup @{ \bold \large @{ Allegro @} @}
333 @{ a^\allegro b c d @}
336 Some objects have alignment procedures of their own, which cancel out
337 any effects of alignments applied to their markup arguments as a
338 whole. For example, the @internalsref{RehearsalMark} is horizontally
339 centered, so using @code{\mark \markup @{ \left-align .. @}} has no
342 In addition, vertical placement is performed after creating the
343 text markup object. If you wish to move an entire piece of markup,
344 you need to use the #'padding property or create an "anchor" point
345 inside the markup (generally with @code{\hspace #0}).
347 @lilypond[quote,verbatim,fragment,relative=1]
349 c'4^\markup{ \raise #5 "not raised" }
350 \once \override TextScript #'padding = #3
351 c'4^\markup{ raised }
352 c'4^\markup{ \hspace #0 \raise #1.5 raised }
358 This manual: @ref{Overview of text markup commands}.
360 Program reference: @internalsref{TextScript}.
362 Init files: @file{scm/@/new@/-markup@/.scm}.
367 Kerning or generation of ligatures is only done when the @TeX{}
368 backend is used. In this case, LilyPond does not account for them so
369 texts will be spaced slightly too wide.
371 Syntax errors for markup mode are confusing.
375 @subsection Nested scores
377 It is possible to nest music inside markups, by adding a @code{\score}
378 block to a markup expression. Such a score must contain a @code{\layout}
381 @lilypond[quote,verbatim,ragged-right]
385 \relative { c4 d e f }
394 @node Overview of text markup commands
395 @subsection Overview of text markup commands
397 The following commands can all be used inside @code{\markup @{ @}}.
399 @include markup-commands.tely
403 @subsection Font selection
405 @cindex font selection
406 @cindex font magnification
407 @cindex @code{font-interface}
409 By setting the object properties described below, you can select a
410 font from the preconfigured font families. LilyPond has default
411 support for the feta music fonts. Text fonts are selected through
412 Pango/FontConfig. The serif font defaults to New Century Schoolbook,
413 the sans and typewriter to whatever the Pango installation defaults
418 @item @code{font-encoding}
419 is a symbol that sets layout of the glyphs. This should only be set to
420 select different types of non-text fonts, eg.
422 @code{fetaBraces} for piano staff braces, @code{fetaMusic} the
423 standard music font, including ancient glyphs, @code{fetaDynamic} for
424 dynamic signs and @code{fetaNumber} for the number font.
426 @item @code{font-family}
427 is a symbol indicating the general class of the typeface. Supported are
428 @code{roman} (Computer Modern), @code{sans}, and @code{typewriter}.
430 @item @code{font-shape}
431 is a symbol indicating the shape of the font. There are typically
432 several font shapes available for each font family. Choices are
433 @code{italic}, @code{caps}, and @code{upright}.
435 @item @code{font-series}
436 is a symbol indicating the series of the font. There are typically
437 several font series for each font family and shape. Choices are
438 @code{medium} and @code{bold}.
442 Fonts selected in the way sketched above come from a predefined style
443 sheet. If you want to use a font from outside the style sheet,
445 @code{font-name} property,
447 @lilypond[fragment,verbatim]
449 \override Staff.TimeSignature #'font-name = #"Charter"
450 \override Staff.TimeSignature #'font-size = #2
453 \override #'(font-name . "Vera Bold")
454 { This text is in Vera Bold }
460 Any font can be used, as long as it is available to Pango/FontConfig.
462 The size of the font may be set with the @code{font-size}
463 property. The resulting size is taken relative to the
464 @code{text-font-size} as defined in the @code{\paper} block.
467 @cindex font magnification
470 It is also possible to change the default font family for the entire
471 document. This is done by calling the @code{make-pango-font-tree} from
472 within the @code{\paper} block. The function takes names for the font
473 families to use for roman, sans serif and monospaced text. For
476 @cindex font families, setting
485 (make-pango-font-tree "Times New Roman"
492 c'^\markup { roman: foo \sans bla \typewriter bar }
496 @c we don't do Helvetica / Courier, since GS incorrectly loads
503 Examples: @file{ly/@/font@/-family@/-override.ly}
506 @node New dynamic marks
507 @subsection New dynamic marks
509 It is possible to print new dynamic marks or text that should be aligned
510 with dynamics. Use @code{make-dynamic-script} to create these marks.
512 @cindex make-dynamic-script
514 @lilypond[quote,verbatim,ragged-right]
515 sfzp = #(make-dynamic-script "sfzp")
521 @cindex Dynamics, editorial
522 @cindex Dynamics, parenthesis
524 It is also possible to print dynamics in round parenthesis or square
525 brackets. These are often used for adding editorial dynamics.
527 @lilypond[quote,verbatim,ragged-right]
528 rndf = \markup{ \center-align {\line { \bold{\italic (}
529 \dynamic f \bold{\italic )} }} }
530 boxf = \markup{ \bracket { \dynamic f } }
531 { c'1_\rndf c'1_\boxf }
536 @node Preparing parts
537 @section Preparing parts
539 This section describes various notation that are useful for preparing
543 * Multi measure rests::
548 * Instrument transpositions::
550 * Different editions from one source::
554 @node Multi measure rests
555 @subsection Multi measure rests
557 @cindex multi measure rests
558 @cindex full measure rests
559 @cindex Rests, multi measure
560 @cindex Rests, full measure
561 @cindex whole rests for a full measure
564 Rests for one full measure (or many bars) are entered using `@code{R}'. It
565 is specifically meant for full bar rests and for entering parts: the rest
566 can expand to fill a score with rests, or it can be printed as a single
567 multi-measure rest. This expansion is controlled by the property
568 @code{Score.skipBars}. If this is set to true, empty measures will not
569 be expanded, and the appropriate number is added automatically
571 @lilypond[quote,ragged-right,fragment,verbatim]
572 \time 4/4 r1 | R1 | R1*2
573 \set Score.skipBars = ##t R1*17 R1*4
576 The @code{1} in @code{R1} is similar to the duration notation used for
577 notes. Hence, for time signatures other than 4/4, you must enter other
578 durations. This can be done with augmentation dots or fractions
580 @lilypond[quote,ragged-right,fragment,verbatim]
581 \set Score.skipBars = ##t
590 An @code{R} spanning a single measure is printed as either a whole rest
591 or a breve, centered in the measure regardless of the time signature.
593 If there are only a few measures of rest, LilyPond prints ``church rests''
594 (a series of rectangles) in the staff. To replace that with a simple
595 rest, use @code{MultiMeasureRest.expand-limit}.
597 @lilypond[quote,ragged-right,fragment,verbatim]
598 \set Score.skipBars = ##t
600 \override MultiMeasureRest #'expand-limit = 1
604 @cindex text on multi-measure rest
605 @cindex script on multi-measure rest
606 @cindex fermata on multi-measure rest
608 Texts can be added to multi-measure rests by using the
609 @var{note}-@code{markup} syntax @ref{Text markup}.
610 A variable (@code{\fermataMarkup}) is provided for
613 @lilypond[quote,ragged-right,verbatim,fragment]
614 \set Score.skipBars = ##t
616 R2.*10^\markup { \italic "ad lib." }
620 Warning! This text is created by @code{MultiMeasureRestText}, not
623 @lilypond[quote,ragged-right,verbatim,fragment]
624 \override TextScript #'padding = #5
626 \override MultiMeasureRestText #'padding = #5
630 If you want to have text on the left end of a multi-measure rest,
631 attach the text to a zero-length skip note, i.e.,
641 Program reference: @internalsref{MultiMeasureRestMusicGroup},
642 @internalsref{MultiMeasureRest}.
644 The layout object @internalsref{MultiMeasureRestNumber} is for the
645 default number, and @internalsref{MultiMeasureRestText} for user
651 It is not possible to use fingerings (e.g., @code{R1-4}) to put numbers
652 over multi-measure rests. And the pitch of multi-measure rests (or
653 staff-centered rests) can not be influenced.
655 @cindex condensing rests
657 There is no way to automatically condense multiple rests into a single
658 multi-measure rest. Multi-measure rests do not take part in rest
661 Be careful when entering multi-measure rests followed by whole
662 notes. The following will enter two notes lasting four measures each
666 When @code{skipBars} is set, the result will look OK, but the bar
667 numbering will be off.
670 @node Metronome marks
671 @subsection Metronome marks
674 @cindex beats per minute
675 @cindex metronome marking
677 Metronome settings can be entered as follows
679 \tempo @var{duration} = @var{per-minute}
682 In the MIDI output, they are interpreted as a tempo change. In the
683 layout output, a metronome marking is printed
684 @cindex @code{\tempo}
685 @lilypond[quote,ragged-right,verbatim,fragment]
692 To change the tempo in the MIDI output without printing anything, make
693 the metronome marking invisible
695 \once \override Score.MetronomeMark #'transparent = ##t
698 To print other metronome markings, use these markup commands
699 @lilypond[quote,ragged-right,verbatim,relative,fragment]
702 \smaller \general-align #Y #DOWN \note #"16." #1
704 \smaller \general-align #Y #DOWN \note #"8" #1
709 See @ref{Text markup} for more details.
714 Program reference: @internalsref{MetronomeMark}.
719 Collisions are not checked. If you have notes above the top line of
720 the staff (or notes with articulations, slurs, text, etc), then the
721 metronome marking may be printed on top of musical symbols. If this
722 occurs, increase the padding of the metronome mark to place it
723 further away from the staff.
726 \override Score.MetronomeMark #'padding = #2.5
730 @node Rehearsal marks
731 @subsection Rehearsal marks
733 @cindex Rehearsal marks
736 To print a rehearsal mark, use the @code{\mark} command
738 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
747 The letter@tie{}`I' is skipped in accordance with engraving traditions.
748 If you wish to include the letter `I', then use
751 \set Score.markFormatter = #format-mark-alphabet
754 The mark is incremented automatically if you use @code{\mark
755 \default}, but you can also use an integer argument to set the mark
756 manually. The value to use is stored in the property
757 @code{rehearsalMark}.
759 The style is defined by the property @code{markFormatter}. It is a
760 function taking the current mark (an integer) and the current context
761 as argument. It should return a markup object. In the following
762 example, @code{markFormatter} is set to a canned procedure. After a
763 few measures, it is set to function that produces a boxed number.
765 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
766 \set Score.markFormatter = #format-mark-numbers
769 \set Score.markFormatter = #format-mark-box-numbers
775 The file @file{scm/@/translation@/-functions@/.scm} contains the definitions
776 of @code{format-mark-numbers} (the default format), @code{format-mark-box-numbers},
777 @code{format-mark-letters} and @code{format-mark-box-letters}.
778 These can be used as inspiration for other formatting functions.
780 You may use @code{format-mark-barnumbers}, @code{format-mark-box-barnumbers},
781 and @code{format-mark-circle-barnumbers} to get bar numbers instead of
782 incremented numbers or letters.
787 Program reference: @internalsref{RehearsalMark}.
789 Init files: @file{scm/@/translation@/-functions@/.scm} contains the
790 definition of @code{format-mark-numbers} and
791 @code{format-mark-letters}. They can be used as inspiration for other
792 formatting functions.
794 Examples: @inputfileref{input/@/regression,rehearsal@/-mark@/-letter@/.ly},
796 @inputfileref{input/@/regression,rehearsal@/-mark@/-number@/.ly}.
800 @subsection Bar numbers
803 @cindex measure numbers
804 @cindex @code{currentBarNumber}
806 Bar numbers are printed by default at the start of the line. The
807 number itself is stored in the @code{currentBarNumber} property, which
808 is normally updated automatically for every measure.
810 Bar numbers can be typeset at regular intervals instead of at the
811 beginning of each line. This is illustrated in the following example,
812 whose source is available as
813 @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}
815 @lilypondfile[ragged-right,quote]{bar-number-regular-interval.ly}
817 Bar numbers can be typeset manually by tweaking the
818 @code{markFormatter} property
820 @lilypond[verbatim,ragged-right,quote]
822 \set Score.markFormatter
823 = #(lambda (mark context)
826 (number->string (ly:context-property context
827 'currentBarNumber)))))
829 c1 \bar "||" \mark \default c1 c1 \mark \default c1 \bar "|."
833 Bar numbers can be manually changed by setting the
834 @code{Staff.currentBarNumber} property
836 @lilypond[verbatim,ragged-right,quote]
838 \repeat unfold 4 {c4 c c c} \break
839 \set Score.currentBarNumber = #50
840 \repeat unfold 4 {c4 c c c}
847 Program reference: @internalsref{BarNumber}.
850 @inputfileref{input/@/test,bar@/-number@/-every@/-five@/-reset@/.ly},
851 and @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}.
856 Bar numbers can collide with the @internalsref{StaffGroup} bracket, if
857 there is one at the top. To solve this, the
858 @code{padding} property of @internalsref{BarNumber} can be
859 used to position the number correctly.
862 @node Instrument names
863 @subsection Instrument names
865 In an orchestral score, instrument names are printed at the left side
868 This can be achieved by setting @internalsref{Staff}.@code{instrument}
869 and @internalsref{Staff}.@code{instr}. This will print a string before
870 the start of the staff. For the first staff, @code{instrument} is
871 used, for the following ones, @code{instr} is used.
873 @lilypond[quote,verbatim,ragged-right,relative=1,fragment]
874 \set Staff.instrument = "Ploink "
875 \set Staff.instr = "Plk "
881 You can also use markup texts to construct more complicated instrument
884 @lilypond[quote,fragment,verbatim,ragged-right]
885 \set Staff.instrument = \markup {
886 \column { "Clarinetti"
887 \line { "in B" \smaller \flat } } }
891 If you wish to center the instrument names, you must center all of them
893 @lilypond[quote,verbatim,ragged-right]
896 \set Staff.instrument = \markup {
897 \center-align { "Clarinetti"
898 \line { "in B" \smaller \flat } } }
902 \set Staff.instrument = \markup{ \center-align { Vibraphone }}
909 For longer instrument names, it may be useful to increase the
910 @code{indent} setting in the @code{\layout} block.
914 Program reference: @internalsref{InstrumentName}.
918 When you put a name on a grand staff or piano staff, the width of the
919 brace is not taken into account. The following property setting can be
920 used to move the instrument names to the left, in such situations.
923 \override Score.InstrumentName #'space-alist = #'((left-edge extra-space . 2.0))
927 @node Instrument transpositions
928 @subsection Instrument transpositions
930 @cindex transposition, MIDI
931 @cindex transposition, instrument
933 The key of a transposing instrument can also be specified. This
934 applies to many wind instruments, for example, clarinets (B-flat, A, and
935 E-flat), horn (F) and trumpet (B-flat, C, D, and E-flat).
937 The transposition is entered after the keyword @code{\transposition}
940 \transposition bes %% B-flat clarinet
944 This command sets the property @code{instrumentTransposition}. The value of
945 this property is used for MIDI output and quotations. It does not
946 affect how notes are printed in the current staff. To change the printed
947 output, see @ref{Transpose}.
949 The pitch to use for @code{\transposition} should correspond to the
950 real sound heard when a @code{c'} written on the staff is played by the
951 transposing instrument. For example, when entering a score in
952 concert pitch, typically all voices are entered in C, so
953 they should be entered as
966 The command @code{\transposition} should be used when the music is
967 entered from a (transposed) orchestral part. For example, in
968 classical horn parts, the tuning of the instrument is often changed
969 during a piece. When copying the notes from the part, use
970 @code{\transposition}, e.g.,
982 @node Ottava brackets
983 @subsection Ottava brackets
985 `Ottava' brackets introduce an extra transposition of an octave for
986 the staff. They are created by invoking the function
987 @code{set-octavation}
993 @lilypond[quote,ragged-right,verbatim,fragment]
1003 The @code{set-octavation} function also takes -1 (for 8va bassa) and 2
1004 (for 15ma) as arguments. Internally the function sets the properties
1005 @code{ottavation} (e.g., to @code{"8va"}) and
1006 @code{centralCPosition}. For overriding the text of the bracket, set
1007 @code{ottavation} after invoking @code{set-octavation}, i.e.,
1009 @lilypond[quote,ragged-right,verbatim]
1012 \set Staff.ottavation = #"8"
1020 Program reference: @internalsref{OttavaBracket}.
1022 Examples: @inputfileref{input/@/regression,ottava@/.ly},
1023 @inputfileref{input/@/regression,ottava@/-broken@/.ly}.
1028 @code{set-octavation} will get confused when clef changes happen
1029 during an octavation bracket.
1032 @node Different editions from one source
1033 @subsection Different editions from one source
1038 The @code{\tag} command marks music expressions with a name. These
1039 tagged expressions can be filtered out later. With this mechanism it
1040 is possible to make different versions of the same music source.
1042 In the following example, we see two versions of a piece of music, one
1043 for the full score, and one with cue notes for the instrumental part
1059 The same can be applied to articulations, texts, etc.: they are
1062 -\tag #@var{your-tag}
1064 to an articulation, for example,
1069 This defines a note with a conditional fingering indication.
1072 @cindex removeWithTag
1073 By applying the @code{\keepWithTag} and @code{\removeWithTag}
1074 commands, tagged expressions can be filtered. For example,
1078 \keepWithTag #'score @var{the music}
1079 \keepWithTag #'part @var{the music}
1084 @lilypondfile[ragged-right,quote]{tag-filter.ly}
1086 The argument of the @code{\tag} command should be a symbol. It's
1087 possible to put multiple tags on a piece of music, with multiple
1088 @code{\tag} entries,
1090 \tag #'original-part \tag #'transposed-part @dots{}
1096 Examples: @inputfileref{input/@/regression,tag@/-filter@/.ly}.
1101 Multiple rests are not merged if you create the score with both tagged
1106 @node Orchestral music
1107 @section Orchestral music
1109 Orchestral music involves some special notation, both in the full
1110 score and the individual parts. This section explains how to tackle
1111 some common problems in orchestral music.
1114 * Automatic part combining::
1116 * Quoting other voices::
1117 * Formatting cue notes::
1118 * Aligning to cadenzas::
1122 @node Automatic part combining
1123 @subsection Automatic part combining
1124 @cindex automatic part combining
1125 @cindex part combiner
1127 Automatic part combining is used to merge two parts of music onto a
1128 staff. It is aimed at typesetting orchestral scores. When the two
1129 parts are identical for a period of time, only one is shown. In
1130 places where the two parts differ, they are typeset as separate
1131 voices, and stem directions are set automatically. Also, solo and
1132 @emph{a due} parts are identified and can be marked.
1134 The syntax for part combining is
1137 \partcombine @var{musicexpr1} @var{musicexpr2}
1141 The following example demonstrates the basic functionality of the part
1142 combiner: putting parts on one staff, and setting stem directions and
1145 @lilypond[quote,verbatim,ragged-right,fragment]
1146 \new Staff \partcombine
1147 \relative g' { g g a( b) c c r r }
1148 \relative g' { g g r4 r e e g g }
1151 The first @code{g} appears only once, although it was
1152 specified twice (once in each part). Stem, slur, and tie directions are
1153 set automatically, depending whether there is a solo or unisono. The
1154 first part (with context called @code{one}) always gets up stems, and
1155 `Solo', while the second (called @code{two}) always gets down stems and
1158 If you just want the merging parts, and not the textual markings, you
1159 may set the property @code{printPartCombineTexts} to false
1161 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
1163 \set Staff.printPartCombineTexts = ##f
1165 \relative g' { g a( b) r }
1166 \relative g' { g r4 r f }
1170 To change the text that is printed for solos or merging, you may
1171 set the @code{soloText}, @code{soloIIText}, and @code{aDueText}
1174 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
1176 \set Score.soloText = #"ichi"
1177 \set Score.soloIIText = #"ni"
1178 \set Score.aDueText = #"tachi"
1180 \relative g' { g4 g a( b) r }
1181 \relative g' { g4 g r r f }
1185 Both arguments to @code{\partcombine} will be interpreted as
1186 @internalsref{Voice} contexts. If using relative octaves,
1187 @code{\relative} should be specified for both music expressions, i.e.,
1191 \relative @dots{} @var{musicexpr1}
1192 \relative @dots{} @var{musicexpr2}
1196 A @code{\relative} section that is outside of @code{\partcombine} has
1197 no effect on the pitches of @var{musicexpr1} and @var{musicexpr2}.
1201 Program reference: @internalsref{PartCombineMusic}.
1205 When @code{printPartCombineTexts} is set, when the two voices play the
1206 same notes on and off, the part combiner may typeset @code{a2} more
1207 than once in a measure.
1209 @code{\partcombine} cannot be inside @code{\times}.
1211 @code{\partcombine} cannot be inside @code{\relative}.
1213 Internally, the @code{\partcombine} interprets both arguments as
1214 @code{Voice}s named @code{one} and @code{two}, and then decides when
1215 the parts can be combined. Consequently, if the arguments switch to
1216 differently named @internalsref{Voice} contexts, the events in those
1221 @subsection Hiding staves
1223 @cindex Frenched scores
1224 @cindex Hiding staves
1226 In orchestral scores, staff lines that only have rests are usually
1227 removed; this saves some space. This style is called `French Score'.
1228 For @internalsref{Lyrics},
1229 @internalsref{ChordNames} and @internalsref{FiguredBass}, this is
1230 switched on by default. When the lines of these contexts turn out
1231 empty after the line-breaking process, they are removed.
1233 For normal staves, a specialized @internalsref{Staff} context is
1234 available, which does the same: staves containing nothing (or only
1235 multi-measure rests) are removed. The context definition is stored in
1236 @code{\RemoveEmptyStaffContext} variable. Observe how the second staff
1237 in this example disappears in the second line
1239 @lilypond[quote,ragged-right,verbatim]
1241 \context { \RemoveEmptyStaffContext }
1246 \new Staff { e4 f g a \break c1 }
1247 \new Staff { c4 d e f \break R1 }
1252 The first system shows all staves in full. If empty staves should be
1253 removed from the first system too, set @code{remove-first} to true in
1254 @internalsref{VerticalAxisGroup}.
1257 \override Score.VerticalAxisGroup #'remove-first = ##t
1260 To remove other types of contexts, use @code{\AncientRemoveEmptyStaffContext}
1261 or @code{\RemoveEmptyRhythmicStaffContext}.
1263 Another application is making ossia sections, i.e., alternative
1264 melodies on a separate piece of staff, with help of a Frenched
1265 staff. See @inputfileref{input/@/test,ossia@/.ly} for an example.
1268 @node Quoting other voices
1269 @subsection Quoting other voices
1271 With quotations, fragments of other parts can be inserted into a part
1272 directly. Before a part can be quoted, it must be marked especially as
1273 quotable. This is done with the @code{\addquote} command.
1276 \addquote @var{name} @var{music}
1281 Here, @var{name} is an identifying string. The @var{music} is any kind
1282 of music. Here is an example of @code{\addquote}
1285 \addquote clarinet \relative c' @{
1290 This command must be entered at toplevel, i.e., outside any music
1293 After calling @code{\addquote}, the quotation may then be done with
1294 @code{\quoteDuring} or @code{\cueDuring},
1297 \quoteDuring #@var{name} @var{music}
1300 During a part, a piece of music can be quoted with the @code{\quoteDuring}
1304 \quoteDuring #"clarinet" @{ s2. @}
1307 This would cite three quarter notes (the duration of @code{s2.}) of
1308 the previously added @code{clarinet} voice.
1311 More precisely, it takes the current time-step of the part being
1312 printed, and extracts the notes at the corresponding point of the
1313 @code{\addquote}d voice. Therefore, the argument to @code{\addquote}
1314 should be the entire part of the voice to be quoted, including any
1315 rests at the beginning.
1317 Quotations take into account the transposition of both source and target
1318 instruments, if they are specified using the @code{\transposition} command.
1320 @lilypond[quote,ragged-right,verbatim]
1321 \addquote clarinet \relative c' {
1327 e'8 f'8 \quoteDuring #"clarinet" { s2 }
1331 The type of events that are present in cue notes can be trimmed with
1332 the @code{quotedEventTypes} property. The default value is
1333 @code{(note-event rest-event)}, which means that only notes and
1334 rests of the cued voice end up in the @code{\quoteDuring}.
1338 \set Staff.quotedEventTypes =
1339 #'(note-event articulation-event dynamic-event)
1343 will quote notes (but no rests), together with scripts and dynamics.
1347 Only the contents of the first @internalsref{Voice} occurring in an
1348 @code{\addquote} command will be considered for quotation, so
1349 @var{music} can not contain @code{\new} and @code{\context Voice}
1350 statements that would switch to a different Voice.
1352 Quoting grace notes is broken and can even cause LilyPond to crash.
1356 In this manual: @ref{Instrument transpositions}.
1358 Examples: @inputfileref{input/@/regression,quote@/.ly}
1359 @inputfileref{input/@/regression,quote@/-transposition@/.ly}
1361 Program reference: @internalsref{QuoteMusic}.
1364 @node Formatting cue notes
1365 @subsection Formatting cue notes
1367 The previous section deals with inserting notes from another voice.
1368 There is a more advanced music function called @code{\cueDuring},
1369 which makes formatting cue notes easier.
1374 \cueDuring #@var{name} #@var{updown} @var{music}
1377 This will insert notes from the part @var{name} into a
1378 @internalsref{Voice} called @code{cue}. This happens simultaneously
1379 with @var{music}, which usually is a rest. When the cue notes start,
1380 the staff in effect becomes polyphonic for a moment. The argument
1381 @var{updown} determines whether the cue notes should be notated as a
1382 first or second voice.
1385 @lilypond[verbatim,ragged-right]
1388 \override Stem #'length-fraction = #0.8
1389 \override Beam #'thickness = #0.384
1390 \override Beam #'length-fraction = #0.8
1393 \addquote clarinet \relative {
1398 \new Staff \relative <<
1400 % setup a context for cue notes.
1401 \new Voice = "cue" { \smaller \skip 1*21 }
1403 \set Score.skipBars = ##t
1407 \cueDuring #"clarinet" #1 {
1416 Here are a couple of hints for successful cue notes
1420 Cue notes have smaller font sizes.
1422 the cued part is marked with the instrument playing the cue.
1424 when the original part takes over again, this should be marked with
1425 the name of the original instrument.
1427 @c really? Are you sure about that last point? I'll check after 3.0 -gp
1429 @c Yes, this is good practice. Otherwise, the start of the original
1430 @c part can only be seen from the font size. This is not good enough
1431 @c for sight-reading. It is possilbe to use other
1432 @c markers (eg. a big close-bracket over the staff) to indicate the cue notes are
1437 Any other changes introduced by the cued part should also be
1438 undone. For example, if the cued instrument plays in a different clef,
1439 the original clef should be stated once again.
1444 @node Aligning to cadenzas
1445 @subsection Aligning to cadenzas
1447 In an orchestral context, cadenzas present a special problem:
1448 when constructing a score that includes a cadenza, all other
1449 instruments should skip just as many notes as the length of the
1450 cadenza, otherwise they will start too soon or too late.
1452 A solution to this problem are the functions @code{mmrest-of-length}
1453 and @code{skip-of-length}. These Scheme functions take a piece of music
1454 as argument, and generate a @code{\skip} or multi-rest, exactly as
1455 long as the piece. The use of @code{mmrest-of-length} is demonstrated
1456 in the following example.
1458 @lilypond[verbatim,ragged-right,quote]
1459 cadenza = \relative c' {
1460 c4 d8 << { e f g } \\ { d4. } >>
1465 \new Staff { \cadenza c'4 }
1467 #(ly:export (mmrest-of-length cadenza))
1476 @node Contemporary notation
1477 @section Contemporary notation
1479 In the 20th century, composers have greatly expanded the musical
1480 vocabulary. With this expansion, many innovations in musical notation
1481 have been tried. The book ``Music Notation in the 20th century'' by
1482 Kurt Stone gives a comprehensive overview (see @ref{Literature
1485 This section describes notation that does
1486 not fit into traditional notation categories, such as pitches,
1487 tuplet beams, and articulation. For contemporary notation
1488 that fits into traditional notation categories, such as
1489 microtones, nested tuplet beams, and unusual fermatas, please
1490 see those sections of the documentation.
1493 @c I don't think we should discourage modern composers who might
1494 @c want to sponsor new features. :)
1495 @c In general, the use of new, innovative notation makes a piece
1496 @c harder to understand and perform and its use should therefore be
1497 @c avoided. For this reason, support for contemporary notation in
1498 @c LilyPond is limited.
1502 * Polymetric notation::
1503 * Time administration::
1504 * Proportional notation::
1506 * Special noteheads::
1512 @node Polymetric notation
1513 @subsection Polymetric notation
1515 Double time signatures are not supported explicitly, but they can be
1516 faked. In the next example, the markup for the time signature is
1517 created with a markup text. This markup text is inserted in the
1518 @internalsref{TimeSignature} grob.
1520 @lilypond[verbatim,ragged-right]
1525 \musicglyph #"scripts.stopped"
1526 \bracket \column { "5" "8" }
1531 \override Staff.TimeSignature #'stencil = #ly:text-interface::print
1532 \override Staff.TimeSignature #'text = #tsMarkup
1534 c'2 \bar ":" c'4 c'4.
1538 Each staff can also have its own time signature. This is done by
1539 moving the @internalsref{Timing_translator} to the @internalsref{Staff}
1545 \remove "Timing_translator"
1546 \remove "Default_bar_line_engraver"
1550 \consists "Timing_translator"
1551 \consists "Default_bar_line_engraver"
1558 Now, each staff has its own time signature.
1571 c4. c8 c c c4. c8 c c
1576 @lilypond[quote,ragged-right]
1580 \remove "Timing_translator"
1581 \remove "Default_bar_line_engraver"
1584 \consists "Timing_translator"
1585 \consists "Default_bar_line_engraver"
1600 c4. c8 c c c4. c8 c c
1606 A different form of polymetric notation is where note lengths have
1607 different values across staves.
1609 This notation can be created by setting a common time signature for
1610 each staff but replacing it manually using
1611 @code{timeSignatureFraction} to the desired fraction. Then the printed
1612 durations in each staff are scaled to the common time signature.
1613 The latter is done with @code{\compressMusic}, which is used similar
1614 to @code{\times}, but does not create a tuplet bracket. The syntax is
1616 \compressMusic #'(@var{numerator} . @var{denominator}) @var{musicexpr}
1621 In this example, music with the time signatures of 3/4, 9/8, and 10/8 are
1622 used in parallel. In the second staff, shown durations are multiplied by
1623 2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are
1624 multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
1626 @lilypond[quote,ragged-right,verbatim,fragment]
1634 \set Staff.timeSignatureFraction = #'(9 . 8)
1635 \compressMusic #'(2 . 3)
1636 \repeat unfold 6 { c8[ c c] }
1640 \set Staff.timeSignatureFraction = #'(10 . 8)
1641 \compressMusic #'(3 . 5) {
1642 \repeat unfold 2 { c8[ c c] }
1643 \repeat unfold 2 { c8[ c] }
1644 | c4. c4. \times 2/3 { c8 c c } c4
1655 When using different time signatures in parallel, the spacing is
1656 aligned vertically, but bar lines distort the regular spacing.
1659 @node Time administration
1660 @subsection Time administration
1662 @cindex Time administration
1664 Time is administered by the @internalsref{Time_signature_engraver},
1665 which usually lives in the @internalsref{Score} context. The
1666 bookkeeping deals with the following variables
1669 @item currentBarNumber
1673 The length of the measures in the current time signature. For a 4/4
1674 time this is@tie{}1, and for 6/8 it is 3/4.
1676 @item measurePosition
1677 The point within the measure where we currently are. This quantity
1678 is reset to@tie{}0 whenever it exceeds @code{measureLength}. When that
1679 happens, @code{currentBarNumber} is incremented.
1682 If set to true, the above variables are updated for every time
1683 step. When set to false, the engraver stays in the current measure
1687 Timing can be changed by setting any of these variables explicitly.
1688 In the next example, the 4/4 time signature is printed, but
1689 @code{measureLength} is set to 5/4. After a while, the measure is
1690 shortened by 1/8, by setting @code{measurePosition} to 7/8 at 2/4
1691 in the measure, so the next bar line will fall at 2/4 + 3/8. The
1692 3/8 arises because 5/4 normally has 10/8, but we have manually
1693 set the measure position to be 7/8 and 10/8 - 7/8 = 3/8.
1695 @lilypond[quote,ragged-right,verbatim,relative,fragment]
1696 \set Score.measureLength = #(ly:make-moment 5 4)
1700 \set Score.measurePosition = #(ly:make-moment 7 8)
1706 As the example illustrates, @code{ly:make-moment n m} constructs a
1707 duration of n/m, for example @code{ly:make-moment 1 8} is an eighth
1708 note duration and @code{ly:make-moment 7 16} is the duration of
1709 seven sixteenths notes.
1712 @node Proportional notation
1713 @subsection Proportional notation
1714 @cindex Proportional notation
1716 Notes can be spaced proportional to their time-difference by
1717 assigning a duration to @code{proportionalNotationDuration}
1719 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
1721 \set Score.proportionalNotationDuration = #(ly:make-moment 1 16)
1722 \new Staff { c8[ c c c c c] c4 c2 r2 }
1723 \new Staff { c2 \times 2/3 { c8 c c } c4 c1 }
1729 @subsection Clusters
1733 A cluster indicates a continuous range of pitches to be played. They
1734 can be denoted as the envelope of a set of notes. They are entered by
1735 applying the function @code{makeClusters} to a sequence of
1737 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1738 \makeClusters { <c e > <b f'> }
1741 The following example (from
1742 @inputfileref{input/@/regression,cluster@/.ly}) shows what the result
1745 @lilypondfile[ragged-right,quote]{cluster.ly}
1747 Ordinary notes and clusters can be put together in the same staff,
1748 even simultaneously. In such a case no attempt is made to
1749 automatically avoid collisions between ordinary notes and clusters.
1753 Program reference: @internalsref{ClusterSpanner},
1754 @internalsref{ClusterSpannerBeacon},
1755 @internalsref{Cluster_spanner_engraver}.
1757 Examples: @inputfileref{input/@/regression,cluster@/.ly}.
1761 Music expressions like @code{<< @{ g8 e8 @} a4 >>} are not printed
1762 accurately. Use @code{<g a>8 <e a>8} instead.
1767 This is covered in articulation; does it really need its
1768 own doc section? -gp
1769 @n ode Special fermatas
1770 @s ubsection Special fermatas
1772 @c index fermatas, special
1774 In contemporary music notation, special fermata symbols denote breaks
1775 of differing lengths. The following fermatas are supported
1777 @li lypond[quote,ragged-right]
1800 \new Lyrics \lyricmode {
1801 \override LyricText #'font-family = #'typewriter
1802 "shortfermata" "fermata" "longfermata" "verylongfermata"
1807 See @ref{Articulations} for general instructions how to apply scripts
1808 such as fermatas to notes.
1813 @node Special noteheads
1814 @subsection Special noteheads
1816 Different noteheads are used by various instruments for various
1817 meanings -- crosses are used for ``parlato'' with vocalists, stopped
1818 notes on guitar; diamonds are used for harmonics on string instruments,
1819 etc. There is a shorthand (@code{\harmonic}) for diamond shapes; the
1820 other notehead styles are produced by tweaking the property
1822 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1824 \override NoteHead #'style = #'cross
1826 \revert NoteHead #'style
1827 e d <c f\harmonic> <d a'\harmonic>
1831 To see all notehead styles, please see
1832 @inputfileref{input/@/regression,note@/-head@/-style@/.ly}.
1837 Program reference: @internalsref{NoteHead}.
1840 @node Feathered beams
1841 @subsection Feathered beams
1843 Feathered beams are not supported natively, but they can be faked by
1844 forcing two beams to overlap. Here is an example,
1846 @c don't change relative setting witout changing positions!
1847 @lilypond[ragged-right,relative=1,fragment,verbatim,quote]
1852 \once \override Voice.Beam #'positions = #'(0 . 0.5)
1857 \once \override Voice.Beam #'positions = #'(0 . -0.5)
1865 @subsection Improvisation
1867 Improvisation is sometimes denoted with slashed note heads. Such note
1868 heads can be created by adding a @internalsref{Pitch_squash_engraver}
1869 to the @internalsref{Staff} or @internalsref{Voice} context. Then, the
1873 \set squashedPosition = #0
1874 \override NoteHead #'style = #'slash
1878 switches on the slashes.
1880 There are shortcuts @code{\improvisationOn} (and an accompanying
1881 @code{\improvisationOff}) for this command sequence. They are used in
1882 the following example
1884 @lilypond[verbatim,ragged-right,quote]
1886 \consists Pitch_squash_engraver
1888 e8 e g a a16(bes)(a8) g \improvisationOn
1891 ~fis2 \improvisationOff a16(bes) a8 g e
1896 @node Educational use
1897 @section Educational use
1899 With the amount of control that LilyPond offers, one can make great
1900 teaching tools in addition to great musical scores.
1904 * Blank music sheet::
1906 * Shape note heads ::
1907 * Easy Notation note heads::
1908 * Analysis brackets::
1909 * Coloring objects::
1913 @subsection Balloon help
1915 Elements of notation can be marked and named with the help of a square
1916 balloon. The primary purpose of this feature is to explain notation.
1918 The following example demonstrates its use.
1920 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
1923 #(add-balloon-text 'NoteHead "heads, or tails?"
1930 The function @code{add-balloon-text} takes the name of a grob, the
1931 label to print, and the position where to put the label relative to
1932 the object. In the above example, the text ``heads or tails?'' ends
1933 3 spaces below and 1 space to the right of the marked head.
1936 @cindex notation, explaining
1940 Program reference: @internalsref{text-balloon-interface}.
1942 Examples: @inputfileref{input/@/regression,balloon@/.ly}.
1947 @node Blank music sheet
1948 @subsection Blank music sheet
1950 A blank music sheet can be produced also by using invisible notes, and
1951 removing @code{Bar_number_engraver}.
1954 @lilypond[quote,verbatim]
1956 \repeat unfold 2 % Change this for more lines.
1961 \override TimeSignature #'transparent = ##t
1962 defaultBarType = #""
1963 \remove Bar_number_engraver
1965 \new Staff \emptymusic
1966 \new TabStaff \emptymusic
1972 @subsection Hidden notes
1974 @cindex Hidden notes
1975 @cindex Invisible notes
1976 @cindex Transparent notes
1978 @cindex @code{\hideNotes}
1979 @cindex @code{\unHideNotes}
1980 Hidden (or invisible or transparent) notes can be useful in preparing theory
1981 or composition exercises.
1983 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
1991 Hidden notes are also great for performing weird tricks. For example,
1992 slurs cannot be attached to rests or spacer rests, but you may wish
1993 to include that in your score -- string instruments use this notation
1994 when doing pizzicato to indicate that the note should ring for as long
1997 @lilypond[quote,ragged-right,verbatim,relative=0,fragment]
2000 c4^"pizz"( \hideNotes c)
2001 \unHideNotes c( \hideNotes c)
2008 @node Shape note heads
2009 @subsection Shape note heads
2011 In shape note head notation, the shape of the note head corresponds
2012 to the harmonic function of a note in the scale. This notation was
2013 popular in the 19th century American song books.
2015 Shape note heads can be produced by setting @code{\aikenHeads} or
2016 @code{\sacredHarpHeads}, depending on the style desired.
2018 @lilypond[verbatim,relative=1,fragment]
2025 Shapes are determined on the step in the scale, where the base of the
2026 scale is determined by the @code{\key} command
2029 @findex shapeNoteStyles
2031 @findex \sacredHarpHeads
2033 Shape note heads are implemented through the @code{shapeNoteStyles}
2034 property. Its value is a vector of symbols. The k-th element indicates
2035 the style to use for the k-th step of the scale. Arbitrary
2036 combinations are possible, eg.,
2039 @lilypond[verbatim,relative=1,fragment]
2040 \set shapeNoteStyles = ##(cross triangle fa #f mensural xcircle diamond)
2045 @node Easy Notation note heads
2046 @subsection Easy Notation note heads
2048 @cindex easy notation
2051 The `easy play' note head includes a note name inside the head. It is
2052 used in music for beginners
2054 @lilypond[quote,ragged-right,verbatim,fragment,staffsize=26]
2059 The command @code{\setEasyHeads} overrides settings for the
2060 @internalsref{NoteHead} object. To make the letters readable, it has
2061 to be printed in a large font size. To print with a larger font, see
2062 @ref{Setting global staff size}.
2066 @cindex @code{\setEasyHeads}
2067 @code{\setEasyHeads}
2070 @node Analysis brackets
2071 @subsection Analysis brackets
2073 @cindex phrasing brackets
2074 @cindex musicological analysis
2075 @cindex note grouping bracket
2077 Brackets are used in musical analysis to indicate structure in musical
2078 pieces. LilyPond supports a simple form of nested horizontal
2079 brackets. To use this, add the @internalsref{Horizontal_bracket_engraver}
2080 to @internalsref{Staff} context. A bracket is started with
2081 @code{\startGroup} and closed with @code{\stopGroup}
2083 @lilypond[quote,ragged-right,verbatim]
2086 c4\startGroup\startGroup
2089 c4\stopGroup\stopGroup
2093 \Staff \consists "Horizontal_bracket_engraver"
2099 Program reference: @internalsref{HorizontalBracket}.
2101 Examples: @inputfileref{input/@/regression,note@/-group@/-bracket@/.ly}.
2104 @node Coloring objects
2105 @subsection Coloring objects
2107 Individual objects may be assigned colors. You may use the
2108 color names listed in the @ref{List of colors}.
2110 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
2111 \override NoteHead #'color = #red
2113 \override NoteHead #'color = #(x11-color 'LimeGreen)
2115 \override Stem #'color = #blue
2119 The full range of colors defined for X11 can be accessed by using the
2120 scheme function x11-color. The function takes one argument that can be a
2124 \override Beam #'color = #(x11-color 'MediumTurquoise)
2130 \override Beam #'color = #(x11-color "MediumTurquoise")
2133 The first form is quicker to write and is more efficient. However, using
2134 the second form it is possible to access X11 colors by the multi-word
2138 \override Beam #'color = #(x11-color "medium turquoise")
2141 If x11-color cannot make sense of the parameter then the color returned
2142 defaults to black. It should be obvious from the final score that
2145 This example, illustrates the use of x11-color. Notice that the stem
2146 color remains black after being set to (x11-color 'Boggle), which is
2147 deliberate nonsense.
2149 @lilypond[quote,ragged-right,verbatim]
2151 \override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
2152 \set Staff.instrument = \markup {
2153 \with-color #(x11-color 'navy) "Clarinet"
2157 \override Beam #'color = #(x11-color "medium turquoise")
2159 \override NoteHead #'color = #(x11-color "LimeGreen")
2161 \override Stem #'color = #(x11-color 'Boggle)
2169 Appendix: @ref{List of colors}.
2173 Not all x11 colors are distinguishable in a web browser. For web use
2174 normal colors are recommended.
2176 An x11 color is not necessarily exactly the same shade as a similarly
2180 @node Automatic notation
2181 @section Automatic notation
2183 This section describes how to change the way that accidentals and
2184 beams are automatically displayed.
2186 FIXME: this might get moved into Changing Defaults. Please send
2187 opinions to lilypond-devel. Thanks! :)
2190 * Automatic accidentals::
2191 * Setting automatic beam behavior::
2194 @node Automatic accidentals
2195 @subsection Automatic accidentals
2196 @cindex Automatic accidentals
2198 Common rules for typesetting accidentals have been placed in a
2199 function. This function is called as follows
2201 @cindex @code{set-accidental-style}
2203 #(set-accidental-style 'STYLE #('CONTEXT#))
2206 The function can take two arguments: the name of the accidental style,
2207 and an optional argument that denotes the context that should be
2208 changed. If no context name is supplied, @code{Staff} is the default,
2209 but you may wish to apply the accidental style to a single @code{Voice}
2212 The following accidental styles are supported
2215 This is the default typesetting behavior. It corresponds
2216 to 18th century common practice: Accidentals are
2217 remembered to the end of the measure in which they occur and
2218 only on their own octave.
2221 The normal behavior is to remember the accidentals on
2222 Staff-level. This variable, however, typesets accidentals
2223 individually for each voice. Apart from that, the rule is similar to
2226 As a result, accidentals from one voice do not get canceled in other
2227 voices, which is often an unwanted result
2229 @lilypond[quote,ragged-right,relative=1,fragment,verbatim]
2231 #(set-accidental-style 'voice)
2238 The @code{voice} option should be used if the voices
2239 are to be read solely by individual musicians. If the staff is to be
2240 used by one musician (e.g., a conductor) then
2241 @code{modern} or @code{modern-cautionary}
2242 should be used instead.
2245 @cindex @code{modern} style accidentals
2246 This rule corresponds to the common practice in the 20th century. This rule
2247 prints the same accidentals as @code{default}, but temporary
2248 accidentals also are canceled in other octaves. Furthermore,
2249 in the same octave, they also get canceled in the following
2252 @lilypond[quote,ragged-right,fragment,verbatim]
2253 #(set-accidental-style 'modern)
2254 cis' c'' cis'2 | c'' c'
2257 @item @code{modern-cautionary}
2258 @cindex @code{modern-cautionary}
2259 This rule is similar to @code{modern}, but the ``extra'' accidentals
2260 (the ones not typeset by @code{default}) are typeset as cautionary
2261 accidentals. They are printed in reduced size or with parentheses
2262 @lilypond[quote,ragged-right,fragment,verbatim]
2263 #(set-accidental-style 'modern-cautionary)
2264 cis' c'' cis'2 | c'' c'
2267 @cindex @code{modern-voice}
2269 This rule is used for multivoice accidentals to be read both by musicians
2270 playing one voice and musicians playing all voices. Accidentals are
2271 typeset for each voice, but they @emph{are} canceled across voices in
2272 the same @internalsref{Staff}.
2274 @cindex @code{modern-voice-cautionary}
2275 @item modern-voice-cautionary
2276 This rule is the same as @code{modern-voice}, but with the extra
2277 accidentals (the ones not typeset by @code{voice}) typeset
2278 as cautionaries. Even though all accidentals typeset by
2279 @code{default} @emph{are} typeset by this variable,
2280 some of them are typeset as cautionaries.
2283 @cindex @code{piano} accidentals
2284 This rule reflects 20th century practice for piano notation. Very similar to
2285 @code{modern} but accidentals also get canceled
2286 across the staves in the same @internalsref{GrandStaff} or
2287 @internalsref{PianoStaff}.
2289 @item piano-cautionary
2290 @cindex @code{#(set-accidental-style 'piano-cautionary)}
2291 Same as @code{#(set-accidental-style 'piano)} but with the extra
2292 accidentals typeset as cautionaries.
2295 @cindex @code{no-reset} accidental style
2296 This is the same as @code{default} but with accidentals lasting
2297 ``forever'' and not only until the next measure
2298 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2299 #(set-accidental-style 'no-reset)
2304 This is sort of the opposite of @code{no-reset}: Accidentals
2305 are not remembered at all---and hence all accidentals are
2306 typeset relative to the key signature, regardless of what was
2309 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2310 #(set-accidental-style 'forget)
2311 \key d\major c4 c cis cis d d dis dis
2318 Program reference: @internalsref{Accidental_engraver},
2319 @internalsref{Accidental}, and @internalsref{AccidentalPlacement}.
2324 Simultaneous notes are considered to be entered in sequential
2325 mode. This means that in a chord the accidentals are typeset as if the
2326 notes in the chord happened once at a time - in the order in which
2327 they appear in the input file.
2329 This is a problem when accidentals in a chord depend on each other,
2330 which does not happen for the default accidental style. The problem
2331 can be solved by manually inserting @code{!} and @code{?} for the
2335 @node Setting automatic beam behavior
2336 @subsection Setting automatic beam behavior
2338 @cindex @code{autoBeamSettings}
2339 @cindex @code{(end * * * *)}
2340 @cindex @code{(begin * * * *)}
2341 @cindex automatic beams, tuning
2342 @cindex tuning automatic beaming
2344 @c [TODO: use \applyContext]
2346 In normal time signatures, automatic beams can start on any note but can
2347 only end in a few positions within the measure: beams can end on a beat,
2348 or at durations specified by the properties in
2349 @code{autoBeamSettings}. The properties in @code{autoBeamSettings}
2350 consist of a list of rules for where beams can begin and end. The
2351 default @code{autoBeamSettings} rules are defined in
2352 @file{scm/@/auto@/-beam@/.scm}.
2354 In order to add a rule to the list, use
2356 #(override-auto-beam-setting '(be p q n m) a b [context])
2361 @item @code{be} is either "begin" or "end".
2363 @item @code{p/q} is the duration of the note for which you want
2364 to add a rule. A beam is considered to have the duration of its
2365 shortest note. Set @code{p} and @code{q} to @code{'*'} to
2366 have this apply to any beam.
2368 @item @code{n/m} is the time signature to which
2369 this rule should apply. Set @code{n} and @code{m} to @code{'*'}
2370 to have this apply in any time signature.
2372 @item @code{a/b} is the position in the bar at which the beam should begin/end.
2374 @item @code{context} is optional, and it specifies the context at which
2375 the change should be made. The default is @code{'Voice}.
2376 @code{#(score-override-auto-beam-setting '(A B C D) E F)} is equivalent to
2377 @code{#(override-auto-beam-setting '(A B C D) E F 'Score)}.
2381 For example, if automatic beams should always end on the first quarter
2385 #(override-auto-beam-setting '(end * * * *) 1 4)
2388 You can force the beam settings to only take effect on beams whose shortest
2389 note is a certain duration
2391 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2393 #(override-auto-beam-setting '(end 1 16 * *) 1 16)
2395 a32 a a a a16 a a a a a |
2396 #(override-auto-beam-setting '(end 1 32 * *) 1 16)
2397 a32 a a a a16 a a a a a |
2400 You can force the beam settings to only take effect in certain time
2403 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2405 #(override-auto-beam-setting '(end * * 5 8) 2 8)
2413 You can also remove a previously set beam-ending rule by using
2416 #(revert-auto-beam-setting '(be p q n m) a b [context])
2420 be, p, q, n, m, a, b and context are the same as above. Note that the
2421 default rules are specified in @file{scm/@/auto@/-beam@/.scm},
2422 so you can revert rules that you did not explicitly create.
2424 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2426 a16 a a a a a a a a a a a a a a a
2427 #(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
2428 a16 a a a a a a a a a a a a a a a
2431 The rule in a revert-auto-beam-setting statement must exactly match the
2432 original rule. That is, no wildcard expansion is taken into account.
2434 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
2436 #(override-auto-beam-setting '(end 1 16 1 4) 1 8)
2438 #(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
2440 #(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
2446 @c TODO: old material -- not covered by above stuff, I think.
2447 If automatic beams should end on every quarter in 5/4 time, specify
2450 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
2451 #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
2452 #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
2453 #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
2457 The same syntax can be used to specify beam starting points. In this
2458 example, automatic beams can only end on a dotted quarter note
2460 #(override-auto-beam-setting '(end * * * *) 3 8)
2461 #(override-auto-beam-setting '(end * * * *) 1 2)
2462 #(override-auto-beam-setting '(end * * * *) 7 8)
2464 In 4/4 time signature, this means that automatic beams could end only on
2465 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
2466 3/8, has passed within the measure).
2468 @cindex automatic beam generation
2470 @cindex @code{autoBeaming}
2473 If beams are used to indicate melismata in songs, then automatic
2474 beaming should be switched off with @code{\autoBeamOff}.
2479 @cindex @code{\autoBeamOff}
2480 @code{\autoBeamOff},
2481 @cindex @code{\autoBeamOn}
2487 If a score ends while an automatic beam has not been ended and is
2488 still accepting notes, this last beam will not be typeset at all. The
2489 same holds polyphonic voices, entered with @code{<< @dots{} \\ @dots{}
2490 >>}. If a polyphonic voice ends while an automatic beam is still
2491 accepting notes, it is not typeset.