3 @c A menu is needed before every deeper *section nesting of @node's; run
4 @c M-x texinfo-all-menus-update
5 @c to automagically fill in these menus before saving changes
7 @c FIXME: singular vs. plural: Beams/Beam
15 @c .{Reference Manual}
17 @node Reference Manual
18 @chapter Reference Manual
21 <!--- @@WEB-TITLE@@=Reference Manual --->
24 This document describes GNU LilyPond and its input format. The last
25 revision of this document was made for LilyPond 1.6.2. It assumes
26 that you already know a little bit about LilyPond input (how to
27 make an input file, how to create sheet music from that input file,
28 etc). New users are encouraged to study the tutorial before reading
34 * Easier music entry::
53 @c FIXME: Note entry vs Music entry at top level menu is confusing.
59 Notes constitute the most basic elements of LilyPond input, but they do
60 not form valid input on their own without a @code{\score} block. However,
61 for the sake of brevity and simplicity we will generally omit
62 @code{\score} blocks and @code{\paper} declarations in this manual.
68 * Chromatic alterations::
73 * Automatic note splitting ::
75 * Easy Notation note heads ::
83 A note is printed by specifying its pitch and then its duration.
84 @lilypond[fragment,verbatim]
93 @cindex Note specification
95 @cindex entering notes
97 The verbose syntax for pitch specification is
101 \pitch @var{scmpitch}
104 where @var{scmpitch} is a pitch scheme object.
106 In Note and Chord mode, pitches may be designated by names. The default
107 names are the Dutch note names. The notes are specified by the letters
108 @code{a} through @code{g}, while the octave is formed with notes ranging
109 from @code{c} to @code{b}. The pitch @code{c} is an octave below
110 middle C and the letters span the octave above that C. Here's an example
111 which should make things more clear:
113 @lilypond[fragment,verbatim]
115 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
118 @cindex note names, Dutch
120 In Dutch, a sharp is formed by adding @code{-is} to the end of a pitch
121 name and a flat is formed by adding @code{-es}. Double sharps and double
122 flats are obtained by adding @code{-isis} or @code{-eses}. @code{aes}
123 and @code{ees} are contracted to @code{as} and @code{es} in Dutch, but
124 both forms are accepted.
126 LilyPond has predefined sets of note names for various other languages.
127 To use them, simply include the language specific init file. For
128 example: @code{\include "english.ly"}. The available language files and
129 the note names they define are:
134 Note Names sharp flat
135 nederlands.ly c d e f g a bes b -is -es
136 english.ly c d e f g a bf b -s/-sharp -f/-flat
137 deutsch.ly c d e f g a b h -is -es
138 norsk.ly c d e f g a b h -iss/-is -ess/-es
139 svenska.ly c d e f g a b h -iss -ess
140 italiano.ly do re mi fa sol la sib si -d -b
141 catalan.ly do re mi fa sol la sib si -d/-s -b
142 espanol.ly do re mi fa sol la sib si -s -b
151 The optional octave specification takes the form of a series of
152 single quote (`@code{'}') characters or a series of comma
153 (`@code{,}') characters. Each @code{'} raises the pitch by one
154 octave; each @code{,} lowers the pitch by an octave.
156 @lilypond[fragment,verbatim,center]
157 c' c'' es' g' as' gisis' ais'
160 @node Chromatic alterations
161 @subsection Chromatic alterations
163 Normally accidentals are printed automatically, but you may also
164 print them manually. A reminder accidental
165 @cindex reminder accidental
167 can be forced by adding an exclamation mark @code{!}
168 after the pitch. A cautionary accidental
169 @cindex cautionary accidental
170 @cindex parenthesized accidental
171 (an accidental within parentheses) can be obtained by adding the
172 question mark `@code{?}' after the pitch.
174 @lilypond[fragment,verbatim]
175 cis' cis' cis'! cis'?
179 The automatic production of accidentals can be tuned in many
180 ways. For more information, refer to @ref{Accidentals}.
187 Rests are entered like notes, with a ``note name'' of `@code{r}':
189 @lilypond[singleline,verbatim]
193 Whole bar rests, centered in middle of the bar, are specified using
194 @code{R} (capital R); see @ref{Multi measure rests}. See also
197 For some music, you may wish to explicitly specify the rest's vertical
198 position. This can be achieved by entering a note with the @code{\rest}
199 keyword appended. Rest collision testing will leave these rests alone.
201 @lilypond[singleline,verbatim]
211 @cindex Invisible rest
214 An invisible rest (also called a `skip') can be entered like a note
215 with note name `@code{s}' or with @code{\skip @var{duration}}:
217 @lilypond[singleline,verbatim]
221 @c FIXME: in Lyrics mode, we have " " and _
223 In Lyrics mode, invisible rests are entered using either `@code{" "}'
225 @lilypond[singleline,verbatim]
227 \context Lyrics \lyrics { lah2 di4 " " dah2 _4 di }
228 \notes\relative c'' { a2 a4 a a2 a4 a }
232 Note that the @code{s} syntax is only available in Note mode and Chord
233 mode. In other situations, you should use the @code{\skip} command,
234 which will work outside of those two modes:
236 @lilypond[singleline,verbatim]
239 { \time 4/8 \skip 2 \time 4/4 }
240 \notes\relative c'' { a2 a1 }
245 The skip command is merely an empty musical placeholder. It doesn't
246 produce any output, not even transparent output.
252 @subsection Durations
256 @cindex @code{\duration}
259 In Note, Chord, and Lyrics mode, durations are designated by numbers
260 and dots: durations are entered as their reciprocal values. For example,
261 a quarter note is entered using a @code{4} (since it's a 1/4 note), while
262 a half note is entered using a @code{2} (since it's a 1/2 note). For notes
263 longer than a whole you must use identifiers.
264 @c FIXME: what's an identifier? I don't think it's been introduced yet.
265 @c and if it has, I obviously skipped that part. - Graham
269 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
271 r1 r2 r4 r8 r16 r32 r64 r64
274 @lilypond[noindent,noquote]
276 \notes \relative c'' {
278 a1 a2 a4 a8 a16 a32 a64 a64
280 r1 r2 r4 r8 r16 r32 r64 r64
285 \remove "Clef_engraver"
286 \remove "Staff_symbol_engraver"
287 \remove "Time_signature_engraver"
288 \consists "Pitch_squash_engraver"
295 If the duration is omitted then it is set to the previously entered
296 duration. At the start of parsing, a quarter note is assumed. The
297 duration can be followed by dots (`@code{.}') in order to obtain dotted
301 @lilypond[fragment,verbatim,center]
302 a' b' c''8 b' a'4 a'4. b'4.. c'8.
307 You can alter the length of duration by a fraction @var{N/M}
308 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
309 won't affect the appearance of the notes or rests produced.
311 @lilypond[fragment,verbatim]
312 a'2*2 b'4*2 a'8*4 a'4*3/2 gis'4*3/2 a'4*3/2 a'4
315 Durations can also be produced through GUILE extension mechanism.
316 @lilypond[verbatim,fragment]
317 c'\duration #(ly:make-duration 2 1)
323 Dot placement for chords is not perfect. In some cases, dots overlap:
336 A tie connects two adjacent note heads of the same pitch. The tie in
337 effect extends the length of a note. Ties should not be confused with
338 slurs, which indicate articulation, or phrasing slurs, which indicate
339 musical phrasing. A tie is entered using the tilde symbol `@code{~}'.
341 @lilypond[fragment,verbatim,center]
342 e' ~ e' <<c' e' g'>> ~ <<c' e' g'>>
345 When a tie is applied to a chord, all note heads (whose pitches match) are
346 connected. If you try to tie together chords that have no common pitches,
347 no ties will be created.
349 If you want less ties created for a chord, you can set
350 @code{Voice.sparseTies} to true. In this case, a single tie is used
351 for every tied chord.
352 @lilypond[fragment,verbatim,center]
353 \property Voice.sparseTies = ##t
354 <<c' e' g'>> ~ <<c' e' g'>>
357 In its meaning a tie is just a way of extending a note duration, similar
358 to the augmentation dot: the following example are two ways of notating
359 exactly the same concept.
361 @lilypond[fragment, singleline]
362 \time 3/4 c'2. c'2 ~ c'4
364 If you need to tie notes over bars, it may be easier to use
365 @ref{Automatic note splitting}.
367 See also @seeinternals{Tie}.
372 At present, the tie is represented as a separate event, temporally
373 located in between the notes. Tying only a subset of the note heads
374 of a chord is not supported in a simple way. It can be achieved by
375 moving the tie-engraver into the Thread context and turning on and off
378 Switching staves when a tie is active will not work.
380 @node Automatic note splitting
381 @subsection Automatic note splitting
382 @c FIXME: This subsection doesn't belong in @ref{Note entry}.
384 LilyPond can automatically converting long notes to tied notes. This
385 is done by replacing the @code{Note_heads_engraver} by the
386 @code{Completion_heads_engraver}.
388 @lilypond[verbatim,noindent,noquote]
390 \notes\relative c'{ \time 2/4
391 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
395 \remove "Note_heads_engraver"
396 \consists "Completion_heads_engraver"
400 This engraver splits all running notes at the bar line, and inserts
401 ties. One of its uses is to debug complex scores: if the measures are
402 not entirely filled, then the ties exactly show how much each measure
407 Not all durations (especially those containing tuplets) can be
408 represented exactly; the engraver will not insert tuplets.
415 @cindex @code{\times}
417 Tuplets are made out of a music expression by multiplying all durations
420 @cindex @code{\times}
422 \times @var{fraction} @var{musicexpr}
425 The duration of @var{musicexpr} will be multiplied by the fraction.
426 In the sheet music, the fraction's denominator will be printed over
427 the notes, optionally with a bracket. The most common tuplet is the
428 triplet in which 3 notes have the length of 2, so the notes are 2/3
429 of their written length:
431 @lilypond[fragment,verbatim,center]
432 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
435 The property @code{tupletSpannerDuration} specifies how long each bracket
436 should last. With this, you can make lots of tuplets while typing
437 @code{\times} only once, saving you lots of typing.
439 @lilypond[fragment, relative, singleline, verbatim]
440 \property Voice.tupletSpannerDuration = #(ly:make-moment 1 4)
441 \times 2/3 { c'8 c c c c c }
444 The format of the number is determined by the property
445 @code{tupletNumberFormatFunction}. The default prints only the
446 denominator, but if you set it to the Scheme function
447 @code{fraction-tuplet-formatter}, Lilypond will print @var{num}:@var{den}
451 @cindex @code{tupletNumberFormatFunction}
452 @cindex tuplet formatting
454 See also @seeinternals{TupletBracket}.
458 Nested tuplets are not formatted automatically. In this case, outer
459 tuplet brackets should be moved automatically.
461 @node Easy Notation note heads
462 @subsection Easy Notation note heads
464 @cindex easy notation
467 A entirely different type of note head is the "easyplay" note head: a
468 note head that includes a note name. It is used in some publications by
469 Hal-Leonard Inc. music publishers.
471 @lilypond[singleline,verbatim,26pt]
473 \notes { c'2 e'4 f' | g'1 }
474 \paper { \translator { \EasyNotation } }
478 Note that @code{EasyNotation} overrides a @internalsref{Score} context. You
479 probably will want to print it with magnification or a large font size to
480 make it more readable. To print with magnification, you must create a dvi
481 (with @file{ly2dvi}) and then enlarge it with something like @file{dvips -x
482 2000 file.dvi}. See @file{man dvips} for details. To print with a larger
483 font, see @ref{Font Size}.
489 If you view the result with Xdvi, then staff lines will show through
490 the letters. Printing the PostScript file obtained with ly2dvi does
491 produce the correct result.
494 @node Easier music entry
495 @section Easier music entry
498 * Graphical interfaces::
502 * Skipping corrected music::
505 When entering music with LilyPond, it is easy to introduce errors. This
506 section deals with tricks and features that help you enter music, and
507 find and correct mistakes.
509 @node Graphical interfaces
510 @subsection Graphical interfaces
513 @cindex graphical interface
520 One way to avoid entering notes using the keyboard is to use a
521 graphical user interface. The following programs are known to have
522 a lilypond export option:
526 Denemo was once intended as
527 a LilyPond graphical user interface. It run on Gnome/GTK.
530 @uref{http://denemo.sourceforge.net/}
534 Noteedit, a graphical score editor that runs under KDE/Qt.
536 @uref{http://rnvs.informatik.tu-chemnitz.de/~jan/noteedit/noteedit.html,}
540 RoseGarden was once the inspiration for naming LilyPond. Nowadays it
541 has been rewritten from scratch and supports LilyPond export as of
545 @uref{http://rosegarden.sf.net/}
549 Another option is to enter the music using your favorite MIDI
550 sequencer, and then import it using midi2ly. midi2ly is described in
551 @ref{Invoking midi2ly}.
555 @node Relative octaves
556 @subsection Relative octaves
558 @cindex relative octave specification
560 Octaves are specified by adding @code{'} and @code{,} to pitch names.
561 When you copy existing music, it is easy to accidentally put a pitch in
562 the wrong octave and hard to find such an error. To prevent these
563 errors, LilyPond features octave entry.
565 @cindex @code{\relative}
567 \relative @var{startpitch} @var{musicexpr}
570 The octave of notes that appear in @var{musicexpr} are calculated as
571 follows: If no octave changing marks are used, the basic interval
572 between this and the last note is always taken to be a fourth or less
573 (This distance is determined without regarding alterations; a
574 @code{fisis} following a @code{ceses} will be put above the
577 The octave changing marks @code{'} and @code{,} can be added to raise or
578 lower the pitch by an extra octave. Upon entering relative mode, an
579 absolute starting pitch must be specified that will act as the
580 predecessor of the first note of @var{musicexpr}.
582 Entering music that changes octave frequently is easy in relative mode.
583 @lilypond[fragment,singleline,verbatim,center]
589 And octave changing marks are used for intervals greater than a fourth.
590 @lilypond[fragment,verbatim,center]
595 If the preceding item is a chord, the first note of the chord is used
596 to determine the first note of the next chord. However, other notes
597 within the second chord are determined by looking at the immediately
600 @lilypond[fragment,verbatim,center]
607 @cindex @code{\notes}
609 The pitch after the @code{\relative} contains a note name. To parse
610 the pitch as a note name, you have to be in note mode, so there must
611 be a surrounding @code{\notes} keyword (which is not
614 The relative conversion will not affect @code{\transpose},
615 @code{\chords} or @code{\relative} sections in its argument. If you
616 want to use relative within transposed music, you must place an
617 additional @code{\relative} inside the @code{\transpose}.
622 @subsection Bar check
626 @cindex @code{barCheckSynchronize}
630 Whenever a bar check is encountered during interpretation, a warning
631 message is issued if it doesn't fall at a measure boundary. This can
632 help you find errors in the input. Depending on the value of
633 @code{barCheckSynchronize}, the beginning of the measure will be
634 relocated, so this can also be used to shorten measures.
636 A bar check is entered using the bar symbol, @code{|}:
638 \time 3/4 c2 e4 | g2.
643 @cindex skipTypesetting
645 Failed bar checks are most often caused by entering incorrect
646 durations. Incorrect durations often completely garble up the score,
647 especially if it is polyphonic, so you should start correcting the score
648 by scanning for failed bar checks and incorrect durations. To speed up
649 this process, you can use @code{skipTypesetting} (See @ref{Skipping
652 @c . {Point and click}
653 @node Point and click
654 @subsection Point and click
655 @cindex poind and click
657 Point and click lets you find notes in the input by clicking on them in
658 the Xdvi window. This makes it very easy to find input that causes some
659 error in the sheet music.
661 To use it, you need the following software
663 @item A dvi viewer that supports src specials.
665 @item Xdvi, version 22.36 or newer. Available from
666 @uref{ftp://ftp.math.berkeley.edu/pub/Software/TeX/xdvi.tar.gz,ftp.math.berkeley.edu}.
668 Note that most @TeX{} distributions ship with xdvik, which is always
669 a few versions behind the official Xdvi. To find out which xdvi you
670 are running, try @code{xdvi -version} or @code{xdvi.bin -version}.
671 @item KDVI. A dvi viewer for KDE. You need KDVI from KDE 3.0 or
672 newer. Enable option @emph{Inverse search} in the menu @emph{Settings}.
681 @item An editor with a client/server interface (or a lightweight GUI
687 @item Emacs. Emacs is an extensible text-editor. It is available from
688 @uref{http://www.gnu.org/software/emacs/}. You need version 21 to use
691 @c move this elsewhere?
693 LilyPond also comes with support files for emacs: lilypond-mode for
694 emacs provides indentation, syntax coloring and handy compile
695 short-cuts. If lilypond-mode is not installed on your platform, then
696 refer to the installation instructions for more information
700 @cindex lilypond-mode for emacs
701 @cindex syntax coloring
703 @item XEmacs. Xemacs is very similar to emacs.
707 @item NEdit. NEdit runs under Windows, and Unix.
708 It is available from @uref{http://www.nedit.org}.
712 @item GVim. GVim is a GUI variant of VIM, the popular VI
713 clone. It is available from @uref{http://www.vim.org}.
722 Xdvi must be configured to find the @TeX{} fonts and music
723 fonts. Refer to the Xdvi documentation for more information.
725 To use point-and-click, add one of these lines to the top of your .ly
728 #(ly:set-point-and-click 'line)
730 @cindex line-location
732 When viewing, Control-Mousebutton 1 will take you to the originating
733 spot in the @file{.ly} file. Control-Mousebutton 2 will show all
736 If you correct large files with point-and-click, be sure to start
737 correcting at the end of the file. When you start at the top, and
738 insert one line, all following locations will be off by a line.
741 For using point-and-click with emacs, add the following
742 In your emacs startup file (usually @file{~/.emacs}),
747 Make sure that the environment variable @var{XEDITOR} is set to
749 emacsclient --no-wait +%l %f
751 @cindex @var{XEDITOR}
752 If you use xemacs instead of emacs, you use @code{(gnuserve-start)} in
753 your @file{.emacs}, and set @code{XEDITOR} to @code{gnuclient -q +%l %f}
755 For using Vim, set @code{XEDITOR} to @code{gvim --remote +%l %f}, or
756 use this argument with xdvi's @code{-editor} option.
759 For using NEdit, set @code{XEDITOR} to @code{nc -noask +%l %f}, or
760 use this argument with xdvi's @code{-editor} option.
762 If can also make your editor jump to the exact location of the note
763 you clicked. This is only supported on Emacs and VIM. Users of Emacs version
764 20 must apply the patch @file{emacsclient.patch}. Users of version 21
765 must apply @file{server.el.patch} (version 21.2 and earlier). At the
766 top of the @code{ly} file, replace the @code{set-point-and-click} line
767 with the following line,
769 #(ly:set-point-and-click 'line-column)
771 @cindex line-colomn-location
772 and set @code{XEDITOR} to @code{emacsclient --no-wait +%l:%c %f}. Vim
773 users can set @var{XEDITOR} to @code{gvim --remote +:%l:norm%c| %f}.
779 When you convert the @TeX{} file to PostScript using @code{dvips}, it
780 will complain about not finding @code{src:X:Y} files. These complaints
781 are harmless, and can be ignored.
783 @node Skipping corrected music
784 @subsection Skipping corrected music
786 The property @code{Score.skipTypesetting} can be used to switch on and
787 off typesetting completely during the interpretation phase. When
788 typesetting is switched off, the music is processed much more quickly.
789 You can use this to skip over the parts of a score that you have already
792 @lilypond[fragment,singleline,verbatim]
794 \property Score.skipTypesetting = ##t
796 \property Score.skipTypesetting = ##f
804 @section Staff notation
806 This section deals with music notation that occurs on staff level,
807 such as keys, clefs and time signatures.
809 @cindex Staff notation
821 @subsection Staff symbol
824 @cindex adjusting staff symbol
825 @cindex StaffSymbol, using \property
826 @cindex staff lines, setting number of
829 The lines of the staff symbol are formed by the
830 @internalsref{StaffSymbol} object. This object is created at the moment
831 that their context is created. You can not change the appearance of
832 the staff symbol by using @code{\override} or @code{\set}. At the
833 moment that @code{\property Staff} is interpreted, a Staff context is
834 made, and the StaffSymbol is created before any @code{\override} is
835 effective. You can deal with this either overriding properties in a
836 @code{\translator} definition, or by using @code{\outputproperty}.
841 If you end a staff half way a piece, the staff symbol may not end
842 exactly on the barline.
847 @subsection Key signature
852 Setting or changing the key signature is done with the @code{\key}
855 @code{\key} @var{pitch} @var{type}
858 @cindex @code{\minor}
859 @cindex @code{\major}
860 @cindex @code{\minor}
861 @cindex @code{\ionian}
862 @cindex @code{\locrian}
863 @cindex @code{\aeolian}
864 @cindex @code{\mixolydian}
865 @cindex @code{\lydian}
866 @cindex @code{\phrygian}
867 @cindex @code{\dorian}
869 Here, @var{type} should be @code{\major} or @code{\minor} to get
870 @var{pitch}-major or @var{pitch}-minor, respectively.
871 The standard mode names @code{\ionian},
872 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
873 @code{\phrygian}, and @code{\dorian} are also defined.
875 This command sets the context property @code{Staff.keySignature}.
876 Non-standard key signatures can be specified by setting this property
879 The printed signature is a @internalsref{KeySignature} object, typically
880 created in @internalsref{Staff} context.
882 @cindex @code{keySignature}
889 The clef can be set or changed with the @code{\clef} command:
890 @lilypond[fragment,verbatim]
891 \key f\major c''2 \clef alto g'2
894 Supported clef-names include
895 @c Moved standard clefs to the top /MB
897 @item treble, violin, G, G2
906 G clef on 1st line, so-called French violin clef
921 By adding @code{_8} or @code{^8} to the clef name, the clef is
922 transposed one octave down or up, respectively. Note that you have to
923 enclose @var{clefname} in quotes if you use underscores or digits in the
929 The object for this symbol is @internalsref{Clef}.
932 This command is equivalent to setting @code{clefGlyph},
933 @code{clefPosition} (which controls the Y position of the clef),
934 @code{centralCPosition} and @code{clefOctavation}. A clef is created
935 when any of these properties are changed.
938 @c . {Time signature}
940 @subsection Time signature
941 @cindex Time signature
945 The time signature is set or changed by the @code{\time}
947 @lilypond[fragment,verbatim]
948 \time 2/4 c'2 \time 3/4 c'2.
951 The actual symbol that's printed can be customized with the @code{style}
952 property. Setting it to @code{#'()} uses fraction style for 4/4 and
956 The object for this symbol is @internalsref{TimeSignature}. There are
957 many more options for its layout. They are selected through the
958 @code{style} object property. See @file{input/test/time.ly} for more
961 This command sets the property @code{timeSignatureFraction},
962 @code{beatLength} and @code{measureLength} in the @code{Timing}
963 context, which is normally aliased to @internalsref{Score}. The property
964 @code{timeSignatureFraction} determine where bar lines should be
965 inserted, and how automatic beams should be generated. Changing the
966 value of @code{timeSignatureFraction} also causes a time signature
967 symbol to be printed.
969 More options are available through the Scheme function
970 @code{set-time-signature}. In combination with the
971 @internalsref{Measure_grouping_engraver}, it will create
972 @internalsref{MeasureGrouping} signs. Such signs ease reading
973 rhythmically complex modern music. In the following example, the 9/8
974 measure is subdivided in 2, 2, 2 and 3. This is passed to
975 @code{set-time-signature} as the third argument @code{(2 2 2 3)}.
978 \score { \notes \relative c'' {
979 #(set-time-signature 9 8 '(2 2 2 3))
980 g8 g d d g g a8-[-( bes g-]-) |
981 #(set-time-signature 5 8 '(3 2))
986 \translator { \StaffContext
987 \consists "Measure_grouping_engraver"
996 @cindex partial measure
997 @cindex measure, partial
998 @cindex shorten measures
999 @cindex @code{\partial}
1001 Partial measures, for example in upbeats, are entered using the
1002 @code{\partial} command:
1003 @lilypond[fragment,verbatim]
1004 \partial 4* 5/16 c'16 c4 f16 a'2. ~ a'8. a'16 | g'1
1007 The syntax for this command is
1009 \partial @var{duration}
1011 This is internally translated into
1013 \property Timing.measurePosition = -@var{length of duration}
1016 The property @code{measurePosition} contains a rational number
1017 indicating how much of the measure has passed at this point.
1020 @node Unmetered music
1021 @subsection Unmetered music
1023 Bar lines and bar numbers are calculated automatically. For unmetered
1024 music (e.g. cadenzas), this is not desirable. The commands
1025 @code{\cadenzaOn} and @code{\cadenzaOff} can be used to switch off the
1028 @lilypond[fragment,relative,singleline,verbatim]
1036 The property @code{Score.timing} can be used to switch off this
1041 @subsection Bar lines
1045 @cindex measure lines
1048 Bar lines are inserted automatically, but if you need a special type
1049 of barline, you can force one using the @code{\bar} command:
1050 @lilypond[fragment,verbatim] c4 \bar "|:" c4
1053 The following bar types are available
1054 @lilypond[fragment, relative, singleline, verbatim]
1066 You are encouraged to use @code{\repeat} for repetitions. See
1069 In scores with many staves, the barlines are automatically placed at
1070 top level, and they are connected between different staves of a
1071 @internalsref{StaffGroup}:
1072 @lilypond[fragment, verbatim]
1073 < \context StaffGroup <
1074 \context Staff = up { e'4 d'
1077 \context Staff = down { \clef bass c4 g e g } >
1078 \context Staff = pedal { \clef bass c2 c2 } >
1081 The objects that are created at @internalsref{Staff} level. The name is
1082 @internalsref{BarLine}.
1084 The command @code{\bar @var{bartype}} is a short cut for
1085 doing @code{\property Score.whichBar = @var{bartype}}
1086 Whenever @code{whichBar} is set to a string, a bar line of that type is
1087 created. @code{whichBar} is usually set automatically: at the start of
1088 a measure it is set to @code{defaultBarType}. The contents of
1089 @code{repeatCommands} is used to override default measure bars.
1091 @code{whichBar} can also be set directly, using @code{\property} or
1092 @code{\bar }. These settings take precedence over the automatic
1093 @code{whichBar} settings.
1096 @cindex Bar_line_engraver
1098 @cindex repeatCommands
1099 @cindex defaultBarType
1108 The easiest way to enter such fragments with more than one voice on a
1109 staff is to split chords using the separator @code{\\}. You can use
1110 it for small, short-lived voices (make a chord of voices) or for
1113 @lilypond[verbatim,fragment]
1114 \context Voice = VA \relative c'' {
1115 c4 < { f d e } \\ { b c2 } > c4 < g' \\ b, \\ f \\ d >
1119 The separator causes @internalsref{Voice} contexts to be instantiated,
1120 bearing the names @code{"1"}, @code{"2"}, etc.
1122 Sometimes, it is necessary to instantiate these contexts by hand: For
1123 Instantiate a separate Voice context for each part, and use
1124 @code{\voiceOne}, up to @code{\voiceFour} to assign a stem directions
1125 and horizontal shift for each part.
1128 @lilypond[singleline, verbatim]
1130 \context Staff < \context Voice = VA { \voiceOne cis2 b }
1131 \context Voice = VB { \voiceThree b4 ais ~ ais4 gis4 }
1132 \context Voice = VC { \voiceTwo fis4~ fis4 f ~ f } >
1135 The identifiers @code{\voiceOne} to @code{\voiceFour} set directions
1136 ties, slurs and stems, and set shift directions.
1138 If you want more than four voices, you can also manually set
1139 horizontal shifts and stem directions, as is shown in the following example:
1140 @lilypond[fragment, verbatim]
1141 \context Staff \notes\relative c''<
1142 \context Voice=one {
1143 \shiftOff \stemUp e4
1145 \context Voice=two {
1146 \shiftOn \stemUp cis
1148 \context Voice=three {
1149 \shiftOnn \stemUp ais
1151 \context Voice=four {
1152 \shiftOnnn \stemUp fis
1158 Normally, note heads with a different number of dots are not merged, but
1159 if you set the object property @code{merge-differently-dotted}, they are:
1160 @lilypond[verbatim,fragment,singleline]
1163 \property Staff.NoteCollision \override
1164 #'merge-differently-dotted = ##t
1166 } \\ { [g'8. f16] [g'8. f'16] }
1170 Similarly, you can merge half note heads with eighth notes, by setting
1171 @code{merge-differently-headed}:
1172 @lilypond[fragment, relative=2,verbatim]
1175 \property Staff.NoteCollision
1176 \override #'merge-differently-headed = ##t
1177 c8 c4. } \\ { c2 c2 } >
1180 LilyPond also vertically shifts rests that are opposite of a stem.
1182 @lilypond[singleline,fragment,verbatim]
1183 \context Voice < c''4 \\ r4 >
1186 See also @internalsref{NoteCollision} and @internalsref{RestCollision}
1190 Resolving collisions is a very intricate subject, and LilyPond only
1191 handles a few situations. When it can not cope, you are advised to use
1192 @code{force-hshift} of the @internalsref{NoteColumn} object and pitched
1193 rests to override typesetting decisions.
1198 Beams are used to group short notes into chunks that are aligned with
1199 the metrum. They are inserted automatically in most cases.
1201 @lilypond[fragment,verbatim, relative=2]
1202 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1205 If you're not satisfied with the automatic beaming, you can enter the
1206 beams explicitly. If you have beaming patterns that differ from the
1207 defaults, you can also set the patterns for automatic beamer.
1209 See also @internalsref{Beam}.
1212 @cindex Automatic beams
1213 @subsection Manual beams
1214 @cindex beams, manual
1218 In some cases it may be necessary to override LilyPond's automatic
1219 beaming algorithm. For example, the auto beamer will not beam over
1220 rests or bar lines, If you want that, specify the begin and end point
1221 manually using a @code{[} before the first beamed note and a @code{]}
1222 after the last note:
1224 @lilypond[fragment,relative,verbatim]
1226 r4 [r8 g' a r8] r8 [g | a] r8
1230 @cindex @code{stemLeftBeamCount}
1232 Normally, beaming patterns within a beam are determined automatically.
1233 When this mechanism fouls up, the properties
1234 @code{Voice.stemLeftBeamCount} and @code{Voice.stemRightBeamCount} can
1235 be used to control the beam subdivision on a stem. If you set either
1236 property, its value will be used only once, and then it is erased.
1238 @lilypond[fragment,relative,verbatim]
1241 [f8 r16 \property Voice.stemLeftBeamCount = #1 f g a]
1244 @cindex @code{stemRightBeamCount}
1247 The property @code{subdivideBeams} can be set in order to subdivide
1248 all 16th or shorter beams at beat positions. This accomplishes the
1249 same effect as twiddling with @code{stemLeftBeamCount} and
1250 @code{stemRightBeamCount}, but it take less typing.
1255 \property Voice.subdivideBeams = ##t
1257 [c32 c c c c c c c c c c c c c c c]
1258 \property Score.beatLength = #(ly:make-moment 1 8)
1259 [c32 c c c c c c c c c c c c c c c]
1261 @lilypond[noindent,noquote]
1263 \notes \relative c' {
1265 \property Voice.subdivideBeams = ##t
1267 [c32 c c c c c c c c c c c c c c c]
1268 \property Score.beatLength = #(ly:make-moment 1 8)
1269 [c32 c c c c c c c c c c c c c c c]
1273 @cindex subdivideBeams
1275 Kneed beams are inserted automatically, when a large gap between two
1276 adjacent beamed notes is detected. This behavior can be tuned through
1277 the object property @code{auto-knee-gap}.
1279 @cindex beams, kneed
1281 @cindex auto-knee-gap
1285 @c TODO -> why this ref? Document?
1286 @cindex @code{neutral-direction}
1290 Auto knee beams can not be used together with hara kiri staves.
1294 The Automatic beamer does not put @strong{unfinished} beams on the
1295 last notes of a score.
1297 Formatting of ties is a difficult subject. LilyPond often does not
1298 give optimal results.
1301 * Setting automatic beam behavior ::
1305 @no de Beam typography
1306 @sub section Beam typography
1308 One of the strong points of LilyPond is how beams are formatted. Beams
1309 are quantized, meaning that the left and right endpoints beams start
1310 exactly on staff lines. Without quantization, small wedges of white
1311 space appear between the beam and staff line, and this looks untidy.
1313 Beams are also slope-damped: melodies that go up or down should also
1314 have beams that go up or down, but the slope of the beams should be
1315 less than the slope of the notes themselves.
1317 Some beams should be horizontal. These are so-called concave beams.
1319 [TODO: some pictures.]
1322 @c . {Automatic beams}
1323 @node Setting automatic beam behavior
1324 @subsection Setting automatic beam behavior
1326 @cindex @code{autoBeamSettings}
1327 @cindex @code{(end * * * *)}
1328 @cindex @code{(begin * * * *)}
1329 @cindex automatic beams, tuning
1330 @cindex tuning automatic beaming
1332 In normal time signatures, automatic beams can start on any note but can
1333 only end in a few positions within the measure: beams can end on a beat,
1334 or at durations specified by the properties in
1335 @code{Voice.autoBeamSettings}. The defaults for @code{autoBeamSettings}
1336 are defined in @file{scm/auto-beam.scm}.
1338 The value of @code{autoBeamSettings} is changed using
1339 @code{\override} and unset using @code{\revert}:
1341 \property Voice.autoBeamSettings \override #'(@var{BE} @var{P} @var{Q} @var{N} @var{M}) = @var{dur}
1342 \property Voice.autoBeamSettings \revert #'(@var{BE} @var{P} @var{Q} @var{N} @var{M})
1344 Here, @var{BE} is the symbol @code{begin} or @code{end}. It determines
1345 whether the rule applies to begin or end-points. The quantity
1346 @var{P}/@var{Q} refers to the length of the beamed notes (and `@code{*
1347 *}' designates notes of any length), @var{N}/@var{M} refers to a time
1348 signature (wildcards, `@code{* *}' may be entered to designate all time
1351 For example, if you want automatic beams to end on every quarter note,
1352 you can use the following:
1354 \property Voice.autoBeamSettings \override
1355 #'(end * * * *) = #(ly:make-moment 1 4)
1357 Since the duration of a quarter note is 1/4 of a whole note, it is
1358 entered as @code{(ly:make-moment 1 4)}.
1360 The same syntax can be used to specify beam starting points. In this
1361 example, automatic beams can only end on a dotted quarter note.
1363 \property Voice.autoBeamSettings \override
1364 #'(end * * * *) = #(ly:make-moment 3 8)
1366 In 4/4 time signature, this means that automatic beams could end only on
1367 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1368 3/8 has passed within the measure).
1370 You can also restrict rules to specific time signatures. A rule that
1371 should only be applied in @var{N}/@var{M} time signature is formed by
1372 replacing the second asterisks by @var{N} and @var{M}. For example, a
1373 rule for 6/8 time exclusively looks like
1375 \property Voice.autoBeamSettings \override
1376 #'(begin * * 6 8) = ...
1379 If you want a rule to apply to certain types of beams, you can use the
1380 first pair of asterisks. Beams are classified according to the shortest
1381 note they contain. For a beam ending rule that only applies to beams
1382 with 32nd notes (and no shorter notes), you would use @code{(end 1
1386 @c Automatic beams can not be put on the last note in a score.
1388 If a score ends while an automatic beam has not been ended and is still
1389 accepting notes, this last beam will not be typeset at all.
1391 @cindex automatic beam generation
1393 @cindex @code{Voice.autoBeaming}
1396 For melodies that have lyrics, you may want to switch off
1397 automatic beaming. This is done by setting @code{Voice.autoBeaming} to
1403 It is not possible to specify beaming parameters for beams with mixed
1404 durations, that differ from the beaming parameters of all separate
1405 durations, i.e., you'll have to specify manual beams to get:
1407 @lilypond[singleline,fragment,relative,noverbatim]
1408 \property Voice.autoBeamSettings
1409 \override #'(end * * * *) = #(ly:make-moment 3 8)
1410 \time 12/8 c'8 c c c16 c c c c c [c c c c] c8 c c4
1412 It is not possible to specify beaming parameters that act differently in
1413 different parts of a measure. This means that it is not possible to use
1414 automatic beaming in irregular meters such as @code{5/8}.
1417 @section Accidentals
1419 This section describes how to change the way that LilyPond automatically
1420 inserts accidentals before the running notes.
1423 * Using the predefined accidental macros::
1424 * Defining your own accidental typesettings::
1427 @node Using the predefined accidental macros
1428 @subsection Using the predefined accidental macros
1429 The constructs for describing the accidental typesetting rules are
1430 quite hairy, so non-experts should stick to the macros defined in
1431 @file{ly/property-init.ly}.
1432 @cindex @file{property-init.ly}
1434 The macros operate on the ``Current'' context (see @ref{Context properties}). This
1435 means that the macros shuold normally be invoked right after the
1436 creation of the context in which the accidental typesetting described
1437 by the macro is to take effect. I.e. if you want to use
1438 piano-accidentals in a pianostaff then you issue
1439 @code{\pianoAccidentals} first thing after the creation of the piano
1443 \notes \relative c'' <
1444 \context Staff = sa @{ cis4 d e2 @}
1445 \context GrandStaff <
1447 \context Staff = sb @{ cis4 d e2 @}
1448 \context Staff = sc @{ es2 c @}
1450 \context Staff = sd @{ es2 c @}
1454 @lilypond[singleline]
1456 \notes \relative c'' <
1457 \context Staff = sa { cis4 d e2 }
1458 \context GrandStaff <
1460 \context Staff = sb { cis4 d e2 }
1461 \context Staff = sc { es2 c }
1463 \context Staff = sd { es2 c }
1468 minimumVerticalExtent = #'(-4.0 . 4.0)
1476 @item \defaultAccidentals
1477 @cindex @code{\defaultAccidentals}
1478 This is the default typesetting behaviour. It should correspond
1479 to 18th century common practice: Accidentals are
1480 remembered to the end of the measure in which they occur and
1481 only on their own octave.
1483 @item \voiceAccidentals
1484 @cindex @code{\voiceAccidentals}
1485 The normal behaviour is to remember the accidentals on
1487 This macro, however, typesets accidentals individually for each
1489 Apart from that the rule is similar to
1490 @code{\defaultAccidentals}.
1492 Warning: This leads to some weird and often unwanted results
1493 because accidentals from one voice DO NOT get cancelled in other
1495 @lilypond[singleline,relative,fragment,verbatim]
1498 \context Voice=va { \voiceOne es g }
1499 \context Voice=vb { \voiceTwo c, e }
1502 Hence you should only use @code{\voiceAccidentals}
1503 if the voices are to be read solely by
1504 individual musicians. if the staff should be readable also
1505 by one musician/conductor then you should use
1506 @code{\modernVoiceAccidentals} or @code{\modernVoiceCautionaries}
1509 @item \modernAccidentals
1510 @cindex @code{\modernAccidentals}
1511 This rule should correspond to the common practice in the 20th
1513 The rule is a bit more complex than @code{\defaultAccidentals}:
1514 You get all the same accidentals, but temporary
1515 accidentals also get cancelled in other octaves. Further more,
1516 in the same octave, they also get cancelled in the following measure:
1517 @lilypond[singleline,fragment,verbatim]
1519 cis' c'' cis'2 | c'' c'
1522 @item \modernCautionaries
1523 @cindex @code{\modernCautionaries}
1524 This rule is similar to @code{\modernAccidentals}, but the
1525 ``extra'' accidentals (the ones not typeset by
1526 @code{\defaultAccidentals}) are typeset as cautionary accidentals
1527 (i.e. in reduced size):
1528 @lilypond[singleline,fragment,verbatim]
1530 cis' c'' cis'2 | c'' c'
1533 @item \modernVoiceAccidentals
1534 @cindex @code{\modernVoiceAccidentals}
1535 Multivoice accidentals to be read both by musicians playing one voice
1536 and musicians playing all voices.
1538 Accidentals are typeset for each voice, but they ARE cancelled
1539 across voices in the same @internalsref{Staff}.
1541 @item \modernVoiceCautionaries
1542 @cindex @code{\modernVoiceCautionaries}
1543 The same as @code{\modernVoiceAccidentals}, but with the
1544 extra accidentals (the ones not typeset by
1545 @code{\voiceAccidentals}) typeset as cautionaries.
1546 Notice that even though all accidentals typeset by
1547 @code{\defaultAccidentals} ARE typeset by this macro then some
1548 of them are typeset as cautionaries.
1550 @item \pianoAccidentals
1551 @cindex @code{\pianoAccidentals}
1552 20th century practice for piano notation. Very similar to
1553 @code{\modernAccidentals} but accidentals also get cancelled
1554 across the staves in the same @internalsref{GrandStaff} or
1555 @internalsref{PianoStaff}.
1557 @item \pianoCautionaries
1558 @cindex @code{\pianoCautionaries}
1559 As @code{\pianoAccidentals} but with the extra accidentals
1560 typeset as cationaries.
1563 @cindex @code{\noResetKey}
1564 Same as @code{\defaultAccidentals} but with accidentals lasting
1565 ``forever'' and not only until the next measure:
1566 @lilypond[singleline,fragment,verbatim,relative]
1571 @item \forgetAccidentals
1572 @cindex @code{\forgetAccidentals}
1573 This is sort of the opposite of @code{\noResetKey}: Accidentals
1574 are not remembered at all - and hence all accidentals are
1575 typeset relative to the key signature, regardless of what was
1576 before in the music:
1577 @lilypond[singleline,fragment,verbatim,relative]
1579 \key d\major c4 c cis cis d d dis dis
1583 @node Defining your own accidental typesettings
1584 @subsection Defining your own accidental typesettings
1586 This section must be considered gurus-only, and hence it must be
1587 sufficient with a short description of the system and a reference to
1588 the internal documentation.
1590 The idea of the algorithm is to try several different rules and then
1591 use the rule that gives the highest number of accidentals.
1592 Each rule cosists of
1595 In which context is the rule applied. I.e. if context is
1596 @internalsref{Score} then all staves share accidentals, and if
1597 context is @internalsref{Staff} then all voices in the same
1598 staff share accidentals, but staves don't - like normally.
1600 Whether the accidental changes all octaves or only the current
1603 Over how many barlines the accidental lasts.
1604 If lazyness is @code{-1} then the accidental is forget
1605 immidiately, and if lazyness is @code{#t} then the accidental
1609 As described in the internal documentation of
1610 @reng{Accidental_engraver}, the properties @code{autoAccidentals} and
1611 @code{autoCautionaries} contain lists of rule descriptions. Notice
1612 that the contexts must be listed from in to out - that is
1613 @internalsref{Thread} before @internalsref{Voice},
1614 @internalsref{Voice} before @internalsref{Staff}, etc.
1615 see the macros in @file{ly/property-init.ly} for examples of how the
1620 Currently the simultaneous notes are considered to be entered in
1621 sequential mode. This means that in a chord the accidentals are
1622 typeset as if the notes in the chord happened one at a time - in the
1623 order in which they appear in the input file.
1625 Of course this is only a problem when you have simultainous notes
1626 which accidentals should depend on each other.
1627 Notice that the problem only occurs when using non-default accidentals
1628 - as the default accidentals only depend on other accidentals on the
1629 same staff and same pitch and hence cannot depend on other
1632 This example shows two examples of the same music giving different
1633 accidentals depending on the order in which the notes occur in the
1636 @lilypond[singleline,fragment,verbatim]
1637 \property Staff.autoAccidentals = #'( Staff (any-octave . 0) )
1638 cis'4 <<c'' c'>> r2 | cis'4 <<c' c''>> r2 | <<cis' c''>> r | <<c'' cis'>> r |
1641 The only solution is to manually insert the problematic
1642 accidentals using @code{!} and @code{?}.
1644 @node Expressive marks
1645 @section Expressive marks
1654 * Analysis brackets::
1661 A slur indicates that notes are to be played bound or @emph{legato}.
1662 They are entered using parentheses:
1663 @lilypond[fragment,verbatim,center]
1664 f'()g'()a' [a'8 b'(] a'4 g'2 )f'4
1667 See also @seeinternals{Slur}.
1669 Slurs avoid crossing stems, and are generally attached to note heads.
1670 However, in some situations with beams, slurs may be attached to stem
1671 ends. If you want to override this layout you can do this through the
1672 object property @code{attachment} of @internalsref{Slur} in
1673 @internalsref{Voice} context It's value is a pair of symbols, specifying
1674 the attachment type of the left and right end points.
1676 @lilypond[fragment,relative,verbatim]
1678 \property Voice.Stem \set #'length = #5.5
1680 \property Voice.Slur \set #'attachment = #'(stem . stem)
1684 If a slur would strike through a stem or beam, the slur will be moved
1685 away upward or downward. If this happens, attaching the slur to the
1686 stems might look better:
1688 @lilypond[fragment,relative,verbatim]
1691 \property Voice.Slur \set #'attachment = #'(stem . stem)
1696 Similarly, the curvature of a slur is adjusted to stay clear of note
1697 heads and stems. When that would increase the curvature too much, the
1698 slur is reverted to its default shape. The threshold for this
1699 decision is in @internalsref{Slur}'s object property @code{beautiful}.
1700 It is loosely related to the enclosed area between the slur and the
1701 notes. Usually, the default setting works well, but in some cases you
1702 may prefer a curved slur when LilyPond decides for a vertically moved
1703 one. You can indicate this preference by increasing the
1704 @code{beautiful} value:
1706 @lilyp ond[verbatim,singleline,relative]
1708 c16( a' f' a a f a, )c,
1709 c( a' f' a a f d, )c
1710 \property Voice.Slur \override #'beautiful = #5.0
1711 c( a' f' a a f d, )c
1717 Producing nice slurs is a difficult problem, and LilyPond currently
1718 uses a simple, empiric method to produce slurs. In some cases, the
1719 results of this method are ugly.
1722 This is reflected by the
1723 @code{beautiful} property, which it is an arbitrary parameter in the
1724 slur formatter. Useful values can only be determined by trial and
1728 @cindex Adjusting slurs
1730 @node Phrasing slurs
1731 @subsection Phrasing slurs
1733 @cindex phrasing slurs
1734 @cindex phrasing marks
1736 A phrasing slur (or phrasing mark) connects chords and is used to
1737 indicate a musical sentence. It is started using @code{\(} and @code{\)}
1740 @lilypond[fragment,verbatim,center,relative]
1741 \time 6/4 c' \( d () e f () e \) d
1744 Typographically, the phrasing slur behaves almost exactly like a normal
1745 slur. See also @seeinternals{PhrasingSlur}. But although they behave
1746 similarily to normal slurs, phrasing slurs count as different objects.
1747 A @code{\slurUp} will have no effect on a phrasing slur; instead, you
1748 should use @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1749 @code{\phrasingSlurBoth}.
1751 Note that the commands
1752 @code{\slurUp}, @code{\slurDown}, and @code{\slurBoth} will only affect
1753 normal slurs and not phrasing slurs.
1756 @subsection Breath marks
1758 Breath marks are entered using @code{\breathe}. See also
1759 @seeinternals{BreathingSign}.
1761 @lilypond[fragment,relative]
1770 @cindex beats per minute
1771 @cindex metronome marking
1773 Metronome settings can be entered as follows:
1775 @cindex @code{\tempo}
1777 \tempo @var{duration} = @var{perminute}
1780 For example, @code{\tempo 4 = 76} requests output with 76 quarter notes
1785 The tempo setting is not printed, but is only used in the MIDI
1786 output. You can trick lily into producing a metronome mark,
1787 though. Details are in @ref{Text markup}.
1792 @subsection Text spanners
1793 @cindex Text spanners
1795 Some textual indications, e.g. rallentando or accelerando, often extend
1796 over many measures. This is indicated by following the text with a
1797 dotted line. You can create such texts using text spanners. The syntax
1803 LilyPond will respond by creating a @internalsref{TextSpanner} object (typically
1804 in @internalsref{Voice} context). The string to be printed, as well as the
1805 style is set through object properties.
1807 An application---or rather, a hack---is to fake octavation indications.
1808 @lilypond[fragment,relative,verbatim]
1809 \relative c' { a''' b c a
1810 \property Voice.TextSpanner \set #'type = #'dotted-line
1811 \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
1812 \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
1813 \property Staff.centralCPosition = #-13
1814 a\startTextSpan b c a \stopTextSpan }
1818 @node Analysis brackets
1819 @subsection Analysis brackets
1821 @cindex phrasing brackets
1822 @cindex musicological analysis
1823 @cindex note grouping bracket
1825 Brackets are used in musical analysis to indicate structure in musical
1826 pieces. LilyPond supports a simple form of nested horizontal brackets.
1827 To use this, add the @internalsref{Horizontal_bracket_engraver} to
1828 @internalsref{Staff} context. A bracket is started with
1829 @code{\groupOpen} and closed with @code{\groupClose}. This produces
1830 @internalsref{HorizontalBracket} objects.
1832 @lilypond[singleline,verbatim]
1833 \score { \notes \relative c'' {
1834 c4-\groupOpen-\groupOpen
1837 c4-\groupClose-\groupClose
1839 \paper { \translator {
1840 \StaffContext \consists "Horizontal_bracket_engraver"
1858 @subsection Articulations
1859 @cindex Articulations
1861 @cindex articulations
1865 A variety of symbols can appear above and below notes to indicate
1866 different characteristics of the performance. They are added to a note
1867 by adding a dash and the the character signifying the
1868 articulation. They are demonstrated here.
1869 @lilypond[singleline]
1871 \notes \context Voice {
1872 \property Voice.TextScript \set #'font-family = #'typewriter
1873 \property Voice.TextScript \set #'font-shape = #'upright
1879 c''4-^_"c-\\^{ }" s4
1885 The script is automatically placed, but if you need to force
1886 directions, you can use @code{_} to force them down, or @code{^} to
1888 @lilypond[fragment, verbatim]
1893 Other symbols can be added using the syntax
1894 @var{note}@code{-\}@var{name}. Again, they can be forced up or down
1895 using @code{^} and @code{_}.
1899 @cindex staccatissimo
1908 @cindex organ pedal marks
1917 @cindex prallmordent
1921 @cindex thumb marking
1928 \property Score.LyricText \override #'font-family =#'typewriter
1929 \property Score.LyricText \override #'font-shape = #'upright
1930 \context Staff \notes {
1931 c''-\accent c''-\marcato c''-\staccatissimo c''^\fermata
1932 c''-\stopped c''-\staccato c''-\tenuto c''-\portato
1934 c''-\downbow c''^\lheel c''-\rheel c''^\ltoe
1935 c''-\rtoe c''-\turn c''-\open c''-\flageolet
1936 c''-\reverseturn c''-\trill c''-\prall c''-\mordent
1937 c''-\prallprall c''-\prallmordent c''-\upprall c''-\downprall
1938 c''-\upmordent c''-\downmordent c''-\pralldown c''-\prallup
1939 c''-\lineprall c''-\thumb c''-\segno c''-\coda
1941 \context Lyrics \lyrics {
1942 accent__ marcato__ staccatissimo__ fermata
1943 stopped__ staccato__ tenuto__ portato
1945 downbow__ lheel__ rheel__ ltoe
1946 rtoe__ turn__ open__ flageolet
1947 reverseturn__ trill__ prall__ mordent
1948 prallprall__ prallmordent__ uprall__ downprall
1949 upmordent__ downmordent__ pralldown__ prallup__
1950 lineprall__ thumb__ segno__ coda
1963 Fingering instructions can also be entered in this shorthand. For
1964 finger changes, use markup texts:
1966 @lilypond[verbatim, singleline, fragment]
1967 c'4-1 c'4-2 c'4-3 c'4-4
1976 See also @seeinternals{Script} and @seeinternals{Fingering}.
1980 All of these note ornaments appear in the printed output but have no
1981 effect on the MIDI rendering of the music.
1983 Unfortunately, there is no support for adding fingering instructions or
1984 ornaments to individual note heads. Some hacks exist, though. See
1985 @file{input/test/script-horizontal.ly}.
1990 @subsection Text scripts
1991 @cindex Text scripts
1993 In addition, it is possible to place arbitrary strings of text or markup
1994 text (see @ref{Text markup}) above or below notes by using a string:
1997 By default, these indications do not influence the note spacing, but
1998 by using the command @code{\fatText}, the widths will be taken into
2001 @lilypond[fragment,singleline,verbatim] \relative c' {
2002 c4^"longtext" \fatText c4_"longlongtext" c4 }
2005 It is possible to use @TeX{} commands in the strings, but this should be
2006 avoided because it makes it impossible for LilyPond to compute the
2007 exact length of the string, which may lead to collisions. Also, @TeX{}
2008 commands won't work with direct PostScript output.
2009 @c (see @ref{PostScript output}).
2011 Text scripts are created in form of @internalsref{TextScript} objects, in
2012 @internalsref{Voice} context.
2014 @ref{Text markup} describes how to change the font or access
2015 special symbols in text scripts.
2020 @subsection Grace notes
2024 @cindex @code{\grace}
2028 Grace notes are ornaments that are written out
2029 @lilypond[relative=2,verbatim,ifragment] c4 \grace c16 c4 \grace {
2033 In normal notation, grace notes are supposed to take up no logical
2034 time in a measure. Such an idea is practical for normal notation, but
2035 is not strict enough to put it into a program. The model that LilyPond
2036 uses for grace notes internally is that all timing is done in two
2039 Every point in musical time consists of two rational numbers: one
2040 denotes the logical time, one denotes the grace timing. The above
2041 example is shown here with timing tuples.
2044 \score { \notes \relative c''{
2045 c4^"(0,0)" \grace c16_" "_"(1/4,-1/16)" c4^"(1/4,0)" \grace {
2046 [c16_"(2/4,-1/8)" d16^"(2/4,-1/16)" ] } c4_" "_"(2/4,0)"
2048 \paper { linewidth = 8.\cm }
2052 The advantage of this approach is that you can use almost any lilypond
2053 construction together with grace notes, for example slurs and clef
2054 changes may appear halfway in between grace notes:
2056 @lilypond[relative=2,verbatim,fragment]
2057 c4 \grace { [ c16 c, \clef bass c, b(] } )c4
2060 The placement of these grace notes is synchronized between different
2061 staves, using this grace timing.
2063 @lilypond[relative=2,verbatim,fragment]
2064 < \context Staff = SA { e4 \grace { c16 d e f } e4 }
2065 \context Staff = SB { c4 \grace { g8 b } c4 } >
2069 Unbeamed eighth notes and shorter by default have a slash through the
2070 stem. This can be controlled with object property @code{stroke-style} of
2071 @internalsref{Stem}. The change in formatting is accomplished by
2072 inserting @code{\startGraceMusic} before handling the grace notes, and
2073 @code{\stopGraceMusic} after finishing the grace notes.
2074 You can add to these definitions to globally change grace note
2075 formatting. The standard definitions are in @file{ly/grace-init.ly}.
2077 [TODO discuss Scheme functionality.]
2080 Notice how the @code{\override} is carefully matched with a @code{\revert}.
2085 @lilypond[fragment,verbatim]
2086 \relative c'' \context Voice {
2087 \grace c8 c4 \grace { [c16 c16] } c4
2089 \property Voice.Stem \override #'stroke-style = #'()
2091 \property Voice.Stem \revert #'stroke-style
2098 If you want to end a note with a grace note, then the standard trick
2099 is to put the grace notes before a phantom ``space note'', e.g.
2100 @lilypond[fragment,verbatim, relative=2]
2103 { s2 \grace { [c16 d] } } >
2108 A @code{\grace} section has some default values, and LilyPond will
2109 use those default values unless you specify otherwise inside the
2110 @code{\grace} section. For example, if you specify \slurUp
2111 @emph{before} your @code{\grace} section, a slur which starts inside
2112 the @code{\grace} won't be forced up, even if the slur ends outside
2113 of the @code{\grace}. Note the difference between the first and
2114 second bars in this example:
2116 @lilypond[fragment,verbatim]
2117 \relative c'' \context Voice {
2136 Grace notes can not be used in the smallest size (@file{paper11.ly}).
2138 Grace note synchronization can also lead to surprises. Staff notation,
2139 such as key signatures, barlines, etc. are also synchronized. Take
2140 care when you mix staves with grace notes and staves without.
2142 @lilypond[relative=2,verbatim,fragment]
2143 < \context Staff = SA { e4 \bar "|:" \grace c16 d4 }
2144 \context Staff = SB { c4 \bar "|:" d4 } >
2147 Grace sections should only be used within sequential music
2148 expressions. Nesting, juxtaposing, or ending sequential music with a
2149 grace section is not supported, and might produce crashes or other
2154 @subsection Glissando
2157 @cindex @code{\glissando}
2159 A glissando line can be requested by attaching a @code{\glissando} to
2162 @lilypond[fragment,relative,verbatim]
2168 Printing of an additional text (such as @emph{gliss.}) must be done
2169 manually. See also @seeinternals{Glissando}.
2175 @subsection Dynamics
2188 @cindex @code{\ffff}
2198 Absolute dynamic marks are specified using an identifier after a
2199 note: @code{c4-\ff}. The available dynamic marks are: @code{\ppp},
2200 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2201 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2202 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2204 @lilypond[verbatim,singleline,fragment,relative]
2205 c'\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2211 @cindex @code{\decr}
2212 @cindex @code{\rced}
2218 A crescendo mark is started with @code{\cr} and terminated with
2219 @code{\rc} (the textual reverse of @code{cr}). A decrescendo mark is
2220 started with @code{\decr} and terminated with @code{\rced}. There are
2221 also shorthands for these marks. A crescendo can be started with
2222 @code{\<} and a decrescendo can be started with @code{\>}. Either one
2223 can be terminated with @code{\!}. Note that @code{\!} must go before
2224 the last note of the dynamic mark whereas @code{\rc} and @code{\rced} go
2225 after the last note. Because these marks are bound to notes, if you
2226 want several marks during one note, you have to use spacer notes.
2228 @lilypond[fragment,verbatim,center]
2229 c'' \< \! c'' d'' \decr e'' \rced
2230 < f''1 { s4 s4 \< \! s4 \> \! s4 } >
2233 You can also use a text saying @emph{cresc.} instead of hairpins. Here
2234 is an example how to do it:
2236 @lilypond[fragment,relative=2,verbatim]
2237 c4 \cresc c4 \endcresc c4
2244 You can also supply your own texts:
2245 @lilypond[fragment,relative,verbatim]
2247 \property Voice.crescendoText = "cresc. poco"
2248 \property Voice.crescendoSpanner = #'dashed-line
2255 Dynamics are objects of @internalsref{DynamicText} and
2256 @internalsref{Hairpin}. Vertical positioning of these symbols is
2257 handled by the @internalsref{DynamicLineSpanner} object. If you want to
2258 adjust padding or vertical direction of the dynamics, you must set
2259 properties for the @internalsref{DynamicLineSpanner} object. Predefined
2260 identifiers to set the vertical direction are \dynamicUp and
2263 @cindex direction, of dynamics
2264 @cindex @code{\dynamicDown}
2265 @cindex @code{\dynamicUp}
2273 @cindex @code{\repeat}
2275 To specify repeats, use the @code{\repeat} keyword. Since repeats
2276 should work differently when played or printed, there are a few
2277 different variants of repeats.
2281 Repeated music is fully written (played) out. Useful for MIDI
2282 output, and entering repetitive music.
2285 This is the normal notation: Repeats are not written out, but
2286 alternative endings (voltas) are printed, left to right.
2289 Alternative endings are written stacked. This has limited use but may be
2290 used to typeset two lines of lyrics in songs with repeats, see
2291 @file{input/star-spangled-banner.ly}.
2297 Make beat or measure repeats. These look like percent signs.
2303 * Repeats and MIDI::
2304 * Manual repeat commands::
2306 * Tremolo subdivisions::
2311 @subsection Repeat syntax
2313 The syntax for repeats is
2316 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2319 If you have alternative endings, you may add
2320 @cindex @code{\alternative}
2322 \alternative @code{@{} @var{alternative1}
2324 @var{alternative3} @dots{} @code{@}}
2326 where each @var{alternative} is a music expression.
2328 Normal notation repeats are used like this:
2329 @lilypond[fragment,verbatim]
2331 \repeat volta 2 { c'4 d' e' f' }
2332 \repeat volta 2 { f' e' d' c' }
2335 With alternative endings:
2336 @lilypond[fragment,verbatim]
2338 \repeat volta 2 {c'4 d' e' f'}
2339 \alternative { {d'2 d'} {f' f} }
2342 Folded repeats look like this:
2345 @lilypond[fragment,verbatim]
2347 \repeat fold 2 {c'4 d' e' f'}
2348 \alternative { {d'2 d'} {f' f} }
2352 If you don't give enough alternatives for all of the repeats, then
2353 the first alternative is assumed to be repeated often enough to equal
2354 the specified number of repeats.
2356 @lilypond[fragment,verbatim]
2360 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2361 \alternative { { g4 g g } { a | a a a a | b2. } }
2366 @node Repeats and MIDI
2367 @subsection Repeats and MIDI
2369 @cindex expanding repeats
2371 For instructions on how to unfoldi repeats for MIDI output, see
2372 the example file @file{input/test/unfold-all-repeats.ly}.
2377 Notice that timing information is not remembered at the start of an
2378 alternative, so you have to reset timing information after a repeat,
2379 e.g. using a bar-check (See @ref{Bar check}), setting
2380 @code{Score.measurePosition} or entering @code{\partial}. Slurs or ties
2381 are also not repeated.
2383 It is possible to nest @code{\repeat}s, although this probably is only
2384 meaningful for unfolded repeats.
2386 Folded repeats offer little more over simultaneous music.
2388 @node Manual repeat commands
2389 @subsection Manual repeat commands
2391 @cindex @code{repeatCommands}
2393 The property @code{repeatCommands} can be used to control the layout of
2394 repeats. Its value is a Scheme list of repeat commands, where each repeat
2402 @item (volta . @var{text})
2403 Print a volta bracket saying @var{text}.
2405 Stop a running volta bracket
2408 @lilypond[verbatim, fragment]
2410 \property Score.repeatCommands = #'((volta "93") end-repeat)
2412 \property Score.repeatCommands = #'((volta #f))
2417 Repeats brackets are @internalsref{VoltaBracket} objects.
2419 @node Tremolo repeats
2420 @subsection Tremolo repeats
2421 @cindex tremolo beams
2423 To place tremolo marks between notes, use @code{\repeat} with tremolo
2425 @lilypond[verbatim,center,singleline]
2427 \context Voice \notes\relative c' {
2428 \repeat "tremolo" 8 { c16 d16 }
2429 \repeat "tremolo" 4 { c16 d16 }
2430 \repeat "tremolo" 2 { c16 d16 }
2431 \repeat "tremolo" 4 c16
2436 Tremolo beams are @internalsref{Beam} objects. Single stem tremolos are
2437 @internalsref{StemTremolo}. The single stem tremolo @emph{must} be
2438 entered without @code{@{} and @code{@}}.
2442 Only powers of two and undotted notes are supported repeat counts.
2444 @node Tremolo subdivisions
2445 @subsection Tremolo subdivisions
2446 @cindex tremolo marks
2447 @cindex @code{tremoloFlags}
2449 Tremolo marks can be printed on a single note by adding
2450 `@code{:}[@var{length}]' after the note. The length must be at least 8.
2451 A @var{length} value of 8 gives one line across the note stem. If the
2452 length is omitted, then then the last value (stored in
2453 @code{Voice.tremoloFlags}) is used.
2455 @lilypond[verbatim,fragment,center]
2456 c'2:8 c':32 | c': c': |
2462 Tremolos in this style do not carry over into the MIDI output.
2465 @node Measure repeats
2466 @subsection Measure repeats
2468 @cindex percent repeats
2469 @cindex measure repeats
2471 In the @code{percent} style, a note pattern can be repeated. It is
2472 printed once, and then the pattern is replaced with a special sign.
2473 Patterns of a one and two measures are replaced by percent-like signs,
2474 patterns that divide the measure length are replaced by slashes.
2476 @lilypond[verbatim,singleline]
2477 \context Voice { \repeat "percent" 4 { c'4 }
2478 \repeat "percent" 2 { c'2 es'2 f'4 fis'4 g'4 c''4 }
2482 The signs are represented by these objects: @internalsref{RepeatSlash} and
2483 @internalsref{PercentRepeat} and @internalsref{DoublePercentRepeat}.
2487 You can not nest percent repeats, e.g. by filling in the first measure
2488 with slashes, and repeating that measure with percents.
2490 @node Rhythmic music
2491 @section Rhythmic music
2493 Sometimes you might want to show only the rhythm of a melody. This can
2494 be done with the rhythmic staff. All pitches of notes on such a staff
2495 are squashed, and the staff itself looks has a single staff line:
2497 @lilypond[fragment,relative,verbatim]
2498 \context RhythmicStaff {
2500 c4 e8 f g2 | r4 g r2 | g1:32 | r1 |
2505 * Percussion staves::
2508 @node Percussion staves
2509 @subsection Percussion staves
2512 To typeset more than one piece of percussion to be played by the same
2513 musician one typically uses a multiline staff where each staff
2514 position refers to a specific piece of percussion.
2516 LilyPond is shipped with a bunch of scheme functions which allows you
2517 to do this fairly easily.
2519 The system is based on the general midi drum-pitches.
2520 In order to use the drum pitches you include
2521 @file{ly/drumpitch-init.ly}. This file defines the pitches from the scheme
2522 variable @code{drum-pitch-names} - which definition can be read in
2523 @file{scm/drums.scm}. You see that each piece of percussion has a full
2524 name and an abbreviated name - and you may freely select whether to
2525 refer to the full name or the abbreviation in your music definition.
2527 To typeset the music on a staff you apply the scheme function
2528 @code{drums->paper} to the percussion music. This function takes a
2529 list of percussion instrument names, notehead scripts and staff
2530 positions (that is: pitches relative to the C-clef) and uses this to
2531 transform the input music by moving the pitch, changing the notehead
2532 and (optionally) adding a script:
2533 @lilypond[singleline,verbatim]
2534 \include "drumpitch-init.ly"
2535 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2536 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2538 \apply #(drums->paper 'drums) \context Staff <
2540 \context Voice = up { \voiceOne \up }
2541 \context Voice = down { \voiceTwo \down }
2546 In the above example the music was transformed using the list @code{'drums}.
2547 Currently the following lists are defined in @file{scm/drums.scm}:
2550 To typeset a typical drum kit on a five-line staff.
2553 \include "drumpitch-init.ly"
2554 nam = \lyrics { cymc cyms cymr hh hhc hho hhho hhp cb hc
2555 bd sn ss tomh tommh tomml toml tomfh tomfl }
2556 mus = \notes { cymc cyms cymr hh hhc hho hhho hhp cb hc
2557 bd sn ss tomh tommh tomml toml tomfh tomfl s16 }
2560 \apply #(drums->paper 'drums) \context Staff <
2564 \context Lyrics \nam
2567 linewidth = 100.0\mm
2570 \remove Bar_engraver
2571 \remove Time_signature_engraver
2572 minimumVerticalExtent = #'(-4.0 . 5.0)
2576 \remove Stem_engraver
2582 Notice that the scheme supports six different toms.
2583 If you are using fewer toms then you simply select the toms that produce
2584 the desired result - i.e. to get toms on the three middle lines you
2585 use @code{tommh}, @code{tomml} and @code{tomfh}.
2587 Because the general midi contain no rimshots we use the sidestick for
2588 this purpose instead.
2590 To typeset timbales on a two line staff.
2591 @lilypond[singleline]
2592 \include "drumpitch-init.ly"
2593 nam = \lyrics { timh ssh timl ssl cb }
2594 mus = \notes { timh ssh timl ssl cb s16 }
2597 \apply #(drums->paper 'timbales) \context Staff <
2601 \context Lyrics \nam
2606 \remove Bar_engraver
2607 \remove Time_signature_engraver
2608 StaffSymbol \override #'line-count = #2
2609 StaffSymbol \override #'staff-space = #2
2610 minimumVerticalExtent = #'(-3.0 . 4.0)
2614 \remove Stem_engraver
2621 To typeset congas on a two line staff.
2622 @lilypond[singleline]
2623 \include "drumpitch-init.ly"
2624 nam = \lyrics { cgh cgho cghm ssh cgl cglo cglm ssl }
2625 mus = \notes { cgh cgho cghm ssh cgl cglo cglm ssl s16 }
2628 \apply #(drums->paper 'congas) \context Staff <
2632 \context Lyrics \nam
2637 \remove Bar_engraver
2638 \remove Time_signature_engraver
2639 StaffSymbol \override #'line-count = #2
2640 StaffSymbol \override #'staff-space = #2
2641 minimumVerticalExtent = #'(-3.0 . 4.0)
2645 \remove Stem_engraver
2651 To typeset bongos on a two line staff.
2652 @lilypond[singleline]
2653 \include "drumpitch-init.ly"
2654 nam = \lyrics { boh boho bohm ssh bol bolo bolm ssl }
2655 mus = \notes { boh boho bohm ssh bol bolo bolm ssl s16 }
2658 \apply #(drums->paper 'bongos) \context Staff <
2662 \context Lyrics \nam
2667 \remove Bar_engraver
2668 \remove Time_signature_engraver
2669 StaffSymbol \override #'line-count = #2
2670 StaffSymbol \override #'staff-space = #2
2671 minimumVerticalExtent = #'(-3.0 . 4.0)
2675 \remove Stem_engraver
2681 To typeset all kinds of simple percussion on one line staves.
2682 @lilypond[singleline]
2683 \include "drumpitch-init.ly"
2684 nam = \lyrics { tri trio trim gui guis guil cb cl tamb cab mar hc }
2685 mus = \notes { tri trio trim gui guis guil cb cl tamb cab mar hc s16 }
2688 \apply #(drums->paper 'percussion) \context Staff <
2692 \context Lyrics \nam
2697 \remove Bar_engraver
2698 \remove Time_signature_engraver
2699 StaffSymbol \override #'line-count = #1
2700 minimumVerticalExtent = #'(-2.0 . 3.0)
2704 \remove Stem_engraver
2711 If you don't like any of the predefined lists you can define your own
2712 list at the top of your file:
2714 @lilypond[singleline, verbatim]
2716 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2717 (snare default #f ,(ly:make-pitch 0 1 0))
2718 (hihat cross #f ,(ly:make-pitch 0 5 0))
2719 (pedalhihat xcircle "stopped" ,(ly:make-pitch 0 5 0))
2720 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2722 \include "drumpitch-init.ly"
2723 up = \notes { hh8 hh hh hh hhp4 hhp }
2724 down = \notes { bd4 sn bd toml8 toml }
2726 \apply #(drums->paper 'mydrums) \context Staff <
2728 \context Voice = up { \voiceOne \up }
2729 \context Voice = down { \voiceTwo \down }
2734 To use a modified existing list instead of building your own from
2735 scratch you can append your modifications to the start of the existing
2739 #(define mydrums (append `(
2740 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2741 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2745 @c FIXME: Too many levels of headers when using subsubsections.
2746 @c Perhaps junk subsection ``Percussion staves''
2747 @subsubsection Percussion staves with normal staves
2748 When you include @file{drumpitch-init.ly} then the default pitches
2749 are overridden so that you after the inclusion cannot use the common
2750 dutch pitch names anymore. Hence you might wan't to reinclude
2751 @file{nederlands.ly} after the drum-pattern-definitions:
2752 @lilypond[singleline,verbatim]
2753 \include "drumpitch-init.ly"
2754 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2755 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2756 \include "nederlands.ly"
2757 bass = \notes \transpose c c,, { a4. e8 r e g e }
2760 \apply #(drums->paper 'drums) \context Staff = drums <
2762 \context Voice = up { \voiceOne \up }
2763 \context Voice = down { \voiceTwo \down }
2765 \context Staff = bass { \clef "F_8" \bass }
2770 @subsubsection Percussion midi output
2771 In order to produce correct midi output you need to produce two score
2772 blocks - one for the paper and one for the midi.
2773 To use the percussion channel you set the property @code{instrument}
2774 to @code{'drums}. Because the drum-pitches themself are similar to the
2775 general midi pitches all you have to do is to insert the voices with
2776 none of the scheme functions to get the correct midi output:
2780 \apply #(drums->paper 'mydrums) \context Staff <
2782 \context Voice = up @{ \voiceOne \up @}
2783 \context Voice = down @{ \voiceTwo \down @}
2789 \property Staff.instrument = #'drums
2798 This scheme is to be considered a temporary implementation. Even
2799 though the scheme will probably keep on working then the future might
2800 bring some other way of typesetting drums, and probably
2801 there will be made no great efforts in keeping things downwards
2806 @section Piano music
2808 Piano music is an odd type of notation. Piano staves are two normal
2809 staves coupled with a brace. The staves are largely independent, but
2810 sometimes voices can cross between the two staves. The
2811 @internalsref{PianoStaff} is especially built to handle this cross-staffing
2812 behavior. In this section we discuss the @internalsref{PianoStaff} and some
2813 other pianistic peculiarities.
2817 * Automatic staff changes::
2818 * Manual staff switches::
2821 * Voice follower lines::
2826 There is no support for putting chords across staves. You can get
2827 this result by increasing the length of the stem in the lower stave so
2828 it reaches the stem in the upper stave, or vice versa. An example is
2829 included with the distribution as @file{input/test/stem-cross-staff.ly}.
2831 @cindex cross staff stem
2832 @cindex stem, cross staff
2835 @c fixme: should have hyperlinks as well.
2840 @c . {Automatic staff changes}
2841 @node Automatic staff changes
2842 @subsection Automatic staff changes
2843 @cindex Automatic staff changes
2845 Voices can switch automatically between the top and the bottom
2846 staff. The syntax for this is
2848 \autochange Staff \context Voice @{ @dots{}@var{music}@dots{} @}
2850 The autochanger switches on basis of pitch (central C is the turning
2851 point), and it looks ahead skipping over rests to switch rests in
2852 advance. Here is a practical example:
2854 @lilypond[verbatim,singleline]
2855 \score { \notes \context PianoStaff <
2856 \context Staff = "up" {
2857 \autochange Staff \context Voice = VA < \relative c' {
2858 g4 a b c d r4 a g } > }
2859 \context Staff = "down" {
2864 Spacer rests are used to prevent the bottom staff from
2865 terminating too soon.
2868 @node Manual staff switches
2869 @subsection Manual staff switches
2871 @cindex manual staff switches
2872 @cindex staff switch, manual
2874 Voices can be switched between staves manually, using the following command:
2876 \translator Staff = @var{staffname} @var{music}
2878 The string @var{staffname} is the name of the staff. It switches the
2879 current voice from its current staff to the Staff called
2880 @var{staffname}. Typically @var{staffname} is @code{"up"} or
2888 Piano pedal instruction can be expressed using
2889 @code{\sustainDown}, @code{\sustainUp}, @code{\unaCorda},
2890 @code{\treCorde}, @code{\sostenutoDown} and @code{\sostenutoUp}.
2892 The symbols that are printed can be modified by setting
2893 @code{pedal@var{X}Strings}, where @var{X} is one of the pedal types:
2894 Sustain, Sostenuto or UnaCorda. Refer to the generated documentation of
2895 @internalsref{SustainPedal}, for example, for more information.
2897 Pedals can also be indicated by a sequence of brackets, by setting the
2898 @code{pedal-type} property of SustainPedal objects:
2900 @lilypond[fragment,verbatim]
2901 \property Staff.SustainPedal \override #'pedal-type = #'bracket
2902 c''4 \sustainDown d''4 e''4 a'4
2903 \sustainUp \sustainDown
2904 f'4 g'4 a'4 \sustainUp
2907 A third style of pedal notation is a mixture of text and brackets,
2908 obtained by setting @code{pedal-type} to @code{mixed}:
2910 @lilypond[fragment,verbatim]
2911 \property Staff.SustainPedal \override #'pedal-type = #'mixed
2912 c''4 \sustainDown d''4 e''4 c'4
2913 \sustainUp \sustainDown
2914 f'4 g'4 a'4 \sustainUp
2917 The default '*Ped' style for sustain and damper pedals corresponds to
2918 @code{\pedal-type = #'text}. However, @code{mixed} is the default style
2919 for a sostenuto pedal:
2921 @lilypond[fragment,verbatim]
2922 c''4 \sostenutoDown d''4 e''4 c'4 f'4 g'4 a'4 \sostenutoUp
2925 For fine-tuning of the appearance of a pedal bracket, the properties
2926 @code{edge-width}, @code{edge-height}, and @code{shorten-pair} of
2927 @code{PianoPedalBracket} objects (see the detailed documentation of
2928 @rgrob{PianoPedalBracket}) can be modified. For example, the bracket
2929 may be extended to the end of the note head.
2931 @lilypond[fragment,verbatim]
2932 \property Staff.PianoPedalBracket \override
2933 #'shorten-pair = #'(0 . -1.0)
2934 c''4 \sostenutoDown d''4 e''4 c'4
2935 f'4 g'4 a'4 \sostenutoUp
2939 @subsection Arpeggio
2942 @cindex broken arpeggio
2943 @cindex @code{\arpeggio}
2945 You can specify an arpeggio sign on a chord by attaching an
2946 @code{\arpeggio} to a chord.
2949 @lilypond[fragment,relative,verbatim]
2950 <<c e g c>>-\arpeggio
2953 When an arpeggio crosses staves in piano music, you attach an arpeggio
2954 to the chords in both staves, and set
2955 @code{PianoStaff.connectArpeggios}.
2957 @lilypond[fragment,relative,verbatim]
2958 \context PianoStaff <
2959 \property PianoStaff.connectArpeggios = ##t
2960 \context Voice = one { <<c' e g c>>-\arpeggio }
2961 \context Voice = other { \clef bass <<c,, e g>>-\arpeggio}
2965 This command creates @internalsref{Arpeggio} objects. Cross staff arpeggios
2966 are @code{PianoStaff.Arpeggio}.
2968 To add an arrow head to explicitly specify the direction of the
2969 arpeggio, you should set the arpeggio object property
2970 @code{arpeggio-direction}.
2972 @lilypond[fragment,relative,verbatim]
2974 \property Voice.Arpeggio \set #'arpeggio-direction = #1
2975 <<c e g c>>-\arpeggio
2976 \property Voice.Arpeggio \set #'arpeggio-direction = #-1
2977 <<c e g c>>-\arpeggio
2981 A square bracket on the left indicates that the player should not
2982 arpeggiate the chord. To draw these brackets, set the
2983 @code{molecule-callback} property of @code{Arpeggio} or
2984 @code{PianoStaff.Arpeggio} objects to @code{\arpeggioBracket}, and use
2985 @code{\arpeggio} statements within the chords as before.
2987 @lilypond[fragment,relative,verbatim]
2988 \context PianoStaff <
2989 \property PianoStaff.connectArpeggios = ##t
2990 \property PianoStaff.Arpeggio \override
2991 #'molecule-callback = \arpeggioBracket
2992 \context Voice = one { <<c' e g c>>-\arpeggio }
2993 \context Voice = other { \clef bass <<c,, e g>>-\arpeggio }
3000 It is not possible to mix connected arpeggios and unconnected
3001 arpeggios in one PianoStaff at the same time.
3005 @node Voice follower lines
3006 @subsection Voice follower lines
3008 @cindex follow voice
3009 @cindex staff switching
3012 @cindex @code{followVoice}
3014 Whenever a voice switches to another staff a line connecting the notes
3015 can be printed automatically. This is enabled if the property
3016 @code{PianoStaff.followVoice} is set to true:
3018 @lilypond[fragment,relative,verbatim]
3019 \context PianoStaff <
3020 \property PianoStaff.followVoice = ##t
3021 \context Staff \context Voice {
3023 \translator Staff=two
3026 \context Staff=two {\clef bass \skip 1*2 }
3030 The associated object is @internalsref{VoiceFollower}.
3036 Tablature notation is used for notating music for plucked string
3037 instruments. It notates pitches not by using note heads, but by
3038 indicating on which string and fret a note must be played. LilyPond
3039 offers limited support for tablature.
3042 * Tablatures basic::
3043 * Non-guitar tablatures::
3044 * Tablature in addition to normal staff::
3047 @node Tablatures basic
3048 @subsection Tablatures basic
3049 @cindex Tablatures basic
3051 Tablature can be typeset with Lilypond by using the
3052 @internalsref{TabStaff} and @internalsref{TabVoice} contexts. As
3053 tablature is a recent feature in Lilypond, most of the guitar special
3054 effects such as bend are not yet supported.
3056 With the @internalsref{TabStaff}, the string number associated to a note
3057 is given as a backslash followed by the string number, e.g. @code{c4\3} for a C
3058 quarter on the third string. By default, string 1 is the highest one, and the
3059 tuning defaults to the standard guitar tuning (with 6 strings).
3061 @lilypond[fragment,verbatim]
3070 If you do not specify a string number then lilypond automatically selects one.
3071 The selection is controlled by the translator property @code{minimumFret}. -- LilyPond
3072 simply selects the first string that does not give a fret number less than
3073 @code{minimumFret}. Default is 0.
3075 Notice that LilyPond does not handle chords in any special way, and hence
3076 the automatic string selector may easily select the same string to two notes in a chord.
3079 e8 fis gis a b cis' dis' e'
3080 \property TabStaff.minimumFret = #8
3081 e8 fis gis a b cis' dis' e'
3083 @lilypond[noindent,noquote]
3086 e8 fis gis a b cis' dis' e'
3087 \property TabStaff.minimumFret = #8
3088 e8 fis gis a b cis' dis' e'
3091 \context StaffGroup <
3092 \context Staff { \clef "G_8" \frag }
3093 \context TabStaff { \frag }
3098 @node Non-guitar tablatures
3099 @subsection Non-guitar tablatures
3100 @cindex Non-guitar tablatures
3102 There are many ways to customize Lilypond tablatures.
3104 First you can change the number of strings, by setting the number of
3105 lines in the @internalsref{TabStaff} (the @code{line-count} property
3106 of TabStaff can only be changed using @code{\outputproperty}, for more
3107 information, see @ref{Tuning per object}. You can change the strings
3108 tuning. A string tuning is given as a Scheme list with one integer
3109 number for each string, the number being the pitch of an open string.
3111 (The numbers specified for stringTuning are the numbers of semitons
3112 to subtract --- or add --- starting the specified pitch by default
3113 middle C, in string order: thus the notes are e, a, d & g)
3115 @lilypond[fragment,verbatim]
3118 \outputproperty #(make-type-checker 'staff-symbol-interface)
3120 \property TabStaff.stringTunings = #'(-5 -10 -15 -20)
3123 a,4 c' a e' e c' a e'
3128 Finally, it is possible to change the Scheme function to format the
3129 tablature note text. The default is @var{fret-number-tablature-format},
3130 which uses the fret number, but for some instruments that may not use
3131 this notation, just create your own tablature-format function. This
3132 function takes three argument: the string number, the string tuning and
3136 @node Tablature in addition to normal staff
3137 @subsection Tablature in addition to normal staff
3138 @cindex Tablature in addition to normal staff
3140 It is possible to typeset both tablature and a "normal" staff, as
3141 commonly done in many parts.
3143 A common trick for that is to put the notes in a variables, and to hide
3144 the fingering information (which correspond to the string number) for
3148 @c @lily pond[verbatim]
3155 \context StaffGroup <
3157 % Hide fingering number
3158 \property Staff.Fingering \override #'transparent = ##t
3163 \property Staff.Stem \override #'direction = #1
3177 LilyPond has support for both entering and printing chords.
3178 @lilypond[verbatim,singleline]
3179 twoWays = \notes \transpose c c' {
3189 < \context ChordNames \twoWays
3190 \context Voice \twoWays > }
3193 This example also shows that the chord printing routines do not try to
3194 be intelligent. If you enter @code{f bes d}, it does not interpret
3195 this as an inversion.
3197 As you can see chords really are a set of pitches. They are internally
3198 stored as simultaneous music expressions. This means you can enter
3199 chords by name and print them as notes, enter them as notes and print
3200 them as chord names, or (the most common case) enter them by name, and
3205 * Printing named chords::
3210 @subsection Chords mode
3213 Chord mode is a mode where you can input sets of pitches using common
3214 names. It is introduced by the keyword @code{\chords}. It is similar
3215 to note mode, but words are also looked up in a chord modifier table
3216 (containing @code{maj}, @code{dim}, etc). Dashes and carets are used
3217 to indicate chord additions and subtractions, so articulation scripts
3218 can not be entered in Chord mode.
3220 Throughout these examples, chords have been shifted around the staff
3221 using @code{\transpose}.
3223 @lilypond[fragment,verbatim]
3227 c:9 c:9-.5+.7+ c:3-.5-
3237 The second type of modifier that may appear after the @code{:} is a
3238 named modifier. Named modifiers are listed in the file
3239 @file{chord-modifiers.ly}. The available modifiers are @code{m} and
3240 @code{min} which lower the 3rd half a step, `@code{aug}' which
3241 raises the 5th, `@code{dim}' which lowers the 5th,
3242 `@code{maj}' which adds a raised 7th, and `@code{sus}'
3243 which replaces the 5th with a 4th.
3245 @lilypond[fragment,verbatim]
3248 c1:m c:min7 c:maj c:aug c:dim c:sus
3254 Chord subtractions are used to eliminate notes from a chord. The
3255 notes to be subtracted are listed after a @code{^} character,
3258 @lilypond[fragment,verbatim,center]
3267 Chord inversions can be specified by appending `@code{/}' and the name
3268 of a single note to a chord. In a chord inversion, the inverted note is
3269 transposed down until it is the lowest note in the chord. If the note
3270 is not in the chord, a warning will be printed.
3272 @lilypond[fragment,verbatim,center]
3282 Bass notes can be added by `@code{/+}' and
3283 the name of a single note to a chord. This has the effect of
3284 adding the specified note to the chord, lowered by an octave,
3285 so it becomes the lowest note in the chord.
3287 @lilypond[fragment,verbatim,center]
3296 The formal syntax for named chords is as follows:
3298 @var{tonic}[@var{duration}][@code{-}@var{modifiers}][@code{^}@var{subtractions}][@code{/}@var{inversion}][@code{/+}@var{bass}].
3301 @var{tonic} should be the tonic note of the chord, and @var{duration} is
3302 the chord duration in the usual notation. There are two kinds of
3303 modifiers. One type is formed by @emph{chord additions}. Additions are
3304 obtained by listing intervals separated by dots. An interval is written
3305 by its number with an optional @code{+} or @code{-} to indicate raising
3306 or lowering by half a step. Chord additions have two effects: they adds
3307 the specified interval and all lower odd numbered intervals to the
3308 chord, and they may lower or raise the specified interval.
3313 Implementation details are gory. For example @code{c:4} not only adds
3314 a fourth, but also removes the third.
3317 @c . {Printing named chords}
3318 @node Printing named chords
3319 @subsection Printing named chords
3321 @cindex printing chord names
3325 For displaying printed chord names, use the @internalsref{ChordNames} context.
3326 The chords may be entered either using the notation described above, or
3327 directly using simultaneous music.
3329 @lilypond[verbatim,singleline]
3331 \chords {a1 b c} <<d f g>> <<e g b>>
3335 \context ChordNames \scheme
3336 \context Staff \transpose c c' \scheme
3341 You can make the chord changes stand out by setting
3342 @code{ChordNames.chordChanges} to true. This will only display chord
3343 names when there's a change in the chords scheme and at the start of a
3348 c1:m c:m \break c:m c:m d
3352 \context ChordNames {
3353 \property ChordNames.chordChanges = ##t
3355 \context Staff \transpose c c' \scheme
3357 \paper{linewidth= 9.\cm}
3361 LilyPond examines chords specified as lists of notes to determine a name
3362 to give the chord. LilyPond will not try to identify chord inversions or
3363 an added bass note, which may result in strange chord names when chords
3364 are entered as a list of pitches:
3366 @lilypond[verbatim,center,singleline]
3375 \context ChordNames \scheme
3376 \context Staff \scheme
3382 By default, a chord name system proposed by Harald Banter (See
3383 @ref{Literature}) is used. The system is very regular and predictable.
3384 Typical American style chord names may be selected by setting the
3385 @code{style} property of the @code{ChordNames.ChordName} object to
3386 @code{'american}. Similarly @code{'jazz} selects Jazz chordnames.
3388 Routines that determine the names to be printed are written in Scheme,
3389 and may be customized by the user. The code can be found in
3390 @file{scm/chord-name.scm}. Here's an example showing the differences in
3394 @c maybe just junk verbatim option?
3395 @lilypond[verbatim,singleline,noquote]
3405 \context ChordNames = banter \scheme
3406 \context ChordNames = american {
3407 \property ChordNames.ChordName \override
3408 #'style = #'american \scheme }
3409 \context ChordNames = jazz {
3410 \property ChordNames.ChordName \override
3411 #'style = #'jazz \scheme }
3412 \context Staff \transpose c c' \scheme
3419 @section Writing parts
3421 Orchestral music involves some special notation, both in the full score,
3422 as in the individual parts. This section explains how to tackle common
3423 problems in orchestral music.
3430 * Instrument names::
3432 * Multi measure rests::
3433 * Automatic part combining::
3434 * Hara kiri staves::
3435 * Sound output for transposing instruments::
3438 @c . {Rehearsal marks}
3439 @node Rehearsal marks
3440 @subsection Rehearsal marks
3441 @cindex Rehearsal marks
3443 @cindex @code{\mark}
3445 To print a rehearsal mark, use the @code{\mark} command.
3446 @lilypond[fragment,verbatim]
3457 As you can see, the mark is incremented automatically if you use
3458 @code{\mark \default}. The value to use is stored in the property
3459 @code{rehearsalMark} is used and automatically incremented. The object
3460 is @internalsref{RehearsalMark} in @internalsref{Score} context. See
3461 @code{input/test/boxed-molecule.ly} if you need boxes around the
3464 The @code{\mark} command can also be used to put signs like coda,
3465 segno and fermatas on a barline. The trick is to use the text markup
3466 mechanism to access the fermata symbol.
3467 @lilypond[fragment,verbatim,relative=1]
3468 c1 \mark #'(music "scripts-ufermata")
3472 The problem is that marks that occur at a line break are typeset only
3473 at the beginning of the next line, opposite to what you want for the
3474 fermata. This can be corrected by the following property setting
3476 \property Score.RehearsalMark \override
3477 #'visibility-lambda = #begin-of-line-invisible
3483 @cindex barlines, putting symbols on
3487 @subsection Bar numbers
3491 @cindex measure numbers
3492 @cindex currentBarNumber
3494 Bar numbers are printed by default at the start of the line. The
3495 number itself is a property that can be set by modifying the
3496 @code{currentBarNumber} property, although that is usually not
3499 \property Score.currentBarNumber = #217
3502 To typeset Bar Numbers at regular intervals instead of at the beginning of each line,
3503 you need to change the grob property @code{break-visibility} as well as the translator
3504 property @code{barNumberVisibility}, as illustrated in the following example which also
3505 adds a box around the bar numbers:
3507 \property Score.BarNumber \override #'break-visibility =
3508 #end-of-line-invisible
3509 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3510 \property Score.BarNumber \override #'molecule-callback =
3511 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3512 \property Score.BarNumber \override #'font-relative-size = #0
3514 @lilypond[noindent,noquote]
3516 \context Staff \notes \transpose c c'' {
3517 \property Score.BarNumber \override #'break-visibility = #end-of-line-invisible
3518 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3519 \property Score.BarNumber \override #'molecule-callback =
3520 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3521 \property Score.BarNumber \override #'font-relative-size = #0
3523 \repeat unfold 16 c1 \bar "|."
3528 See also @seeinternals{BarNumber}.
3532 Barnumbers can collide with the StaffGroup, if there is one at the
3533 top. To solve this, You have to twiddle with the
3534 @internalsref{padding} property of @internalsref{BarNumber} if your
3535 score starts with a @internalsref{StaffGroup}.
3537 @node Instrument names
3538 @subsection Instrument names
3540 In scores, the instrument name is printed before the staff. This can
3541 be done by setting @code{Staff.instrument} and
3542 @code{Staff.instr}. This will print a string before the start of the
3543 staff. For the first start, @code{instrument} is used, for the next
3544 ones @code{instr} is used.
3546 @lilypond[verbatim,singleline]
3547 \property Staff.instrument = "ploink " { c''4 }
3550 You can also use markup texts to construct more complicated instrument
3554 @lilypond[verbatim,singleline]
3556 '((font-relative-size . -2 ) (music "accidentals--1")))
3559 \property Staff.instrument = #`((kern . 0.5) (lines
3560 "2 Clarinetti" (columns " (B" ,text-flat ")")))
3568 When you put a name on a grand staff or piano staff the width of the
3569 brace is not taken into account. You must add extra spaces to the end of
3570 the name to avoid a collision.
3573 @subsection Transpose
3575 @cindex transposition of pitches
3576 @cindex @code{\transpose}
3578 A music expression can be transposed with @code{\transpose}. The syntax
3581 \transpose @var{from} @var{to} @var{musicexpr}
3584 This means that @var{musicexpr} is transposed to by the interval
3585 between @var{from} is @var{to}.
3587 @code{\transpose} distinguishes between enharmonic pitches: both
3588 @code{\transpose c cis} or @code{\transpose c des} will transpose up
3589 half a tone. The first version will print sharps and the second
3590 version will print flats.
3592 @lilypond[singleline, verbatim]
3593 mus =\notes { \key d \major cis d fis g }
3594 \score { \notes \context Staff {
3597 \transpose c g' \mus
3598 \transpose c f' \mus
3602 If you want to use both @code{\transpose} and @code{\relative}, then
3603 you must use @code{\transpose} first. @code{\relative} will have no
3604 effect music that appears inside a @code{\transpose}.
3606 @c . {Multi measure rests}
3607 @node Multi measure rests
3608 @subsection Multi measure rests
3609 @cindex Multi measure rests
3613 Multi measure rests are entered using `@code{R}'. It is specifically
3614 meant for full bar rests and for entering parts: the rest can expand to
3615 fill a score with rests, or it can be printed as a single multimeasure
3616 rest This expansion is controlled by the property
3617 @code{Score.skipBars}. If this is set to true, Lily will not expand
3618 empty measures, and the appropriate number is added automatically.
3620 @lilypond[fragment,verbatim]
3621 \time 4/4 r1 | R1 | R1*2
3622 \property Score.skipBars = ##t R1*17 R1*4
3625 The @code{1} in @code{R1} is similar to the duration notation used for
3626 notes. Hence, for time signatures other than 4/4, you must enter other
3627 durations. This can be done with augmentation dots, or with
3630 @lilypond[fragment,verbatim]
3631 \property Score.skipBars = ##t
3638 Notice that a @code{R} spanning a single measure is printed as a whole
3639 rest centered in the measure, regardless of the time signature.
3641 [ add note about breves.]
3644 @cindex whole rests for a full measure
3646 The object for this object is @internalsref{MultiMeasureRest}, and
3647 @internalsref{MultiMeasureRestNumber}.
3651 Currently, there is no way to automatically condense multiple rests
3652 into a single multimeasure rest. Multi measure rests do not take part
3655 Multi-measure rests do not accept @var{note}-@code{text} syntax for
3656 putting texts and scripts on the rest. This has to be done by setting
3657 @code{#'text} in @internalsref{MultiMeasureRestNumber}. An identifier is
3658 provided for a fermata:
3660 @cindex text on multi-measure rest
3661 @cindex script on multi-measure rest
3662 @cindex fermata on multi-measure rest
3664 @lilypond[verbatim,fragment]
3666 \setMmRestFermata R2.
3670 @cindex condensing rests
3672 @node Automatic part combining
3673 @subsection Automatic part combining
3674 @cindex automatic part combining
3675 @cindex part combiner
3678 Automatic part combining is used to merge two parts of music onto a
3679 staff in an intelligent way. It is aimed primarily at typesetting
3680 orchestral scores. When the two parts are identical for a period of
3681 time, only one is shown. In places where the two parts differ, they
3682 are typeset as separate voices, and stem directions are set
3683 automatically. Also, solo and @emph{a due} parts can be identified
3686 The syntax for part combining is
3689 \partcombine @var{context} @var{musicexpr1} @var{musicexpr2}
3691 where the pieces of music @var{musicexpr1} and @var{musicexpr2} will be
3692 combined into one context of type @var{context}. The music expressions
3693 must be interpreted by contexts whose names should start with @code{one}
3696 The most useful function of the part combiner is to combine parts into
3697 one voice, as common for wind parts in orchestral scores:
3699 @lilypond[verbatim,singleline,fragment]
3701 \context Voice=one \partcombine Voice
3702 \context Thread=one \relative c'' {
3705 \context Thread=two \relative c'' {
3711 Notice that the first @code{g} appears only once, although it was
3712 specified twice (once in each part). Stem, slur and tie directions are
3713 set automatically, depending whether there is a solo or unisono. The
3714 first part (with context called @code{one}) always gets up stems, and
3715 `solo', while the second (called @code{two}) always gets down stems and
3718 If you just want the merging parts, and not the textual markings, you
3719 may set the property @var{soloADue} to false.
3721 @lilypond[verbatim,singleline,fragment]
3723 \property Staff.soloADue = ##f
3724 \context Voice=one \partcombine Voice
3725 \context Thread=one \relative c'' {
3728 \context Thread=two \relative c'' {
3734 There are a number of other properties that you can use to tweak the
3735 behavior of part combining, refer to the automatically generated
3736 documentation of @reng{Thread_devnull_engraver} and
3737 @reng{Voice_devnull_engraver}. Look at the documentation of the
3738 responsible engravers, @code{Thread_devnull_engraver},
3739 @code{Voice_devnull_engraver} and @code{A2_engraver}.
3743 In @code{soloADue} mode, when the two voices play the same notes on and
3744 off, the part combiner may typeset @code{a2} more than once in a
3747 @lilypond[fragment,singleline]
3749 \context Voice=one \partcombine Voice
3750 \context Thread=one \relative c'' {
3753 \context Thread=two \relative c'' {
3759 @cindex @code{Thread_devnull_engraver}
3760 @cindex @code{Voice_engraver}
3761 @cindex @code{A2_engraver}
3763 @node Hara kiri staves
3764 @subsection Hara kiri staves
3766 In orchestral scores, staff lines that only have rests are usually removed.
3767 This saves some space. LilyPond also supports this through the hara
3768 kiri@footnote{Hara kiri, also called Seppuku, is the ritual suicide of
3769 the Japanese Samourai warriors.} staff. This staff commits suicide when
3770 it finds itself to be empty after the line-breaking process. It will
3771 not disappear when it contains normal rests, you must use multi measure
3774 The hara kiri staff is specialized version of the @internalsref{Staff}
3775 context. It is available as the context identifier
3776 @code{\HaraKiriStaffContext}. Observe how the second staff in this
3777 example disappears in the second line.
3781 \notes \relative c' <
3782 \context Staff = SA { e4 f g a \break c1 }
3783 \context Staff = SB { c4 d e f \break R1 }
3787 \translator { \HaraKiriStaffContext }
3793 @node Sound output for transposing instruments
3794 @subsection Sound output for transposing instruments
3796 When you want to make a MIDI file from a score containing transposed
3797 and untransposed instruments, you have to instruct LilyPond the pitch
3798 offset (in semitones) for the transposed instruments. This is done
3799 using the @code{transposing} property. It does not affect printed
3802 @cindex @code{transposing}
3805 \property Staff.instrument = #"Cl. in B-flat"
3806 \property Staff.transposing = #-2
3812 @node Ancient notation
3813 @section Ancient notation
3815 @cindex Vaticana, Editio
3816 @cindex Medicaea, Editio
3822 * Ancient note heads::
3830 @node Ancient note heads
3831 @subsection Ancient note heads
3833 To get a longa note head, you have to use mensural note heads. This
3834 is accomplished by setting the @code{style} property of the
3835 NoteHead object to @code{mensural}. There is also a note head style
3836 @code{baroque} which gives mensural note heads for @code{\longa} and
3837 @code{\breve} but standard note heads for shorter notes.
3839 @lilypond[fragment,singleline,verbatim]
3840 \property Voice.NoteHead \set #'style = #'mensural
3845 @subsection Ancient clefs
3847 LilyPond supports a variety of clefs, many of them ancient.
3849 For modern clefs, see section @ref{Clef}. For the percussion clef, see
3850 section @ref{Percussion staves}. For the @code{TAB} clef, see section
3853 The following table shows all ancient clefs that are supported via the
3854 @code{\clef} command. Some of the clefs use the same glyph, but differ
3855 only with respect to the line they are printed on. In such cases, a
3856 trailing number in the name is used to enumerate these clefs. Still,
3857 you can manually force a clef glyph to be typeset on an arbitrary line,
3858 as described in section @ref{Clef}. The note printed to the right side
3859 of each clef denotes the @code{c'} with respect to the clef.
3863 @c --- This should go somewhere else: ---
3864 @c @item modern style G clef (glyph: @code{clefs-G})
3867 @c @code{treble}, @code{violin}, @code{G}, @code{G2}, @code{french}
3869 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "G" c'}
3871 @c @item modern style F clef (glyph: @code{clefs-F})
3874 @c @code{varbaritone}, @code{bass}, @code{F}, @code{subbass}
3876 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "F" c'}
3878 @c @item modern style C clef (glyph: @code{clefs-C})
3881 @c @code{soprano}, @code{mezzosoprano}, @code{alto}, @code{C},
3882 @c @code{tenor}, @code{baritone}
3884 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "C" c'}
3886 @item modern style mensural C clef (glyph: @code{clefs-neo_mensural_c'})
3889 @code{neo_mensural_c1}, @code{neo_mensural_c2},
3890 @code{neo_mensural_c3}, @code{neo_mensural_c4}
3892 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "neo_mensural_c2" c'}
3894 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c1})
3900 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c1" c'}
3902 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c2})
3908 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c2" c'}
3910 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c3})
3916 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c3" c'}
3918 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c4})
3924 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c4" c'}
3926 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c5})
3932 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c5" c'}
3934 @item petrucci style mensural F clef (glyph: @code{clefs-petrucci_f})
3939 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_f" c'}
3941 @item petrucci style mensural G clef (glyph: @code{clefs-petrucci_g})
3946 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_g" c'}
3948 @item historic style mensural C clef (glyph: @code{clefs-mensural_c'})
3951 @code{mensural_c1}, @code{mensural_c2}, @code{mensural_c3},
3954 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_c2" c'}
3956 @item historic style mensural F clef (glyph: @code{clefs-mensural_f})
3961 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_f" c'}
3963 @item historic style mensural G clef (glyph: @code{clefs-mensural_g})
3968 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_g" c'}
3970 @item Editio Vaticana style do clef (glyph: @code{clefs-vaticana_do})
3973 @code{vaticana_do1}, @code{vaticana_do2}, @code{vaticana_do3}
3975 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_do2" c'}
3977 @item Editio Vaticana style fa clef (glyph: @code{clefs-vaticana_fa})
3980 @code{vaticana_fa1}, @code{vaticana_fa2}
3982 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_fa2" c'}
3984 @item Editio Medicaea style do clef (glyph: @code{clefs-medicaea_do})
3987 @code{medicaea_do1}, @code{medicaea_do2}, @code{medicaea_do3}
3989 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_do2" c'}
3991 @item Editio Medicaea style fa clef (glyph: @code{clefs-medicaea_fa})
3994 @code{medicaea_fa1}, @code{medicaea_fa2}
3996 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_fa2" c'}
3998 @item historic style hufnagel do clef (glyph: @code{clefs-hufnagel_do})
4001 @code{hufnagel_do1}, @code{hufnagel_do2}, @code{hufnagel_do3}
4003 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do2" c'}
4005 @item historic style hufnagel fa clef (glyph: @code{clefs-hufnagel_fa})
4008 @code{hufnagel_fa1}, @code{hufnagel_fa2}
4010 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_fa2" c'}
4012 @item historic style hufnagel combined do/fa clef (glyph: @code{clefs-hufnagel_do_fa})
4015 @code{hufnagel_do_fa}
4017 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do_fa" c'}
4019 @c --- This should go somewhere else: ---
4020 @c @item modern style percussion clef (glyph: @code{clefs-percussion})
4023 @c @code{percussion}
4025 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "percussion" c'}
4027 @c @item modern style tab clef (glyph: @code{clefs-tab})
4032 @c @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #6 \property Staff.TimeSignature \set #'transparent = ##t \clef "tab" c'}
4036 @emph{Modern style} means ``as is typeset in current editions of
4037 transcribed mensural music''.
4039 @emph{Petrucci style} means ``inspired by printings published by the
4040 famous engraver Petrucci (1466-1539)''.
4042 @emph{Historic style} means ``as was typeset or written in contemporary
4043 historic editions (other than those of Petrucci)''.
4045 @emph{Editio XXX style} means ``as is/was printed in Editio XXX''.
4047 Petrucci used C clefs with differently balanced left-side vertical
4048 beams, depending on which staffline it was printed.
4051 @subsection Custodes
4056 A @emph{custos} (plural: @emph{custodes}; latin word for `guard') is a
4057 staff context symbol that appears at the end of a staff line. It
4058 anticipates the pitch of the first note(s) of the following line and
4059 thus helps the player or singer to manage line breaks during
4060 performance, thus enhancing readability of a score.
4062 @lilypond[verbatim,noquote]
4065 \property Staff.Custos \set #'style = #'mensural
4070 \consists Custos_engraver
4076 Custodes were frequently used in music notation until the 17th century.
4077 There were different appearances for different notation styles.
4078 Nowadays, they have survived only in special forms of musical notation
4079 such as via the @emph{editio vaticana} dating back to the beginning of
4082 For typesetting custodes, just put a @code{Custos_engraver} into the
4083 @internalsref{Staff} context when declaring the @code{\paper} block. In this
4084 block, you can also globally control the appearance of the custos symbol
4085 by setting the custos @code{style} property. Currently supported styles
4086 are @code{vaticana}, @code{medicaea}, @code{hufnagel} and
4093 \consists Custos_engraver
4094 Custos \override #'style = #'mensural
4099 The property can also be set locally, for example in a @code{\notes}
4104 \property Staff.Custos \override #'style = #'vaticana
4105 c'1 d' e' d' \break c' d' e' d'
4110 @subsection Ligatures
4114 @c TODO: Should double check if I recalled things correctly when I wrote
4115 @c down the following paragraph by heart.
4116 In musical terminology, a ligature is a coherent graphical symbol that
4117 represents at least two different notes. Ligatures originally appeared
4118 in the manuscripts of Gregorian chant notation roughly since the 9th
4119 century as an allusion to the accent symbols of greek lyric poetry to
4120 denote ascending or descending sequences of notes. Both, the shape and
4121 the exact meaning of ligatures changed tremendously during the following
4122 centuries: In early notation, ligatures where used for monophonic tunes
4123 (Gregorian chant) and very soon denoted also the way of performance in
4124 the sense of articulation. With upcoming multiphony, the need for a
4125 metric system arised, since multiple voices of a piece have to be
4126 synchronized some way. New notation systems were invented, that used
4127 the manifold shapes of ligatures to now denote rhythmical patterns
4128 (e.g. black mensural notation, mannered notation, ars nova). With the
4129 invention of the metric system of the white mensural notation, the need
4130 for ligatures to denote such patterns disappeared. Nevertheless,
4131 ligatures were still in use in the mensural system for a couple of
4132 decades until they finally disappeared during the late 16th / early 17th
4133 century. Still, ligatures have survived in contemporary editions of
4134 Gregorian chant such as the Editio Vaticana from 1905/08.
4136 Syntactically, ligatures are simply enclosed by @code{\[} and @code{\]}.
4137 Some ligature styles (such as Editio Vaticana) may need additional input
4138 syntax specific for this particular type of ligature. By default, the
4139 @internalsref{LigatureBracket} engraver just marks the start and end of
4140 a ligature by small square angles:
4142 @lilypond[singleline,verbatim]
4144 \notes \transpose c c' {
4152 To select a specific style of ligatures, a proper ligature engraver has
4153 to be added to the @internalsref{Voice} context, as explained in the
4154 following subsections. Currently, Lilypond only supports white mensural
4155 ligatures with certain limitations. Support for Editio Vaticana will be
4156 added in the future.
4159 * White mensural ligatures::
4162 @node White mensural ligatures
4163 @subsubsection White mensural ligatures
4165 @cindex Mensural ligatures
4166 @cindex White mensural ligatures
4168 Lilypond has limited support for white mensural ligatures. The
4169 implementation is still experimental; it currently may output strange
4170 warnings or even crash in some cases or produce weird results on more
4171 complex ligatures. To engrave white mensural ligatures, in the paper
4172 block the @internalsref{MensuralLigature} engraver has to be put into
4173 the @internalsref{Voice} context (and you probably want to remove the
4174 @internalsref{LigatureBracket} engraver). There is no additional input
4175 language to describe the shape of a white mensural ligature. The shape
4176 is rather determined solely from the pitch and duration of the enclosed
4177 notes. While this approach may take a new user quite a while to get
4178 accustomed, it has a great advantage: this way, lily has full musical
4179 information about the ligature. This is not only required for correct
4180 MIDI output, but also allows for automatic transcription of the
4185 @lilypond[singleline,verbatim]
4187 \notes \transpose c c' {
4188 \property Score.timing = ##f
4189 \property Score.defaultBarType = "empty"
4190 \property Voice.NoteHead \set #'style = #'neo_mensural
4191 \property Staff.TimeSignature \set #'style = #'neo_mensural
4193 \[ g\longa c\breve a\breve f\breve d'\longa \]
4195 \[ e1 f1 a\breve g\longa \]
4200 \remove Ligature_bracket_engraver
4201 \consists Mensural_ligature_engraver
4207 Without replacing @code{Ligature_bracket_engraver} with
4208 @code{Mensural_ligature_engraver}, the same music transcribes to the
4211 @lilypond[singleline,verbatim]
4213 \notes \transpose c c' {
4214 \property Score.timing = ##f
4215 \property Score.defaultBarType = "empty"
4216 \property Voice.NoteHead \set #'style = #'neo_mensural
4217 \property Staff.TimeSignature \set #'style = #'neo_mensural
4219 \[ g\longa c\breve a\breve f\breve d'\longa \]
4221 \[ e1 f1 a\breve g\longa \]
4227 @subsection Figured bass
4229 @cindex Basso continuo
4231 LilyPond has limited support for figured bass:
4233 @lilypond[verbatim,fragment]
4235 \context FiguredBass
4240 \context Voice { c4 g8 }
4244 The support for figured bass consists of two parts: there is an input
4245 mode, introduced by @code{\figures}, where you can enter bass figures
4246 as numbers, and there is a context called @internalsref{FiguredBass}
4247 that takes care of making @internalsref{BassFigure} objects.
4249 In figures input mode, a group of bass figures is delimited by
4250 @code{<} and @code{>}. The duration is entered after the @code{>}.
4255 \context FiguredBass
4259 Accidentals are added to the numbers if you alterate them by
4260 appending @code{-}, @code{!} and @code{+}.
4266 \context FiguredBass
4267 \figures { <4- 6+ 7!> }
4270 Spaces or dashes may be inserted by using @code{_}. Brackets are
4271 introduced with @code{[} and @code{]}.
4277 \context FiguredBass
4278 \figures { < [4 6] 8 [_ 12]> }
4281 Although the support for figured bass may superficially resemble chord
4282 support, it works much simpler: in figured bass simply stores the
4283 numbers, and then prints the numbers you entered. There is no
4284 conversion to pitches, and no realizations of the bass are played in
4288 @c . {Tuning output}
4290 @section Tuning output
4292 LilyPond tries to take as much formatting as possible out of your
4293 hands. Nevertheless, there are situations where it needs some help, or
4294 where you want to override its decisions. In this section we discuss
4295 ways to do just that.
4297 Formatting is internally done by manipulating so called objects (graphic
4298 objects). Each object carries with it a set of properties (object
4299 properties) specific to that object. For example, a stem object has
4300 properties that specify its direction, length and thickness.
4302 The most direct way of tuning the output is by altering the values of
4303 these properties. There are two ways of doing that: first, you can
4304 temporarily change the definition of a certain type of object, thus
4305 affecting a whole set of objects. Second, you can select one specific
4306 object, and set a object property in that object.
4309 * Tuning groups of objects ::
4310 * Tuning per object ::
4315 @node Tuning groups of objects
4316 @subsection Tuning groups of objects
4318 @cindex object description
4320 A object definition is a Scheme association list, that is stored in a
4321 context property. By assigning to that property (using plain
4322 @code{\property}), you can change the resulting objects.
4324 @lilypond[verbatim, fragment]
4325 c'4 \property Voice.Stem = #'()
4328 The @code{\property} assignment effectively empties the definition of
4329 the Stem object. One of the effects is that the recipe of how it should be
4330 printed is erased, with the effect of rendering it invisible. The above
4331 assignment is available as a standard identifier, for the case that you
4335 \property Voice.Stem = \turnOff
4342 This mechanism is fairly crude, since you can only set, but not modify,
4343 the definition of a object. For this reason, there is a more advanced
4346 The definition of a object is actually a list of default object
4347 properties. For example, the definition of the Stem object (available in
4348 @file{scm/grob-description.scm}), defines the following values for
4353 (beamed-lengths . (0.0 2.5 2.0 1.5))
4354 (Y-extent-callback . ,Stem::height)
4358 You can add a property on top of the existing definition, or remove a
4359 property, thus overriding the system defaults:
4361 c'4 \property Voice.Stem \override #'thickness = #4.0
4362 c'4 \property Voice.Stem \revert #'thickness
4365 You should balance @code{\override} and @code{\revert}. If that's too
4366 much work, you can use the @code{\set} shorthand. It performs a revert
4367 followed by an override. The following example gives exactly the same
4368 result as the previous one.
4370 c'4 \property Voice.Stem \set #'thickness = #4.0
4371 c'4 \property Voice.Stem \set #'thickness = #0.8
4374 If you use @code{\set}, you must explicitly restore the default.
4377 Formally the syntax for these constructions is
4379 \property @var{context}.@var{grobname} \override @var{symbol} = @var{value}
4380 \property @var{context}.@var{grobname} \set @var{symbol} = @var{value}
4381 \property @var{context}.@var{grobname} \revert @var{symbol}
4383 Here @var{symbol} is a Scheme expression of symbol type, @var{context}
4384 and @var{grobname} are strings and @var{value} is a Scheme expression.
4387 If you revert a setting which was not set in the first place, then it
4388 has no effect. However, if the setting was set as a system default, it
4389 may remove the default value, and this may give surprising results,
4390 including crashes. In other words, @code{\override} and @code{\revert},
4391 must be carefully balanced.
4393 These are examples of correct nesting of @code{\override}, @code{\set},
4396 A clumsy but correct form:
4398 \override \revert \override \revert \override \revert
4401 Shorter version of the same:
4403 \override \set \set \revert
4406 A short form, using only @code{\set}. This requires you to know the
4409 \set \set \set \set @var{to default value}
4412 If there is no default (i.e. by default, the object property is unset),
4415 \set \set \set \revert
4418 For the digirati, the object description is an Scheme association
4419 list. Since a Scheme list is a singly linked list, we can treat it as a
4420 stack, and @code{\override} and @code{\revert} are just push and pop
4421 operations. This pushing and popping is also used for overriding
4422 automatic beaming settings.
4426 LilyPond will hang or crash if @var{value} contains cyclic references.
4427 The backend is not very strict in type-checking object properties. If you
4428 @code{\revert} properties that are expected to be set by default,
4434 @node Tuning per object
4435 @subsection Tuning per object
4438 Tuning a single object is most often done with @code{\property}. The
4441 \once \property @dots{}
4444 applies a setting only during one moment in the score: notice how the
4445 original setting for stem thickness is restored automatically in the
4448 @lilypond[verbatim, fragment, relative=1]
4450 \once \property Voice.Stem \set #'thickness = #4
4456 @cindex \outputproperty
4458 A second way of tuning objects is the more arcane @code{\outputproperty}
4459 feature. The syntax is as follows:
4461 \outputproperty @var{predicate} @var{symbol} = @var{value}
4463 Here @code{predicate} is a Scheme function taking a object argument, and
4464 returning a boolean. This statement is processed by the
4465 @code{Output_property_engraver}. It instructs the engraver to feed all
4466 objects that it sees to @var{predicate}. Whenever the predicate returns
4467 true, the object property @var{symbol} will be set to @var{value}.
4469 This command is only single shot, in contrast to @code{\override} and
4472 You will need to combine this statement with @code{\context} to select
4473 the appropriate context to apply this to.
4475 In the following example, all note heads occurring at current staff
4476 level, are shifted up and right by setting their @code{extra-offset}
4479 @lilypond[fragment,verbatim,singleline]
4481 \context Staff \outputproperty
4482 #(make-type-checker 'note-head-interface)
4483 #'extra-offset = #'(0.5 . 0.75)
4487 @cindex @code{extra-offset}
4489 In this example, the predicate checks the @code{text} object property, to
4490 shift only the `m.d.' text, but not the fingering instruction "2".
4491 @lilypond[verbatim,singleline]
4492 #(define (make-text-checker text)
4493 (lambda (grob) (equal? text (ly:get-grob-property grob 'text))))
4496 \notes\relative c''' {
4497 \property Voice.Stem \set #'direction = #1
4498 \outputproperty #(make-text-checker "m.d.")
4499 #'extra-offset = #'(-3.5 . -4.5)
4507 If possible, avoid this feature: the semantics are not very clean, and
4508 the syntax and semantics are up for rewrite.
4513 @node Font selection
4514 @subsection Font selection
4516 The most common thing to change about the appearance of fonts is
4517 their size. The font size of a @internalsref{Voice},
4518 @internalsref{Staff} or @internalsref{Thread} context, can be easily
4519 changed by setting the @code{fontSize} property for that context:
4520 @lilypond[fragment,relative=1]
4521 c4 c4 \property Voice.fontSize = #-1
4524 This command will not change the size of variable symbols, such as
4525 beams or slurs. You can use this command to get smaller symbol for
4526 cue notes, but that involves some more subtleties. An elaborate
4527 example of those is in @file{input/test/cue-notes.ly}.
4535 The font used for printing a object can be selected by setting
4536 @code{font-name}, e.g.
4538 \property Staff.TimeSignature
4539 \set #'font-name = #"cmr17"
4541 You may use any font which is available to @TeX{}, such as foreign
4542 fonts or fonts that do not belong to the Computer Modern font family.
4543 Font selection for the standard fonts, @TeX{}'s Computer Modern fonts,
4544 can also be adjusted with a more fine-grained mechanism. By setting
4545 the object properties described below, you can select a different font.
4546 All three mechanisms work for every object that supports
4547 @code{font-interface}.
4551 A symbol indicating the general class of the typeface. Supported are
4552 @code{roman} (Computer Modern), @code{braces} (for piano staff
4553 braces), @code{music} (the standard music font), @code{ancient} (the
4554 ancient notation font) @code{dynamic} (font for dynamic signs) and
4558 A symbol indicating the shape of the font, there are typically several
4559 font shapes available for each font family. Choices are @code{italic},
4560 @code{caps} and @code{upright}
4563 A symbol indicating the series of the font. There are typically several
4564 font series for each font family and shape. Choices are @code{medium}
4567 @item font-relative-size
4568 A number indicating the size relative the standard size. For example,
4569 with 20pt staff height, relative size -1 corresponds to 16pt staff
4570 height, and relative size +1 corresponds to 23 pt staff height.
4572 @item font-design-size
4573 A number indicating the design size of the font.
4575 This is a feature of the Computer Modern Font: each point size has a
4576 slightly different design. Smaller design sizes are relatively wider,
4577 which enhances readability.
4580 For any of these properties, the value @code{*} (i.e. the @emph{symbol},
4581 @code{*}, entered as @code{#'*}), acts as a wildcard. This can be used
4582 to override default setting, which are always present. For example:
4584 \property Lyrics.LyricText \override #'font-series = #'bold
4585 \property Lyrics.LyricText \override #'font-family = #'typewriter
4586 \property Lyrics.LyricText \override #'font-shape = #'*
4589 @cindex @code{font-style}
4591 There are also pre-cooked font selection qualifiers. These are
4592 selected through the object property @code{font-style}. For example,
4593 the style @code{finger} selects family @code{number} and relative size
4594 @code{-3}. Styles available include @code{volta}, @code{finger},
4595 @code{tuplet}, @code{timesig}, @code{mmrest}, @code{script},
4596 @code{large}, @code{Large} and @code{dynamic}. The style sheets and
4597 tables for selecting fonts are located in @file{scm/font.scm}. Refer
4598 to this file for more information.
4600 @cindex magnification
4602 The size of the font may be scaled with the object property
4603 @code{font-magnification}. For example, @code{2.0} blows up all
4604 letters by a factor 2 in both directions.
4608 Relative size is not linked to any real size.
4610 There is no style sheet provided for other fonts besides the @TeX{}
4611 family, and the style sheet can not be modified easiyl.
4613 @cindex font selection
4614 @cindex font magnification
4615 @cindex @code{font-interface}
4619 @subsection Text markup
4623 LilyPond has an internal mechanism to typeset texts. You can
4624 form text markup expressions by composing scheme expressions
4625 in the following way.
4627 @lilypond[verbatim, singleline]
4632 c^#'(italic "italic")
4633 d_#'((bold italic) "ff")
4635 f_#'(lines "one" (bold "two"))
4636 g^#'(music "noteheads-2" ((raise . 2.4) "flags-u3"))
4640 Normally, the Scheme markup text is stored in the @code{text} property
4641 of a object. Formally, it is defined as follows:
4644 text: string | (head? text+)
4645 head: markup | (markup+)
4646 markup-item: property | abbrev
4647 property: (@var{key} . @var{value})
4648 abbrev: @code{columns lines roman music bold italic named super sub}
4649 @code{overstrike text finger volta timesig mmrest mark script}
4650 @code{large Large dynamic}
4653 The markup is broken down and converted into a list of object properties,
4654 which are prepended to the property list. The @var{key}-@var{value}
4655 pair is a object property. A list of properties available is included in
4656 the generated documentation for @internalsref{text-interface}.
4658 The following abbreviations are defined:
4661 horizontal mode: set all text on one line (default)
4663 vertical mode: set every text on a new line
4667 selects the Feta font (the standard font for music notation glyphs),
4668 and uses named lookup
4675 lookup by character name
4677 plain text lookup (by character value)
4683 the next text or character overstrikes this one
4685 select fingering number fontstyle
4687 select volta number fontstyle
4689 select time signature number fontstyle
4691 select multi measure rest number fontstyle
4693 select mark number fontstyle
4695 select scriptsize roman fontstyle
4697 select large roman fontstyle
4699 select Large roman fontstyle
4701 select dynamics fontstyle
4705 @cindex metronome mark
4707 One practical application of complicated markup is to fake a metronome
4711 #(define note '(columns
4712 (music "noteheads-2" ((kern . -0.1) "flags-stem"))))
4713 #(define eight-note `(columns ,note ((kern . -0.1)
4714 (music ((raise . 3.5) "flags-u3")))))
4715 #(define dotted-eight-note
4716 `(columns ,eight-note (music "dots-dot")))
4719 \notes\relative c'' {
4720 a1^#`((columns (font-relative-size . -1))
4721 ,dotted-eight-note " = 64")
4727 TextScript \override #'font-shape = #'upright
4735 The syntax and semantics of markup texts are not clean, and both
4736 syntax and semantics are slated for a rewrite.
4738 LilyPond does not do kerning, and there generally spaces texts
4744 @section Global layout
4746 The global layout determined by three factors: the page layout, the
4747 line breaks and the spacing. These all influence each other: The
4748 choice of spacing determines how densely each system of music is set,
4749 where line breaks breaks are chosen, and thus ultimately how many
4750 pages a piece of music takes. In this section we will explain how the
4751 lilypond spacing engine works, and how you can tune its results.
4753 Globally spoken, this procedure happens in three steps: first,
4754 flexible distances (``springs'') are chosen, based on durations. All
4755 possible line breaking combination are tried, and the one with the
4756 best results---a layout that has uniform density and requires as
4757 little stretching or cramping as possible---is chosen. When the score
4758 is processed by @TeX{}, page are filled with systems, and page breaks
4759 are chosen whenever the page gets full.
4762 * Vertical spacing::
4763 * Horizontal spacing::
4770 @node Vertical spacing
4771 @subsection Vertical spacing
4773 @cindex vertical spacing
4774 @cindex distance between staves
4775 @cindex staff distance
4776 @cindex between staves, distance
4777 @cindex staffs per page
4780 The height of each system is determined automatically by lilypond, to
4781 keep systems from bumping into each other, some minimum distances are
4782 set. By changing these, you can put staves closer together, and thus
4783 put more systems onto one page.
4785 Normally staves are stacked vertically. To make
4786 staves maintain a distance, their vertical size is padded. This is
4787 done with the property @code{minimumVerticalExtent}. It takes a pair
4788 of numbers, so if you want to make it smaller from its, then you could
4791 \property Staff.minimumVerticalExtent = #'(-4 . 4)
4793 This sets the vertical size of the current staff to 4 staff-space on
4794 either side of the center staff line. The argument of
4795 @code{minimumVerticalExtent} is interpreted as an interval, where the
4796 center line is the 0, so the first number is generally negative. you
4797 could also make the staff larger at the bottom by setting it to
4798 @code{(-6 . 4)}. The default value is @code{(-6 . 6)}.
4800 Vertical aligment of staves is handled by the
4801 @internalsref{VerticalAlignment} object, which lives at
4802 @internalsref{Score} level.
4804 The piano staves are handled a little differently: to make cross-staff
4805 beaming work correctly, it necessary that the distance between staves
4806 is fixed. This is also done with a @internalsref{VerticalAlignment}
4807 object, created in @internalsref{PianoStaff}, but a forced distance is
4808 set. This is done with the object property #'forced-distance. If you
4809 want to override this, use a @code{\translator} block as follows:
4813 VerticalAlignment \override #'forced-distance = #9
4816 This would bring the staves together at a distance of 9 staff spaces,
4817 and again this is measured from the center line of each staff.
4821 @node Horizontal spacing
4822 @subsection Horizontal Spacing
4824 The spacing engine translates differences in durations into
4825 stretchable distances (``springs'') of differing lengths. Longer
4826 durations get more space, shorter durations get less. The basis for
4827 assigning spaces to durations, is that the shortest durations get a
4828 fixed amount of space, and the longer durations get more: doubling a
4829 duration adds a fixed amount of space to the note.
4831 For example, the following piece contains lots of half, quarter and
4832 8th notes, the eighth note is followed by 1 note head width. The The
4833 quarter note is followed by 2 NHW, the half by 3 NHW, etc.
4834 @lilypond[fragment, verbatim, relative=1]
4835 c2 c4. c8 c4. c8 c4. c8 c8 c8 c4 c4 c4
4838 These two amounts of space are @code{shortest-duration-space}
4839 @code{spacing-increment}, object properties of
4840 @internalsref{SpacingSpanner}. Normally @code{spacing-increment} is
4841 set to 1.2, which is the width of a note head, and
4842 @code{shortest-duration-space} is set to 2.0, meaning that the
4843 shortest note gets 2 noteheads of space. For normal notes, this space
4844 is always counted from the left edge of the symbol, so the short notes
4845 in a score is generally followed by one note head width of space.
4847 If one would follow the above procedure exactly, then adding a single
4848 32th note to a score that uses 8th and 16th notes, would widen up the
4849 entire score a lot. The shortest note is no longer a 16th, but a 64th,
4850 thus adding 2 noteheads of space to every note. To prevent this, the
4851 shortest duration for spacing is not the shortest note in the score,
4852 but the most commonly found shortest note. Notes that are even
4853 shorter this are followed by a space that is proportonial to their
4854 duration relative to the common shortest note. So if we were to add
4855 only a few 16th notes to the example above, they would be followed by
4858 @lilypond[fragment, verbatim, relative=1]
4859 c2 c4. c8 c4. [c16 c] c4. c8 c8 c8 c4 c4 c4
4862 The most common shortest duration is determined as follows: in every
4863 measure, the shortest duration is determined. The most common short
4864 duration, is taken as the basis for the spacing, with the stipulation
4865 that this shortest duration should always be equal to or shorter than
4866 1/8th note. The shortest duration is printed when you run lilypond
4867 with @code{--verbose}. These durations may also be customized. If you
4868 set the @code{common-shortest-duration} in
4869 @internalsref{SpacingSpanner}, then this sets the base duration for
4870 spacing. The maximum duration for this base (normally 1/8th), is set
4871 through @code{base-shortest-duration}.
4873 @cindex @code{common-shortest-duration}
4874 @cindex @code{base-shortest-duration}
4875 @cindex @code{stem-spacing-correction}
4876 @cindex @code{spacing}
4878 In the introduction it was explained that stem directions influence
4879 spacing. This is controlled with @code{stem-spacing-correction} in
4880 @internalsref{NoteSpacing}. The @code{StaffSpacing} object contains the
4881 same property for controlling the stem/barline spacing. In the
4882 following example shows these corrections, once with default settings,
4883 and once with exaggerated corrections.
4889 \property Staff.NoteSpacing \override #'stem-spacing-correction
4891 \property Staff.StaffSpacing \override #'stem-spacing-correction
4896 \paper { linewidth = -1. } }
4903 Spacing is determined on a score wide basis. If you have a score that
4904 changes its character (measured in durations) half way during the
4905 score, the part containing the longer durations will be spaced too
4908 Generating optically pleasing spacing is black magic. LilyPond tries
4909 to deal with a number of frequent cases. Here is an example that is
4910 not handled correctly, due to the combination of chord collisions and
4915 \context PianoStaff \notes \transpose c c'' <
4916 \context Staff = up { s1 }
4917 \context Staff = down { [c8 c \translator Staff=up <<c d>> c
4918 \translator Staff=down c c c] }
4920 \paper { linewidth = -1 }
4927 @subsection Font size
4928 @cindex font size, setting
4929 @cindex staff size, setting
4930 @cindex @code{paper} file
4932 The Feta font provides musical symbols at seven different sizes.
4933 These fonts are 11 point, 13 point, 16 point, 19 pt, 20 point, 23
4934 point, and 26 point. The point size of a font is the height of the
4935 five lines in a staff when displayed in the font.
4937 Definitions for these sizes are the files @file{paperSZ.ly}, where
4938 @code{SZ} is one of 11, 13, 16, 19, 20, 23 and 26. If you include any
4939 of these files, the identifiers @code{paperEleven},
4940 @code{paperThirteen}, @code{paperSixteen}, @code{paperNineteen},
4941 @code{paperTwenty}, @code{paperTwentythree}, and @code{paperTwentysix}
4942 are defined respectively. The default @code{\paper} block is also
4943 set. These files should be imported at toplevel, i.e.
4945 \include "paper26.ly"
4949 The font definitions are generated using a Scheme function. For more
4950 details, see the file @file{scm/font.scm}.
4955 @subsection Line breaking
4958 @cindex breaking lines
4960 Line breaks are normally computed automatically. They are chosen such
4961 that it looks neither cramped nor loose, and that consecutive lines have
4964 Occasionally you might want to override the automatic breaks; you can
4965 do this by specifying @code{\break}. This will force a line break at
4966 this point. Line breaks can only occur at places where there are bar
4967 lines. If you want to have a line break where there is no bar line,
4968 you can force an invisible bar line by entering @code{\bar
4969 ""}. Similarly, @code{\noBreak} forbids a line break at a certain
4973 @cindex regular line breaks
4974 @cindex four bar music.
4976 If you want linebreaks at regular intervals, you can use the following:
4978 < \repeat 7 unfold @{ s1 * 4 \break @}
4982 This makes the following 28 measures (assuming 4/4 time) be broken every
4986 @subsection Page layout
4989 @cindex breaking pages
4991 @cindex @code{indent}
4992 @cindex @code{linewidth}
4994 The most basic settings influencing the spacing are @code{indent} and
4995 @code{linewidth}. They are set in the @code{\paper} block. They
4996 control the indentation of the first line of music, and the lengths of
4997 the lines. If @code{linewidth} set to a negative value, a single
4998 unjustified line is produced. A similar effect for scores that are
4999 longer than one line, can be produced by setting @code{raggedright} to
5000 true in the @code{\paper} block.
5004 The page layout process happens outside lilypond. Ly2dvi sets page
5005 layout instructions. Ly2dvi responds to the following variables in the
5006 @code{\paper} block. The variable @code{textheight} sets the total
5007 height of the music on each page. The spacing between systems is
5008 controlled with @code{interscoreline}, its default is 16pt.
5009 The distance between the score lines will stretch in order to fill the
5010 full page @code{interscorelinefill} is set to a positive number. In
5011 that case @code{interscoreline} specifies the minimum spacing.
5013 @cindex @code{textheight}
5014 @cindex @code{interscoreline}
5015 @cindex @code{interscorelinefill}
5017 If the variable @code{lastpagefill} is defined (that is, it gets any
5018 value assigned in the @code{\paper} block), systems are evenly
5019 distributed vertically on the last page. This might produce ugly
5020 results in case there are not enough systems on the last page. Note
5021 that @command{lilypond-book} ignores @code{lastpagefill}. See
5022 @ref{Integrating text and music with lilypond-book} for
5025 @cindex @code{lastpagefill}
5027 Page breaks are normally computed by @TeX{}, so they are not under
5028 direct control of LilyPond. However, you can insert a commands into
5029 the @file{.tex} output to instruct @TeX{} where to break pages. You
5030 can insert a @code{\newpage} from within lilypond. This is done by
5031 setting the @code{between-systems-strings} on the
5032 @internalsref{NonMusicalPaperColumn} where the system is broken.
5036 @cindex @code{papersize}
5038 To change the paper size, you must first set the
5039 @code{papersize} paper variable variable. Set it to
5040 the strings @code{a4}, @code{letter}, or @code{legal}. After this
5041 specification, you must set the font as described above. If you want
5042 the default font, then use the 20 point font.
5045 \paper@{ papersize = "a4" @}
5046 \include "paper16.ly"
5049 The file @code{paper16.ly} will now include a file named @file{a4.ly}, which
5050 will set the paper variables @code{hsize} and @code{vsize} (used by
5051 Lilypond and @code{ly2dvi})
5061 LilyPond can produce MIDI output. The performance lacks lots of
5062 interesting effects, such as swing, articulation, slurring, etc., but it
5063 is good enough for proof-hearing the music you have entered. Ties,
5064 dynamics and tempo changes are interpreted.
5066 Dynamic marks, crescendi and decrescendi translate into MIDI volume
5067 levels. Dynamic marks translate to a fixed fraction of the available
5068 MIDI volume range, crescendi and decrescendi make the the volume vary
5069 linearly between their two extremities. The fractions be adjusted by
5070 overriding the @code{absolute-volume-alist} defined in
5071 @file{scm/midi.scm}.
5073 For each type of musical instrument (that MIDI supports), a volume range
5074 can be defined. This gives you basic equalizer control, which can
5075 enhance the quality of the MIDI output remarkably. You can add
5076 instruments and ranges or change the default settings by overriding the
5077 @code{instrument-equalizer-alist} defined in @file{scm/midi.scm}.
5079 Both loudness controls are combined to produce the final MIDI volume.
5083 * MIDI instrument names::
5088 @subsection MIDI block
5092 The MIDI block is analogous to the paper block, but it is somewhat
5093 simpler. The @code{\midi} block can contain:
5097 @item a @code{\tempo} definition
5098 @item context definitions
5101 Assignments in the @code{\midi} block are not allowed.
5105 @cindex context definition
5107 Context definitions follow precisely the same syntax as within the
5108 \paper block. Translation modules for sound are called performers.
5109 The contexts for MIDI output are defined in @file{ly/performer-init.ly}.
5112 @node MIDI instrument names
5113 @subsection MIDI instrument names
5115 @cindex instrument names
5116 @cindex @code{Staff.midiInstrument}
5117 @cindex @code{Staff.instrument}
5119 The MIDI instrument name is set by the @code{Staff.midiInstrument}
5120 property or, if that property is not set, the @code{Staff.instrument}
5121 property. The instrument name should be chosen from the list in
5122 @ref{MIDI instruments}.
5126 If the selected string does not exactly match, then LilyPond uses the
5127 default (Grand Piano). It is not possible to select an instrument by