1 @c -*- coding: latin-1; 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.
16 * Even more than notes::
19 * Contemporary notation::
21 * Automatic notation::
28 This section explains how to include text (with various formatting) in
37 * Overview of text markup commands::
39 * Other text markup issues::
44 @subsection Text scripts
47 @cindex text items, non-empty
48 @cindex non-empty texts
50 It is possible to place arbitrary strings of text or markup text (see
51 @ref{Text markup}) above or below notes by using a string
52 @code{c^"text"}. By default, these indications do not influence the
53 note spacing, but by using the command @code{\fatText}, the widths
54 will be taken into account
56 @lilypond[quote,fragment,raggedright,verbatim,relative=1]
57 c4^"longtext" \fatText c4_"longlongtext" c4
60 More complex formatting may also be added to a note by using the
62 @lilypond[fragment,raggedright,verbatim,quote]
63 c'4^\markup { bla \bold bla }
66 The @code{\markup} is described in more detail in
72 @cindex @code{\fatText}
74 @cindex @code{\emptyText}
79 In this manual: @ref{Text markup}.
81 Program reference: @internalsref{TextScriptEvent}, @internalsref{TextScript}.
85 @subsection Text spanners
88 Some performance indications, e.g., @i{rallentando} or @i{accelerando},
89 are written as text and are extended over many measures with dotted
90 lines. Such texts are created using text spanners; attach
91 @code{\startTextSpan} and @code{\stopTextSpan} to the first and last
94 The string to be printed, as well as the style, is set through object
97 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
100 \override TextSpanner #'edge-text = #'("rall " . "")
101 c2\startTextSpan b c\stopTextSpan a
106 @cindex textSpannerUp
107 @code{textSpannerUp},
108 @cindex textSpannerDown
109 @code{textSpannerDown},
110 @cindex textSpannerNeutral
111 @code{textSpannerNeutral}.
115 Internals @internalsref{TextSpanEvent},
116 @internalsref{TextSpanner}.
118 Examples: @inputfileref{input/@/regression,text@/-spanner@/.ly}.
122 @subsection Text markup
128 The internal mechanism to typeset texts is accessed with the keyword
129 @code{\markup}. Within markup mode, you can enter texts similar to
130 lyrics. They are simply entered, while commands use the backslash @code{\}.
133 @lilypond[quote,verbatim,fragment,relative=1]
135 c1_\markup { hi there }
136 c1^\markup { hi \bold there, is \italic anyone home? }
139 @cindex font switching
141 The markup in the example demonstrates font switching commands. The
142 command @code{\bold} and @code{\italic} apply to the first following
143 word only; enclose a set of texts with braces to apply a command
146 \markup @{ \bold @{ hi there @} @}
150 For clarity, you can also do this for single arguments, e.g.,
153 \markup @{ is \italic @{ anyone @} home @}
156 @cindex font size, texts
159 In markup mode you can compose expressions, similar to mathematical
160 expressions, XML documents, and music expressions. You can stack
161 expressions grouped vertically with the command @code{\column}.
162 Similarly, @code{\center-align} aligns texts by their center lines:
164 @lilypond[quote,verbatim,fragment,relative=1]
165 c1^\markup { \column { a bbbb \line { c d } } }
166 c1^\markup { \center-align { a bbbb c } }
167 c1^\markup { \line { a b c } }
171 Markups can be stored in variables and these variables
172 may be attached to notes, like
174 allegro = \markup @{ \bold \large @{ Allegro @} @}
175 @{ a^\allegro b c d @}
179 Some objects have alignment procedures of their own, which cancel out
180 any effects of alignments applied to their markup arguments as a
181 whole. For example, the @internalsref{RehearsalMark} is horizontally
182 centered, so using @code{\mark \markup @{ \left-align .. @}} has no
188 Program reference: @internalsref{TextScriptEvent}, @internalsref{TextScript}.
190 Init files: @file{scm/@/new@/-markup@/.scm}.
194 Kerning or generation of ligatures is only done when the @TeX{}
195 backend is used. In this case, LilyPond does not account for them so
196 texts will be spaced slightly too wide.
198 Syntax errors for markup mode are confusing.
202 @subsection Text encoding
204 LilyPond uses the Pango library to format multi-lingual texts, and
205 does not perform any input-encoding conversions. This means that any
206 text, be it title, lyric text, or musical instruction containing
207 non-ASCII characters, must be utf-8. Easiest to enter such texts is
208 by using a Unicode-aware editor, and save using utf-8 encoding. Most
209 popular modern editors have utf-8 support, for example, vim, Emacs,
212 Depending on the fonts installed, the following fragment shows Hebrew
219 @lilypondfile[fontload]{utf-8.ly}
222 The @TeX{} backend does not handle encoding specially at all. Strings
223 in the input are put in the output as-is. Extents of text items in the
224 @TeX{} backend, are determined by reading a file created via the
225 @file{texstr} backend,
228 lilypond -b texstr input/les-nereides.ly
229 latex les-nereides.texstr
232 The last command produces @file{les-nereides.textmetrics}, which is
233 read when you execute
236 lilypond -b tex input/les-nereides.ly
239 Both @file{les-nereides.texstr} and @file{les-nereides.tex} need
240 suitable LaTeX wrappers to load appropriate La@TeX{} packages for
241 interpreting non-ASCII strings.
245 @inputfileref{input/regression,utf-8.ly}
249 @subsection Nested scores
251 It is possible to nest music inside markups, by adding a @code{\score}
252 block to a markup expression. Such a score must contain a @code{\layout}
255 @lilypond[quote,verbatim,raggedright]
259 \relative { c4 d e f }
269 @node Overview of text markup commands
270 @subsection Overview of text markup commands
272 The following commands can all be used inside @code{\markup @{ @}}.
274 @include markup-commands.tely
277 @node New dynamic marks
278 @subsection New dynamic marks
280 It is possible to print new dynamic marks or text that should be aligned
281 with dynamics. Use @code{make-dynamic-script} to create these marks.
283 @cindex make-dynamic-script
285 @lilypond[quote,verbatim,raggedright]
286 sfzp = #(make-dynamic-script "sfzp")
292 @cindex Dynamics, editorial
293 @cindex Dynamics, parenthesis
295 It is also possible to print dynamics in round parenthesis or square
296 brackets. These are often used for adding editorial dynamics.
298 @lilypond[quote,verbatim,raggedright]
299 rndf = \markup{ \center-align {\line { \bold{\italic (}
300 \dynamic f \bold{\italic )} }} }
301 boxf = \markup{ \bracket { \dynamic f } }
302 { c'1_\rndf c'1_\boxf }
306 @node Other text markup issues
307 @subsection Other text markup issues
309 To use a normal font within a title, you must define it manually
312 #(def-markup-command (normal-font layout props arg) (markup?)
313 "Switch to normal text font"
314 (interpret-markup layout (cons '((font-series . 'medium) (font-shape . 'upright)) props) arg))
317 title = \markup@{ ABCD \normal-font ABCD @}
322 @c really bad section name. :(
323 @node Even more than notes
324 @section Even more than notes
329 * Multi measure rests::
330 * Time administration::
336 @subsection Transpose
338 @cindex transposition of pitches
339 @cindex @code{\transpose}
341 A music expression can be transposed with @code{\transpose}. The
344 \transpose @var{from} @var{to} @var{musicexpr}
347 This means that @var{musicexpr} is transposed by the interval between
348 the pitches @var{from} and @var{to}: any note with pitch @code{from}
349 is changed to @code{to}.
352 For example, consider a piece written in the key of D-major. If
353 this piece is a little too low for its performer, it can be
354 transposed up to E-major with
356 \transpose d e @dots{}
359 Consider a part written for violin (a C instrument). If
360 this part is to be played on the A clarinet, the following
361 transposition will produce the appropriate part
364 \transpose a c @dots{}
367 @code{\transpose} distinguishes between enharmonic pitches: both
368 @code{\transpose c cis} or @code{\transpose c des} will transpose up
369 half a tone. The first version will print sharps and the second
370 version will print flats
372 @lilypond[quote,raggedright,verbatim]
373 mus = { \key d \major cis d fis g }
382 @code{\transpose} may also be used to input written notes for a
383 transposing instrument. Pitches are normally entered into LilyPond
384 in C (or ``concert pitch''), but they may be entered in another
385 key. For example, when entering music for a B-flat trumpet which
386 begins on concert D, one would write
389 \transpose c bes @{ e4 @dots{} @}
392 To print this music in B-flat again (ie producing a trumpet part,
393 instead of a concert pitch conductor's score) you would wrap the
394 existing music with another @code{transpose}
397 \transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @}
404 Program reference: @internalsref{TransposedMusic}, and
405 @internalsref{UntransposableMusic}.
409 If you want to use both @code{\transpose} and @code{\relative},
410 you must put @code{\transpose} outside of @code{\relative}, since
411 @code{\relative} will have no effect music that appears inside a
415 @node Ottava brackets
416 @subsection Ottava brackets
418 `Ottava' brackets introduce an extra transposition of an octave for
419 the staff. They are created by invoking the function
420 @code{set-octavation}
426 @lilypond[quote,raggedright,verbatim,fragment]
436 The @code{set-octavation} function also takes -1 (for 8va bassa) and 2
437 (for 15ma) as arguments. Internally the function sets the properties
438 @code{ottavation} (e.g., to @code{"8va"}) and
439 @code{centralCPosition}. For overriding the text of the bracket, set
440 @code{ottavation} after invoking @code{set-octavation}, i.e.,
442 @lilypond[quote,raggedright,verbatim]
445 \set Staff.ottavation = #"8"
452 Program reference: @internalsref{OttavaBracket}.
454 Examples: @inputfileref{input/@/regression,ottava@/.ly},
455 @inputfileref{input/@/regression,ottava@/-broken@/.ly}.
459 @code{set-octavation} will get confused when clef changes happen
460 during an octavation bracket.
463 @node Multi measure rests
464 @subsection Multi measure rests
465 @cindex multi measure rests
466 @cindex Rests, multi measure
470 Multi-measure rests are entered using `@code{R}'. It is specifically
471 meant for full bar rests and for entering parts: the rest can expand
472 to fill a score with rests, or it can be printed as a single
473 multi-measure rest. This expansion is controlled by the property
474 @code{Score.skipBars}. If this is set to true, empty measures will not
475 be expanded, and the appropriate number is added automatically
477 @lilypond[quote,raggedright,fragment,verbatim]
478 \time 4/4 r1 | R1 | R1*2
479 \set Score.skipBars = ##t R1*17 R1*4
482 The @code{1} in @code{R1} is similar to the duration notation used for
483 notes. Hence, for time signatures other than 4/4, you must enter other
484 durations. This can be done with augmentation dots or fractions
486 @lilypond[quote,raggedright,fragment,verbatim]
487 \set Score.skipBars = ##t
496 An @code{R} spanning a single measure is printed as either a whole rest
497 or a breve, centered in the measure regardless of the time signature.
499 If there are only a few measures of rest, LilyPond prints ``church rests''
500 (a series of rectangles) in the staff. To replace that with a simple
501 rest, use @code{MultiMeasureRest.expand-limit}.
503 @lilypond[quote,raggedright,fragment,verbatim]
504 \set Score.skipBars = ##t
506 \override MultiMeasureRest #'expand-limit = 1
511 @cindex text on multi-measure rest
512 @cindex script on multi-measure rest
513 @cindex fermata on multi-measure rest
515 Texts can be added to multi-measure rests by using the
516 @var{note}-@code{markup} syntax (see @ref{Text markup}).
517 A variable (@code{\fermataMarkup}) is provided for
520 @lilypond[quote,raggedright,verbatim,fragment]
521 \set Score.skipBars = ##t
523 R2.*10^\markup { \italic "ad lib." }
527 If you want to have text on the left end of a multi-measure rest,
528 attach the text to a zero-length skip note, i.e.,
536 @cindex whole rests for a full measure
540 Program reference: @internalsref{MultiMeasureRestEvent},
541 @internalsref{MultiMeasureTextEvent},
542 @internalsref{MultiMeasureRestMusicGroup}, and
543 @internalsref{MultiMeasureRest}.
545 The layout object @internalsref{MultiMeasureRestNumber} is for the
546 default number, and @internalsref{MultiMeasureRestText} for user
551 It is not possible to use fingerings (e.g., @code{R1-4}) to put numbers
552 over multi-measure rests. And the pitch of multi-measure rests (or
553 staff-centered rests) can not be influenced.
555 @cindex condensing rests
557 There is no way to automatically condense multiple rests into a single
558 multi-measure rest. Multi-measure rests do not take part in rest
561 Be careful when entering multi-measure rests followed by whole
562 notes. The following will enter two notes lasting four measures each
566 When @code{skipBars} is set, the result will look OK, but the bar
567 numbering will be off.
570 @node Time administration
571 @subsection Time administration
573 Time is administered by the @internalsref{Time_signature_engraver},
574 which usually lives in the @internalsref{Score} context.
575 The bookkeeping deals with the following variables
578 @item currentBarNumber
582 The length of the measures in the current time signature. For a 4/4
583 time this is@tie{}1, and for 6/8 it is 3/4.
585 @item measurePosition
586 The point within the measure where we currently are. This quantity
587 is reset to@tie{}0 whenever it exceeds @code{measureLength}. When that
588 happens, @code{currentBarNumber} is incremented.
591 If set to true, the above variables are updated for every time
592 step. When set to false, the engraver stays in the current measure
596 Timing can be changed by setting any of these variables explicitly.
597 In the next example, the 4/4 time signature is printed, but
598 @code{measureLength} is set to 5/4. After a while, the measure is
599 shortened by 1/8, by setting @code{measurePosition} to 7/8 at 2/4
600 in the measure, so the next bar line will fall at 2/4 + 3/8. The
601 3/8 arises because 5/4 normally has 10/8, but we have manually
602 set the measure position to be 7/8 and 10/8 - 7/8 = 3/8.
604 @lilypond[quote,raggedright,verbatim,relative,fragment]
605 \set Score.measureLength = #(ly:make-moment 5 4)
609 \set Score.measurePosition = #(ly:make-moment 7 8)
616 @node Preparing parts
617 @section Preparing parts
619 This section describes various notation that are useful for preparing
627 * Instrument transpositions::
628 * Different editions from one source::
632 @node Metronome marks
633 @subsection Metronome marks
636 @cindex beats per minute
637 @cindex metronome marking
639 Metronome settings can be entered as follows
641 \tempo @var{duration} = @var{per-minute}
644 In the MIDI output, they are interpreted as a tempo change. In the
645 layout output, a metronome marking is printed
646 @cindex @code{\tempo}
647 @lilypond[quote,raggedright,verbatim,fragment]
651 To change the tempo in the MIDI output without printing anything, make
652 the metronome marking invisible
654 \once \override Score.MetronomeMark #'transparent = ##t
657 To print other metronome markings, use these markup commands
658 @lilypond[quote,raggedright,verbatim,relative,fragment]
661 \smaller \general-align #Y #DOWN \note #"16." #1
663 \smaller \general-align #Y #DOWN \note #"8" #1"
668 See @ref{Text markup} for more details.
673 Program reference: @internalsref{MetronomeChangeEvent}
674 @internalsref{MetronomeMark}.
678 Collisions are not checked. If you have notes above the top line of
679 the staff (or notes with articulations, slurs, text, etc), then the
680 metronome marking may be printed on top of musical symbols. If this
681 occurs, increase the padding of the metronome mark to place it
682 further away from the staff.
685 \override Score.MetronomeMark #'padding = #2.5
689 @node Rehearsal marks
690 @subsection Rehearsal marks
691 @cindex Rehearsal marks
695 To print a rehearsal mark, use the @code{\mark} command
697 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
706 (The letter@tie{}`I' is skipped in accordance with engraving traditions.)
707 @c umm, is the manual the right place for feature requests? :) -gp
708 @c FIXME - should make that tunable.
710 The mark is incremented automatically if you use @code{\mark
711 \default}, but you can also use an integer argument to set the mark
712 manually. The value to use is stored in the property
713 @code{rehearsalMark}.
715 The style is defined by the property @code{markFormatter}. It is a
716 function taking the current mark (an integer) and the current context
717 as argument. It should return a markup object. In the following
718 example, @code{markFormatter} is set to a canned procedure. After a
719 few measures, it is set to function that produces a boxed number.
721 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
722 \set Score.markFormatter = #format-mark-numbers
725 \set Score.markFormatter = #format-mark-box-numbers
731 The file @file{scm/@/translation@/-functions@/.scm} contains the definitions
732 of @code{format-mark-numbers} (the default format), @code{format-mark-box-numbers},
733 @code{format-mark-letters} and @code{format-mark-box-letters}.
734 These can be used as inspiration for other formatting functions.
737 @cindex coda on bar line
738 @cindex segno on bar line
739 @cindex fermata on bar line
740 @cindex bar lines, symbols on
742 The @code{\mark} command can also be used to put signs like coda,
743 segno, and fermata on a bar line. Use @code{\markup} to
744 access the appropriate symbol
746 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
747 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
751 If the mark occurs at a line break, the mark will be printed at the
752 beginning of the next line.
753 @c IMO this is a bug; hopefully it'll be fixed soon, so I can
754 @c delete this sentence. -gp
755 If there is no next line, then the mark will not be printed at all.
756 To print the mark at the end of the current line, use
759 \override Score.RehearsalMark
760 #'break-visibility = #begin-of-line-invisible
766 @cindex bar lines, putting symbols on
770 Program reference: @internalsref{MarkEvent}, @internalsref{RehearsalMark}.
772 Init files: @file{scm/@/translation@/-functions@/.scm} contains the
773 definition of @code{format-mark-numbers} and
774 @code{format-mark-letters}. They can be used as inspiration for other
775 formatting functions.
777 Examples: @inputfileref{input/@/regression,rehearsal@/-mark@/-letter@/.ly},
779 @inputfileref{input/@/regression,rehearsal@/-mark@/-number@/.ly}.
783 @subsection Bar numbers
787 @cindex measure numbers
788 @cindex @code{currentBarNumber}
790 Bar numbers are printed by default at the start of the line. The
791 number itself is stored in the @code{currentBarNumber} property, which
792 is normally updated automatically for every measure.
794 Bar numbers can be typeset at regular intervals instead of at the
795 beginning of each line. This is illustrated in the following example,
796 whose source is available as
797 @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}
799 @lilypondfile[raggedright,quote]{bar-number-regular-interval.ly}
801 Bar numbers can be typeset manually by tweaking the
802 @code{markFormatter} property
804 @lilypond[verbatim,raggedright,quote]
806 \set Score.markFormatter
807 = #(lambda (mark context)
810 (number->string (ly:context-property context
811 'currentBarNumber)))))
813 c1 \bar "||" \mark \default c1 c1 \mark \default c1 \bar "|."
817 Bar numbers can be manually changed by setting the
818 @code{Staff.currentBarNumber} property
820 @lilypond[verbatim,raggedright,quote]
822 \repeat unfold 4 {c4 c c c} \break
823 \set Score.currentBarNumber = #50
824 \repeat unfold 4 {c4 c c c}
830 Program reference: @internalsref{BarNumber}.
833 @inputfileref{input/@/test,bar@/-number@/-every@/-five@/-reset@/.ly},
834 and @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}.
838 Bar numbers can collide with the @internalsref{StaffGroup} bracket, if
839 there is one at the top. To solve this, the
840 @code{padding} property of @internalsref{BarNumber} can be
841 used to position the number correctly.
844 @node Instrument names
845 @subsection Instrument names
847 In an orchestral score, instrument names are printed at the left side
850 This can be achieved by setting @internalsref{Staff}.@code{instrument}
851 and @internalsref{Staff}.@code{instr}. This will print a string before
852 the start of the staff. For the first staff, @code{instrument} is
853 used, for the following ones, @code{instr} is used.
855 @lilypond[quote,verbatim,raggedright,relative=1,fragment]
856 \set Staff.instrument = "Ploink "
857 \set Staff.instr = "Plk "
863 You can also use markup texts to construct more complicated instrument
866 @lilypond[quote,fragment,verbatim,raggedright]
867 \set Staff.instrument = \markup {
868 \column { "Clarinetti"
869 \line { "in B" \smaller \flat } } }
873 For longer instrument names, it may be useful to increase the
874 @code{indent} setting in the @code{\layout} block.
878 Program reference: @internalsref{InstrumentName}.
882 When you put a name on a grand staff or piano staff, the width of the
883 brace is not taken into account. You must add extra spaces to the end of
884 the name to avoid a collision.
887 @node Instrument transpositions
888 @subsection Instrument transpositions
889 @cindex transposition, MIDI
890 @cindex transposition, instrument
892 The key of a transposing instrument can also be specified. This
893 applies to many wind instruments, for example, clarinets (B-flat, A, and
894 E-flat), horn (F) and trumpet (B-flat, C, D, and E-flat).
896 The transposition is entered after the keyword @code{\transposition}
899 \transposition bes %% B-flat clarinet
903 This command sets the property @code{instrumentTransposition}. The value of
904 this property is used for MIDI output and quotations. It does not
905 affect how notes are printed in the current staff. To change the printed
906 output, see @ref{Transpose}.
908 The pitch to use for @code{\transposition} should correspond to the
909 transposition of the notes. For example, when entering a score in
910 concert pitch, typically all voices are entered in C, so
911 they should be entered as
924 The command @code{\transposition} should be used when the music is
925 entered from a (transposed) orchestral part. For example, in
926 classical horn parts, the tuning of the instrument is often changed
927 during a piece. When copying the notes from the part, use
928 @code{\transposition}, e.g.,
940 @node Different editions from one source
941 @subsection Different editions from one source
944 The @code{\tag} command marks music expressions with a name. These
945 tagged expressions can be filtered out later. With this mechanism it
946 is possible to make different versions of the same music source.
948 In the following example, we see two versions of a piece of music, one
949 for the full score, and one with cue notes for the instrumental part
965 The same can be applied to articulations, texts, etc.: they are
968 -\tag #@var{your-tag}
970 to an articulation, for example,
975 This defines a note with a conditional fingering indication.
978 @cindex removeWithTag
979 By applying the @code{\keepWithTag} and @code{\removeWithTag}
980 commands, tagged expressions can be filtered. For example,
984 \keepWithTag #'score @var{the music}
985 \keepWithTag #'part @var{the music}
990 @lilypondfile[raggedright,quote]{tag-filter.ly}
993 The argument of the @code{\tag} command should be a symbol, or a list
994 of symbols, for example,
996 \tag #'(original-part transposed-part) @dots{}
1003 Examples: @inputfileref{input/@/regression,tag@/-filter@/.ly}.
1007 Multiple rests are not merged if you create the score with both tagged
1011 @node Orchestral music
1012 @section Orchestral music
1014 Orchestral music involves some special notation, both in the full
1015 score and the individual parts. This section explains how to tackle
1016 some common problems in orchestral music.
1019 * Automatic part combining::
1021 * Quoting other voices::
1022 * Formatting cue notes::
1023 * Aligning to cadenzas::
1027 @node Automatic part combining
1028 @subsection Automatic part combining
1029 @cindex automatic part combining
1030 @cindex part combiner
1032 Automatic part combining is used to merge two parts of music onto a
1033 staff. It is aimed at typesetting orchestral scores. When the two
1034 parts are identical for a period of time, only one is shown. In
1035 places where the two parts differ, they are typeset as separate
1036 voices, and stem directions are set automatically. Also, solo and
1037 @emph{a due} parts are identified and can be marked.
1039 The syntax for part combining is
1042 \partcombine @var{musicexpr1} @var{musicexpr2}
1046 The following example demonstrates the basic functionality of the part
1047 combiner: putting parts on one staff, and setting stem directions and
1050 @lilypond[quote,verbatim,raggedright,fragment]
1051 \new Staff \partcombine
1052 \relative g' { g g a( b) c c r r }
1053 \relative g' { g g r4 r e e g g }
1056 The first @code{g} appears only once, although it was
1057 specified twice (once in each part). Stem, slur, and tie directions are
1058 set automatically, depending whether there is a solo or unisono. The
1059 first part (with context called @code{one}) always gets up stems, and
1060 `Solo', while the second (called @code{two}) always gets down stems and
1063 If you just want the merging parts, and not the textual markings, you
1064 may set the property @code{printPartCombineTexts} to false
1066 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
1068 \set Staff.printPartCombineTexts = ##f
1070 \relative g' { g a( b) r }
1071 \relative g' { g r4 r f }
1075 To change the text that is printed for solos or merging, you may
1076 set the @code{soloText}, @code{soloIIText}, and @code{aDueText}
1079 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
1081 \set Score.soloText = #"ichi"
1082 \set Score.soloIIText = #"ni"
1083 \set Score.aDueText = #"tachi"
1085 \relative g' { g4 g a( b) r }
1086 \relative g' { g4 g r r f }
1090 Both arguments to @code{\partcombine} will be interpreted as
1091 @internalsref{Voice} contexts. If using relative octaves,
1092 @code{\relative} should be specified for both music expressions, i.e.,
1096 \relative @dots{} @var{musicexpr1}
1097 \relative @dots{} @var{musicexpr2}
1101 A @code{\relative} section that is outside of @code{\partcombine} has
1102 no effect on the pitches of @var{musicexpr1} and @var{musicexpr2}.
1106 Program reference: @internalsref{PartCombineMusic},
1107 @internalsref{SoloOneEvent}, and
1108 @internalsref{SoloTwoEvent}, and
1109 @internalsref{UnisonoEvent}.
1113 When @code{printPartCombineTexts} is set, when the two voices play the
1114 same notes on and off, the part combiner may typeset @code{a2} more
1115 than once in a measure.
1117 @code{\partcombine} cannot be inside @code{\times}.
1119 @code{\partcombine} cannot be inside @code{\relative}.
1121 Internally, the @code{\partcombine} interprets both arguments as
1122 @code{Voice}s named @code{one} and @code{two}, and then decides when
1123 the parts can be combined. Consequently, if the arguments switch to
1124 differently named @internalsref{Voice} contexts, the events in those
1129 @subsection Hiding staves
1131 @cindex Frenched scores
1132 @cindex Hiding staves
1134 In orchestral scores, staff lines that only have rests are usually
1135 removed; this saves some space. This style is called `French Score'.
1136 For @internalsref{Lyrics},
1137 @internalsref{ChordNames} and @internalsref{FiguredBass}, this is
1138 switched on by default. When the lines of these contexts turn out
1139 empty after the line-breaking process, they are removed.
1141 For normal staves, a specialized @internalsref{Staff} context is
1142 available, which does the same: staves containing nothing (or only
1143 multi-measure rests) are removed. The context definition is stored in
1144 @code{\RemoveEmptyStaffContext} variable. Observe how the second staff
1145 in this example disappears in the second line
1147 @lilypond[quote,raggedright,verbatim]
1149 \context { \RemoveEmptyStaffContext }
1154 \new Staff { e4 f g a \break c1 }
1155 \new Staff { c4 d e f \break R1 }
1160 The first system shows all staves in full. If empty staves should be
1161 removed from the first system too, set @code{remove-first} to true in
1162 @internalsref{RemoveEmptyVerticalGroup}.
1165 \override Score.RemoveEmptyVerticalGroup #'remove-first = ##t
1168 To remove other types of contexts, use @code{\AncientRemoveEmptyStaffContext}
1169 or @code{\RemoveEmptyRhythmicStaffContext}.
1171 Another application is making ossia sections, i.e., alternative
1172 melodies on a separate piece of staff, with help of a Frenched
1173 staff. See @inputfileref{input/@/test,ossia@/.ly} for an example.
1176 @node Quoting other voices
1177 @subsection Quoting other voices
1179 With quotations, fragments of other parts can be inserted into a part
1180 directly. Before a part can be quoted, it must be marked especially as
1181 quotable. This is done with the @code{\addquote} command.
1184 \addquote @var{name} @var{music}
1189 Here, @var{name} is an identifying string. The @var{music} is any kind
1190 of music. Here is an example of @code{\addquote}
1193 \addquote clarinet \relative c' @{
1198 This command must be entered at toplevel, i.e., outside any music
1201 After calling @code{\addquote}, the quotation may then be done with
1202 @code{\quoteDuring} or @code{\cueDuring},
1205 \quoteDuring #@var{name} @var{music}
1208 During a part, a piece of music can be quoted with the @code{\quoteDuring}
1212 \quoteDuring #"clarinet" @{ s2. @}
1215 This would cite three quarter notes (the duration of @code{s2.}) of
1216 the previously added @code{clarinet} voice.
1219 More precisely, it takes the current time-step of the part being
1220 printed, and extracts the notes at the corresponding point of the
1221 @code{\addquote}d voice. Therefore, the argument to @code{\addquote}
1222 should be the entire part of the voice to be quoted, including any
1223 rests at the beginning.
1225 Quotations take into account the transposition of both source and target
1226 instruments, if they are specified using the @code{\transposition} command.
1228 @lilypond[quote,raggedright,verbatim]
1229 \addquote clarinet \relative c' {
1235 e'8 f'8 \quoteDuring #"clarinet" { s2 }
1239 The type of events that are present in cue notes can be trimmed with
1240 the @code{quotedEventTypes} property. The default value is
1241 @code{(note-event rest-event)}, which means that only notes and
1242 rests of the cued voice end up in the @code{\quoteDuring}.
1246 \set Staff.quotedEventTypes =
1247 #'(note-event articulation-event dynamic-event)
1251 will quote notes (but no rests), together with scripts and dynamics.
1255 Only the contents of the first @internalsref{Voice} occurring in an
1256 @code{\addquote} command will be considered for quotation, so
1257 @var{music} can not contain @code{\new} and @code{\context Voice}
1258 statements that would switch to a different Voice.
1260 Quoting grace notes is broken and can even cause LilyPond to crash.
1264 In this manual: @ref{Instrument transpositions}.
1266 Examples: @inputfileref{input/@/regression,quote@/.ly}
1267 @inputfileref{input/@/regression,quote@/-transposition@/.ly}
1269 Program reference: @internalsref{QuoteMusic}.
1272 @node Formatting cue notes
1273 @subsection Formatting cue notes
1275 The previous section deals with inserting notes from another voice.
1276 There is a more advanced music function called @code{\cueDuring},
1277 which makes formatting cue notes easier.
1282 \cueDuring #@var{name} #@var{updown} @var{music}
1285 This will insert notes from the part @var{name} into a
1286 @internalsref{Voice} called @code{cue}. This happens simultaneously
1287 with @var{music}, which usually is a rest. When the cue notes start,
1288 the staff in effect becomes polyphonic for a moment. The argument
1289 @var{updown} determines whether the cue notes should be notated as a
1290 first or second voice.
1293 @lilypond[verbatim,raggedright]
1296 \override Stem #'length = #5.5
1297 \override Beam #'thickness = #0.384
1298 \override Beam #'space-function =
1299 #(lambda (beam mult) (* 0.8 (Beam::space_function beam mult)))
1302 \addquote clarinet \relative {
1307 \new Staff \relative <<
1309 % setup a context for cue notes.
1310 \context Voice = cue { \smaller \skip 1*21 }
1312 \set Score.skipBars = ##t
1316 \cueDuring #"clarinet" #1 {
1325 Here are a couple of hints for successful cue notes
1329 Cue notes have smaller font sizes.
1331 the cued part is marked with the instrument playing the cue.
1333 when the original part takes over again, this should be marked with
1334 the name of the original instrument.
1336 @c really? Are you sure about that last point? I'll check after 3.0 -gp
1338 @c Yes, this is good practice. Otherwise, the start of the original
1339 @c part can only be seen from the font size. This is not good enough
1340 @c for sight-reading. It is possilbe to use other
1341 @c markers (eg. a big close-bracket over the staff) to indicate the cue notes are
1346 any other changes introduced by the cued part should also be
1347 undone. For example, if the cued instrument plays in a different clef,
1348 the original clef should be stated once again.
1353 @node Aligning to cadenzas
1354 @subsection Aligning to cadenzas
1356 In an orchestral context, cadenzas present a special problem:
1357 when constructing a score that includes a cadenza, all other
1358 instruments should skip just as many notes as the length of the
1359 cadenza, otherwise they will start too soon or too late.
1361 A solution to this problem are the functions @code{mmrest-of-length}
1362 and @code{skip-of-length}. These Scheme functions take a piece of music
1363 as argument, and generate a @code{\skip} or multi-rest, exactly as
1364 long as the piece. The use of @code{mmrest-of-length} is demonstrated
1365 in the following example.
1367 @lilypond[verbatim,raggedright,quote]
1368 cadenza = \relative c' {
1369 c4 d8 << { e f g } \\ { d4. } >>
1374 \new Staff { \cadenza c'4 }
1376 #(ly:export (mmrest-of-length cadenza))
1385 @node Contemporary notation
1386 @section Contemporary notation
1388 In the 20th century, composers have greatly expanded the musical
1389 vocabulary. With this expansion, many innovations in musical notation
1390 have been tried. The book ``Music Notation in the 20th century'' by
1391 Kurt Stone gives a comprehensive overview (see @ref{Literature
1392 list}). In general, the use of new, innovative notation makes a piece
1393 harder to understand and perform and its use should therefore be
1394 avoided. For this reason, support for contemporary notation in
1395 LilyPond is limited.
1399 * Polymetric notation::
1401 * Special fermatas::
1406 @node Polymetric notation
1407 @subsection Polymetric notation
1409 Double time signatures are not supported explicitly, but they can be
1410 faked. In the next example, the markup for the time signature is
1411 created with a markup text. This markup text is inserted in the
1412 @internalsref{TimeSignature} grob.
1414 @lilypond[verbatim,raggedright]
1419 \musicglyph #"scripts.stopped"
1420 \bracket \column { "5" "8" }
1425 \override Staff.TimeSignature #'print-function = #Text_interface::print
1426 \override Staff.TimeSignature #'text = #tsMarkup
1428 c'2 \bar ":" c'4 c'4.
1432 Each staff can also have its own time signature. This is done by
1433 moving the @internalsref{Timing_engraver} to the @internalsref{Staff}
1438 \context @{ \Score \remove "Timing_engraver" @}
1439 \context @{ \Staff \consists "Timing_engraver" @}
1444 Now, each staff has its own time signature.
1457 c4. c8 c c c4. c8 c c
1462 @lilypond[quote,raggedright]
1464 \context{ \Score \remove "Timing_engraver" }
1465 \context{ \Staff \consists "Timing_engraver" }
1479 c4. c8 c c c4. c8 c c
1485 A different form of polymetric notation is where note lengths have
1486 different values across staves.
1488 This notation can be created by setting a common time signature for
1489 each staff but replacing it manually using
1490 @code{timeSignatureFraction} to the desired fraction. Then the printed
1491 durations in each staff are scaled to the common time signature.
1492 The latter is done with @code{\compressmusic}, which is similar to
1493 @code{\times}, but does not create a tuplet bracket.
1496 In this example, music with the time signatures of 3/4, 9/8, and 10/8 are
1497 used in parallel. In the second staff, shown durations are multiplied by
1498 2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are
1499 multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
1501 @lilypond[quote,raggedright,verbatim,fragment]
1509 \set Staff.timeSignatureFraction = #'(9 . 8)
1510 \compressmusic #'(2 . 3)
1511 \repeat unfold 6 { c8[ c c] }
1515 \set Staff.timeSignatureFraction = #'(10 . 8)
1516 \compressmusic #'(3 . 5) {
1517 \repeat unfold 2 { c8[ c c] }
1518 \repeat unfold 2 { c8[ c] }
1519 | c4. c4. \times 2/3 { c8 c c } c4
1530 When using different time signatures in parallel, the spacing is
1531 aligned vertically, but bar lines distort the regular spacing.
1536 @subsection Clusters
1540 A cluster indicates a continuous range of pitches to be played. They
1541 can be denoted as the envelope of a set of notes. They are entered by
1542 applying the function @code{makeClusters} to a sequence of
1544 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1545 \makeClusters { <c e > <b f'> }
1548 The following example (from
1549 @inputfileref{input/@/regression,cluster@/.ly}) shows what the result
1552 @lilypondfile[raggedright,quote]{cluster.ly}
1554 Ordinary notes and clusters can be put together in the same staff,
1555 even simultaneously. In such a case no attempt is made to
1556 automatically avoid collisions between ordinary notes and clusters.
1560 Program reference: @internalsref{ClusterSpanner},
1561 @internalsref{ClusterSpannerBeacon},
1562 @internalsref{Cluster_spanner_engraver}, and
1563 @internalsref{ClusterNoteEvent}.
1565 Examples: @inputfileref{input/@/regression,cluster@/.ly}.
1569 Music expressions like @code{<< @{ g8 e8 @} a4 >>} are not printed
1570 accurately. Use @code{<g a>8 <e a>8} instead.
1574 @node Special fermatas
1575 @subsection Special fermatas
1577 @cindex fermatas, special
1579 In contemporary music notation, special fermata symbols denote breaks
1580 of differing lengths. The following fermatas are supported
1582 @lilypond[quote,raggedright]
1605 \context Lyrics \lyricmode {
1606 \override LyricText #'font-family = #'typewriter
1607 "shortfermata" "fermata" "longfermata" "verylongfermata"
1612 See @ref{Articulations} for general instructions how to apply scripts
1613 such as fermatas to notes.
1615 @node Feathered beams
1616 @subsection Feathered beams
1618 Feathered beams are not supported natively, but they can be faked by
1619 forcing two beams to overlap. Here is an example,
1621 @c don't change relative setting witout changing positions!
1622 @lilypond[raggedright,relative=1,fragment,verbatim]
1627 \once \override Voice.Beam #'positions = #'(0 . 0.5)
1632 \once \override Voice.Beam #'positions = #'(0 . -0.5)
1640 @subsection Improvisation
1642 Improvisation is sometimes denoted with slashed note heads. Such note
1643 heads can be created by adding a @internalsref{Pitch_squash_engraver}
1644 to the @internalsref{Staff} or @internalsref{Voice} context. Then, the
1648 \set squashedPosition = #0
1649 \override NoteHead #'style = #'slash
1653 switches on the slashes.
1655 There are shortcuts @code{\improvisationOn} (and an accompanying
1656 @code{\improvisationOff}) for this command sequence. They are used in
1657 the following example
1659 @lilypond[verbatim,raggedright,quote]
1661 \consists Pitch_squash_engraver
1663 e8 e g a a16(bes)(a8) g \improvisationOn
1666 ~fis2 \improvisationOff a16(bes) a8 g e
1671 @node Educational use
1672 @section Educational use
1674 With the amount of control that LilyPond offers, one can make great
1675 teaching tools in addition to great musical scores.
1679 * Blank music sheet::
1681 * Shaped note heads ::
1682 * Easy Notation note heads::
1683 * Analysis brackets::
1684 * Coloring objects::
1688 @subsection Balloon help
1690 Elements of notation can be marked and named with the help of a square
1691 balloon. The primary purpose of this feature is to explain notation.
1693 The following example demonstrates its use.
1695 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
1698 #(add-balloon-text 'NoteHead "heads, or tails?"
1705 The function @code{add-balloon-text} takes the name of a grob, the
1706 label to print, and the position where to put the label relative to
1707 the object. In the above example, the text ``heads or tails?'' ends
1708 3 spaces below and 1 space to the right of the marked head.
1711 @cindex notation, explaining
1715 Program reference: @internalsref{text-balloon-interface}.
1717 Examples: @inputfileref{input/@/regression,balloon@/.ly}.
1722 @node Blank music sheet
1723 @subsection Blank music sheet
1725 A blank music sheet can be produced also by using invisible notes, and
1726 removing @code{Bar_number_engraver}.
1729 @lilypond[quote,verbatim]
1731 \repeat unfold 2 % Change this for more lines.
1736 \override TimeSignature #'transparent = ##t
1737 defaultBarType = #""
1738 \remove Bar_number_engraver
1740 \context Staff \emptymusic
1741 \context TabStaff \emptymusic
1747 @subsection Hidden notes
1749 @cindex Hidden notes
1750 @cindex Invisible notes
1751 @cindex Transparent notes
1753 @cindex @code{\hideNotes}
1754 @cindex @code{\unHideNotes}
1755 Hidden (or invisible or transparent) notes can be useful in preparing theory
1756 or composition exercises.
1758 @lilypond[quote,raggedright,verbatim,relative=2,fragment]
1766 Hidden notes are also great for performing weird tricks. For example,
1767 slurs cannot be attached to rests or spacer rests, but you may wish
1768 to include that in your score -- string instruments use this notation
1769 when doing pizzicato to indicate that the note should ring for as long
1772 @lilypond[quote,raggedright,verbatim,relative=0,fragment]
1775 c4^"pizz"( \hideNotes c)
1776 \unHideNotes c( \hideNotes c)
1783 @node Shaped note heads
1784 @subsection Shaped note heads
1786 In shaped note head notation, the shape of the note head corresponds
1787 to the harmonic function of a note in the scale. This notation was
1788 popular in the 19th century American song books.
1790 Shaped note heads can be produced by setting @code{\aikenHeads} or
1791 @code{\sacredHarpHeads}, depending on the style desired.
1793 @lilypond[verbatim,relative=1,fragment]
1800 Shapes are determined on the step in the scale, where the base of the
1801 scale is determined by the @code{\key} command
1804 @findex shapeNoteStyles
1806 @findex \sacredHarpHeads
1808 Shaped note heads are implemented through the @code{shapeNoteStyles}
1809 property. Its value is a vector of symbols. The k-th element indicates
1810 the style to use for the k-th step of the scale. Arbitrary
1811 combinations are possible, eg.,
1814 @lilypond[verbatim,relative=1,fragment]
1815 \set shapeNoteStyles = ##(cross triangle fa #f mensural xcircle diamond)
1820 @node Easy Notation note heads
1821 @subsection Easy Notation note heads
1823 @cindex easy notation
1826 The `easy play' note head includes a note name inside the head. It is
1827 used in music for beginners
1829 @lilypond[quote,raggedright,verbatim,fragment,staffsize=26]
1834 The command @code{\setEasyHeads} overrides settings for the
1835 @internalsref{NoteHead} object. To make the letters readable, it has
1836 to be printed in a large font size. To print with a larger font, see
1837 @ref{Setting global staff size}.
1841 @cindex @code{\setEasyHeads}
1842 @code{\setEasyHeads}
1845 @node Analysis brackets
1846 @subsection Analysis brackets
1848 @cindex phrasing brackets
1849 @cindex musicological analysis
1850 @cindex note grouping bracket
1852 Brackets are used in musical analysis to indicate structure in musical
1853 pieces. LilyPond supports a simple form of nested horizontal
1854 brackets. To use this, add the @internalsref{Horizontal_bracket_engraver}
1855 to @internalsref{Staff} context. A bracket is started with
1856 @code{\startGroup} and closed with @code{\stopGroup}
1858 @lilypond[quote,raggedright,verbatim]
1861 c4\startGroup\startGroup
1864 c4\stopGroup\stopGroup
1868 \Staff \consists "Horizontal_bracket_engraver"
1874 Program reference: @internalsref{HorizontalBracket},
1875 @internalsref{NoteGroupingEvent}.
1877 Examples: @inputfileref{input/@/regression,note@/-group@/-bracket@/.ly}.
1883 I don't think we need this info.
1888 Whenever a note is found, a @internalsref{Stem} object is created
1889 automatically. For whole notes and rests, they are also created but
1894 @cindex @code{\stemUp}
1896 @cindex @code{\stemDown}
1898 @cindex @code{\stemNeutral}
1899 @code{\stemNeutral}.
1904 @node Coloring objects
1905 @subsection Coloring objects
1907 @c FIXME: need link to missing list of colors
1908 Individual objects may be assigned colors. You may use color names
1911 @lilypond[quote,raggedright,verbatim,fragment]
1912 \override NoteHead #'color = #red
1914 \override NoteHead #'color = #(x11-color 'LimeGreen)
1916 \override Stem #'color = #blue
1920 The full range of colors defined for X11 can be accessed by using the
1921 scheme function x11-color. The function takes one argument that can be a
1925 \override Beam #'color = #(x11-color 'MediumTurquoise)
1931 \override Beam #'color = #(x11-color "MediumTurquoise")
1934 The first form is quicker to write and is more efficient. However, using
1935 the second form it is possible to access X11 colors by the multi-word
1939 \override Beam #'color = #(x11-color "medium turquoise")
1942 If x11-color cannot make sense of the parameter then the color returned
1943 defaults to black. It should be obvious from the final score that
1946 This example, illustrates the use of x11-color. Notice that the stem
1947 color remains black after being set to (x11-color 'Boggle), which is
1948 deliberate nonsense.
1950 @lilypond[quote,raggedright,verbatim]
1952 \override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
1953 \set Staff.instrument = \markup {
1954 \with-color #(x11-color 'navy) "Clarinet"
1958 \override Beam #'color = #(x11-color "medium turquoise")
1960 \override NoteHead #'color = #(x11-color "LimeGreen")
1962 \override Stem #'color = #(x11-color 'Boggle)
1969 Not all x11 colors are distinguishable in a web browser. For web use
1970 normal colors are recommended.
1972 An x11 color is not necessarily exactly the same shade as a similarly
1981 @node Automatic notation
1982 @section Automatic notation
1984 This section describes how to change the way that accidentals and
1985 beams are automatically displayed.
1987 FIXME: this might get moved into Changing Defaults. Please send
1988 opinions to lilypond-devel. Thanks! :)
1991 * Automatic accidentals::
1992 * Setting automatic beam behavior::
1996 @node Automatic accidentals
1997 @subsection Automatic accidentals
1998 @cindex Automatic accidentals
2000 Common rules for typesetting accidentals have been placed in a
2001 function. This function is called as follows
2003 @cindex @code{set-accidental-style}
2005 #(set-accidental-style 'STYLE #('CONTEXT#))
2008 The function can take two arguments: the name of the accidental style,
2009 and an optional argument that denotes the context that should be
2010 changed. If no context name is supplied, @code{Staff} is the default,
2011 but you may wish to apply the accidental style to a single @code{Voice}
2014 The following accidental styles are supported
2017 This is the default typesetting behavior. It corresponds
2018 to 18th century common practice: Accidentals are
2019 remembered to the end of the measure in which they occur and
2020 only on their own octave.
2023 The normal behavior is to remember the accidentals on
2024 Staff-level. This variable, however, typesets accidentals
2025 individually for each voice. Apart from that, the rule is similar to
2028 As a result, accidentals from one voice do not get canceled in other
2029 voices, which is often an unwanted result
2031 @lilypond[quote,raggedright,relative=1,fragment,verbatim]
2033 #(set-accidental-style 'voice)
2040 The @code{voice} option should be used if the voices
2041 are to be read solely by individual musicians. If the staff is to be
2042 used by one musician (e.g., a conductor) then
2043 @code{modern} or @code{modern-cautionary}
2044 should be used instead.
2047 @cindex @code{modern} style accidentals
2048 This rule corresponds to the common practice in the 20th century. This rule
2049 prints the same accidentals as @code{default}, but temporary
2050 accidentals also are canceled in other octaves. Furthermore,
2051 in the same octave, they also get canceled in the following
2054 @lilypond[quote,raggedright,fragment,verbatim]
2055 #(set-accidental-style 'modern)
2056 cis' c'' cis'2 | c'' c'
2059 @item @code{modern-cautionary}
2060 @cindex @code{modern-cautionary}
2061 This rule is similar to @code{modern}, but the ``extra'' accidentals
2062 (the ones not typeset by @code{default}) are typeset as cautionary
2063 accidentals. They are printed in reduced size or with parentheses
2064 @lilypond[quote,raggedright,fragment,verbatim]
2065 #(set-accidental-style 'modern-cautionary)
2066 cis' c'' cis'2 | c'' c'
2069 @cindex @code{modern-voice}
2071 This rule is used for multivoice accidentals to be read both by musicians
2072 playing one voice and musicians playing all voices. Accidentals are
2073 typeset for each voice, but they @emph{are} canceled across voices in
2074 the same @internalsref{Staff}.
2076 @cindex @code{modern-voice-cautionary}
2077 @item modern-voice-cautionary
2078 This rule is the same as @code{modern-voice}, but with the extra
2079 accidentals (the ones not typeset by @code{voice}) typeset
2080 as cautionaries. Even though all accidentals typeset by
2081 @code{default} @emph{are} typeset by this variable,
2082 some of them are typeset as cautionaries.
2085 @cindex @code{piano} accidentals
2086 This rule reflects 20th century practice for piano notation. Very similar to
2087 @code{modern} but accidentals also get canceled
2088 across the staves in the same @internalsref{GrandStaff} or
2089 @internalsref{PianoStaff}.
2091 @item piano-cautionary
2092 @cindex @code{#(set-accidental-style 'piano-cautionary)}
2093 Same as @code{#(set-accidental-style 'piano)} but with the extra
2094 accidentals typeset as cautionaries.
2097 @cindex @code{no-reset} accidental style
2098 This is the same as @code{default} but with accidentals lasting
2099 ``forever'' and not only until the next measure
2100 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
2101 #(set-accidental-style 'no-reset)
2106 This is sort of the opposite of @code{no-reset}: Accidentals
2107 are not remembered at all---and hence all accidentals are
2108 typeset relative to the key signature, regardless of what was
2111 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
2112 #(set-accidental-style 'forget)
2113 \key d\major c4 c cis cis d d dis dis
2120 Program reference: @internalsref{Accidental_engraver},
2121 @internalsref{Accidental}, and @internalsref{AccidentalPlacement}.
2126 Simultaneous notes are considered to be entered in sequential
2127 mode. This means that in a chord the accidentals are typeset as if the
2128 notes in the chord happened once at a time - in the order in which
2129 they appear in the input file.
2131 This is a problem when accidentals in a chord depend on each other,
2132 which does not happen for the default accidental style. The problem
2133 can be solved by manually inserting @code{!} and @code{?} for the
2137 @node Setting automatic beam behavior
2138 @subsection Setting automatic beam behavior
2140 @cindex @code{autoBeamSettings}
2141 @cindex @code{(end * * * *)}
2142 @cindex @code{(begin * * * *)}
2143 @cindex automatic beams, tuning
2144 @cindex tuning automatic beaming
2146 @c [TODO: use \applycontext]
2148 In normal time signatures, automatic beams can start on any note but can
2149 only end in a few positions within the measure: beams can end on a beat,
2150 or at durations specified by the properties in
2151 @code{autoBeamSettings}. The defaults for @code{autoBeamSettings}
2152 are defined in @file{scm/@/auto@/-beam@/.scm}.
2154 The value of @code{autoBeamSettings} is changed with three functions,
2156 #(override-auto-beam-setting
2157 '(@var{be} @var{p} @var{q} @var{n} @var{m}) @var{a} @var{b}
2159 #(score-override-auto-beam-setting
2160 '(@var{be} @var{p} @var{q} @var{n} @var{m}) @var{a} @var{b})
2161 #(revert-auto-beam-setting '(@var{be} @var{p} @var{q} @var{n} @var{m})
2164 Here, @var{be} is the symbol @code{begin} or @code{end}, and
2165 @var{context} is an optional context (default: @code{'Voice}). It
2166 determines whether the rule applies to begin or end-points. The
2167 quantity @var{p}/@var{q} refers to the length of the beamed notes (and
2168 `@code{* *}' designates notes of any length), @var{n}/@var{M} refers
2169 to a time signature (wildcards `@code{* *}' may be entered to
2170 designate all time signatures), @var{a}/@var{b} is a duration. By
2171 default, this command changes settings for the current voice. It is
2172 also possible to adjust settings at higher contexts, by adding a
2173 @var{context} argument. @code{score-override-auto-beam-setting} is
2174 equal to @code{override-auto-beam-setting} with the argument
2175 @var{context} set to @code{'Score}.
2177 For example, if automatic beams should end on the first quarter note, use
2180 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
2182 Since the duration of a quarter note is 1/4 of a whole note, it is
2183 entered as @code{(ly:make-moment 1 4)}.
2185 If automatic beams should end on every quarter in 5/4 time, specify
2188 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
2189 #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
2190 #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
2191 #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
2195 The same syntax can be used to specify beam starting points. In this
2196 example, automatic beams can only end on a dotted quarter note
2198 #(override-auto-beam-setting '(end * * * *) 3 8)
2199 #(override-auto-beam-setting '(end * * * *) 1 2)
2200 #(override-auto-beam-setting '(end * * * *) 7 8)
2202 In 4/4 time signature, this means that automatic beams could end only on
2203 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
2204 3/8, has passed within the measure).
2206 Rules can also be restricted to specific time signatures. A rule that
2207 should only be applied in @var{N}/@var{M} time signature is formed by
2208 replacing the second asterisks by @var{N} and @var{M}. For example, a
2209 rule for 6/8 time exclusively looks like
2211 #(override-auto-beam-setting '(begin * * 6 8) @dots{})
2214 If a rule should be to applied only to certain types of beams, use the
2215 first pair of asterisks. Beams are classified according to the
2216 shortest note they contain. For a beam ending rule that only applies
2217 to beams with 32nd notes (and no shorter notes), use @code{(end 1 32 *
2222 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
2224 #(override-auto-beam-setting '(end * * 5 8) 2 8)
2232 @cindex automatic beam generation
2234 @cindex @code{autoBeaming}
2237 If beams are used to indicate melismata in songs, then automatic
2238 beaming should be switched off. This is done by setting
2239 @code{autoBeaming} to @code{#f}.
2243 @cindex @code{\autoBeamOff}
2244 @code{\autoBeamOff},
2245 @cindex @code{\autoBeamOn}
2251 If a score ends while an automatic beam has not been ended and is
2252 still accepting notes, this last beam will not be typeset at all. The
2253 same holds polyphonic voices, entered with @code{<< @dots{} \\ @dots{}
2254 >>}. If a polyphonic voice ends while an automatic beam is still
2255 accepting notes, it is not typeset.
2257 @node Beam formatting
2258 @subsection Beam formatting
2260 When a beam falls in the middle of the staff, the beams point normally
2261 down. However, this behaviour can be altered with the
2262 @code{neutral-direction} property.
2264 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
2267 \override Beam #'neutral-direction = #-1
2269 \override Beam #'neutral-direction = #1