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
8 @node Advanced notation
9 @chapter Advanced notation
11 This chapter deals with rarely-used and advanced notation.
17 * Contemporary notation::
25 This section describes how to change the way that accidentals are
26 inserted automatically before notes.
29 * Automatic accidentals::
32 @node Automatic accidentals
33 @subsection Automatic accidentals
34 @cindex Automatic accidentals
36 Common rules for typesetting accidentals have been placed in a
37 function. This function is called as follows
39 @cindex @code{set-accidental-style}
41 #(set-accidental-style 'STYLE #('CONTEXT#))
44 The function can take two arguments: the name of the accidental style,
45 and an optional argument that denotes the context that should be
46 changed. If no context name is supplied, @code{Staff} is the default,
47 but you may wish to apply the accidental style to a single @code{Voice}
50 The following accidental styles are supported
53 This is the default typesetting behavior. It corresponds
54 to 18th century common practice: Accidentals are
55 remembered to the end of the measure in which they occur and
56 only on their own octave.
59 The normal behavior is to remember the accidentals on
60 Staff-level. This variable, however, typesets accidentals
61 individually for each voice. Apart from that, the rule is similar to
64 As a result, accidentals from one voice do not get canceled in other
65 voices, which is often an unwanted result
67 @lilypond[quote,raggedright,relative=1,fragment,verbatim]
69 #(set-accidental-style 'voice)
76 The @code{voice} option should be used if the voices
77 are to be read solely by individual musicians. If the staff is to be
78 used by one musician (e.g., a conductor) then
79 @code{modern} or @code{modern-cautionary}
80 should be used instead.
83 @cindex @code{modern} style accidentals
84 This rule corresponds to the common practice in the 20th century. This rule
85 prints the same accidentals as @code{default}, but temporary
86 accidentals also are canceled in other octaves. Furthermore,
87 in the same octave, they also get canceled in the following
90 @lilypond[quote,raggedright,fragment,verbatim]
91 #(set-accidental-style 'modern)
92 cis' c'' cis'2 | c'' c'
95 @item @code{modern-cautionary}
96 @cindex @code{modern-cautionary}
97 This rule is similar to @code{modern}, but the ``extra'' accidentals
98 (the ones not typeset by @code{default}) are typeset as cautionary
99 accidentals. They are printed in reduced size or with parentheses
100 @lilypond[quote,raggedright,fragment,verbatim]
101 #(set-accidental-style 'modern-cautionary)
102 cis' c'' cis'2 | c'' c'
105 @cindex @code{modern-voice}
107 This rule is used for multivoice accidentals to be read both by musicians
108 playing one voice and musicians playing all voices. Accidentals are
109 typeset for each voice, but they @emph{are} canceled across voices in
110 the same @internalsref{Staff}.
112 @cindex @code{modern-voice-cautionary}
113 @item modern-voice-cautionary
114 This rule is the same as @code{modern-voice}, but with the extra
115 accidentals (the ones not typeset by @code{voice}) typeset
116 as cautionaries. Even though all accidentals typeset by
117 @code{default} @emph{are} typeset by this variable,
118 some of them are typeset as cautionaries.
121 @cindex @code{piano} accidentals
122 This rule reflects 20th century practice for piano notation. Very similar to
123 @code{modern} but accidentals also get canceled
124 across the staves in the same @internalsref{GrandStaff} or
125 @internalsref{PianoStaff}.
127 @item piano-cautionary
128 @cindex @code{#(set-accidental-style 'piano-cautionary)}
129 Same as @code{#(set-accidental-style 'piano)} but with the extra
130 accidentals typeset as cautionaries.
133 @cindex @code{no-reset} accidental style
134 This is the same as @code{default} but with accidentals lasting
135 ``forever'' and not only until the next measure
136 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
137 #(set-accidental-style 'no-reset)
142 This is sort of the opposite of @code{no-reset}: Accidentals
143 are not remembered at all---and hence all accidentals are
144 typeset relative to the key signature, regardless of what was
147 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
148 #(set-accidental-style 'forget)
149 \key d\major c4 c cis cis d d dis dis
156 Program reference: @internalsref{Accidental_engraver},
157 @internalsref{Accidental}, and @internalsref{AccidentalPlacement}.
162 Simultaneous notes are considered to be entered in sequential
163 mode. This means that in a chord the accidentals are typeset as if the
164 notes in the chord happened once at a time - in the order in which
165 they appear in the input file.
167 This is a problem when accidentals in a chord depend on each other,
168 which does not happen for the default accidental style. The problem
169 can be solved by manually inserting @code{!} and @code{?} for the
173 @node Expressive stuff
174 @section Expressive stuff
176 Expressive marks help musicians to bring more to the music than simple
183 * Analysis brackets::
188 @node Metronome marks
189 @subsection Metronome marks
192 @cindex beats per minute
193 @cindex metronome marking
195 Metronome settings can be entered as follows
197 \tempo @var{duration} = @var{per-minute}
200 In the MIDI output, they are interpreted as a tempo change. In the
201 layout output, a metronome marking is printed
202 @cindex @code{\tempo}
203 @lilypond[quote,raggedright,verbatim,fragment]
209 Program reference: @internalsref{MetronomeChangeEvent}.
213 Collisions are not checked. If you have notes above the top line of
214 the staff (or notes with articulations, slurs, text, etc), then the
215 metronome marking may be printed on top of musical symbols. If this
216 occurs, increase the padding of the metronome mark to place it
217 further away from the staff.
220 \override Score.MetronomeMark #'padding = #2.5
225 @subsection Text scripts
228 @cindex text items, non-empty
229 @cindex non-empty texts
231 It is possible to place arbitrary strings of text or markup text (see
232 @ref{Text markup}) above or below notes by using a string
233 @code{c^"text"}. By default, these indications do not influence the
234 note spacing, but by using the command @code{\fatText}, the widths
235 will be taken into account
237 @lilypond[quote,fragment,raggedright,verbatim,relative=1]
238 c4^"longtext" \fatText c4_"longlongtext" c4
241 More complex formatting may also be added to a note by using the
243 @lilypond[fragment,raggedright,verbatim,quote]
244 c'4^\markup { bla \bold bla }
247 The @code{\markup} is described in more detail in
253 @cindex @code{\fatText}
255 @cindex @code{\emptyText}
260 In this manual: @ref{Text markup}.
262 Program reference: @internalsref{TextScriptEvent}, @internalsref{TextScript}.
266 @subsection Text spanners
267 @cindex Text spanners
269 Some performance indications, e.g., @i{rallentando} or @i{accelerando},
270 are written as text and are extended over many measures with dotted
271 lines. Such texts are created using text spanners; attach
272 @code{\startTextSpan} and @code{\stopTextSpan} to the first and last
273 notes of the spanner.
275 The string to be printed, as well as the style, is set through object
278 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
280 \override TextSpanner #'direction = #-1
281 \override TextSpanner #'edge-text = #'("rall " . "")
282 c2\startTextSpan b c\stopTextSpan a
288 Internals @internalsref{TextSpanEvent},
289 @internalsref{TextSpanner}.
291 Examples: @inputfileref{input/@/regression,text@/-spanner@/.ly}.
294 @node Analysis brackets
295 @subsection Analysis brackets
297 @cindex phrasing brackets
298 @cindex musicological analysis
299 @cindex note grouping bracket
301 Brackets are used in musical analysis to indicate structure in musical
302 pieces. LilyPond supports a simple form of nested horizontal
303 brackets. To use this, add the @internalsref{Horizontal_bracket_engraver}
304 to @internalsref{Staff} context. A bracket is started with
305 @code{\startGroup} and closed with @code{\stopGroup}
307 @lilypond[quote,raggedright,verbatim]
310 c4\startGroup\startGroup
313 c4\stopGroup\stopGroup
317 \Staff \consists "Horizontal_bracket_engraver"
323 Program reference: @internalsref{HorizontalBracket},
324 @internalsref{NoteGroupingEvent}.
326 Examples: @inputfileref{input/@/regression,note@/-group@/-bracket@/.ly}.
330 @subsection Articulations
331 @cindex Articulations
333 @cindex articulations
337 A variety of symbols can appear above and below notes to indicate
338 different characteristics of the performance. They are added to a note
339 by adding a dash and the character signifying the
340 articulation. They are demonstrated here
342 @lilypondfile[quote,raggedright]{script-abbreviations.ly}
344 The meanings of these shorthands can be changed. See
345 @file{ly/@/script@/-init@/.ly} for examples.
348 The script is automatically placed, but the direction can be forced as
349 well. Like other pieces of LilyPond code, @code{_} will place them
350 below the staff, and @code{^} will place them above.
353 @lilypond[quote,raggedright,fragment,verbatim]
357 Other symbols can be added using the syntax
358 @var{note}@code{\}@var{name}. Again, they
359 can be forced up or down using @code{^} and @code{_},
362 @lilypond[quote,raggedright,verbatim,fragment,relative=2]
363 c\fermata c^\fermata c_\fermata
370 @cindex staccatissimo
380 @cindex organ pedal marks
393 @cindex thumb marking
398 Here is a chart showing all scripts available,
400 @lilypondfile[raggedright,quote]{script-chart.ly}
403 The vertical ordering of scripts is controlled with the
404 @code{script-priority} property. The lower this number, the closer it
405 will be put to the note. In this example, the
406 @internalsref{TextScript} (the sharp symbol) first has the lowest
407 priority, so it is put lowest in the first example. In the second, the
408 prall trill (the @internalsref{Script}) has the lowest, so it is on the
409 inside. When two objects have the same priority, the order in which
410 they are entered decides which one comes first.
413 @lilypond[verbatim,relative=3,raggedright,fragment,quote]
414 \once \override TextScript #'script-priority = #-100
415 a4^\prall^\markup { \sharp }
417 \once \override Script #'script-priority = #-100
418 a4^\prall^\markup { \sharp }
426 Program reference: @internalsref{ScriptEvent}, and @internalsref{Script}.
430 These signs appear in the printed output but have no effect on the
431 MIDI rendering of the music.
440 @node Orchestral music
441 @section Orchestral music
443 @cindex Writing parts
445 Orchestral music involves some special notation, both in the full
446 score and the individual parts. This section explains how to tackle
447 some common problems in orchestral music.
455 * Instrument transpositions::
456 * Multi measure rests::
457 * Automatic part combining::
459 * Different editions from one source::
460 * Quoting other voices::
461 * Formatting cue notes::
467 @node Rehearsal marks
468 @subsection Rehearsal marks
469 @cindex Rehearsal marks
473 To print a rehearsal mark, use the @code{\mark} command
475 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
484 (The letter@tie{}`I' is skipped in accordance with engraving traditions.)
485 @c umm, is the manual the right place for feature requests? :) -gp
486 @c FIXME - should make that tunable.
488 The mark is incremented automatically if you use @code{\mark
489 \default}, but you can also use an integer argument to set the mark
490 manually. The value to use is stored in the property
491 @code{rehearsalMark}.
493 The style is defined by the property @code{markFormatter}. It is a
494 function taking the current mark (an integer) and the current context
495 as argument. It should return a markup object. In the following
496 example, @code{markFormatter} is set to a canned procedure. After a
497 few measures, it is set to function that produces a boxed number.
499 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
500 \set Score.markFormatter = #format-mark-numbers
503 \set Score.markFormatter = #format-mark-box-numbers
509 The file @file{scm/@/translation@/-functions@/.scm} contains the definitions
510 of @code{format-mark-numbers} (the default format), @code{format-mark-box-numbers},
511 @code{format-mark-letters} and @code{format-mark-box-letters}.
512 These can be used as inspiration for other formatting functions.
515 @cindex coda on bar line
516 @cindex segno on bar line
517 @cindex fermata on bar line
518 @cindex bar lines, symbols on
520 The @code{\mark} command can also be used to put signs like coda,
521 segno, and fermata on a bar line. Use @code{\markup} to
522 access the appropriate symbol
524 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
525 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
529 If the mark occurs at a line break, the mark will be printed at the
530 beginning of the next line.
531 @c IMO this is a bug; hopefully it'll be fixed soon, so I can
532 @c delete this sentence. -gp
533 If there is no next line, then the mark will not be printed at all.
534 To print the mark at the end of the current line, use
537 \override Score.RehearsalMark
538 #'break-visibility = #begin-of-line-invisible
544 @cindex bar lines, putting symbols on
548 Program reference: @internalsref{MarkEvent}, @internalsref{RehearsalMark}.
550 Init files: @file{scm/@/translation@/-functions@/.scm} contains the
551 definition of @code{format-mark-numbers} and
552 @code{format-mark-letters}. They can be used as inspiration for other
553 formatting functions.
555 Examples: @inputfileref{input/@/regression,rehearsal@/-mark@/-letter@/.ly},
557 @inputfileref{input/@/regression,rehearsal@/-mark@/-number@/.ly}.
561 @subsection Bar numbers
565 @cindex measure numbers
566 @cindex @code{currentBarNumber}
568 Bar numbers are printed by default at the start of the line. The
569 number itself is stored in the @code{currentBarNumber} property, which
570 is normally updated automatically for every measure.
572 Bar numbers can be typeset at regular intervals instead of at the
573 beginning of each line. This is illustrated in the following example,
574 whose source is available as
575 @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}
577 @lilypondfile[raggedright,quote]{bar-number-regular-interval.ly}
579 Bar numbers can be typeset manually by tweaking the
580 @code{markFormatter} property
582 @lilypond[verbatim,raggedright,quote]
584 \set Score.markFormatter
585 = #(lambda (mark context)
588 (number->string (ly:context-property context
589 'currentBarNumber)))))
591 c1 \bar "||" \mark \default c1 c1 \mark \default c1 \bar "|."
595 Bar numbers can be manually changed by setting the
596 @code{Staff.currentBarNumber} property
598 @lilypond[verbatim,raggedright,quote]
600 \repeat unfold 4 {c4 c c c} \break
601 \set Score.currentBarNumber = #50
602 \repeat unfold 4 {c4 c c c}
608 Program reference: @internalsref{BarNumber}.
611 @inputfileref{input/@/test,bar@/-number@/-every@/-five@/-reset@/.ly},
612 and @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}.
616 Bar numbers can collide with the @internalsref{StaffGroup} bracket, if
617 there is one at the top. To solve this, the
618 @code{padding} property of @internalsref{BarNumber} can be
619 used to position the number correctly.
621 @node Instrument names
622 @subsection Instrument names
624 In an orchestral score, instrument names are printed at the left side
627 This can be achieved by setting @internalsref{Staff}.@code{instrument}
628 and @internalsref{Staff}.@code{instr}. This will print a string before
629 the start of the staff. For the first staff, @code{instrument} is
630 used, for the following ones, @code{instr} is used.
632 @lilypond[quote,verbatim,raggedright,relative=1,fragment]
633 \set Staff.instrument = "Ploink "
634 \set Staff.instr = "Plk "
640 You can also use markup texts to construct more complicated instrument
643 @lilypond[quote,fragment,verbatim,raggedright]
644 \set Staff.instrument = \markup {
645 \column { "Clarinetti"
646 \line { "in B" \smaller \flat } } }
650 For longer instrument names, it may be useful to increase the
651 @code{indent} setting in the @code{\layout} block.
655 Program reference: @internalsref{InstrumentName}.
659 When you put a name on a grand staff or piano staff, the width of the
660 brace is not taken into account. You must add extra spaces to the end of
661 the name to avoid a collision.
663 @node Instrument transpositions
664 @subsection Instrument transpositions
666 The key of a transposing instrument can also be specified. This
667 applies to many wind instruments, for example, clarinets (B-flat, A, and
668 E-flat), horn (F) and trumpet (B-flat, C, D, and E-flat).
670 The transposition is entered after the keyword @code{\transposition}
673 \transposition bes %% B-flat clarinet
677 This command sets the property @code{instrumentTransposition}. The value of
678 this property is used for MIDI output and quotations. It does not
679 affect how notes are printed in the current staff. To change the printed
680 output, see @ref{Transpose}.
682 The pitch to use for @code{\transposition} should correspond to the
683 transposition of the notes. For example, when entering a score in
684 concert pitch, typically all voices are entered in C, so
685 they should be entered as
698 The command @code{\transposition} should be used when the music is
699 entered from a (transposed) orchestral part. For example, in
700 classical horn parts, the tuning of the instrument is often changed
701 during a piece. When copying the notes from the part, use
702 @code{\transposition}, e.g.,
715 @cindex transposition, MIDI
716 @cindex transposition, instrument
719 @node Multi measure rests
720 @subsection Multi measure rests
721 @cindex multi measure rests
722 @cindex Rests, multi measure
726 Multi-measure rests are entered using `@code{R}'. It is specifically
727 meant for full bar rests and for entering parts: the rest can expand
728 to fill a score with rests, or it can be printed as a single
729 multi-measure rest. This expansion is controlled by the property
730 @code{Score.skipBars}. If this is set to true, empty measures will not
731 be expanded, and the appropriate number is added automatically
733 @lilypond[quote,raggedright,fragment,verbatim]
734 \time 4/4 r1 | R1 | R1*2
735 \set Score.skipBars = ##t R1*17 R1*4
738 The @code{1} in @code{R1} is similar to the duration notation used for
739 notes. Hence, for time signatures other than 4/4, you must enter other
740 durations. This can be done with augmentation dots or fractions
742 @lilypond[quote,raggedright,fragment,verbatim]
743 \set Score.skipBars = ##t
752 An @code{R} spanning a single measure is printed as either a whole rest
753 or a breve, centered in the measure regardless of the time signature.
755 If there are only a few measures of rest, LilyPond prints ``church rests''
756 (a series of rectangles) in the staff. To replace that with a simple
757 rest, use @code{MultiMeasureRest.expand-limit}.
759 @lilypond[quote,raggedright,fragment,verbatim]
760 \set Score.skipBars = ##t
762 \override MultiMeasureRest #'expand-limit = 1
767 @cindex text on multi-measure rest
768 @cindex script on multi-measure rest
769 @cindex fermata on multi-measure rest
771 Texts can be added to multi-measure rests by using the
772 @var{note}-@code{markup} syntax (see @ref{Text markup}).
773 A variable (@code{\fermataMarkup}) is provided for
776 @lilypond[quote,raggedright,verbatim,fragment]
777 \set Score.skipBars = ##t
779 R2.*10^\markup { \italic "ad lib." }
783 If you want to have text on the left end of a multi-measure rest,
784 attach the text to a zero-length skip note, i.e.,
792 @cindex whole rests for a full measure
796 Program reference: @internalsref{MultiMeasureRestEvent},
797 @internalsref{MultiMeasureTextEvent},
798 @internalsref{MultiMeasureRestMusicGroup}, and
799 @internalsref{MultiMeasureRest}.
801 The layout object @internalsref{MultiMeasureRestNumber} is for the
802 default number, and @internalsref{MultiMeasureRestText} for user
807 It is not possible to use fingerings (e.g., @code{R1-4}) to put numbers
808 over multi-measure rests. And the pitch of multi-measure rests (or
809 staff-centered rests) can not be influenced.
811 @cindex condensing rests
813 There is no way to automatically condense multiple rests into a single
814 multi-measure rest. Multi-measure rests do not take part in rest
817 Be careful when entering multi-measure rests followed by whole
818 notes. The following will enter two notes lasting four measures each
822 When @code{skipBars} is set, the result will look OK, but the bar
823 numbering will be off.
825 @node Automatic part combining
826 @subsection Automatic part combining
827 @cindex automatic part combining
828 @cindex part combiner
831 Automatic part combining is used to merge two parts of music onto a
832 staff. It is aimed at typesetting orchestral scores. When the two
833 parts are identical for a period of time, only one is shown. In
834 places where the two parts differ, they are typeset as separate
835 voices, and stem directions are set automatically. Also, solo and
836 @emph{a due} parts are identified and can be marked.
838 The syntax for part combining is
841 \partcombine @var{musicexpr1} @var{musicexpr2}
846 The following example demonstrates the basic functionality of the part
847 combiner: putting parts on one staff, and setting stem directions and
850 @lilypond[quote,verbatim,raggedright,fragment]
851 \new Staff \partcombine
852 \relative g' { g g a( b) c c r r }
853 \relative g' { g g r4 r e e g g }
856 The first @code{g} appears only once, although it was
857 specified twice (once in each part). Stem, slur, and tie directions are
858 set automatically, depending whether there is a solo or unisono. The
859 first part (with context called @code{one}) always gets up stems, and
860 `Solo', while the second (called @code{two}) always gets down stems and
863 If you just want the merging parts, and not the textual markings, you
864 may set the property @code{printPartCombineTexts} to false
866 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
868 \set Staff.printPartCombineTexts = ##f
870 \relative g' { g a( b) r }
871 \relative g' { g r4 r f }
875 To change the text that is printed for solos or merging, you may
876 set the @code{soloText}, @code{soloIIText}, and @code{aDueText}
879 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
881 \set Score.soloText = #"ichi"
882 \set Score.soloIIText = #"ni"
883 \set Score.aDueText = #"tachi"
885 \relative g' { g4 g a( b) r }
886 \relative g' { g4 g r r f }
890 Both arguments to @code{\partcombine} will be interpreted as
891 @internalsref{Voice} contexts. If using relative octaves,
892 @code{\relative} should be specified for both music expressions, i.e.,
896 \relative @dots{} @var{musicexpr1}
897 \relative @dots{} @var{musicexpr2}
901 A @code{\relative} section that is outside of @code{\partcombine} has
902 no effect on the pitches of @var{musicexpr1} and @var{musicexpr2}.
906 Program reference: @internalsref{PartCombineMusic},
907 @internalsref{SoloOneEvent}, and
908 @internalsref{SoloTwoEvent}, and
909 @internalsref{UnisonoEvent}.
913 When @code{printPartCombineTexts} is set, when the two voices play the
914 same notes on and off, the part combiner may typeset @code{a2} more
915 than once in a measure.
917 @code{\partcombine} cannot be inside @code{\times}.
919 @code{\partcombine} cannot be inside @code{\relative}.
921 Internally, the @code{\partcombine} interprets both arguments as
922 @code{Voice}s named @code{one} and @code{two}, and then decides when
923 the parts can be combined. Consequently, if the arguments switch to
924 differently named @internalsref{Voice} contexts, the events in those
928 @subsection Hiding staves
930 @cindex Frenched scores
931 @cindex Hiding staves
933 In orchestral scores, staff lines that only have rests are usually
934 removed. This saves some space. This style is called `French Score'.
935 For @internalsref{Lyrics},
936 @internalsref{ChordNames} and @internalsref{FiguredBass}, this is
937 switched on by default. When the lines of these contexts turn out
938 empty after the line-breaking process, they are removed.
940 For normal staves, a specialized @internalsref{Staff} context is
941 available, which does the same: staves containing nothing (or only
942 multi-measure rests) are removed. The context definition is stored in
943 @code{\RemoveEmptyStaffContext} variable. Observe how the second staff
944 in this example disappears in the second line
946 @lilypond[quote,raggedright,verbatim]
948 \context { \RemoveEmptyStaffContext }
953 \new Staff { e4 f g a \break c1 }
954 \new Staff { c4 d e f \break R1 }
959 The first system shows all staves in full. If empty staves should be
960 removed from the first system too, set @code{remove-first} to false in
961 @internalsref{RemoveEmptyVerticalGroup}.
963 Another application is making ossia sections, i.e., alternative
964 melodies on a separate piece of staff, with help of a Frenched
965 staff. See @inputfileref{input/@/test,ossia@/.ly} for an example.
968 @node Different editions from one source
969 @subsection Different editions from one source
972 The @code{\tag} command marks music expressions with a name. These
973 tagged expressions can be filtered out later. With this mechanism it
974 is possible to make different versions of the same music source.
976 In the following example, we see two versions of a piece of music, one
977 for the full score, and one with cue notes for the instrumental part
993 The same can be applied to articulations, texts, etc.: they are
996 -\tag #@var{your-tag}
998 to an articulation, for example,
1003 This defines a note with a conditional fingering indication.
1006 @cindex removeWithTag
1007 By applying the @code{\keepWithTag} and @code{\removeWithTag}
1008 commands, tagged expressions can be filtered. For example,
1012 \keepWithTag #'score @var{the music}
1013 \keepWithTag #'part @var{the music}
1018 @lilypondfile[raggedright,quote]{tag-filter.ly}
1021 The argument of the @code{\tag} command should be a symbol, or a list
1022 of symbols, for example,
1024 \tag #'(original-part transposed-part) @dots{}
1031 Examples: @inputfileref{input/@/regression,tag@/-filter@/.ly}.
1035 Multiple rests are not merged if you create the score with both tagged
1039 @node Quoting other voices
1040 @subsection Quoting other voices
1042 With quotations, fragments of other parts can be inserted into a part
1043 directly. Before a part can be quoted, it must be marked especially as
1044 quotable. This is done with the @code{\addquote} command.
1047 \addquote @var{name} @var{music}
1052 Here, @var{name} is an identifying string. The @var{music} is any kind
1053 of music. Here is an example of @code{\addquote}
1056 \addquote clarinet \relative c' @{
1061 This command must be entered at toplevel, i.e., outside any music
1064 After calling @code{\addquote}, the quotation may then be done with
1065 @code{\quoteDuring} or @code{\cueDuring},
1068 \quoteDuring #@var{name} @var{music}
1071 During a part, a piece of music can be quoted with the @code{\quoteDuring}
1075 \quoteDuring #"clarinet" @{ s2. @}
1078 This would cite three quarter notes (the duration of @code{s2.}) of
1079 the previously added @code{clarinet} voice.
1082 More precisely, it takes the current time-step of the part being
1083 printed, and extracts the notes at the corresponding point of the
1084 @code{\addquote}d voice. Therefore, the argument to @code{\addquote}
1085 should be the entire part of the voice to be quoted, including any
1086 rests at the beginning.
1088 Quotations take into account the transposition of both source and target
1089 instruments, if they are specified using the @code{\transposition} command.
1091 @lilypond[quote,raggedright,verbatim]
1092 \addquote clarinet \relative c' {
1098 e'8 f'8 \quoteDuring #"clarinet" { s2 }
1102 The type of events that are present in cue notes can be trimmed with
1103 the @code{quotedEventTypes} property. The default value is
1104 @code{(note-event rest-event)}, which means that only notes and
1105 rests of the cued voice end up in the @code{\quoteDuring}.
1109 \set Staff.quotedEventTypes =
1110 #'(note-event articulation-event dynamic-event)
1114 will quote notes (but no rests), together with scripts and dynamics.
1118 Only the contents of the first @internalsref{Voice} occurring in an
1119 @code{\addquote} command will be considered for quotation, so
1120 @var{music} can not contain @code{\new} and @code{\context Voice}
1121 statements that would switch to a different Voice.
1123 Quoting grace notes is broken and can even cause LilyPond to crash.
1127 In this manual: @ref{Instrument transpositions}.
1129 Examples: @inputfileref{input/@/regression,quote@/.ly}
1130 @inputfileref{input/@/regression,quote@/-transposition@/.ly}
1132 Program reference: @internalsref{QuoteMusic}.
1134 @node Formatting cue notes
1135 @subsection Formatting cue notes
1137 The previous section deals with inserting notes from another voice.
1138 There is a more advanced music function called @code{\cueDuring},
1139 which makes formatting cue notes easier.
1144 \cueDuring #@var{name} #@var{updown} @var{music}
1147 This will insert notes from the part @var{name} into a
1148 @internalsref{Voice} called @code{cue}. This happens simultaneously
1149 with @var{music}, which usually is a rest. When the cue notes start,
1150 the staff in effect becomes polyphonic for a moment. The argument
1151 @var{updown} determines whether the cue notes should be notated as a
1152 first or second voice.
1155 @lilypond[verbatim,raggedright]
1158 \override Stem #'length = #5.5
1159 \override Beam #'thickness = #0.384
1160 \override Beam #'space-function =
1161 #(lambda (beam mult) (* 0.8 (Beam::space_function beam mult)))
1164 \addquote clarinet \relative {
1169 \new Staff \relative <<
1171 % setup a context for cue notes.
1172 \context Voice = cue { \smaller \skip 1*21 }
1174 \set Score.skipBars = ##t
1178 \cueDuring #"clarinet" #1 {
1187 Here are a couple of hints for successful cue notes
1191 Cue notes have smaller font sizes.
1193 the cued part is marked with the instrument playing the cue.
1195 when the original part takes over again, this should be marked with
1196 the name of the original instrument.
1198 @c really? Are you sure about that last point? I'll check after 3.0 -gp
1200 @c Yes, this is good practice. Otherwise, the start of the original
1201 @c part can only be seen from the font size. This is not good enough
1202 @c for sight-reading. It is possilbe to use other
1203 @c markers (eg. a big close-bracket over the staff) to indicate the cue notes are
1208 any other changes introduced by the cued part should also be
1209 undone. For example, if the cued instrument plays in a different clef,
1210 the original clef should be stated once again.
1218 @node Contemporary notation
1219 @section Contemporary notation
1221 In the 20th century, composers have greatly expanded the musical
1222 vocabulary. With this expansion, many innovations in musical notation
1223 have been tried. The book ``Music Notation in the 20th century'' by
1224 Kurt Stone gives a comprehensive overview (see @ref{Literature
1225 list}). In general, the use of new, innovative notation makes a piece
1226 harder to understand and perform and its use should therefore be
1227 avoided. For this reason, support for contemporary notation in
1228 LilyPond is limited.
1232 * Polymetric notation::
1234 * Special fermatas::
1239 @node Polymetric notation
1240 @subsection Polymetric notation
1242 Double time signatures are not supported explicitly, but they can be
1243 faked. In the next example, the markup for the time signature is
1244 created with a markup text. This markup text is inserted in the
1245 @internalsref{TimeSignature} grob.
1247 @lilypond[verbatim,raggedright]
1252 \musicglyph #"scripts.stopped"
1253 \bracket \column { "5" "8" }
1258 \override Staff.TimeSignature #'print-function = #Text_interface::print
1259 \override Staff.TimeSignature #'text = #tsMarkup
1261 c'2 \bar ":" c'4 c'4.
1265 Each staff can also have its own time signature. This is done by
1266 moving the @internalsref{Timing_engraver} to the @internalsref{Staff}
1271 \context @{ \Score \remove "Timing_engraver" @}
1272 \context @{ \Staff \consists "Timing_engraver" @}
1277 Now, each staff has its own time signature.
1290 c4. c8 c c c4. c8 c c
1295 @lilypond[quote,raggedright]
1297 \context{ \Score \remove "Timing_engraver" }
1298 \context{ \Staff \consists "Timing_engraver" }
1312 c4. c8 c c c4. c8 c c
1318 A different form of polymetric notation is where note lengths have
1319 different values across staves.
1321 This notation can be created by setting a common time signature for
1322 each staff but replacing it manually using
1323 @code{timeSignatureFraction} to the desired fraction. Then the printed
1324 durations in each staff are scaled to the common time signature.
1325 The latter is done with @code{\compressmusic}, which is similar to
1326 @code{\times}, but does not create a tuplet bracket.
1329 In this example, music with the time signatures of 3/4, 9/8, and 10/8 are
1330 used in parallel. In the second staff, shown durations are multiplied by
1331 2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are
1332 multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
1334 @lilypond[quote,raggedright,verbatim,fragment]
1342 \set Staff.timeSignatureFraction = #'(9 . 8)
1343 \compressmusic #'(2 . 3)
1344 \repeat unfold 6 { c8[ c c] }
1348 \set Staff.timeSignatureFraction = #'(10 . 8)
1349 \compressmusic #'(3 . 5) {
1350 \repeat unfold 2 { c8[ c c] }
1351 \repeat unfold 2 { c8[ c] }
1352 | c4. c4. \times 2/3 { c8 c c } c4
1363 When using different time signatures in parallel, the spacing is
1364 aligned vertically, but bar lines distort the regular spacing.
1369 @subsection Clusters
1373 A cluster indicates a continuous range of pitches to be played. They
1374 can be denoted as the envelope of a set of notes. They are entered by
1375 applying the function @code{makeClusters} to a sequence of
1377 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1378 \makeClusters { <c e > <b f'> }
1381 The following example (from
1382 @inputfileref{input/@/regression,cluster@/.ly}) shows what the result
1385 @lilypondfile[raggedright,quote]{cluster.ly}
1387 Ordinary notes and clusters can be put together in the same staff,
1388 even simultaneously. In such a case no attempt is made to
1389 automatically avoid collisions between ordinary notes and clusters.
1393 Program reference: @internalsref{ClusterSpanner},
1394 @internalsref{ClusterSpannerBeacon},
1395 @internalsref{Cluster_spanner_engraver}, and
1396 @internalsref{ClusterNoteEvent}.
1398 Examples: @inputfileref{input/@/regression,cluster@/.ly}.
1402 Music expressions like @code{<< @{ g8 e8 @} a4 >>} are not printed
1403 accurately. Use @code{<g a>8 <e a>8} instead.
1407 @node Special fermatas
1408 @subsection Special fermatas
1410 @cindex fermatas, special
1412 In contemporary music notation, special fermata symbols denote breaks
1413 of differing lengths. The following fermatas are supported
1415 @lilypond[quote,raggedright]
1438 \context Lyrics \lyricmode {
1439 \override LyricText #'font-family = #'typewriter
1440 "shortfermata" "fermata" "longfermata" "verylongfermata"
1445 See @ref{Articulations} for general instructions how to apply scripts
1446 such as fermatas to notes.
1448 @node Feathered beams
1449 @subsection Feathered beams
1451 Feathered beams are not supported natively, but they can be faked by
1452 forcing two beams to overlap. Here is an example,
1454 @c don't change relative setting witout changing positions!
1455 @lilypond[raggedright,relative=1,fragment,verbatim]
1460 \once \override Voice.Beam #'positions = #'(0 . 0.5)
1465 \once \override Voice.Beam #'positions = #'(0 . -0.5)
1473 @subsection Improvisation
1475 Improvisation is sometimes denoted with slashed note heads. Such note
1476 heads can be created by adding a @internalsref{Pitch_squash_engraver}
1477 to the @internalsref{Staff} or @internalsref{Voice} context. Then, the
1481 \set squashedPosition = #0
1482 \override NoteHead #'style = #'slash
1486 switches on the slashes.
1488 There are shortcuts @code{\improvisationOn} (and an accompanying
1489 @code{\improvisationOff}) for this command sequence. They are used in
1490 the following example
1492 @lilypond[verbatim,raggedright,quote]
1494 \consists Pitch_squash_engraver
1496 e8 e g a a16(bes)(a8) g \improvisationOn
1499 ~fis2 \improvisationOff a16(bes) a8 g e
1504 @node Educational use
1505 @section Educational use
1507 With the amount of control that LilyPond offers, one can make great
1508 teaching tools in addition to great musical scores.
1512 * Blank music sheet::
1514 * Shaped note heads ::
1515 * Easy Notation note heads::
1519 @subsection Balloon help
1521 Elements of notation can be marked and named with the help of a square
1522 balloon. The primary purpose of this feature is to explain notation.
1524 The following example demonstrates its use.
1526 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
1529 #(add-balloon-text 'NoteHead "heads, or tails?"
1536 The function @code{add-balloon-text} takes the name of a grob, the
1537 label to print, and the position where to put the label relative to
1538 the object. In the above example, the text ``heads or tails?'' ends
1539 3 spaces below and 1 space to the right of the marked head.
1542 @cindex notation, explaining
1546 Program reference: @internalsref{text-balloon-interface}.
1548 Examples: @inputfileref{input/@/regression,balloon@/.ly}.
1553 @node Blank music sheet
1554 @subsection Blank music sheet
1556 A blank music sheet can be produced also by using invisible notes, and
1557 removing @code{Bar_number_engraver}.
1560 @lilypond[quote,verbatim]
1562 \repeat unfold 2 % Change this for more lines.
1567 \override TimeSignature #'transparent = ##t
1568 defaultBarType = #""
1569 \remove Bar_number_engraver
1571 \context Staff \emptymusic
1572 \context TabStaff \emptymusic
1578 @subsection Hidden notes
1580 @cindex Hidden notes
1581 @cindex Invisible notes
1582 @cindex Transparent notes
1584 Hidden (or invisible or transparent) notes can be useful in preparing theory
1585 or composition exercises.
1587 @lilypond[quote,raggedright,verbatim,relative=2,fragment]
1595 Hidden notes are also great for performing weird tricks. For example,
1596 slurs cannot be attached to rests or spacer rests, but you may wish
1597 to include that in your score -- string instruments use this notation
1598 when doing pizzicato to indicate that the note should ring for as long
1601 @lilypond[quote,raggedright,verbatim,relative=0,fragment]
1604 c4^"pizz"( \hideNotes c)
1605 \unHideNotes c( \hideNotes c)
1612 @node Shaped note heads
1613 @subsection Shaped note heads
1615 In shaped note head notation, the shape of the note head corresponds
1616 to the harmonic function of a note in the scale. This notation was
1617 popular in the 19th century American song books.
1619 Shaped note heads can be produced by setting @code{\aikenHeads} or
1620 @code{\sacredHarpHeads}, depending on the style desired.
1622 @lilypond[verbatim,relative=1,fragment]
1629 Shapes are determined on the step in the scale, where the base of the
1630 scale is determined by the @code{\key} command
1633 @findex shapeNoteStyles
1635 @findex \sacredHarpHeads
1637 Shaped note heads are implemented through the @code{shapeNoteStyles}
1638 property. Its value is a vector of symbols. The k-th element indicates
1639 the style to use for the k-th step of the scale. Arbitrary
1640 combinations are possible, eg.,
1643 @lilypond[verbatim,relative=1,fragment]
1644 \set shapeNoteStyles = ##(cross triangle fa #f mensural xcircle diamond)
1649 @node Easy Notation note heads
1650 @subsection Easy Notation note heads
1652 @cindex easy notation
1655 The `easy play' note head includes a note name inside the head. It is
1656 used in music for beginners
1658 @lilypond[quote,raggedright,verbatim,fragment,staffsize=26]
1663 The command @code{\setEasyHeads} overrides settings for the
1664 @internalsref{NoteHead} object. To make the letters readable, it has
1665 to be printed in a large font size. To print with a larger font, see
1666 @ref{Setting global staff size}.
1670 @cindex @code{\setEasyHeads}
1671 @code{\setEasyHeads}