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.7.10. 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::
49 * Contemporary notation::
55 @c FIXME: Note entry vs Music entry at top level menu is confusing.
61 Notes constitute the most basic elements of LilyPond input, but they do
62 not form valid input on their own without a @code{\score} block. However,
63 for the sake of brevity and simplicity we will generally omit
64 @code{\score} blocks and @code{\paper} declarations in this manual.
70 * Chromatic alterations::
75 * Automatic note splitting ::
77 * Easy Notation note heads ::
85 A note is printed by specifying its pitch and then its duration.
86 @lilypond[fragment,verbatim]
95 @cindex Note specification
97 @cindex entering notes
99 The verbose syntax for pitch specification is
101 @cindex @code{\pitch}
103 \pitch @var{scmpitch}
106 where @var{scmpitch} is a pitch scheme object.
108 In Note and Chord mode, pitches may be designated by names. The default
109 names are the Dutch note names. The notes are specified by the letters
110 @code{a} through @code{g}, while the octave is formed with notes ranging
111 from @code{c} to @code{b}. The pitch @code{c} is an octave below
112 middle C and the letters span the octave above that C. Here's an example
113 which should make things more clear:
115 @lilypond[fragment,verbatim]
117 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
120 @cindex note names, Dutch
122 In Dutch, a sharp is formed by adding @code{-is} to the end of a pitch
123 name and a flat is formed by adding @code{-es}. Double sharps and double
124 flats are obtained by adding @code{-isis} or @code{-eses}. @code{aes}
125 and @code{ees} are contracted to @code{as} and @code{es} in Dutch, but
126 both forms are accepted.
128 LilyPond has predefined sets of note names for various other languages.
129 To use them, simply include the language specific init file. For
130 example: @code{\include "english.ly"}. The available language files and
131 the note names they define are:
136 Note Names sharp flat
137 nederlands.ly c d e f g a bes b -is -es
138 english.ly c d e f g a bf b -s/-sharp -f/-flat
139 deutsch.ly c d e f g a b h -is -es
140 norsk.ly c d e f g a b h -iss/-is -ess/-es
141 svenska.ly c d e f g a b h -iss -ess
142 italiano.ly do re mi fa sol la sib si -d -b
143 catalan.ly do re mi fa sol la sib si -d/-s -b
144 espanol.ly do re mi fa sol la sib si -s -b
153 The optional octave specification takes the form of a series of
154 single quote (`@code{'}') characters or a series of comma
155 (`@code{,}') characters. Each @code{'} raises the pitch by one
156 octave; each @code{,} lowers the pitch by an octave.
158 @lilypond[fragment,verbatim,center]
159 c' c'' es' g' as' gisis' ais'
162 @node Chromatic alterations
163 @subsection Chromatic alterations
165 Normally accidentals are printed automatically, but you may also
166 print them manually. A reminder accidental
167 @cindex reminder accidental
169 can be forced by adding an exclamation mark @code{!}
170 after the pitch. A cautionary accidental
171 @cindex cautionary accidental
172 @cindex parenthesized accidental
173 (an accidental within parentheses) can be obtained by adding the
174 question mark `@code{?}' after the pitch.
176 @lilypond[fragment,verbatim]
177 cis' cis' cis'! cis'?
181 The automatic production of accidentals can be tuned in many
182 ways. For more information, refer to @ref{Accidentals}.
189 Rests are entered like notes, with a ``note name'' of `@code{r}':
191 @lilypond[singleline,verbatim]
195 Whole bar rests, centered in middle of the bar, are specified using
196 @code{R} (capital R); see @ref{Multi measure rests}. See also
199 For some music, you may wish to explicitly specify the rest's vertical
200 position. This can be achieved by entering a note with the @code{\rest}
201 keyword appended. Rest collision testing will leave these rests alone.
203 @lilypond[singleline,verbatim]
213 @cindex Invisible rest
216 An invisible rest (also called a `skip') can be entered like a note
217 with note name `@code{s}' or with @code{\skip @var{duration}}:
219 @lilypond[singleline,verbatim]
223 @c FIXME: in Lyrics mode, we have " " and _
225 In Lyrics mode, invisible rests are entered using either `@code{" "}'
227 @lilypond[singleline,verbatim]
229 \context Lyrics \lyrics { lah2 di4 " " dah2 _4 di }
230 \notes\relative c'' { a2 a4 a a2 a4 a }
234 Note that the @code{s} syntax is only available in Note mode and Chord
235 mode. In other situations, you should use the @code{\skip} command,
236 which will work outside of those two modes:
238 @lilypond[singleline,verbatim]
241 { \time 4/8 \skip 2 \time 4/4 }
242 \notes\relative c'' { a2 a1 }
247 The skip command is merely an empty musical placeholder. It doesn't
248 produce any output, not even transparent output.
254 @subsection Durations
258 @cindex @code{\duration}
261 In Note, Chord, and Lyrics mode, durations are designated by numbers
262 and dots: durations are entered as their reciprocal values. For example,
263 a quarter note is entered using a @code{4} (since it's a 1/4 note), while
264 a half note is entered using a @code{2} (since it's a 1/2 note). For notes
265 longer than a whole you must use identifiers.
266 @c FIXME: what's an identifier? I don't think it's been introduced yet.
267 @c and if it has, I obviously skipped that part. - Graham
271 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
273 r1 r2 r4 r8 r16 r32 r64 r64
276 @lilypond[noindent,noquote]
278 \notes \relative c'' {
280 a1 a2 a4 a8 a16 a32 a64 a64
282 r1 r2 r4 r8 r16 r32 r64 r64
287 \remove "Clef_engraver"
288 \remove "Staff_symbol_engraver"
289 \remove "Time_signature_engraver"
290 \consists "Pitch_squash_engraver"
297 If the duration is omitted then it is set to the previously entered
298 duration. At the start of parsing, a quarter note is assumed. The
299 duration can be followed by dots (`@code{.}') in order to obtain dotted
303 @lilypond[fragment,verbatim,center]
304 a' b' c''8 b' a'4 a'4. b'4.. c'8.
309 You can alter the length of duration by a fraction @var{N/M}
310 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
311 won't affect the appearance of the notes or rests produced.
313 @lilypond[fragment,verbatim]
314 a'2*2 b'4*2 a'8*4 a'4*3/2 gis'4*3/2 a'4*3/2 a'4
317 Durations can also be produced through GUILE extension mechanism.
318 @lilypond[verbatim,fragment]
319 c'\duration #(ly:make-duration 2 1)
325 Dot placement for chords is not perfect. In some cases, dots overlap:
338 A tie connects two adjacent note heads of the same pitch. The tie in
339 effect extends the length of a note. Ties should not be confused with
340 slurs, which indicate articulation, or phrasing slurs, which indicate
341 musical phrasing. A tie is entered using the tilde symbol `@code{~}'.
343 @lilypond[fragment,verbatim,center]
344 e' ~ e' <<c' e' g'>> ~ <<c' e' g'>>
347 When a tie is applied to a chord, all note heads (whose pitches match) are
348 connected. If you try to tie together chords that have no common pitches,
349 no ties will be created.
351 If you want less ties created for a chord, you can set
352 @code{Voice.sparseTies} to true. In this case, a single tie is used
353 for every tied chord.
354 @lilypond[fragment,verbatim,center]
355 \property Voice.sparseTies = ##t
356 <<c' e' g'>> ~ <<c' e' g'>>
359 In its meaning a tie is just a way of extending a note duration, similar
360 to the augmentation dot: the following example are two ways of notating
361 exactly the same concept.
363 @lilypond[fragment, singleline]
364 \time 3/4 c'2. c'2 ~ c'4
366 If you need to tie notes over bars, it may be easier to use
367 @ref{Automatic note splitting}.
369 See also @seeinternals{Tie}.
374 At present, the tie is represented as a separate event, temporally
375 located in between the notes. Tying only a subset of the note heads
376 of a chord is not supported in a simple way. It can be achieved by
377 moving the tie-engraver into the Thread context and turning on and off
380 Switching staves when a tie is active will not work.
382 @node Automatic note splitting
383 @subsection Automatic note splitting
384 @c FIXME: This subsection doesn't belong in @ref{Note entry}.
386 LilyPond can automatically converting long notes to tied notes. This
387 is done by replacing the @code{Note_heads_engraver} by the
388 @code{Completion_heads_engraver}.
390 @lilypond[verbatim,noindent,noquote]
392 \notes\relative c'{ \time 2/4
393 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
397 \remove "Note_heads_engraver"
398 \consists "Completion_heads_engraver"
402 This engraver splits all running notes at the bar line, and inserts
403 ties. One of its uses is to debug complex scores: if the measures are
404 not entirely filled, then the ties exactly show how much each measure
409 Not all durations (especially those containing tuplets) can be
410 represented exactly; the engraver will not insert tuplets.
417 @cindex @code{\times}
419 Tuplets are made out of a music expression by multiplying all durations
422 @cindex @code{\times}
424 \times @var{fraction} @var{musicexpr}
427 The duration of @var{musicexpr} will be multiplied by the fraction.
428 In the sheet music, the fraction's denominator will be printed over
429 the notes, optionally with a bracket. The most common tuplet is the
430 triplet in which 3 notes have the length of 2, so the notes are 2/3
431 of their written length:
433 @lilypond[fragment,verbatim,center]
434 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
437 The property @code{tupletSpannerDuration} specifies how long each bracket
438 should last. With this, you can make lots of tuplets while typing
439 @code{\times} only once, saving you lots of typing.
441 @lilypond[fragment, relative, singleline, verbatim]
442 \property Voice.tupletSpannerDuration = #(ly:make-moment 1 4)
443 \times 2/3 { c'8 c c c c c }
446 The format of the number is determined by the property
447 @code{tupletNumberFormatFunction}. The default prints only the
448 denominator, but if you set it to the Scheme function
449 @code{fraction-tuplet-formatter}, Lilypond will print @var{num}:@var{den}
453 @cindex @code{tupletNumberFormatFunction}
454 @cindex tuplet formatting
456 See also @seeinternals{TupletBracket}.
460 Nested tuplets are not formatted automatically. In this case, outer
461 tuplet brackets should be moved automatically.
463 @node Easy Notation note heads
464 @subsection Easy Notation note heads
466 @cindex easy notation
469 A entirely different type of note head is the "easyplay" note head: a
470 note head that includes a note name. It is used in some publications by
471 Hal-Leonard Inc. music publishers.
473 @lilypond[singleline,verbatim,26pt]
475 \notes { c'2 e'4 f' | g'1 }
476 \paper { \translator { \EasyNotation } }
480 Note that @code{EasyNotation} overrides a @internalsref{Score} context. You
481 probably will want to print it with magnification or a large font size to
482 make it more readable. To print with magnification, you must create a dvi
483 (with @file{ly2dvi}) and then enlarge it with something like @file{dvips -x
484 2000 file.dvi}. See @file{man dvips} for details. To print with a larger
485 font, see @ref{Font Size}.
491 If you view the result with Xdvi, then staff lines will show through
492 the letters. Printing the PostScript file obtained with ly2dvi does
493 produce the correct result.
496 @node Easier music entry
497 @section Easier music entry
500 * Graphical interfaces::
504 * Skipping corrected music::
507 When entering music with LilyPond, it is easy to introduce errors. This
508 section deals with tricks and features that help you enter music, and
509 find and correct mistakes.
511 @node Graphical interfaces
512 @subsection Graphical interfaces
515 @cindex graphical interface
522 One way to avoid entering notes using the keyboard is to use a
523 graphical user interface. The following programs are known to have
524 a lilypond export option:
528 Denemo was once intended as
529 a LilyPond graphical user interface. It run on Gnome/GTK.
532 @uref{http://denemo.sourceforge.net/}
536 Noteedit, a graphical score editor that runs under KDE/Qt.
538 @uref{http://rnvs.informatik.tu-chemnitz.de/~jan/noteedit/noteedit.html,}
542 RoseGarden was once the inspiration for naming LilyPond. Nowadays it
543 has been rewritten from scratch and supports LilyPond export as of
547 @uref{http://rosegarden.sf.net/}
551 Another option is to enter the music using your favorite
552 sequencer/notation editor, and then export it as MIDI or MusicXML.
553 You can then import it in lilypond by using either midi2ly or
555 xml2ly. midi2ly is described in @ref{Invoking midi2ly}. @code{xml2ly}
557 is a tool to convert from the MusicXML music representation format
558 (@uref{http://www.musicxml.org}) to LilyPond format. @code{xml2ly} is
559 described at @uref{http://www.nongnu.org/xml2ly/}.
563 @node Relative octaves
564 @subsection Relative octaves
566 @cindex relative octave specification
568 Octaves are specified by adding @code{'} and @code{,} to pitch names.
569 When you copy existing music, it is easy to accidentally put a pitch in
570 the wrong octave and hard to find such an error. To prevent these
571 errors, LilyPond features octave entry.
573 @cindex @code{\relative}
575 \relative @var{startpitch} @var{musicexpr}
578 The octave of notes that appear in @var{musicexpr} are calculated as
579 follows: If no octave changing marks are used, the basic interval
580 between this and the last note is always taken to be a fourth or less
581 (This distance is determined without regarding alterations; a
582 @code{fisis} following a @code{ceses} will be put above the
585 The octave changing marks @code{'} and @code{,} can be added to raise or
586 lower the pitch by an extra octave. Upon entering relative mode, an
587 absolute starting pitch must be specified that will act as the
588 predecessor of the first note of @var{musicexpr}.
590 Entering music that changes octave frequently is easy in relative mode.
591 @lilypond[fragment,singleline,verbatim,center]
597 And octave changing marks are used for intervals greater than a fourth.
598 @lilypond[fragment,verbatim,center]
603 If the preceding item is a chord, the first note of the chord is used
604 to determine the first note of the next chord. However, other notes
605 within the second chord are determined by looking at the immediately
608 @lilypond[fragment,verbatim,center]
615 @cindex @code{\notes}
617 The pitch after the @code{\relative} contains a note name. To parse
618 the pitch as a note name, you have to be in note mode, so there must
619 be a surrounding @code{\notes} keyword (which is not
622 The relative conversion will not affect @code{\transpose},
623 @code{\chords} or @code{\relative} sections in its argument. If you
624 want to use relative within transposed music, you must place an
625 additional @code{\relative} inside the @code{\transpose}.
630 @subsection Bar check
634 @cindex @code{barCheckSynchronize}
638 Whenever a bar check is encountered during interpretation, a warning
639 message is issued if it doesn't fall at a measure boundary. This can
640 help you find errors in the input. Depending on the value of
641 @code{barCheckSynchronize}, the beginning of the measure will be
642 relocated, so this can also be used to shorten measures.
644 A bar check is entered using the bar symbol, @code{|}:
646 \time 3/4 c2 e4 | g2.
651 @cindex skipTypesetting
653 Failed bar checks are most often caused by entering incorrect
654 durations. Incorrect durations often completely garble up the score,
655 especially if it is polyphonic, so you should start correcting the score
656 by scanning for failed bar checks and incorrect durations. To speed up
657 this process, you can use @code{skipTypesetting} (See @ref{Skipping
660 @c . {Point and click}
661 @node Point and click
662 @subsection Point and click
663 @cindex poind and click
665 Point and click lets you find notes in the input by clicking on them in
666 the Xdvi window. This makes it very easy to find input that causes some
667 error in the sheet music.
669 To use it, you need the following software
671 @item A dvi viewer that supports src specials.
673 @item Xdvi, version 22.36 or newer. Available from
674 @uref{ftp://ftp.math.berkeley.edu/pub/Software/TeX/xdvi.tar.gz,ftp.math.berkeley.edu}.
676 Note that most @TeX{} distributions ship with xdvik, which is always
677 a few versions behind the official Xdvi. To find out which xdvi you
678 are running, try @code{xdvi -version} or @code{xdvi.bin -version}.
679 @item KDVI. A dvi viewer for KDE. You need KDVI from KDE 3.0 or
680 newer. Enable option @emph{Inverse search} in the menu @emph{Settings}.
689 @item An editor with a client/server interface (or a lightweight GUI
695 @item Emacs. Emacs is an extensible text-editor. It is available from
696 @uref{http://www.gnu.org/software/emacs/}. You need version 21 to use
699 @c move this elsewhere?
701 LilyPond also comes with support files for emacs: lilypond-mode for
702 emacs provides indentation, autocompletion, syntax coloring, handy
703 compile short-cuts and reading Info documents of lilypond inside emacs.
704 If lilypond-mode is not installed on your platform,
705 then refer to the installation instructions for more information.
709 @cindex lilypond-mode for emacs
710 @cindex syntax coloring
712 @item XEmacs. Xemacs is very similar to emacs.
716 @item NEdit. NEdit runs under Windows, and Unix.
717 It is available from @uref{http://www.nedit.org}.
721 @item GVim. GVim is a GUI variant of VIM, the popular VI
722 clone. It is available from @uref{http://www.vim.org}.
731 Xdvi must be configured to find the @TeX{} fonts and music
732 fonts. Refer to the Xdvi documentation for more information.
734 To use point-and-click, add one of these lines to the top of your .ly
737 #(ly:set-point-and-click 'line)
739 @cindex line-location
741 When viewing, Control-Mousebutton 1 will take you to the originating
742 spot in the @file{.ly} file. Control-Mousebutton 2 will show all
745 If you correct large files with point-and-click, be sure to start
746 correcting at the end of the file. When you start at the top, and
747 insert one line, all following locations will be off by a line.
750 For using point-and-click with emacs, add the following
751 In your emacs startup file (usually @file{~/.emacs}),
756 Make sure that the environment variable @var{XEDITOR} is set to
758 emacsclient --no-wait +%l %f
760 @cindex @var{XEDITOR}
761 If you use xemacs instead of emacs, you use @code{(gnuserve-start)} in
762 your @file{.emacs}, and set @code{XEDITOR} to @code{gnuclient -q +%l %f}
764 For using Vim, set @code{XEDITOR} to @code{gvim --remote +%l %f}, or
765 use this argument with xdvi's @code{-editor} option.
768 For using NEdit, set @code{XEDITOR} to @code{nc -noask +%l %f}, or
769 use this argument with xdvi's @code{-editor} option.
771 If can also make your editor jump to the exact location of the note
772 you clicked. This is only supported on Emacs and VIM. Users of Emacs version
773 20 must apply the patch @file{emacsclient.patch}. Users of version 21
774 must apply @file{server.el.patch} (version 21.2 and earlier). At the
775 top of the @code{ly} file, replace the @code{set-point-and-click} line
776 with the following line,
778 #(ly:set-point-and-click 'line-column)
780 @cindex line-colomn-location
781 and set @code{XEDITOR} to @code{emacsclient --no-wait +%l:%c %f}. Vim
782 users can set @var{XEDITOR} to @code{gvim --remote +:%l:norm%c| %f}.
788 When you convert the @TeX{} file to PostScript using @code{dvips}, it
789 will complain about not finding @code{src:X:Y} files. These complaints
790 are harmless, and can be ignored.
792 @node Skipping corrected music
793 @subsection Skipping corrected music
795 The property @code{Score.skipTypesetting} can be used to switch on and
796 off typesetting completely during the interpretation phase. When
797 typesetting is switched off, the music is processed much more quickly.
798 You can use this to skip over the parts of a score that you have already
801 @lilypond[fragment,singleline,verbatim]
803 \property Score.skipTypesetting = ##t
805 \property Score.skipTypesetting = ##f
813 @section Staff notation
815 This section deals with music notation that occurs on staff level,
816 such as keys, clefs and time signatures.
818 @cindex Staff notation
830 @subsection Staff symbol
833 @cindex adjusting staff symbol
834 @cindex StaffSymbol, using \property
835 @cindex staff lines, setting number of
838 The lines of the staff symbol are formed by the
839 @internalsref{StaffSymbol} object. This object is created at the moment
840 that their context is created. You can not change the appearance of
841 the staff symbol by using @code{\override} or @code{\set}. At the
842 moment that @code{\property Staff} is interpreted, a Staff context is
843 made, and the StaffSymbol is created before any @code{\override} is
844 effective. You can deal with this either overriding properties in a
845 @code{\translator} definition, or by using @code{\outputproperty}.
850 If you end a staff half way a piece, the staff symbol may not end
851 exactly on the barline.
856 @subsection Key signature
861 Setting or changing the key signature is done with the @code{\key}
864 @code{\key} @var{pitch} @var{type}
867 @cindex @code{\minor}
868 @cindex @code{\major}
869 @cindex @code{\minor}
870 @cindex @code{\ionian}
871 @cindex @code{\locrian}
872 @cindex @code{\aeolian}
873 @cindex @code{\mixolydian}
874 @cindex @code{\lydian}
875 @cindex @code{\phrygian}
876 @cindex @code{\dorian}
878 Here, @var{type} should be @code{\major} or @code{\minor} to get
879 @var{pitch}-major or @var{pitch}-minor, respectively.
880 The standard mode names @code{\ionian},
881 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
882 @code{\phrygian}, and @code{\dorian} are also defined.
884 This command sets the context property @code{Staff.keySignature}.
885 Non-standard key signatures can be specified by setting this property
888 The printed signature is a @internalsref{KeySignature} object, typically
889 created in @internalsref{Staff} context.
891 @cindex @code{keySignature}
898 The clef can be set or changed with the @code{\clef} command:
899 @lilypond[fragment,verbatim]
900 \key f\major c''2 \clef alto g'2
903 Supported clef-names include
904 @c Moved standard clefs to the top /MB
906 @item treble, violin, G, G2
915 G clef on 1st line, so-called French violin clef
930 By adding @code{_8} or @code{^8} to the clef name, the clef is
931 transposed one octave down or up, respectively. Note that you have to
932 enclose @var{clefname} in quotes if you use underscores or digits in the
938 The object for this symbol is @internalsref{Clef}.
941 This command is equivalent to setting @code{clefGlyph},
942 @code{clefPosition} (which controls the Y position of the clef),
943 @code{centralCPosition} and @code{clefOctavation}. A clef is created
944 when any of these properties are changed.
947 @c . {Time signature}
949 @subsection Time signature
950 @cindex Time signature
954 The time signature is set or changed by the @code{\time}
956 @lilypond[fragment,verbatim]
957 \time 2/4 c'2 \time 3/4 c'2.
960 The actual symbol that's printed can be customized with the @code{style}
961 property. Setting it to @code{#'()} uses fraction style for 4/4 and
965 The object for this symbol is @internalsref{TimeSignature}. There are
966 many more options for its layout. They are selected through the
967 @code{style} object property. See @file{input/test/time.ly} for more
970 This command sets the property @code{timeSignatureFraction},
971 @code{beatLength} and @code{measureLength} in the @code{Timing}
972 context, which is normally aliased to @internalsref{Score}. The property
973 @code{timeSignatureFraction} determine where bar lines should be
974 inserted, and how automatic beams should be generated. Changing the
975 value of @code{timeSignatureFraction} also causes a time signature
976 symbol to be printed.
978 More options are available through the Scheme function
979 @code{set-time-signature}. In combination with the
980 @internalsref{Measure_grouping_engraver}, it will create
981 @internalsref{MeasureGrouping} signs. Such signs ease reading
982 rhythmically complex modern music. In the following example, the 9/8
983 measure is subdivided in 2, 2, 2 and 3. This is passed to
984 @code{set-time-signature} as the third argument @code{(2 2 2 3)}.
987 \score { \notes \relative c'' {
988 #(set-time-signature 9 8 '(2 2 2 3))
989 g8 g d d g g a8-[-( bes g-]-) |
990 #(set-time-signature 5 8 '(3 2))
995 \translator { \StaffContext
996 \consists "Measure_grouping_engraver"
1005 @cindex partial measure
1006 @cindex measure, partial
1007 @cindex shorten measures
1008 @cindex @code{\partial}
1010 Partial measures, for example in upbeats, are entered using the
1011 @code{\partial} command:
1012 @lilypond[fragment,verbatim]
1013 \partial 4* 5/16 c'16 c4 f16 a'2. ~ a'8. a'16 | g'1
1016 The syntax for this command is
1018 \partial @var{duration}
1020 This is internally translated into
1022 \property Timing.measurePosition = -@var{length of duration}
1025 The property @code{measurePosition} contains a rational number
1026 indicating how much of the measure has passed at this point.
1029 @node Unmetered music
1030 @subsection Unmetered music
1032 Bar lines and bar numbers are calculated automatically. For unmetered
1033 music (e.g. cadenzas), this is not desirable. The commands
1034 @code{\cadenzaOn} and @code{\cadenzaOff} can be used to switch off the
1037 @lilypond[fragment,relative,singleline,verbatim]
1045 The property @code{Score.timing} can be used to switch off this
1050 @subsection Bar lines
1054 @cindex measure lines
1057 Bar lines are inserted automatically, but if you need a special type
1058 of barline, you can force one using the @code{\bar} command:
1059 @lilypond[fragment,verbatim] c4 \bar "|:" c4
1062 The following bar types are available
1063 @lilypond[fragment, relative, singleline, verbatim]
1075 You are encouraged to use @code{\repeat} for repetitions. See
1078 In scores with many staves, the barlines are automatically placed at
1079 top level, and they are connected between different staves of a
1080 @internalsref{StaffGroup}:
1081 @lilypond[fragment, verbatim]
1082 < \context StaffGroup <
1083 \context Staff = up { e'4 d'
1086 \context Staff = down { \clef bass c4 g e g } >
1087 \context Staff = pedal { \clef bass c2 c2 } >
1090 The objects that are created at @internalsref{Staff} level. The name is
1091 @internalsref{BarLine}.
1093 The command @code{\bar @var{bartype}} is a short cut for
1094 doing @code{\property Score.whichBar = @var{bartype}}
1095 Whenever @code{whichBar} is set to a string, a bar line of that type is
1096 created. @code{whichBar} is usually set automatically: at the start of
1097 a measure it is set to @code{defaultBarType}. The contents of
1098 @code{repeatCommands} is used to override default measure bars.
1100 @code{whichBar} can also be set directly, using @code{\property} or
1101 @code{\bar }. These settings take precedence over the automatic
1102 @code{whichBar} settings.
1105 @cindex Bar_line_engraver
1107 @cindex repeatCommands
1108 @cindex defaultBarType
1117 The easiest way to enter such fragments with more than one voice on a
1118 staff is to split chords using the separator @code{\\}. You can use
1119 it for small, short-lived voices (make a chord of voices) or for
1122 @lilypond[verbatim,fragment]
1123 \context Voice = VA \relative c'' {
1124 c4 < { f d e } \\ { b c2 } > c4 < g' \\ b, \\ f \\ d >
1128 The separator causes @internalsref{Voice} contexts to be instantiated,
1129 bearing the names @code{"1"}, @code{"2"}, etc.
1131 Sometimes, it is necessary to instantiate these contexts by hand: For
1132 Instantiate a separate Voice context for each part, and use
1133 @code{\voiceOne}, up to @code{\voiceFour} to assign a stem directions
1134 and horizontal shift for each part.
1137 @lilypond[singleline, verbatim]
1139 \context Staff < \context Voice = VA { \voiceOne cis2 b }
1140 \context Voice = VB { \voiceThree b4 ais ~ ais4 gis4 }
1141 \context Voice = VC { \voiceTwo fis4~ fis4 f ~ f } >
1144 The identifiers @code{\voiceOne} to @code{\voiceFour} set directions
1145 ties, slurs and stems, and set shift directions.
1147 If you want more than four voices, you can also manually set
1148 horizontal shifts and stem directions, as is shown in the following example:
1149 @lilypond[fragment, verbatim]
1150 \context Staff \notes\relative c''<
1151 \context Voice=one {
1152 \shiftOff \stemUp e4
1154 \context Voice=two {
1155 \shiftOn \stemUp cis
1157 \context Voice=three {
1158 \shiftOnn \stemUp ais
1160 \context Voice=four {
1161 \shiftOnnn \stemUp fis
1167 Normally, note heads with a different number of dots are not merged, but
1168 if you set the object property @code{merge-differently-dotted}, they are:
1169 @lilypond[verbatim,fragment,singleline]
1172 \property Staff.NoteCollision \override
1173 #'merge-differently-dotted = ##t
1175 } \\ { [g'8. f16] [g'8. f'16] }
1179 Similarly, you can merge half note heads with eighth notes, by setting
1180 @code{merge-differently-headed}:
1181 @lilypond[fragment, relative=2,verbatim]
1184 \property Staff.NoteCollision
1185 \override #'merge-differently-headed = ##t
1186 c8 c4. } \\ { c2 c2 } >
1189 LilyPond also vertically shifts rests that are opposite of a stem.
1191 @lilypond[singleline,fragment,verbatim]
1192 \context Voice < c''4 \\ r4 >
1195 See also @internalsref{NoteCollision} and @internalsref{RestCollision}
1199 Resolving collisions is a very intricate subject, and LilyPond only
1200 handles a few situations. When it can not cope, you are advised to use
1201 @code{force-hshift} of the @internalsref{NoteColumn} object and pitched
1202 rests to override typesetting decisions.
1207 Beams are used to group short notes into chunks that are aligned with
1208 the metrum. They are inserted automatically in most cases.
1210 @lilypond[fragment,verbatim, relative=2]
1211 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1214 If you're not satisfied with the automatic beaming, you can enter the
1215 beams explicitly. If you have beaming patterns that differ from the
1216 defaults, you can also set the patterns for automatic beamer.
1218 See also @internalsref{Beam}.
1221 @cindex Automatic beams
1222 @subsection Manual beams
1223 @cindex beams, manual
1227 In some cases it may be necessary to override LilyPond's automatic
1228 beaming algorithm. For example, the auto beamer will not beam over
1229 rests or bar lines, If you want that, specify the begin and end point
1230 manually using a @code{[} before the first beamed note and a @code{]}
1231 after the last note:
1233 @lilypond[fragment,relative,verbatim]
1235 r4 [r8 g' a r8] r8 [g | a] r8
1239 @cindex @code{stemLeftBeamCount}
1241 Normally, beaming patterns within a beam are determined automatically.
1242 When this mechanism fouls up, the properties
1243 @code{Voice.stemLeftBeamCount} and @code{Voice.stemRightBeamCount} can
1244 be used to control the beam subdivision on a stem. If you set either
1245 property, its value will be used only once, and then it is erased.
1247 @lilypond[fragment,relative,verbatim]
1250 [f8 r16 \property Voice.stemLeftBeamCount = #1 f g a]
1253 @cindex @code{stemRightBeamCount}
1256 The property @code{subdivideBeams} can be set in order to subdivide
1257 all 16th or shorter beams at beat positions. This accomplishes the
1258 same effect as twiddling with @code{stemLeftBeamCount} and
1259 @code{stemRightBeamCount}, but it take less typing.
1264 \property Voice.subdivideBeams = ##t
1266 [c32 c c c c c c c c c c c c c c c]
1267 \property Score.beatLength = #(ly:make-moment 1 8)
1268 [c32 c c c c c c c c c c c c c c c]
1270 @lilypond[noindent,noquote]
1272 \notes \relative c' {
1274 \property Voice.subdivideBeams = ##t
1276 [c32 c c c c c c c c c c c c c c c]
1277 \property Score.beatLength = #(ly:make-moment 1 8)
1278 [c32 c c c c c c c c c c c c c c c]
1282 @cindex subdivideBeams
1284 Kneed beams are inserted automatically, when a large gap between two
1285 adjacent beamed notes is detected. This behavior can be tuned through
1286 the object property @code{auto-knee-gap}.
1288 @cindex beams, kneed
1290 @cindex auto-knee-gap
1294 @c TODO -> why this ref? Document?
1295 @cindex @code{neutral-direction}
1299 Auto knee beams can not be used together with hara kiri staves.
1303 The Automatic beamer does not put @strong{unfinished} beams on the
1304 last notes of a score.
1306 Formatting of ties is a difficult subject. LilyPond often does not
1307 give optimal results.
1310 * Setting automatic beam behavior ::
1314 @no de Beam typography
1315 @sub section Beam typography
1317 One of the strong points of LilyPond is how beams are formatted. Beams
1318 are quantized, meaning that the left and right endpoints beams start
1319 exactly on staff lines. Without quantization, small wedges of white
1320 space appear between the beam and staff line, and this looks untidy.
1322 Beams are also slope-damped: melodies that go up or down should also
1323 have beams that go up or down, but the slope of the beams should be
1324 less than the slope of the notes themselves.
1326 Some beams should be horizontal. These are so-called concave beams.
1328 [TODO: some pictures.]
1331 @c . {Automatic beams}
1332 @node Setting automatic beam behavior
1333 @subsection Setting automatic beam behavior
1335 @cindex @code{autoBeamSettings}
1336 @cindex @code{(end * * * *)}
1337 @cindex @code{(begin * * * *)}
1338 @cindex automatic beams, tuning
1339 @cindex tuning automatic beaming
1341 In normal time signatures, automatic beams can start on any note but can
1342 only end in a few positions within the measure: beams can end on a beat,
1343 or at durations specified by the properties in
1344 @code{Voice.autoBeamSettings}. The defaults for @code{autoBeamSettings}
1345 are defined in @file{scm/auto-beam.scm}.
1347 The value of @code{autoBeamSettings} is changed using
1348 @code{\override} and unset using @code{\revert}:
1350 \property Voice.autoBeamSettings \override #'(@var{BE} @var{P} @var{Q} @var{N} @var{M}) = @var{dur}
1351 \property Voice.autoBeamSettings \revert #'(@var{BE} @var{P} @var{Q} @var{N} @var{M})
1353 Here, @var{BE} is the symbol @code{begin} or @code{end}. It determines
1354 whether the rule applies to begin or end-points. The quantity
1355 @var{P}/@var{Q} refers to the length of the beamed notes (and `@code{*
1356 *}' designates notes of any length), @var{N}/@var{M} refers to a time
1357 signature (wildcards, `@code{* *}' may be entered to designate all time
1360 For example, if you want automatic beams to end on every quarter note,
1361 you can use the following:
1363 \property Voice.autoBeamSettings \override
1364 #'(end * * * *) = #(ly:make-moment 1 4)
1366 Since the duration of a quarter note is 1/4 of a whole note, it is
1367 entered as @code{(ly:make-moment 1 4)}.
1369 The same syntax can be used to specify beam starting points. In this
1370 example, automatic beams can only end on a dotted quarter note.
1372 \property Voice.autoBeamSettings \override
1373 #'(end * * * *) = #(ly:make-moment 3 8)
1375 In 4/4 time signature, this means that automatic beams could end only on
1376 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1377 3/8 has passed within the measure).
1379 You can also restrict rules to specific time signatures. A rule that
1380 should only be applied in @var{N}/@var{M} time signature is formed by
1381 replacing the second asterisks by @var{N} and @var{M}. For example, a
1382 rule for 6/8 time exclusively looks like
1384 \property Voice.autoBeamSettings \override
1385 #'(begin * * 6 8) = ...
1388 If you want a rule to apply to certain types of beams, you can use the
1389 first pair of asterisks. Beams are classified according to the shortest
1390 note they contain. For a beam ending rule that only applies to beams
1391 with 32nd notes (and no shorter notes), you would use @code{(end 1
1395 @c Automatic beams can not be put on the last note in a score.
1397 If a score ends while an automatic beam has not been ended and is still
1398 accepting notes, this last beam will not be typeset at all.
1400 @cindex automatic beam generation
1402 @cindex @code{Voice.autoBeaming}
1405 For melodies that have lyrics, you may want to switch off
1406 automatic beaming. This is done by setting @code{Voice.autoBeaming} to
1412 It is not possible to specify beaming parameters for beams with mixed
1413 durations, that differ from the beaming parameters of all separate
1414 durations, i.e., you'll have to specify manual beams to get:
1416 @lilypond[singleline,fragment,relative,noverbatim]
1417 \property Voice.autoBeamSettings
1418 \override #'(end * * * *) = #(ly:make-moment 3 8)
1419 \time 12/8 c'8 c c c16 c c c c c [c c c c] c8 c c4
1421 It is not possible to specify beaming parameters that act differently in
1422 different parts of a measure. This means that it is not possible to use
1423 automatic beaming in irregular meters such as @code{5/8}.
1426 @section Accidentals
1428 This section describes how to change the way that LilyPond automatically
1429 inserts accidentals before the running notes.
1432 * Using the predefined accidental macros::
1433 * Defining your own accidental typesettings::
1436 @node Using the predefined accidental macros
1437 @subsection Using the predefined accidental macros
1438 The constructs for describing the accidental typesetting rules are
1439 quite hairy, so non-experts should stick to the macros defined in
1440 @file{ly/property-init.ly}.
1441 @cindex @file{property-init.ly}
1443 The macros operate on the ``Current'' context (see @ref{Context properties}). This
1444 means that the macros shuold normally be invoked right after the
1445 creation of the context in which the accidental typesetting described
1446 by the macro is to take effect. I.e. if you want to use
1447 piano-accidentals in a pianostaff then you issue
1448 @code{\pianoAccidentals} first thing after the creation of the piano
1452 \notes \relative c'' <
1453 \context Staff = sa @{ cis4 d e2 @}
1454 \context GrandStaff <
1456 \context Staff = sb @{ cis4 d e2 @}
1457 \context Staff = sc @{ es2 c @}
1459 \context Staff = sd @{ es2 c @}
1463 @lilypond[singleline]
1465 \notes \relative c'' <
1466 \context Staff = sa { cis4 d e2 }
1467 \context GrandStaff <
1469 \context Staff = sb { cis4 d e2 }
1470 \context Staff = sc { es2 c }
1472 \context Staff = sd { es2 c }
1477 minimumVerticalExtent = #'(-4.0 . 4.0)
1485 @item \defaultAccidentals
1486 @cindex @code{\defaultAccidentals}
1487 This is the default typesetting behaviour. It should correspond
1488 to 18th century common practice: Accidentals are
1489 remembered to the end of the measure in which they occur and
1490 only on their own octave.
1492 @item \voiceAccidentals
1493 @cindex @code{\voiceAccidentals}
1494 The normal behaviour is to remember the accidentals on
1496 This macro, however, typesets accidentals individually for each
1498 Apart from that the rule is similar to
1499 @code{\defaultAccidentals}.
1501 Warning: This leads to some weird and often unwanted results
1502 because accidentals from one voice DO NOT get cancelled in other
1504 @lilypond[singleline,relative,fragment,verbatim]
1507 \context Voice=va { \voiceOne es g }
1508 \context Voice=vb { \voiceTwo c, e }
1511 Hence you should only use @code{\voiceAccidentals}
1512 if the voices are to be read solely by
1513 individual musicians. if the staff should be readable also
1514 by one musician/conductor then you should use
1515 @code{\modernVoiceAccidentals} or @code{\modernVoiceCautionaries}
1518 @item \modernAccidentals
1519 @cindex @code{\modernAccidentals}
1520 This rule should correspond to the common practice in the 20th
1522 The rule is a bit more complex than @code{\defaultAccidentals}:
1523 You get all the same accidentals, but temporary
1524 accidentals also get cancelled in other octaves. Further more,
1525 in the same octave, they also get cancelled in the following measure:
1526 @lilypond[singleline,fragment,verbatim]
1528 cis' c'' cis'2 | c'' c'
1531 @item \modernCautionaries
1532 @cindex @code{\modernCautionaries}
1533 This rule is similar to @code{\modernAccidentals}, but the
1534 ``extra'' accidentals (the ones not typeset by
1535 @code{\defaultAccidentals}) are typeset as cautionary accidentals
1536 (i.e. in reduced size):
1537 @lilypond[singleline,fragment,verbatim]
1539 cis' c'' cis'2 | c'' c'
1542 @item \modernVoiceAccidentals
1543 @cindex @code{\modernVoiceAccidentals}
1544 Multivoice accidentals to be read both by musicians playing one voice
1545 and musicians playing all voices.
1547 Accidentals are typeset for each voice, but they ARE cancelled
1548 across voices in the same @internalsref{Staff}.
1550 @item \modernVoiceCautionaries
1551 @cindex @code{\modernVoiceCautionaries}
1552 The same as @code{\modernVoiceAccidentals}, but with the
1553 extra accidentals (the ones not typeset by
1554 @code{\voiceAccidentals}) typeset as cautionaries.
1555 Notice that even though all accidentals typeset by
1556 @code{\defaultAccidentals} ARE typeset by this macro then some
1557 of them are typeset as cautionaries.
1559 @item \pianoAccidentals
1560 @cindex @code{\pianoAccidentals}
1561 20th century practice for piano notation. Very similar to
1562 @code{\modernAccidentals} but accidentals also get cancelled
1563 across the staves in the same @internalsref{GrandStaff} or
1564 @internalsref{PianoStaff}.
1566 @item \pianoCautionaries
1567 @cindex @code{\pianoCautionaries}
1568 As @code{\pianoAccidentals} but with the extra accidentals
1569 typeset as cationaries.
1572 @cindex @code{\noResetKey}
1573 Same as @code{\defaultAccidentals} but with accidentals lasting
1574 ``forever'' and not only until the next measure:
1575 @lilypond[singleline,fragment,verbatim,relative]
1580 @item \forgetAccidentals
1581 @cindex @code{\forgetAccidentals}
1582 This is sort of the opposite of @code{\noResetKey}: Accidentals
1583 are not remembered at all - and hence all accidentals are
1584 typeset relative to the key signature, regardless of what was
1585 before in the music:
1586 @lilypond[singleline,fragment,verbatim,relative]
1588 \key d\major c4 c cis cis d d dis dis
1592 @node Defining your own accidental typesettings
1593 @subsection Defining your own accidental typesettings
1595 This section must be considered gurus-only, and hence it must be
1596 sufficient with a short description of the system and a reference to
1597 the internal documentation.
1599 The idea of the algorithm is to try several different rules and then
1600 use the rule that gives the highest number of accidentals.
1601 Each rule cosists of
1604 In which context is the rule applied. I.e. if context is
1605 @internalsref{Score} then all staves share accidentals, and if
1606 context is @internalsref{Staff} then all voices in the same
1607 staff share accidentals, but staves don't - like normally.
1609 Whether the accidental changes all octaves or only the current
1612 Over how many barlines the accidental lasts.
1613 If lazyness is @code{-1} then the accidental is forget
1614 immidiately, and if lazyness is @code{#t} then the accidental
1618 As described in the internal documentation of
1619 @reng{Accidental_engraver}, the properties @code{autoAccidentals} and
1620 @code{autoCautionaries} contain lists of rule descriptions. Notice
1621 that the contexts must be listed from in to out - that is
1622 @internalsref{Thread} before @internalsref{Voice},
1623 @internalsref{Voice} before @internalsref{Staff}, etc.
1624 see the macros in @file{ly/property-init.ly} for examples of how the
1629 Currently the simultaneous notes are considered to be entered in
1630 sequential mode. This means that in a chord the accidentals are
1631 typeset as if the notes in the chord happened one at a time - in the
1632 order in which they appear in the input file.
1634 Of course this is only a problem when you have simultainous notes
1635 which accidentals should depend on each other.
1636 Notice that the problem only occurs when using non-default accidentals
1637 - as the default accidentals only depend on other accidentals on the
1638 same staff and same pitch and hence cannot depend on other
1641 This example shows two examples of the same music giving different
1642 accidentals depending on the order in which the notes occur in the
1645 @lilypond[singleline,fragment,verbatim]
1646 \property Staff.autoAccidentals = #'( Staff (any-octave . 0) )
1647 cis'4 <<c'' c'>> r2 | cis'4 <<c' c''>> r2 | <<cis' c''>> r | <<c'' cis'>> r |
1650 The only solution is to manually insert the problematic
1651 accidentals using @code{!} and @code{?}.
1653 @node Expressive marks
1654 @section Expressive marks
1663 * Analysis brackets::
1670 A slur indicates that notes are to be played bound or @emph{legato}.
1671 They are entered using parentheses:
1672 @lilypond[fragment,verbatim,center]
1673 f'()g'()a' [a'8 b'(] a'4 g'2 )f'4
1676 See also @seeinternals{Slur}.
1678 Slurs avoid crossing stems, and are generally attached to note heads.
1679 However, in some situations with beams, slurs may be attached to stem
1680 ends. If you want to override this layout you can do this through the
1681 object property @code{attachment} of @internalsref{Slur} in
1682 @internalsref{Voice} context It's value is a pair of symbols, specifying
1683 the attachment type of the left and right end points.
1685 @lilypond[fragment,relative,verbatim]
1687 \property Voice.Stem \set #'length = #5.5
1689 \property Voice.Slur \set #'attachment = #'(stem . stem)
1693 If a slur would strike through a stem or beam, the slur will be moved
1694 away upward or downward. If this happens, attaching the slur to the
1695 stems might look better:
1697 @lilypond[fragment,relative,verbatim]
1700 \property Voice.Slur \set #'attachment = #'(stem . stem)
1705 Similarly, the curvature of a slur is adjusted to stay clear of note
1706 heads and stems. When that would increase the curvature too much, the
1707 slur is reverted to its default shape. The threshold for this
1708 decision is in @internalsref{Slur}'s object property @code{beautiful}.
1709 It is loosely related to the enclosed area between the slur and the
1710 notes. Usually, the default setting works well, but in some cases you
1711 may prefer a curved slur when LilyPond decides for a vertically moved
1712 one. You can indicate this preference by increasing the
1713 @code{beautiful} value:
1715 @lilyp ond[verbatim,singleline,relative]
1717 c16( a' f' a a f a, )c,
1718 c( a' f' a a f d, )c
1719 \property Voice.Slur \override #'beautiful = #5.0
1720 c( a' f' a a f d, )c
1726 Producing nice slurs is a difficult problem, and LilyPond currently
1727 uses a simple, empiric method to produce slurs. In some cases, the
1728 results of this method are ugly.
1731 This is reflected by the
1732 @code{beautiful} property, which it is an arbitrary parameter in the
1733 slur formatter. Useful values can only be determined by trial and
1737 @cindex Adjusting slurs
1739 @node Phrasing slurs
1740 @subsection Phrasing slurs
1742 @cindex phrasing slurs
1743 @cindex phrasing marks
1745 A phrasing slur (or phrasing mark) connects chords and is used to
1746 indicate a musical sentence. It is started using @code{\(} and @code{\)}
1749 @lilypond[fragment,verbatim,center,relative]
1750 \time 6/4 c' \( d () e f () e \) d
1753 Typographically, the phrasing slur behaves almost exactly like a normal
1754 slur. See also @seeinternals{PhrasingSlur}. But although they behave
1755 similarily to normal slurs, phrasing slurs count as different objects.
1756 A @code{\slurUp} will have no effect on a phrasing slur; instead, you
1757 should use @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1758 @code{\phrasingSlurBoth}.
1760 Note that the commands
1761 @code{\slurUp}, @code{\slurDown}, and @code{\slurBoth} will only affect
1762 normal slurs and not phrasing slurs.
1765 @subsection Breath marks
1767 Breath marks are entered using @code{\breathe}. See also
1768 @seeinternals{BreathingSign}.
1770 @lilypond[fragment,relative]
1779 @cindex beats per minute
1780 @cindex metronome marking
1782 Metronome settings can be entered as follows:
1784 @cindex @code{\tempo}
1786 \tempo @var{duration} = @var{perminute}
1789 For example, @code{\tempo 4 = 76} requests output with 76 quarter notes
1794 The tempo setting is not printed, but is only used in the MIDI
1795 output. You can trick lily into producing a metronome mark,
1796 though. Details are in @ref{Text markup}.
1801 @subsection Text spanners
1802 @cindex Text spanners
1804 Some textual indications, e.g. rallentando or accelerando, often extend
1805 over many measures. This is indicated by following the text with a
1806 dotted line. You can create such texts using text spanners. The syntax
1812 LilyPond will respond by creating a @internalsref{TextSpanner} object (typically
1813 in @internalsref{Voice} context). The string to be printed, as well as the
1814 style is set through object properties.
1816 An application---or rather, a hack---is to fake octavation indications.
1817 @lilypond[fragment,relative,verbatim]
1818 \relative c' { a''' b c a
1819 \property Voice.TextSpanner \set #'type = #'dotted-line
1820 \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
1821 \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
1822 \property Staff.centralCPosition = #-13
1823 a\startTextSpan b c a \stopTextSpan }
1827 @node Analysis brackets
1828 @subsection Analysis brackets
1830 @cindex phrasing brackets
1831 @cindex musicological analysis
1832 @cindex note grouping bracket
1834 Brackets are used in musical analysis to indicate structure in musical
1835 pieces. LilyPond supports a simple form of nested horizontal brackets.
1836 To use this, add the @internalsref{Horizontal_bracket_engraver} to
1837 @internalsref{Staff} context. A bracket is started with
1838 @code{\groupOpen} and closed with @code{\groupClose}. This produces
1839 @internalsref{HorizontalBracket} objects.
1841 @lilypond[singleline,verbatim]
1842 \score { \notes \relative c'' {
1843 c4-\groupOpen-\groupOpen
1846 c4-\groupClose-\groupClose
1848 \paper { \translator {
1849 \StaffContext \consists "Horizontal_bracket_engraver"
1867 @subsection Articulations
1868 @cindex Articulations
1870 @cindex articulations
1874 A variety of symbols can appear above and below notes to indicate
1875 different characteristics of the performance. They are added to a note
1876 by adding a dash and the the character signifying the
1877 articulation. They are demonstrated here.
1878 @lilypond[singleline]
1880 \notes \context Voice {
1881 \property Voice.TextScript \set #'font-family = #'typewriter
1882 \property Voice.TextScript \set #'font-shape = #'upright
1888 c''4-^_"c-\\^{ }" s4
1894 The script is automatically placed, but if you need to force
1895 directions, you can use @code{_} to force them down, or @code{^} to
1897 @lilypond[fragment, verbatim]
1902 Other symbols can be added using the syntax
1903 @var{note}@code{-\}@var{name}. Again, they can be forced up or down
1904 using @code{^} and @code{_}.
1908 @cindex staccatissimo
1917 @cindex organ pedal marks
1926 @cindex prallmordent
1930 @cindex thumb marking
1937 \property Score.LyricText \override #'font-family =#'typewriter
1938 \property Score.LyricText \override #'font-shape = #'upright
1939 \context Staff \notes {
1940 c''-\accent c''-\marcato c''-\staccatissimo c''^\fermata
1941 c''-\stopped c''-\staccato c''-\tenuto c''-\portato
1943 c''-\downbow c''^\lheel c''-\rheel c''^\ltoe
1944 c''-\rtoe c''-\turn c''-\open c''-\flageolet
1945 c''-\reverseturn c''-\trill c''-\prall c''-\mordent
1946 c''-\prallprall c''-\prallmordent c''-\upprall c''-\downprall
1947 c''-\upmordent c''-\downmordent c''-\pralldown c''-\prallup
1948 c''-\lineprall c''-\thumb c''-\segno c''-\coda
1950 \context Lyrics \lyrics {
1951 accent__ marcato__ staccatissimo__ fermata
1952 stopped__ staccato__ tenuto__ portato
1954 downbow__ lheel__ rheel__ ltoe
1955 rtoe__ turn__ open__ flageolet
1956 reverseturn__ trill__ prall__ mordent
1957 prallprall__ prallmordent__ uprall__ downprall
1958 upmordent__ downmordent__ pralldown__ prallup__
1959 lineprall__ thumb__ segno__ coda
1972 Fingering instructions can also be entered in this shorthand. For
1973 finger changes, use markup texts:
1975 @lilypond[verbatim, singleline, fragment]
1976 c'4-1 c'4-2 c'4-3 c'4-4
1985 See also @seeinternals{Script} and @seeinternals{Fingering}.
1989 All of these note ornaments appear in the printed output but have no
1990 effect on the MIDI rendering of the music.
1992 Unfortunately, there is no support for adding fingering instructions or
1993 ornaments to individual note heads. Some hacks exist, though. See
1994 @file{input/test/script-horizontal.ly}.
1999 @subsection Text scripts
2000 @cindex Text scripts
2002 In addition, it is possible to place arbitrary strings of text or markup
2003 text (see @ref{Text markup}) above or below notes by using a string:
2006 By default, these indications do not influence the note spacing, but
2007 by using the command @code{\fatText}, the widths will be taken into
2010 @lilypond[fragment,singleline,verbatim] \relative c' {
2011 c4^"longtext" \fatText c4_"longlongtext" c4 }
2014 It is possible to use @TeX{} commands in the strings, but this should be
2015 avoided because it makes it impossible for LilyPond to compute the
2016 exact length of the string, which may lead to collisions. Also, @TeX{}
2017 commands won't work with direct PostScript output.
2018 @c (see @ref{PostScript output}).
2020 Text scripts are created in form of @internalsref{TextScript} objects, in
2021 @internalsref{Voice} context.
2023 @ref{Text markup} describes how to change the font or access
2024 special symbols in text scripts.
2029 @subsection Grace notes
2033 @cindex @code{\grace}
2037 Grace notes are ornaments that are written out
2038 @lilypond[relative=2,verbatim,ifragment] c4 \grace c16 c4 \grace {
2042 In normal notation, grace notes are supposed to take up no logical
2043 time in a measure. Such an idea is practical for normal notation, but
2044 is not strict enough to put it into a program. The model that LilyPond
2045 uses for grace notes internally is that all timing is done in two
2048 Every point in musical time consists of two rational numbers: one
2049 denotes the logical time, one denotes the grace timing. The above
2050 example is shown here with timing tuples.
2053 \score { \notes \relative c''{
2054 c4^"(0,0)" \grace c16_" "_"(1/4,-1/16)" c4^"(1/4,0)" \grace {
2055 [c16_"(2/4,-1/8)" d16^"(2/4,-1/16)" ] } c4_" "_"(2/4,0)"
2057 \paper { linewidth = 8.\cm }
2061 The advantage of this approach is that you can use almost any lilypond
2062 construction together with grace notes, for example slurs and clef
2063 changes may appear halfway in between grace notes:
2065 @lilypond[relative=2,verbatim,fragment]
2066 c4 \grace { [ c16 c, \clef bass c, b(] } )c4
2069 The placement of these grace notes is synchronized between different
2070 staves, using this grace timing.
2072 @lilypond[relative=2,verbatim,fragment]
2073 < \context Staff = SA { e4 \grace { c16 d e f } e4 }
2074 \context Staff = SB { c4 \grace { g8 b } c4 } >
2078 Unbeamed eighth notes and shorter by default have a slash through the
2079 stem. This can be controlled with object property @code{stroke-style} of
2080 @internalsref{Stem}. The change in formatting is accomplished by
2081 inserting @code{\startGraceMusic} before handling the grace notes, and
2082 @code{\stopGraceMusic} after finishing the grace notes.
2083 You can add to these definitions to globally change grace note
2084 formatting. The standard definitions are in @file{ly/grace-init.ly}.
2086 [TODO discuss Scheme functionality.]
2089 Notice how the @code{\override} is carefully matched with a @code{\revert}.
2094 @lilypond[fragment,verbatim]
2095 \relative c'' \context Voice {
2096 \grace c8 c4 \grace { [c16 c16] } c4
2098 \property Voice.Stem \override #'stroke-style = #'()
2100 \property Voice.Stem \revert #'stroke-style
2107 If you want to end a note with a grace note, then the standard trick
2108 is to put the grace notes before a phantom ``space note'', e.g.
2109 @lilypond[fragment,verbatim, relative=2]
2112 { s2 \grace { [c16 d] } } >
2117 A @code{\grace} section has some default values, and LilyPond will
2118 use those default values unless you specify otherwise inside the
2119 @code{\grace} section. For example, if you specify \slurUp
2120 @emph{before} your @code{\grace} section, a slur which starts inside
2121 the @code{\grace} won't be forced up, even if the slur ends outside
2122 of the @code{\grace}. Note the difference between the first and
2123 second bars in this example:
2125 @lilypond[fragment,verbatim]
2126 \relative c'' \context Voice {
2145 Grace notes can not be used in the smallest size (@file{paper11.ly}).
2147 Grace note synchronization can also lead to surprises. Staff notation,
2148 such as key signatures, barlines, etc. are also synchronized. Take
2149 care when you mix staves with grace notes and staves without.
2151 @lilypond[relative=2,verbatim,fragment]
2152 < \context Staff = SA { e4 \bar "|:" \grace c16 d4 }
2153 \context Staff = SB { c4 \bar "|:" d4 } >
2156 Grace sections should only be used within sequential music
2157 expressions. Nesting, juxtaposing, or ending sequential music with a
2158 grace section is not supported, and might produce crashes or other
2163 @subsection Glissando
2166 @cindex @code{\glissando}
2168 A glissando line can be requested by attaching a @code{\glissando} to
2171 @lilypond[fragment,relative,verbatim]
2177 Printing of an additional text (such as @emph{gliss.}) must be done
2178 manually. See also @seeinternals{Glissando}.
2184 @subsection Dynamics
2197 @cindex @code{\ffff}
2207 Absolute dynamic marks are specified using an identifier after a
2208 note: @code{c4-\ff}. The available dynamic marks are: @code{\ppp},
2209 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2210 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2211 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2213 @lilypond[verbatim,singleline,fragment,relative]
2214 c'\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2220 @cindex @code{\decr}
2221 @cindex @code{\rced}
2227 A crescendo mark is started with @code{\cr} and terminated with
2228 @code{\rc} (the textual reverse of @code{cr}). A decrescendo mark is
2229 started with @code{\decr} and terminated with @code{\rced}. There are
2230 also shorthands for these marks. A crescendo can be started with
2231 @code{\<} and a decrescendo can be started with @code{\>}. Either one
2232 can be terminated with @code{\!}. Note that @code{\!} must go before
2233 the last note of the dynamic mark whereas @code{\rc} and @code{\rced} go
2234 after the last note. Because these marks are bound to notes, if you
2235 want several marks during one note, you have to use spacer notes.
2237 @lilypond[fragment,verbatim,center]
2238 c'' \< \! c'' d'' \decr e'' \rced
2239 < f''1 { s4 s4 \< \! s4 \> \! s4 } >
2242 You can also use a text saying @emph{cresc.} instead of hairpins. Here
2243 is an example how to do it:
2245 @lilypond[fragment,relative=2,verbatim]
2246 c4 \cresc c4 \endcresc c4
2253 You can also supply your own texts:
2254 @lilypond[fragment,relative,verbatim]
2256 \property Voice.crescendoText = "cresc. poco"
2257 \property Voice.crescendoSpanner = #'dashed-line
2264 Dynamics are objects of @internalsref{DynamicText} and
2265 @internalsref{Hairpin}. Vertical positioning of these symbols is
2266 handled by the @internalsref{DynamicLineSpanner} object. If you want to
2267 adjust padding or vertical direction of the dynamics, you must set
2268 properties for the @internalsref{DynamicLineSpanner} object. Predefined
2269 identifiers to set the vertical direction are \dynamicUp and
2272 @cindex direction, of dynamics
2273 @cindex @code{\dynamicDown}
2274 @cindex @code{\dynamicUp}
2282 @cindex @code{\repeat}
2284 To specify repeats, use the @code{\repeat} keyword. Since repeats
2285 should work differently when played or printed, there are a few
2286 different variants of repeats.
2290 Repeated music is fully written (played) out. Useful for MIDI
2291 output, and entering repetitive music.
2294 This is the normal notation: Repeats are not written out, but
2295 alternative endings (voltas) are printed, left to right.
2298 Alternative endings are written stacked. This has limited use but may be
2299 used to typeset two lines of lyrics in songs with repeats, see
2300 @file{input/star-spangled-banner.ly}.
2306 Make beat or measure repeats. These look like percent signs.
2312 * Repeats and MIDI::
2313 * Manual repeat commands::
2315 * Tremolo subdivisions::
2320 @subsection Repeat syntax
2322 The syntax for repeats is
2325 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2328 If you have alternative endings, you may add
2329 @cindex @code{\alternative}
2331 \alternative @code{@{} @var{alternative1}
2333 @var{alternative3} @dots{} @code{@}}
2335 where each @var{alternative} is a music expression.
2337 Normal notation repeats are used like this:
2338 @lilypond[fragment,verbatim]
2340 \repeat volta 2 { c'4 d' e' f' }
2341 \repeat volta 2 { f' e' d' c' }
2344 With alternative endings:
2345 @lilypond[fragment,verbatim]
2347 \repeat volta 2 {c'4 d' e' f'}
2348 \alternative { {d'2 d'} {f' f} }
2351 Folded repeats look like this:
2354 @lilypond[fragment,verbatim]
2356 \repeat fold 2 {c'4 d' e' f'}
2357 \alternative { {d'2 d'} {f' f} }
2361 If you don't give enough alternatives for all of the repeats, then
2362 the first alternative is assumed to be repeated often enough to equal
2363 the specified number of repeats.
2365 @lilypond[fragment,verbatim]
2369 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2370 \alternative { { g4 g g } { a | a a a a | b2. } }
2375 @node Repeats and MIDI
2376 @subsection Repeats and MIDI
2378 @cindex expanding repeats
2380 For instructions on how to unfoldi repeats for MIDI output, see
2381 the example file @file{input/test/unfold-all-repeats.ly}.
2386 Notice that timing information is not remembered at the start of an
2387 alternative, so you have to reset timing information after a repeat,
2388 e.g. using a bar-check (See @ref{Bar check}), setting
2389 @code{Score.measurePosition} or entering @code{\partial}. Slurs or ties
2390 are also not repeated.
2392 It is possible to nest @code{\repeat}s, although this probably is only
2393 meaningful for unfolded repeats.
2395 Folded repeats offer little more over simultaneous music.
2397 @node Manual repeat commands
2398 @subsection Manual repeat commands
2400 @cindex @code{repeatCommands}
2402 The property @code{repeatCommands} can be used to control the layout of
2403 repeats. Its value is a Scheme list of repeat commands, where each repeat
2411 @item (volta . @var{text})
2412 Print a volta bracket saying @var{text} (the text can be specified
2413 as a text string or as a markup text, see @ref{Text markup}).
2415 Stop a running volta bracket
2418 @lilypond[verbatim, fragment]
2420 \property Score.repeatCommands = #'((volta "93") end-repeat)
2422 \property Score.repeatCommands = #'((volta #f))
2427 Repeats brackets are @internalsref{VoltaBracket} objects.
2429 @node Tremolo repeats
2430 @subsection Tremolo repeats
2431 @cindex tremolo beams
2433 To place tremolo marks between notes, use @code{\repeat} with tremolo
2435 @lilypond[verbatim,center,singleline]
2437 \context Voice \notes\relative c' {
2438 \repeat "tremolo" 8 { c16 d16 }
2439 \repeat "tremolo" 4 { c16 d16 }
2440 \repeat "tremolo" 2 { c16 d16 }
2441 \repeat "tremolo" 4 c16
2446 Tremolo beams are @internalsref{Beam} objects. Single stem tremolos are
2447 @internalsref{StemTremolo}. The single stem tremolo @emph{must} be
2448 entered without @code{@{} and @code{@}}.
2452 Only powers of two and undotted notes are supported repeat counts.
2454 @node Tremolo subdivisions
2455 @subsection Tremolo subdivisions
2456 @cindex tremolo marks
2457 @cindex @code{tremoloFlags}
2459 Tremolo marks can be printed on a single note by adding
2460 `@code{:}[@var{length}]' after the note. The length must be at least 8.
2461 A @var{length} value of 8 gives one line across the note stem. If the
2462 length is omitted, then then the last value (stored in
2463 @code{Voice.tremoloFlags}) is used.
2465 @lilypond[verbatim,fragment,center]
2466 c'2:8 c':32 | c': c': |
2472 Tremolos in this style do not carry over into the MIDI output.
2475 @node Measure repeats
2476 @subsection Measure repeats
2478 @cindex percent repeats
2479 @cindex measure repeats
2481 In the @code{percent} style, a note pattern can be repeated. It is
2482 printed once, and then the pattern is replaced with a special sign.
2483 Patterns of a one and two measures are replaced by percent-like signs,
2484 patterns that divide the measure length are replaced by slashes.
2486 @lilypond[verbatim,singleline]
2487 \context Voice { \repeat "percent" 4 { c'4 }
2488 \repeat "percent" 2 { c'2 es'2 f'4 fis'4 g'4 c''4 }
2492 The signs are represented by these objects: @internalsref{RepeatSlash} and
2493 @internalsref{PercentRepeat} and @internalsref{DoublePercentRepeat}.
2497 You can not nest percent repeats, e.g. by filling in the first measure
2498 with slashes, and repeating that measure with percents.
2500 @node Rhythmic music
2501 @section Rhythmic music
2503 Sometimes you might want to show only the rhythm of a melody. This can
2504 be done with the rhythmic staff. All pitches of notes on such a staff
2505 are squashed, and the staff itself looks has a single staff line:
2507 @lilypond[fragment,relative,verbatim]
2508 \context RhythmicStaff {
2510 c4 e8 f g2 | r4 g r2 | g1:32 | r1 |
2515 * Percussion staves::
2518 @node Percussion staves
2519 @subsection Percussion staves
2522 To typeset more than one piece of percussion to be played by the same
2523 musician one typically uses a multiline staff where each staff
2524 position refers to a specific piece of percussion.
2526 LilyPond is shipped with a bunch of scheme functions which allows you
2527 to do this fairly easily.
2529 The system is based on the general midi drum-pitches.
2530 In order to use the drum pitches you include
2531 @file{ly/drumpitch-init.ly}. This file defines the pitches from the scheme
2532 variable @code{drum-pitch-names} - which definition can be read in
2533 @file{scm/drums.scm}. You see that each piece of percussion has a full
2534 name and an abbreviated name - and you may freely select whether to
2535 refer to the full name or the abbreviation in your music definition.
2537 To typeset the music on a staff you apply the scheme function
2538 @code{drums->paper} to the percussion music. This function takes a
2539 list of percussion instrument names, notehead scripts and staff
2540 positions (that is: pitches relative to the C-clef) and uses this to
2541 transform the input music by moving the pitch, changing the notehead
2542 and (optionally) adding a script:
2543 @lilypond[singleline,verbatim]
2544 \include "drumpitch-init.ly"
2545 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2546 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2548 \apply #(drums->paper 'drums) \context Staff <
2550 \context Voice = up { \voiceOne \up }
2551 \context Voice = down { \voiceTwo \down }
2556 In the above example the music was transformed using the list @code{'drums}.
2557 Currently the following lists are defined in @file{scm/drums.scm}:
2560 To typeset a typical drum kit on a five-line staff.
2563 \include "drumpitch-init.ly"
2564 nam = \lyrics { cymc cyms cymr hh hhc hho hhho hhp cb hc
2565 bd sn ss tomh tommh tomml toml tomfh tomfl }
2566 mus = \notes { cymc cyms cymr hh hhc hho hhho hhp cb hc
2567 bd sn ss tomh tommh tomml toml tomfh tomfl s16 }
2570 \apply #(drums->paper 'drums) \context Staff <
2574 \context Lyrics \nam
2577 linewidth = 100.0\mm
2580 \remove Bar_engraver
2581 \remove Time_signature_engraver
2582 minimumVerticalExtent = #'(-4.0 . 5.0)
2586 \remove Stem_engraver
2592 Notice that the scheme supports six different toms.
2593 If you are using fewer toms then you simply select the toms that produce
2594 the desired result - i.e. to get toms on the three middle lines you
2595 use @code{tommh}, @code{tomml} and @code{tomfh}.
2597 Because the general midi contain no rimshots we use the sidestick for
2598 this purpose instead.
2600 To typeset timbales on a two line staff.
2601 @lilypond[singleline]
2602 \include "drumpitch-init.ly"
2603 nam = \lyrics { timh ssh timl ssl cb }
2604 mus = \notes { timh ssh timl ssl cb s16 }
2607 \apply #(drums->paper 'timbales) \context Staff <
2611 \context Lyrics \nam
2616 \remove Bar_engraver
2617 \remove Time_signature_engraver
2618 StaffSymbol \override #'line-count = #2
2619 StaffSymbol \override #'staff-space = #2
2620 minimumVerticalExtent = #'(-3.0 . 4.0)
2624 \remove Stem_engraver
2631 To typeset congas on a two line staff.
2632 @lilypond[singleline]
2633 \include "drumpitch-init.ly"
2634 nam = \lyrics { cgh cgho cghm ssh cgl cglo cglm ssl }
2635 mus = \notes { cgh cgho cghm ssh cgl cglo cglm ssl s16 }
2638 \apply #(drums->paper 'congas) \context Staff <
2642 \context Lyrics \nam
2647 \remove Bar_engraver
2648 \remove Time_signature_engraver
2649 StaffSymbol \override #'line-count = #2
2650 StaffSymbol \override #'staff-space = #2
2651 minimumVerticalExtent = #'(-3.0 . 4.0)
2655 \remove Stem_engraver
2661 To typeset bongos on a two line staff.
2662 @lilypond[singleline]
2663 \include "drumpitch-init.ly"
2664 nam = \lyrics { boh boho bohm ssh bol bolo bolm ssl }
2665 mus = \notes { boh boho bohm ssh bol bolo bolm ssl s16 }
2668 \apply #(drums->paper 'bongos) \context Staff <
2672 \context Lyrics \nam
2677 \remove Bar_engraver
2678 \remove Time_signature_engraver
2679 StaffSymbol \override #'line-count = #2
2680 StaffSymbol \override #'staff-space = #2
2681 minimumVerticalExtent = #'(-3.0 . 4.0)
2685 \remove Stem_engraver
2691 To typeset all kinds of simple percussion on one line staves.
2692 @lilypond[singleline]
2693 \include "drumpitch-init.ly"
2694 nam = \lyrics { tri trio trim gui guis guil cb cl tamb cab mar hc }
2695 mus = \notes { tri trio trim gui guis guil cb cl tamb cab mar hc s16 }
2698 \apply #(drums->paper 'percussion) \context Staff <
2702 \context Lyrics \nam
2707 \remove Bar_engraver
2708 \remove Time_signature_engraver
2709 StaffSymbol \override #'line-count = #1
2710 minimumVerticalExtent = #'(-2.0 . 3.0)
2714 \remove Stem_engraver
2721 If you don't like any of the predefined lists you can define your own
2722 list at the top of your file:
2724 @lilypond[singleline, verbatim]
2726 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2727 (snare default #f ,(ly:make-pitch 0 1 0))
2728 (hihat cross #f ,(ly:make-pitch 0 5 0))
2729 (pedalhihat xcircle "stopped" ,(ly:make-pitch 0 5 0))
2730 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2732 \include "drumpitch-init.ly"
2733 up = \notes { hh8 hh hh hh hhp4 hhp }
2734 down = \notes { bd4 sn bd toml8 toml }
2736 \apply #(drums->paper 'mydrums) \context Staff <
2738 \context Voice = up { \voiceOne \up }
2739 \context Voice = down { \voiceTwo \down }
2744 To use a modified existing list instead of building your own from
2745 scratch you can append your modifications to the start of the existing
2749 #(define mydrums (append `(
2750 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2751 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2755 @c FIXME: Too many levels of headers when using subsubsections.
2756 @c Perhaps junk subsection ``Percussion staves''
2757 @subsubsection Percussion staves with normal staves
2758 When you include @file{drumpitch-init.ly} then the default pitches
2759 are overridden so that you after the inclusion cannot use the common
2760 dutch pitch names anymore. Hence you might wan't to reinclude
2761 @file{nederlands.ly} after the drum-pattern-definitions:
2762 @lilypond[singleline,verbatim]
2763 \include "drumpitch-init.ly"
2764 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2765 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2766 \include "nederlands.ly"
2767 bass = \notes \transpose c c,, { a4. e8 r e g e }
2770 \apply #(drums->paper 'drums) \context Staff = drums <
2772 \context Voice = up { \voiceOne \up }
2773 \context Voice = down { \voiceTwo \down }
2775 \context Staff = bass { \clef "F_8" \bass }
2780 @subsubsection Percussion midi output
2781 In order to produce correct midi output you need to produce two score
2782 blocks - one for the paper and one for the midi.
2783 To use the percussion channel you set the property @code{instrument}
2784 to @code{'drums}. Because the drum-pitches themself are similar to the
2785 general midi pitches all you have to do is to insert the voices with
2786 none of the scheme functions to get the correct midi output:
2790 \apply #(drums->paper 'mydrums) \context Staff <
2792 \context Voice = up @{ \voiceOne \up @}
2793 \context Voice = down @{ \voiceTwo \down @}
2799 \property Staff.instrument = #'drums
2808 This scheme is to be considered a temporary implementation. Even
2809 though the scheme will probably keep on working then the future might
2810 bring some other way of typesetting drums, and probably
2811 there will be made no great efforts in keeping things downwards
2816 @section Piano music
2818 Piano music is an odd type of notation. Piano staves are two normal
2819 staves coupled with a brace. The staves are largely independent, but
2820 sometimes voices can cross between the two staves. The
2821 @internalsref{PianoStaff} is especially built to handle this cross-staffing
2822 behavior. In this section we discuss the @internalsref{PianoStaff} and some
2823 other pianistic peculiarities.
2827 * Automatic staff changes::
2828 * Manual staff switches::
2831 * Voice follower lines::
2836 There is no support for putting chords across staves. You can get
2837 this result by increasing the length of the stem in the lower stave so
2838 it reaches the stem in the upper stave, or vice versa. An example is
2839 included with the distribution as @file{input/test/stem-cross-staff.ly}.
2841 @cindex cross staff stem
2842 @cindex stem, cross staff
2845 @c fixme: should have hyperlinks as well.
2850 @c . {Automatic staff changes}
2851 @node Automatic staff changes
2852 @subsection Automatic staff changes
2853 @cindex Automatic staff changes
2855 Voices can switch automatically between the top and the bottom
2856 staff. The syntax for this is
2858 \autochange Staff \context Voice @{ @dots{}@var{music}@dots{} @}
2860 The autochanger switches on basis of pitch (central C is the turning
2861 point), and it looks ahead skipping over rests to switch rests in
2862 advance. Here is a practical example:
2864 @lilypond[verbatim,singleline]
2865 \score { \notes \context PianoStaff <
2866 \context Staff = "up" {
2867 \autochange Staff \context Voice = VA < \relative c' {
2868 g4 a b c d r4 a g } > }
2869 \context Staff = "down" {
2874 Spacer rests are used to prevent the bottom staff from
2875 terminating too soon.
2878 @node Manual staff switches
2879 @subsection Manual staff switches
2881 @cindex manual staff switches
2882 @cindex staff switch, manual
2884 Voices can be switched between staves manually, using the following command:
2886 \translator Staff = @var{staffname} @var{music}
2888 The string @var{staffname} is the name of the staff. It switches the
2889 current voice from its current staff to the Staff called
2890 @var{staffname}. Typically @var{staffname} is @code{"up"} or
2898 Piano pedal instruction can be expressed using
2899 @code{\sustainDown}, @code{\sustainUp}, @code{\unaCorda},
2900 @code{\treCorde}, @code{\sostenutoDown} and @code{\sostenutoUp}.
2902 The symbols that are printed can be modified by setting
2903 @code{pedal@var{X}Strings}, where @var{X} is one of the pedal types:
2904 Sustain, Sostenuto or UnaCorda. Refer to the generated documentation of
2905 @internalsref{SustainPedal}, for example, for more information.
2907 Pedals can also be indicated by a sequence of brackets, by setting the
2908 @code{pedal-type} property of SustainPedal objects:
2910 @lilypond[fragment,verbatim]
2911 \property Staff.SustainPedal \override #'pedal-type = #'bracket
2912 c''4 \sustainDown d''4 e''4 a'4
2913 \sustainUp \sustainDown
2914 f'4 g'4 a'4 \sustainUp
2917 A third style of pedal notation is a mixture of text and brackets,
2918 obtained by setting @code{pedal-type} to @code{mixed}:
2920 @lilypond[fragment,verbatim]
2921 \property Staff.SustainPedal \override #'pedal-type = #'mixed
2922 c''4 \sustainDown d''4 e''4 c'4
2923 \sustainUp \sustainDown
2924 f'4 g'4 a'4 \sustainUp
2927 The default '*Ped' style for sustain and damper pedals corresponds to
2928 @code{\pedal-type = #'text}. However, @code{mixed} is the default style
2929 for a sostenuto pedal:
2931 @lilypond[fragment,verbatim]
2932 c''4 \sostenutoDown d''4 e''4 c'4 f'4 g'4 a'4 \sostenutoUp
2935 For fine-tuning of the appearance of a pedal bracket, the properties
2936 @code{edge-width}, @code{edge-height}, and @code{shorten-pair} of
2937 @code{PianoPedalBracket} objects (see the detailed documentation of
2938 @rgrob{PianoPedalBracket}) can be modified. For example, the bracket
2939 may be extended to the end of the note head.
2941 @lilypond[fragment,verbatim]
2942 \property Staff.PianoPedalBracket \override
2943 #'shorten-pair = #'(0 . -1.0)
2944 c''4 \sostenutoDown d''4 e''4 c'4
2945 f'4 g'4 a'4 \sostenutoUp
2949 @subsection Arpeggio
2952 @cindex broken arpeggio
2953 @cindex @code{\arpeggio}
2955 You can specify an arpeggio sign on a chord by attaching an
2956 @code{\arpeggio} to a chord.
2959 @lilypond[fragment,relative,verbatim]
2960 <<c e g c>>-\arpeggio
2963 When an arpeggio crosses staves in piano music, you attach an arpeggio
2964 to the chords in both staves, and set
2965 @code{PianoStaff.connectArpeggios}.
2967 @lilypond[fragment,relative,verbatim]
2968 \context PianoStaff <
2969 \property PianoStaff.connectArpeggios = ##t
2970 \context Voice = one { <<c' e g c>>-\arpeggio }
2971 \context Voice = other { \clef bass <<c,, e g>>-\arpeggio}
2975 This command creates @internalsref{Arpeggio} objects. Cross staff arpeggios
2976 are @code{PianoStaff.Arpeggio}.
2978 To add an arrow head to explicitly specify the direction of the
2979 arpeggio, you should set the arpeggio object property
2980 @code{arpeggio-direction}.
2982 @lilypond[fragment,relative,verbatim]
2984 \property Voice.Arpeggio \set #'arpeggio-direction = #1
2985 <<c e g c>>-\arpeggio
2986 \property Voice.Arpeggio \set #'arpeggio-direction = #-1
2987 <<c e g c>>-\arpeggio
2991 A square bracket on the left indicates that the player should not
2992 arpeggiate the chord. To draw these brackets, set the
2993 @code{molecule-callback} property of @code{Arpeggio} or
2994 @code{PianoStaff.Arpeggio} objects to @code{\arpeggioBracket}, and use
2995 @code{\arpeggio} statements within the chords as before.
2997 @lilypond[fragment,relative,verbatim]
2998 \context PianoStaff <
2999 \property PianoStaff.connectArpeggios = ##t
3000 \property PianoStaff.Arpeggio \override
3001 #'molecule-callback = \arpeggioBracket
3002 \context Voice = one { <<c' e g c>>-\arpeggio }
3003 \context Voice = other { \clef bass <<c,, e g>>-\arpeggio }
3010 It is not possible to mix connected arpeggios and unconnected
3011 arpeggios in one PianoStaff at the same time.
3015 @node Voice follower lines
3016 @subsection Voice follower lines
3018 @cindex follow voice
3019 @cindex staff switching
3022 @cindex @code{followVoice}
3024 Whenever a voice switches to another staff a line connecting the notes
3025 can be printed automatically. This is enabled if the property
3026 @code{PianoStaff.followVoice} is set to true:
3028 @lilypond[fragment,relative,verbatim]
3029 \context PianoStaff <
3030 \property PianoStaff.followVoice = ##t
3031 \context Staff \context Voice {
3033 \translator Staff=two
3036 \context Staff=two {\clef bass \skip 1*2 }
3040 The associated object is @internalsref{VoiceFollower}.
3044 @section Vocal music
3046 For a discussion of how to put lyrics into a score, see section
3047 @code{Printing lyrics} in the tutorial.
3049 [TODO: Move lyrics section from tutorial to here?]
3051 See also the sections on @ref{Slurs} and @ref{Breath marks}.
3053 [TODO: Move slurs / breath marks section to here?]
3055 [TODO: Write subsection upon usage of ChoirStaff.]
3065 The term @emph{ambitus} denotes a range of pitches for a given voice a
3066 part of music. It also may denote the pitch range that a musical
3067 instrument is capable of playing. Most musical instruments have their
3068 ambitus standardized (or at least there is agreement upon the minimal
3069 ambitus of a particular type of instrument), such that a composer or
3070 arranger of a piece of music can easily meet the ambitus constraints of
3071 the targeted instrument. However, the ambitus of the human voice
3072 depends on individual physiological state, including education and
3073 training of the voice. Therefore, a singer potentially has to check for
3074 each piece of music if the ambitus of that piece meets his individual
3075 capabilities. This is why the ambitus of a piece may be of particular
3076 value to vocal performers.
3078 The ambitus is typically notated on a per-voice basis at the very
3079 beginning of a piece, e.g. nearby the initial clef or time signature of
3080 each staff. The range is graphically specified by two noteheads, that
3081 represent the minimum and maximum pitch. Some publishers use a textual
3082 notation: they put the range in words in front of the corresponding
3083 staff. Lilypond currently only supports the graphical ambitus notation.
3085 To apply, simply add the @internalsref{Ambitus_engraver} to the
3086 @internalsref{Voice} context, as shown in the below example:
3088 @lilypond[singleline,verbatim]
3089 upper = \notes \relative c {
3092 as'' c e2 bes f cis d4 e f2 g
3094 lower = \notes \relative c {
3097 e'4 b g a c es fis a cis b a g f e d2
3100 \context ChoirStaff {
3102 \context Staff = one { \upper }
3103 \context Staff = three { \lower }
3109 \consists Ambitus_engraver
3115 The shape of the note heads to use can be changed via the
3116 @code{note-head-style} property, which holds the glyph name of the note
3117 head (see also @ref{Ancient note heads}). The vertical line between the
3118 upper and lower head can be switched on or off via the @code{join-heads}
3124 \consists Ambitus_engraver
3125 Ambitus \set #'note-head-style = #'noteheads-2mensural
3126 Ambitus \set #'join-heads = ##f
3130 By default, the ambitus grob is put before the clef. You can control
3131 this behaviour through the @code{breakAlignOrder} property of the score
3132 context by redefining the order, e.g. with the following addition to the
3138 breakAlignOrder = #'(
3156 Tablature notation is used for notating music for plucked string
3157 instruments. It notates pitches not by using note heads, but by
3158 indicating on which string and fret a note must be played. LilyPond
3159 offers limited support for tablature.
3162 * Tablatures basic::
3163 * Non-guitar tablatures::
3164 * Tablature in addition to normal staff::
3167 @node Tablatures basic
3168 @subsection Tablatures basic
3169 @cindex Tablatures basic
3171 Tablature can be typeset with Lilypond by using the
3172 @internalsref{TabStaff} and @internalsref{TabVoice} contexts. As
3173 tablature is a recent feature in Lilypond, most of the guitar special
3174 effects such as bend are not yet supported.
3176 With the @internalsref{TabStaff}, the string number associated to a note
3177 is given as a backslash followed by the string number, e.g. @code{c4\3} for a C
3178 quarter on the third string. By default, string 1 is the highest one, and the
3179 tuning defaults to the standard guitar tuning (with 6 strings).
3181 @lilypond[fragment,verbatim]
3190 If you do not specify a string number then lilypond automatically selects one.
3191 The selection is controlled by the translator property @code{minimumFret}. -- LilyPond
3192 simply selects the first string that does not give a fret number less than
3193 @code{minimumFret}. Default is 0.
3195 Notice that LilyPond does not handle chords in any special way, and hence
3196 the automatic string selector may easily select the same string to two notes in a chord.
3199 e8 fis gis a b cis' dis' e'
3200 \property TabStaff.minimumFret = #8
3201 e8 fis gis a b cis' dis' e'
3203 @lilypond[noindent,noquote]
3206 e8 fis gis a b cis' dis' e'
3207 \property TabStaff.minimumFret = #8
3208 e8 fis gis a b cis' dis' e'
3211 \context StaffGroup <
3212 \context Staff { \clef "G_8" \frag }
3213 \context TabStaff { \frag }
3218 @node Non-guitar tablatures
3219 @subsection Non-guitar tablatures
3220 @cindex Non-guitar tablatures
3222 There are many ways to customize Lilypond tablatures.
3224 First you can change the number of strings, by setting the number of
3225 lines in the @internalsref{TabStaff} (the @code{line-count} property
3226 of TabStaff can only be changed using @code{\outputproperty}, for more
3227 information, see @ref{Tuning per object}. You can change the strings
3228 tuning. A string tuning is given as a Scheme list with one integer
3229 number for each string, the number being the pitch of an open string.
3231 (The numbers specified for stringTuning are the numbers of semitons
3232 to subtract --- or add --- starting the specified pitch by default
3233 middle C, in string order: thus the notes are e, a, d & g)
3235 @lilypond[fragment,verbatim]
3238 \outputproperty #(make-type-checker 'staff-symbol-interface)
3240 \property TabStaff.stringTunings = #'(-5 -10 -15 -20)
3243 a,4 c' a e' e c' a e'
3248 Finally, it is possible to change the Scheme function to format the
3249 tablature note text. The default is @var{fret-number-tablature-format},
3250 which uses the fret number, but for some instruments that may not use
3251 this notation, just create your own tablature-format function. This
3252 function takes three argument: the string number, the string tuning and
3256 @node Tablature in addition to normal staff
3257 @subsection Tablature in addition to normal staff
3258 @cindex Tablature in addition to normal staff
3260 It is possible to typeset both tablature and a "normal" staff, as
3261 commonly done in many parts.
3263 A common trick for that is to put the notes in a variables, and to hide
3264 the fingering information (which correspond to the string number) for
3268 @c @lily pond[verbatim]
3275 \context StaffGroup <
3277 % Hide fingering number
3278 \property Staff.Fingering \override #'transparent = ##t
3283 \property Staff.Stem \override #'direction = #1
3297 LilyPond has support for both entering and printing chords.
3298 @lilypond[verbatim,singleline]
3299 twoWays = \notes \transpose c c' {
3309 < \context ChordNames \twoWays
3310 \context Voice \twoWays > }
3313 This example also shows that the chord printing routines do not try to
3314 be intelligent. If you enter @code{f bes d}, it does not interpret
3315 this as an inversion.
3317 As you can see chords really are a set of pitches. They are internally
3318 stored as simultaneous music expressions. This means you can enter
3319 chords by name and print them as notes, enter them as notes and print
3320 them as chord names, or (the most common case) enter them by name, and
3325 * Printing named chords::
3330 @subsection Chords mode
3333 Chord mode is a mode where you can input sets of pitches using common
3334 names. It is introduced by the keyword @code{\chords}. It is similar
3335 to note mode, but words are also looked up in a chord modifier table
3336 (containing @code{maj}, @code{dim}, etc). Dashes and carets are used
3337 to indicate chord additions and subtractions, so articulation scripts
3338 can not be entered in Chord mode.
3340 Throughout these examples, chords have been shifted around the staff
3341 using @code{\transpose}.
3343 @lilypond[fragment,verbatim]
3347 c:9 c:9-.5+.7+ c:3-.5-
3357 The second type of modifier that may appear after the @code{:} is a
3358 named modifier. Named modifiers are listed in the file
3359 @file{chord-modifiers.ly}. The available modifiers are @code{m} and
3360 @code{min} which lower the 3rd half a step, `@code{aug}' which
3361 raises the 5th, `@code{dim}' which lowers the 5th,
3362 `@code{maj}' which adds a raised 7th, and `@code{sus}'
3363 which replaces the 5th with a 4th.
3365 @lilypond[fragment,verbatim]
3368 c1:m c:min7 c:maj c:aug c:dim c:sus
3374 Chord subtractions are used to eliminate notes from a chord. The
3375 notes to be subtracted are listed after a @code{^} character,
3378 @lilypond[fragment,verbatim,center]
3387 Chord inversions can be specified by appending `@code{/}' and the name
3388 of a single note to a chord. In a chord inversion, the inverted note is
3389 transposed down until it is the lowest note in the chord. If the note
3390 is not in the chord, a warning will be printed.
3392 @lilypond[fragment,verbatim,center]
3402 Bass notes can be added by `@code{/+}' and
3403 the name of a single note to a chord. This has the effect of
3404 adding the specified note to the chord, lowered by an octave,
3405 so it becomes the lowest note in the chord.
3407 @lilypond[fragment,verbatim,center]
3416 The formal syntax for named chords is as follows:
3418 @var{tonic}[@var{duration}][@code{-}@var{modifiers}][@code{^}@var{subtractions}][@code{/}@var{inversion}][@code{/+}@var{bass}].
3421 @var{tonic} should be the tonic note of the chord, and @var{duration} is
3422 the chord duration in the usual notation. There are two kinds of
3423 modifiers. One type is formed by @emph{chord additions}. Additions are
3424 obtained by listing intervals separated by dots. An interval is written
3425 by its number with an optional @code{+} or @code{-} to indicate raising
3426 or lowering by half a step. Chord additions have two effects: they adds
3427 the specified interval and all lower odd numbered intervals to the
3428 chord, and they may lower or raise the specified interval.
3433 Implementation details are gory. For example @code{c:4} not only adds
3434 a fourth, but also removes the third.
3437 @c . {Printing named chords}
3438 @node Printing named chords
3439 @subsection Printing named chords
3441 @cindex printing chord names
3445 For displaying printed chord names, use the @internalsref{ChordNames} context.
3446 The chords may be entered either using the notation described above, or
3447 directly using simultaneous music.
3449 @lilypond[verbatim,singleline]
3451 \chords {a1 b c} <<d f g>> <<e g b>>
3455 \context ChordNames \scheme
3456 \context Staff \transpose c c' \scheme
3461 You can make the chord changes stand out by setting
3462 @code{ChordNames.chordChanges} to true. This will only display chord
3463 names when there's a change in the chords scheme and at the start of a
3468 c1:m c:m \break c:m c:m d
3472 \context ChordNames {
3473 \property ChordNames.chordChanges = ##t
3475 \context Staff \transpose c c' \scheme
3477 \paper{linewidth= 9.\cm}
3481 LilyPond examines chords specified as lists of notes to determine a name
3482 to give the chord. LilyPond will not try to identify chord inversions or
3483 an added bass note, which may result in strange chord names when chords
3484 are entered as a list of pitches:
3486 @lilypond[verbatim,center,singleline]
3495 \context ChordNames \scheme
3496 \context Staff \scheme
3502 By default, a chord name system proposed by Harald Banter (See
3503 @ref{Literature}) is used. The system is very regular and predictable.
3504 Typical American style chord names may be selected by setting the
3505 @code{style} property of the @code{ChordNames.ChordName} object to
3506 @code{'american}. Similarly @code{'jazz} selects Jazz chordnames.
3508 Routines that determine the names to be printed are written in Scheme,
3509 and may be customized by the user. The code can be found in
3510 @file{scm/chord-name.scm}. Here's an example showing the differences in
3514 @c maybe just junk verbatim option?
3515 @lilypond[verbatim,singleline,noquote]
3525 \context ChordNames = banter \scheme
3526 \context ChordNames = american {
3527 \property ChordNames.ChordName \override
3528 #'style = #'american \scheme }
3529 \context ChordNames = jazz {
3530 \property ChordNames.ChordName \override
3531 #'style = #'jazz \scheme }
3532 \context Staff \transpose c c' \scheme
3539 @section Writing parts
3541 Orchestral music involves some special notation, both in the full score,
3542 as in the individual parts. This section explains how to tackle common
3543 problems in orchestral music.
3550 * Instrument names::
3552 * Multi measure rests::
3553 * Automatic part combining::
3554 * Hara kiri staves::
3555 * Sound output for transposing instruments::
3558 @c . {Rehearsal marks}
3559 @node Rehearsal marks
3560 @subsection Rehearsal marks
3561 @cindex Rehearsal marks
3563 @cindex @code{\mark}
3565 To print a rehearsal mark, use the @code{\mark} command.
3566 @lilypond[fragment,verbatim]
3577 As you can see, the mark is incremented automatically if you use
3578 @code{\mark \default}. The value to use is stored in the property
3579 @code{rehearsalMark} is used and automatically incremented. The object
3580 is @internalsref{RehearsalMark} in @internalsref{Score} context. See
3581 @code{input/test/boxed-molecule.ly} if you need boxes around the
3584 The @code{\mark} command can also be used to put signs like coda,
3585 segno and fermatas on a barline. The trick is to use the text markup
3586 mechanism to access the fermata symbol.
3587 @lilypond[fragment,verbatim,relative=1]
3588 c1 \mark #'(music "scripts-ufermata")
3592 The problem is that marks that occur at a line break are typeset only
3593 at the beginning of the next line, opposite to what you want for the
3594 fermata. This can be corrected by the following property setting
3596 \property Score.RehearsalMark \override
3597 #'visibility-lambda = #begin-of-line-invisible
3603 @cindex barlines, putting symbols on
3607 @subsection Bar numbers
3611 @cindex measure numbers
3612 @cindex currentBarNumber
3614 Bar numbers are printed by default at the start of the line. The
3615 number itself is a property that can be set by modifying the
3616 @code{currentBarNumber} property, although that is usually not
3619 \property Score.currentBarNumber = #217
3622 To typeset Bar Numbers at regular intervals instead of at the beginning of each line,
3623 you need to change the grob property @code{break-visibility} as well as the translator
3624 property @code{barNumberVisibility}, as illustrated in the following example which also
3625 adds a box around the bar numbers:
3627 \property Score.BarNumber \override #'break-visibility =
3628 #end-of-line-invisible
3629 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3630 \property Score.BarNumber \override #'molecule-callback =
3631 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3632 \property Score.BarNumber \override #'font-relative-size = #0
3634 @lilypond[noindent,noquote]
3636 \context Staff \notes \transpose c c'' {
3637 \property Score.BarNumber \override #'break-visibility = #end-of-line-invisible
3638 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3639 \property Score.BarNumber \override #'molecule-callback =
3640 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3641 \property Score.BarNumber \override #'font-relative-size = #0
3643 \repeat unfold 16 c1 \bar "|."
3648 If you would like the bar numbers to appear at regular intervals, but
3649 not starting from measure zero, you can use the context function,
3650 @code{set-bar-number-visibility}, to automatically set
3651 @code{barNumberVisibility} so that the bar numbers appear at regular
3652 intervals, starting from the @code{\applycontext}:
3655 resetBarnum = \context Score \applycontext
3656 #(set-bar-number-visibility 4)
3658 \property Score.BarNumber \override #'break-visibility =
3659 #end-of-line-invisible
3660 \mark "A" \resetBarnum
3661 \repeat unfold 10 c1
3662 \mark \default \resetBarnum
3665 @lilypond[noindent,noquote]
3666 resetBarnum = \context Score \applycontext
3667 #(set-bar-number-visibility 4)
3670 \notes \transpose c c'' {
3671 \property Score.BarNumber \override #'break-visibility =#end-of-line-invisible
3672 \property Score.RehearsalMark \override #'padding = #2.5
3673 \mark "A" \resetBarnum
3674 \repeat unfold 10 c1
3675 \mark \default \resetBarnum
3683 See also @seeinternals{BarNumber}.
3687 Barnumbers can collide with the StaffGroup, if there is one at the
3688 top. To solve this, You have to twiddle with the
3689 @internalsref{padding} property of @internalsref{BarNumber} if your
3690 score starts with a @internalsref{StaffGroup}.
3692 @node Instrument names
3693 @subsection Instrument names
3695 In scores, the instrument name is printed before the staff. This can
3696 be done by setting @code{Staff.instrument} and
3697 @code{Staff.instr}. This will print a string before the start of the
3698 staff. For the first start, @code{instrument} is used, for the next
3699 ones @code{instr} is used.
3701 @lilypond[verbatim,singleline]
3702 \property Staff.instrument = "ploink " { c''4 }
3705 You can also use markup texts to construct more complicated instrument
3709 @lilypond[verbatim,singleline]
3711 \notes \context Staff = treble {
3712 \property Staff.instrument
3713 = \markup { \column << "Clarinetti" { "in B" \smaller \musicglyph #"accidentals--1" } >> }
3716 \paper { linewidth= 8.0\cm }
3723 When you put a name on a grand staff or piano staff the width of the
3724 brace is not taken into account. You must add extra spaces to the end of
3725 the name to avoid a collision.
3728 @subsection Transpose
3730 @cindex transposition of pitches
3731 @cindex @code{\transpose}
3733 A music expression can be transposed with @code{\transpose}. The syntax
3736 \transpose @var{from} @var{to} @var{musicexpr}
3739 This means that @var{musicexpr} is transposed to by the interval
3740 between @var{from} is @var{to}.
3742 @code{\transpose} distinguishes between enharmonic pitches: both
3743 @code{\transpose c cis} or @code{\transpose c des} will transpose up
3744 half a tone. The first version will print sharps and the second
3745 version will print flats.
3747 @lilypond[singleline, verbatim]
3748 mus =\notes { \key d \major cis d fis g }
3749 \score { \notes \context Staff {
3752 \transpose c g' \mus
3753 \transpose c f' \mus
3757 If you want to use both @code{\transpose} and @code{\relative}, then
3758 you must use @code{\transpose} first. @code{\relative} will have no
3759 effect music that appears inside a @code{\transpose}.
3761 @c . {Multi measure rests}
3762 @node Multi measure rests
3763 @subsection Multi measure rests
3764 @cindex Multi measure rests
3768 Multi measure rests are entered using `@code{R}'. It is specifically
3769 meant for full bar rests and for entering parts: the rest can expand to
3770 fill a score with rests, or it can be printed as a single multimeasure
3771 rest This expansion is controlled by the property
3772 @code{Score.skipBars}. If this is set to true, Lily will not expand
3773 empty measures, and the appropriate number is added automatically.
3775 @lilypond[fragment,verbatim]
3776 \time 4/4 r1 | R1 | R1*2
3777 \property Score.skipBars = ##t R1*17 R1*4
3780 The @code{1} in @code{R1} is similar to the duration notation used for
3781 notes. Hence, for time signatures other than 4/4, you must enter other
3782 durations. This can be done with augmentation dots, or with
3785 @lilypond[fragment,verbatim]
3786 \property Score.skipBars = ##t
3793 Notice that a @code{R} spanning a single measure is printed as a whole
3794 rest centered in the measure, regardless of the time signature.
3796 [ add note about breves.]
3799 @cindex whole rests for a full measure
3801 The object for this object is @internalsref{MultiMeasureRest}, and
3802 @internalsref{MultiMeasureRestNumber}.
3806 Currently, there is no way to automatically condense multiple rests
3807 into a single multimeasure rest. Multi measure rests do not take part
3810 Multi-measure rests do not accept @var{note}-@code{text} syntax for
3811 putting texts and scripts on the rest. This has to be done by setting
3812 @code{#'text} in @internalsref{MultiMeasureRestNumber}. An identifier is
3813 provided for a fermata:
3815 @cindex text on multi-measure rest
3816 @cindex script on multi-measure rest
3817 @cindex fermata on multi-measure rest
3819 @lilypond[verbatim,fragment]
3821 \setMmRestFermata R2.
3825 @cindex condensing rests
3827 @node Automatic part combining
3828 @subsection Automatic part combining
3829 @cindex automatic part combining
3830 @cindex part combiner
3833 Automatic part combining is used to merge two parts of music onto a
3834 staff in an intelligent way. It is aimed primarily at typesetting
3835 orchestral scores. When the two parts are identical for a period of
3836 time, only one is shown. In places where the two parts differ, they
3837 are typeset as separate voices, and stem directions are set
3838 automatically. Also, solo and @emph{a due} parts can be identified
3841 The syntax for part combining is
3844 \partcombine @var{context} @var{musicexpr1} @var{musicexpr2}
3846 where the pieces of music @var{musicexpr1} and @var{musicexpr2} will be
3847 combined into one context of type @var{context}. The music expressions
3848 must be interpreted by contexts whose names should start with @code{one}
3851 The most useful function of the part combiner is to combine parts into
3852 one voice, as common for wind parts in orchestral scores:
3854 @lilypond[verbatim,singleline,fragment]
3856 \context Voice=one \partcombine Voice
3857 \context Thread=one \relative c'' {
3860 \context Thread=two \relative c'' {
3866 Notice that the first @code{g} appears only once, although it was
3867 specified twice (once in each part). Stem, slur and tie directions are
3868 set automatically, depending whether there is a solo or unisono. The
3869 first part (with context called @code{one}) always gets up stems, and
3870 `solo', while the second (called @code{two}) always gets down stems and
3873 If you just want the merging parts, and not the textual markings, you
3874 may set the property @var{soloADue} to false.
3876 @lilypond[verbatim,singleline,fragment]
3878 \property Staff.soloADue = ##f
3879 \context Voice=one \partcombine Voice
3880 \context Thread=one \relative c'' {
3883 \context Thread=two \relative c'' {
3889 There are a number of other properties that you can use to tweak the
3890 behavior of part combining, refer to the automatically generated
3891 documentation of @reng{Thread_devnull_engraver} and
3892 @reng{Voice_devnull_engraver}. Look at the documentation of the
3893 responsible engravers, @code{Thread_devnull_engraver},
3894 @code{Voice_devnull_engraver} and @code{A2_engraver}.
3898 In @code{soloADue} mode, when the two voices play the same notes on and
3899 off, the part combiner may typeset @code{a2} more than once in a
3902 @lilypond[fragment,singleline]
3904 \context Voice=one \partcombine Voice
3905 \context Thread=one \relative c'' {
3908 \context Thread=two \relative c'' {
3914 @cindex @code{Thread_devnull_engraver}
3915 @cindex @code{Voice_engraver}
3916 @cindex @code{A2_engraver}
3918 @node Hara kiri staves
3919 @subsection Hara kiri staves
3921 In orchestral scores, staff lines that only have rests are usually removed.
3922 This saves some space. LilyPond also supports this through the hara
3923 kiri@footnote{Hara kiri, also called Seppuku, is the ritual suicide of
3924 the Japanese Samourai warriors.} staff. This staff commits suicide when
3925 it finds itself to be empty after the line-breaking process. It will
3926 not disappear when it contains normal rests, you must use multi measure
3929 The hara kiri staff is specialized version of the @internalsref{Staff}
3930 context. It is available as the context identifier
3931 @code{\HaraKiriStaffContext}. Observe how the second staff in this
3932 example disappears in the second line.
3936 \notes \relative c' <
3937 \context Staff = SA { e4 f g a \break c1 }
3938 \context Staff = SB { c4 d e f \break R1 }
3942 \translator { \HaraKiriStaffContext }
3948 @node Sound output for transposing instruments
3949 @subsection Sound output for transposing instruments
3951 When you want to make a MIDI file from a score containing transposed
3952 and untransposed instruments, you have to instruct LilyPond the pitch
3953 offset (in semitones) for the transposed instruments. This is done
3954 using the @code{transposing} property. It does not affect printed
3957 @cindex @code{transposing}
3960 \property Staff.instrument = #"Cl. in B-flat"
3961 \property Staff.transposing = #-2
3967 @node Ancient notation
3968 @section Ancient notation
3970 @cindex Vaticana, Editio
3971 @cindex Medicaea, Editio
3977 * Ancient note heads::
3985 @node Ancient note heads
3986 @subsection Ancient note heads
3988 To get a longa note head, you have to use mensural note heads. This
3989 is accomplished by setting the @code{style} property of the
3990 NoteHead object to @code{mensural}. There is also a note head style
3991 @code{baroque} which gives mensural note heads for @code{\longa} and
3992 @code{\breve} but standard note heads for shorter notes.
3994 @lilypond[fragment,singleline,verbatim]
3995 \property Voice.NoteHead \set #'style = #'mensural
4000 @subsection Ancient clefs
4002 LilyPond supports a variety of clefs, many of them ancient.
4004 For modern clefs, see section @ref{Clef}. For the percussion clef, see
4005 section @ref{Percussion staves}. For the @code{TAB} clef, see section
4008 The following table shows all ancient clefs that are supported via the
4009 @code{\clef} command. Some of the clefs use the same glyph, but differ
4010 only with respect to the line they are printed on. In such cases, a
4011 trailing number in the name is used to enumerate these clefs. Still,
4012 you can manually force a clef glyph to be typeset on an arbitrary line,
4013 as described in section @ref{Clef}. The note printed to the right side
4014 of each clef denotes the @code{c'} with respect to the clef.
4018 @c --- This should go somewhere else: ---
4019 @c @item modern style G clef (glyph: @code{clefs-G})
4022 @c @code{treble}, @code{violin}, @code{G}, @code{G2}, @code{french}
4024 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "G" c'}
4026 @c @item modern style F clef (glyph: @code{clefs-F})
4029 @c @code{varbaritone}, @code{bass}, @code{F}, @code{subbass}
4031 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "F" c'}
4033 @c @item modern style C clef (glyph: @code{clefs-C})
4036 @c @code{soprano}, @code{mezzosoprano}, @code{alto}, @code{C},
4037 @c @code{tenor}, @code{baritone}
4039 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "C" c'}
4041 @item modern style mensural C clef (glyph: @code{clefs-neo_mensural_c'})
4044 @code{neo_mensural_c1}, @code{neo_mensural_c2},
4045 @code{neo_mensural_c3}, @code{neo_mensural_c4}
4047 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "neo_mensural_c2" c'}
4049 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c1})
4055 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c1" c'}
4057 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c2})
4063 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c2" c'}
4065 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c3})
4071 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c3" c'}
4073 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c4})
4079 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c4" c'}
4081 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c5})
4087 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c5" c'}
4089 @item petrucci style mensural F clef (glyph: @code{clefs-petrucci_f})
4094 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_f" c'}
4096 @item petrucci style mensural G clef (glyph: @code{clefs-petrucci_g})
4101 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_g" c'}
4103 @item historic style mensural C clef (glyph: @code{clefs-mensural_c'})
4106 @code{mensural_c1}, @code{mensural_c2}, @code{mensural_c3},
4109 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_c2" c'}
4111 @item historic style mensural F clef (glyph: @code{clefs-mensural_f})
4116 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_f" c'}
4118 @item historic style mensural G clef (glyph: @code{clefs-mensural_g})
4123 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_g" c'}
4125 @item Editio Vaticana style do clef (glyph: @code{clefs-vaticana_do})
4128 @code{vaticana_do1}, @code{vaticana_do2}, @code{vaticana_do3}
4130 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_do2" c'}
4132 @item Editio Vaticana style fa clef (glyph: @code{clefs-vaticana_fa})
4135 @code{vaticana_fa1}, @code{vaticana_fa2}
4137 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_fa2" c'}
4139 @item Editio Medicaea style do clef (glyph: @code{clefs-medicaea_do})
4142 @code{medicaea_do1}, @code{medicaea_do2}, @code{medicaea_do3}
4144 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_do2" c'}
4146 @item Editio Medicaea style fa clef (glyph: @code{clefs-medicaea_fa})
4149 @code{medicaea_fa1}, @code{medicaea_fa2}
4151 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_fa2" c'}
4153 @item historic style hufnagel do clef (glyph: @code{clefs-hufnagel_do})
4156 @code{hufnagel_do1}, @code{hufnagel_do2}, @code{hufnagel_do3}
4158 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do2" c'}
4160 @item historic style hufnagel fa clef (glyph: @code{clefs-hufnagel_fa})
4163 @code{hufnagel_fa1}, @code{hufnagel_fa2}
4165 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_fa2" c'}
4167 @item historic style hufnagel combined do/fa clef (glyph: @code{clefs-hufnagel_do_fa})
4170 @code{hufnagel_do_fa}
4172 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do_fa" c'}
4174 @c --- This should go somewhere else: ---
4175 @c @item modern style percussion clef (glyph: @code{clefs-percussion})
4178 @c @code{percussion}
4180 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "percussion" c'}
4182 @c @item modern style tab clef (glyph: @code{clefs-tab})
4187 @c @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #6 \property Staff.TimeSignature \set #'transparent = ##t \clef "tab" c'}
4191 @emph{Modern style} means ``as is typeset in current editions of
4192 transcribed mensural music''.
4194 @emph{Petrucci style} means ``inspired by printings published by the
4195 famous engraver Petrucci (1466-1539)''.
4197 @emph{Historic style} means ``as was typeset or written in contemporary
4198 historic editions (other than those of Petrucci)''.
4200 @emph{Editio XXX style} means ``as is/was printed in Editio XXX''.
4202 Petrucci used C clefs with differently balanced left-side vertical
4203 beams, depending on which staffline it was printed.
4206 @subsection Custodes
4211 A @emph{custos} (plural: @emph{custodes}; latin word for `guard') is a
4212 staff context symbol that appears at the end of a staff line. It
4213 anticipates the pitch of the first note(s) of the following line and
4214 thus helps the player or singer to manage line breaks during
4215 performance, thus enhancing readability of a score.
4217 @lilypond[verbatim,noquote]
4220 \property Staff.Custos \set #'style = #'mensural
4225 \consists Custos_engraver
4231 Custodes were frequently used in music notation until the 17th century.
4232 There were different appearances for different notation styles.
4233 Nowadays, they have survived only in special forms of musical notation
4234 such as via the @emph{editio vaticana} dating back to the beginning of
4237 For typesetting custodes, just put a @code{Custos_engraver} into the
4238 @internalsref{Staff} context when declaring the @code{\paper} block. In this
4239 block, you can also globally control the appearance of the custos symbol
4240 by setting the custos @code{style} property. Currently supported styles
4241 are @code{vaticana}, @code{medicaea}, @code{hufnagel} and
4248 \consists Custos_engraver
4249 Custos \override #'style = #'mensural
4254 The property can also be set locally, for example in a @code{\notes}
4259 \property Staff.Custos \override #'style = #'vaticana
4260 c'1 d' e' d' \break c' d' e' d'
4265 @subsection Ligatures
4269 @c TODO: Should double check if I recalled things correctly when I wrote
4270 @c down the following paragraph by heart.
4271 In musical terminology, a ligature is a coherent graphical symbol that
4272 represents at least two different notes. Ligatures originally appeared
4273 in the manuscripts of Gregorian chant notation roughly since the 9th
4274 century as an allusion to the accent symbols of greek lyric poetry to
4275 denote ascending or descending sequences of notes. Both, the shape and
4276 the exact meaning of ligatures changed tremendously during the following
4277 centuries: In early notation, ligatures where used for monophonic tunes
4278 (Gregorian chant) and very soon denoted also the way of performance in
4279 the sense of articulation. With upcoming multiphony, the need for a
4280 metric system arised, since multiple voices of a piece have to be
4281 synchronized some way. New notation systems were invented, that used
4282 the manifold shapes of ligatures to now denote rhythmical patterns
4283 (e.g. black mensural notation, mannered notation, ars nova). With the
4284 invention of the metric system of the white mensural notation, the need
4285 for ligatures to denote such patterns disappeared. Nevertheless,
4286 ligatures were still in use in the mensural system for a couple of
4287 decades until they finally disappeared during the late 16th / early 17th
4288 century. Still, ligatures have survived in contemporary editions of
4289 Gregorian chant such as the Editio Vaticana from 1905/08.
4291 Syntactically, ligatures are simply enclosed by @code{\[} and @code{\]}.
4292 Some ligature styles (such as Editio Vaticana) may need additional input
4293 syntax specific for this particular type of ligature. By default, the
4294 @internalsref{LigatureBracket} engraver just marks the start and end of
4295 a ligature by small square angles:
4297 @lilypond[singleline,verbatim]
4299 \notes \transpose c c' {
4307 To select a specific style of ligatures, a proper ligature engraver has
4308 to be added to the @internalsref{Voice} context, as explained in the
4309 following subsections. Currently, Lilypond only supports white mensural
4310 ligatures with certain limitations. Support for Editio Vaticana will be
4311 added in the future.
4314 * White mensural ligatures::
4317 @node White mensural ligatures
4318 @subsubsection White mensural ligatures
4320 @cindex Mensural ligatures
4321 @cindex White mensural ligatures
4323 Lilypond has limited support for white mensural ligatures. The
4324 implementation is still experimental; it currently may output strange
4325 warnings or even crash in some cases or produce weird results on more
4326 complex ligatures. To engrave white mensural ligatures, in the paper
4327 block the @internalsref{MensuralLigature} engraver has to be put into
4328 the @internalsref{Voice} context (and you probably want to remove the
4329 @internalsref{LigatureBracket} engraver). There is no additional input
4330 language to describe the shape of a white mensural ligature. The shape
4331 is rather determined solely from the pitch and duration of the enclosed
4332 notes. While this approach may take a new user quite a while to get
4333 accustomed, it has a great advantage: this way, lily has full musical
4334 information about the ligature. This is not only required for correct
4335 MIDI output, but also allows for automatic transcription of the
4340 @lilypond[singleline,verbatim]
4342 \notes \transpose c c' {
4343 \property Score.timing = ##f
4344 \property Score.defaultBarType = "empty"
4345 \property Voice.NoteHead \set #'style = #'neo_mensural
4346 \property Staff.TimeSignature \set #'style = #'neo_mensural
4348 \[ g\longa c\breve a\breve f\breve d'\longa \]
4350 \[ e1 f1 a\breve g\longa \]
4355 \remove Ligature_bracket_engraver
4356 \consists Mensural_ligature_engraver
4362 Without replacing @code{Ligature_bracket_engraver} with
4363 @code{Mensural_ligature_engraver}, the same music transcribes to the
4366 @lilypond[singleline,verbatim]
4368 \notes \transpose c c' {
4369 \property Score.timing = ##f
4370 \property Score.defaultBarType = "empty"
4371 \property Voice.NoteHead \set #'style = #'neo_mensural
4372 \property Staff.TimeSignature \set #'style = #'neo_mensural
4374 \[ g\longa c\breve a\breve f\breve d'\longa \]
4376 \[ e1 f1 a\breve g\longa \]
4382 @subsection Figured bass
4384 @cindex Basso continuo
4386 LilyPond has limited support for figured bass:
4388 @lilypond[verbatim,fragment]
4390 \context FiguredBass
4395 \context Voice { c4 g8 }
4399 The support for figured bass consists of two parts: there is an input
4400 mode, introduced by @code{\figures}, where you can enter bass figures
4401 as numbers, and there is a context called @internalsref{FiguredBass}
4402 that takes care of making @internalsref{BassFigure} objects.
4404 In figures input mode, a group of bass figures is delimited by
4405 @code{<} and @code{>}. The duration is entered after the @code{>}.
4410 \context FiguredBass
4414 Accidentals are added to the numbers if you alterate them by
4415 appending @code{-}, @code{!} and @code{+}.
4421 \context FiguredBass
4422 \figures { <4- 6+ 7!> }
4425 Spaces or dashes may be inserted by using @code{_}. Brackets are
4426 introduced with @code{[} and @code{]}.
4432 \context FiguredBass
4433 \figures { < [4 6] 8 [_ 12]> }
4436 Although the support for figured bass may superficially resemble chord
4437 support, it works much simpler: in figured bass simply stores the
4438 numbers, and then prints the numbers you entered. There is no
4439 conversion to pitches, and no realizations of the bass are played in
4443 @c . {Contemporary notation}
4444 @node Contemporary notation
4445 @section Contemporary notation
4452 @subsection Clusters
4456 In musical terminology, a @emph{cluster} denotes a range of
4457 simultaneously sounding pitches that may change over time. The set of
4458 available pitches to apply usually depends on the accoustic source.
4459 Thus, in piano music, a cluster typically consists of a continous range
4460 of the semitones as provided by the piano's fixed set of a chromatic
4461 scale. In choral music, each singer of the choir typically may sing an
4462 arbitrary pitch within the cluster's range that is not bound to any
4463 diatonic, chromatic or other scale. In electronic music, a cluster
4464 (theoretically) may even cover a continuous range of pitches, thus
4465 resulting in coloured noise, such as pink noise.
4467 Clusters can be notated in the context of ordinary staff notation by
4468 engraving simple geometrical shapes that replace ordinary notation of
4469 notes. Ordinary notes as musical events specify starting time and
4470 duration of pitches; however, the duration of a note is expressed by the
4471 shape of the note head rather than by the horizontal graphical extent of
4472 the note symbol. In contrast, the shape of a cluster geometrically
4473 describes the development of a range of pitches (vertical extent) over
4474 time (horizontal extent). Still, the geometrical shape of a cluster
4475 covers the area in wich any single pitch contained in the cluster would
4476 be notated as an ordinary note. From this point of view, it is
4477 reasonable to specify a cluster as the envelope of a set of notes. This
4478 is exactly how to construct a cluster with lilypond.
4480 @lilypond[singleline,verbatim]
4482 \context PianoStaff <
4483 \context Voice = voiceI { % same as voiceII, but with ordinary notes
4484 \notes \relative c' {
4486 a4 <e4 d'4> | \break
4487 < g8 a8 > < e8 a8 > a4 c1 < d4 b4 > e4 |
4491 \context Voice = voiceII { % same as voiceI, but with cluster notation
4492 \notes \relative c' {
4494 % hide notes, accidentals, etc.
4495 \property Thread.NoteHead \set #'transparent = ##t
4496 \property Voice.Stem \set #'transparent = ##t
4497 \property Voice.Beam \set #'transparent = ##t
4498 \property Staff.Accidental \set #'transparent = ##t
4500 \property Voice.Cluster \set #'padding = #0.01
4501 \property Voice.Cluster \set #'shape = #'ramp
4505 a4 <e4 d'4> | \break
4506 < g8 a8 > < e8 a8 > a4 c1 < d4 b4 > e4 |
4507 c4 \stopCluster a4 f4 g4 a4
4514 Note that the second voice differs from the first one only by the
4515 additional keywords @code{\startCluster} and @code{\stopCluster} and the
4516 fact that notes, accidentals, etc. are hidden. A future version of
4517 lilypond may automatically hide notes, accidentals, etc. within the
4520 Also note that a music expression like @code{< @{ g8 e8 @} a4 >} is
4521 illegal; in such a case, you can instead use the expression @code{< g8
4524 By default, cluster engraver is in the voice context. This allows
4525 putting ordinary notes and clusters together in the same staff, even
4526 simultaneously. However, in such a case no attempt is made to
4527 automatically avoid collisions between ordinary notes and clusters.
4529 The geometrical shape can be further controlled with grob properties
4530 @code{padding} and @code{shape}. @code{padding} adds to the vertical
4531 extent of the shape (top and bottom) and is expressed in units of
4532 staffspace. Since the pitch range of a single pitch is infinitely
4533 small, if padding is set to @code{0.0}, this possibly results in an
4534 invisible shape, if you,for example, say @code{ \startCluster c d e
4535 \endCluster}. The default value for @code{padding} therefore is
4536 @code{0.25}, such that a single pitch roughly shows the same height as a
4537 note head. Property @code{shape} controls how the overall shape of the
4538 cluster is constructed from the set of notes. Currently supported
4539 values are @code{leftsided-stairs}, @code{rightsided-stairs},
4540 @code{centered-stairs}, and @code{ramp}.
4542 @c . {Tuning output}
4544 @section Tuning output
4546 LilyPond tries to take as much formatting as possible out of your
4547 hands. Nevertheless, there are situations where it needs some help, or
4548 where you want to override its decisions. In this section we discuss
4549 ways to do just that.
4551 Formatting is internally done by manipulating so called objects (graphic
4552 objects). Each object carries with it a set of properties (object
4553 properties) specific to that object. For example, a stem object has
4554 properties that specify its direction, length and thickness.
4556 The most direct way of tuning the output is by altering the values of
4557 these properties. There are two ways of doing that: first, you can
4558 temporarily change the definition of a certain type of object, thus
4559 affecting a whole set of objects. Second, you can select one specific
4560 object, and set a object property in that object.
4563 * Tuning groups of objects ::
4564 * Tuning per object ::
4569 @node Tuning groups of objects
4570 @subsection Tuning groups of objects
4572 @cindex object description
4574 A object definition is a Scheme association list, that is stored in a
4575 context property. By assigning to that property (using plain
4576 @code{\property}), you can change the resulting objects.
4578 @lilypond[verbatim, fragment]
4579 c'4 \property Voice.Stem = #'()
4582 The @code{\property} assignment effectively empties the definition of
4583 the Stem object. One of the effects is that the recipe of how it should be
4584 printed is erased, with the effect of rendering it invisible. The above
4585 assignment is available as a standard identifier, for the case that you
4589 \property Voice.Stem = \turnOff
4596 This mechanism is fairly crude, since you can only set, but not modify,
4597 the definition of a object. For this reason, there is a more advanced
4600 The definition of a object is actually a list of default object
4601 properties. For example, the definition of the Stem object (available in
4602 @file{scm/grob-description.scm}), defines the following values for
4607 (beamed-lengths . (0.0 2.5 2.0 1.5))
4608 (Y-extent-callback . ,Stem::height)
4612 You can add a property on top of the existing definition, or remove a
4613 property, thus overriding the system defaults:
4615 c'4 \property Voice.Stem \override #'thickness = #4.0
4616 c'4 \property Voice.Stem \revert #'thickness
4619 You should balance @code{\override} and @code{\revert}. If that's too
4620 much work, you can use the @code{\set} shorthand. It performs a revert
4621 followed by an override. The following example gives exactly the same
4622 result as the previous one.
4624 c'4 \property Voice.Stem \set #'thickness = #4.0
4625 c'4 \property Voice.Stem \set #'thickness = #0.8
4628 If you use @code{\set}, you must explicitly restore the default.
4631 Formally the syntax for these constructions is
4633 \property @var{context}.@var{grobname} \override @var{symbol} = @var{value}
4634 \property @var{context}.@var{grobname} \set @var{symbol} = @var{value}
4635 \property @var{context}.@var{grobname} \revert @var{symbol}
4637 Here @var{symbol} is a Scheme expression of symbol type, @var{context}
4638 and @var{grobname} are strings and @var{value} is a Scheme expression.
4641 If you revert a setting which was not set in the first place, then it
4642 has no effect. However, if the setting was set as a system default, it
4643 may remove the default value, and this may give surprising results,
4644 including crashes. In other words, @code{\override} and @code{\revert},
4645 must be carefully balanced.
4647 These are examples of correct nesting of @code{\override}, @code{\set},
4650 A clumsy but correct form:
4652 \override \revert \override \revert \override \revert
4655 Shorter version of the same:
4657 \override \set \set \revert
4660 A short form, using only @code{\set}. This requires you to know the
4663 \set \set \set \set @var{to default value}
4666 If there is no default (i.e. by default, the object property is unset),
4669 \set \set \set \revert
4672 For the digirati, the object description is an Scheme association
4673 list. Since a Scheme list is a singly linked list, we can treat it as a
4674 stack, and @code{\override} and @code{\revert} are just push and pop
4675 operations. This pushing and popping is also used for overriding
4676 automatic beaming settings.
4680 LilyPond will hang or crash if @var{value} contains cyclic references.
4681 The backend is not very strict in type-checking object properties. If you
4682 @code{\revert} properties that are expected to be set by default,
4688 @node Tuning per object
4689 @subsection Tuning per object
4692 Tuning a single object is most often done with @code{\property}. The
4695 \once \property @dots{}
4698 applies a setting only during one moment in the score: notice how the
4699 original setting for stem thickness is restored automatically in the
4702 @lilypond[verbatim, fragment, relative=1]
4704 \once \property Voice.Stem \set #'thickness = #4
4710 @cindex \outputproperty
4712 A second way of tuning objects is the more arcane @code{\outputproperty}
4713 feature. The syntax is as follows:
4715 \outputproperty @var{predicate} @var{symbol} = @var{value}
4717 Here @code{predicate} is a Scheme function taking a object argument, and
4718 returning a boolean. This statement is processed by the
4719 @code{Output_property_engraver}. It instructs the engraver to feed all
4720 objects that it sees to @var{predicate}. Whenever the predicate returns
4721 true, the object property @var{symbol} will be set to @var{value}.
4723 This command is only single shot, in contrast to @code{\override} and
4726 You will need to combine this statement with @code{\context} to select
4727 the appropriate context to apply this to.
4729 In the following example, all note heads occurring at current staff
4730 level, are shifted up and right by setting their @code{extra-offset}
4733 @lilypond[fragment,verbatim,singleline]
4735 \context Staff \outputproperty
4736 #(make-type-checker 'note-head-interface)
4737 #'extra-offset = #'(0.5 . 0.75)
4741 @cindex @code{extra-offset}
4743 In this example, the predicate checks the @code{text} object property, to
4744 shift only the `m.d.' text, but not the fingering instruction "2".
4745 @lilypond[verbatim,singleline]
4746 #(define (make-text-checker text)
4747 (lambda (grob) (equal? text (ly:get-grob-property grob 'text))))
4750 \notes\relative c''' {
4751 \property Voice.Stem \set #'direction = #1
4752 \outputproperty #(make-text-checker "m.d.")
4753 #'extra-offset = #'(-3.5 . -4.5)
4761 If possible, avoid this feature: the semantics are not very clean, and
4762 the syntax and semantics are up for rewrite.
4767 @node Font selection
4768 @subsection Font selection
4770 The most common thing to change about the appearance of fonts is
4771 their size. The font size of a @internalsref{Voice},
4772 @internalsref{Staff} or @internalsref{Thread} context, can be easily
4773 changed by setting the @code{fontSize} property for that context:
4774 @lilypond[fragment,relative=1]
4775 c4 c4 \property Voice.fontSize = #-1
4778 This command will not change the size of variable symbols, such as
4779 beams or slurs. You can use this command to get smaller symbol for
4780 cue notes, but that involves some more subtleties. An elaborate
4781 example of those is in @file{input/test/cue-notes.ly}.
4789 The font used for printing a object can be selected by setting
4790 @code{font-name}, e.g.
4792 \property Staff.TimeSignature
4793 \set #'font-name = #"cmr17"
4795 You may use any font which is available to @TeX{}, such as foreign
4796 fonts or fonts that do not belong to the Computer Modern font family.
4797 Font selection for the standard fonts, @TeX{}'s Computer Modern fonts,
4798 can also be adjusted with a more fine-grained mechanism. By setting
4799 the object properties described below, you can select a different font.
4800 All three mechanisms work for every object that supports
4801 @code{font-interface}.
4805 A symbol indicating the general class of the typeface. Supported are
4806 @code{roman} (Computer Modern), @code{braces} (for piano staff
4807 braces), @code{music} (the standard music font), @code{ancient} (the
4808 ancient notation font) @code{dynamic} (font for dynamic signs) and
4812 A symbol indicating the shape of the font, there are typically several
4813 font shapes available for each font family. Choices are @code{italic},
4814 @code{caps} and @code{upright}
4817 A symbol indicating the series of the font. There are typically several
4818 font series for each font family and shape. Choices are @code{medium}
4821 @item font-relative-size
4822 A number indicating the size relative the standard size. For example,
4823 with 20pt staff height, relative size -1 corresponds to 16pt staff
4824 height, and relative size +1 corresponds to 23 pt staff height.
4826 @item font-design-size
4827 A number indicating the design size of the font.
4829 This is a feature of the Computer Modern Font: each point size has a
4830 slightly different design. Smaller design sizes are relatively wider,
4831 which enhances readability.
4834 For any of these properties, the value @code{*} (i.e. the @emph{symbol},
4835 @code{*}, entered as @code{#'*}), acts as a wildcard. This can be used
4836 to override default setting, which are always present. For example:
4838 \property Lyrics.LyricText \override #'font-series = #'bold
4839 \property Lyrics.LyricText \override #'font-family = #'typewriter
4840 \property Lyrics.LyricText \override #'font-shape = #'*
4843 @cindex @code{font-style}
4845 There are also pre-cooked font selection qualifiers. These are
4846 selected through the object property @code{font-style}. For example,
4847 the style @code{finger} selects family @code{number} and relative size
4848 @code{-3}. Styles available include @code{volta}, @code{finger},
4849 @code{tuplet}, @code{timesig}, @code{mmrest}, @code{script},
4850 @code{large}, @code{Large} and @code{dynamic}. The style sheets and
4851 tables for selecting fonts are located in @file{scm/font.scm}. Refer
4852 to this file for more information.
4854 @cindex magnification
4856 The size of the font may be scaled with the object property
4857 @code{font-magnification}. For example, @code{2.0} blows up all
4858 letters by a factor 2 in both directions.
4862 Relative size is not linked to any real size.
4864 There is no style sheet provided for other fonts besides the @TeX{}
4865 family, and the style sheet can not be modified easiyl.
4867 @cindex font selection
4868 @cindex font magnification
4869 @cindex @code{font-interface}
4873 @subsection Text markup
4878 @cindex typeset text
4880 LilyPond has an internal mechanism to typeset texts. You can access it
4881 with the keyword @code{\markup}. Within markup mode, you can enter texts
4882 similar to lyrics: simply enter them, surrounded by spaces.
4885 @lilypond[verbatim,fragment,relative=1]
4886 c1^\markup { hello }
4887 c1_\markup { hi there }
4888 c1^\markup { hi \bold there, is \italic anyone home? }
4891 @cindex font switching
4893 The line of the example demonstrates font switching commands. Notice
4894 that the command only apply to the first following word; enclose a set
4895 of texts with braces to apply a command to more words.
4897 \markup @{ \bold @{ hi there @} @}
4899 For clarity, you can also do this for single arguments, e.g.
4901 \markup @{ is \italic @{ anyone @} home @}
4904 @cindex font size, texts
4907 The following size commands set abolute sizes
4923 You can also make letter larger or smaller relative to their neighbors,
4924 with the commands @code{\larger} and @code{\smaller}.
4928 @cindex font style, for texts
4934 The following font change commands are defined:
4937 This changes to the font used for dynamic signs. Note that this font
4938 doesn't contain all characters of the alphabet.
4940 This changes to the font used for time signatures. It only contains
4941 numbers and a few punctuation marks.
4946 @cindex raising text
4947 @cindex lowering text
4949 @cindex translating text
4954 Raising and lowering texts can be done with @code{\super} and
4957 @lilypond[verbatim,fragment,relative=1]
4958 c1^\markup { E "=" mc \super "2" }
4963 If you want to give an explicit amount for lowering or raising, use
4964 @code{\raise}. This command takes a Scheme valued argument,
4965 @lilypond[verbatim,fragment,relative=1]
4966 c1^\markup { C \small \raise #1.0 { "9/7+" }}
4968 The argument to @code{\raise} is the vertical displacement amount,
4969 measured in (global) staff spaces.
4971 Other commands taking single arguments include
4976 This is converted to a musical symbol, e.g. @code{\musicglyph
4977 #"accidentals-0"} will select the natural sign from the music font.
4978 See @ref{The Feta font} for a complete listing of the possible glyphs.
4980 This produces a single character, e.g. @code{\char #65} produces the
4983 @item \hspace #@var{amount}
4985 This produces a invisible object taking horizontal space.
4987 \markup @{ A \hspace #2.0 B @}
4989 will put extra space between A and B. Note that lilypond
4990 inserts space before and after @code{\hspace}.
4992 @item \fontsize #@var{size}
4994 This sets the relative font size, eg.
4996 A \fontsize #2 @{ B C @} D
4999 This will enlarge the B and the C by two steps.
5000 @item \translate #(cons @var{x} @var{y})
5002 This translates an object. It's first argument is a cons of numbers
5004 A \translate #(cons 2 -3) @{ B C @} D
5006 This moves `B C' 2 spaces to the right, and 3 down.
5008 @item \magnify #@var{mag}
5010 This sets the font magnification for the its argument. In the following
5011 example, the middle A will be 10% larger.
5013 A \magnify #1.1 @{ A @} A
5017 @item \override #(@var{key} . @var{value})
5019 This overrides a formatting property for its argument. The argument
5020 should be a key/value pair, e.g.
5022 m \override #'(font-family . math) m m
5026 In markup mode you can compose expressions, similar to mathematical
5027 expressions, XML documents and music expressions. The braces group
5028 notes into horizontal lines. Other types of lists also exist: you can
5029 stack expressions grouped with @code{<<}, and @code{>>} vertically with
5030 the command @code{\column}.
5032 @lilypond[verbatim,fragment,relative=1]
5033 c1^\markup { \column << a b c >> }
5034 c1^\markup { \line << a b c >> }
5037 The markup mechanism is very flexible and extensible. Refer to
5038 @file{scm/new-markup.scm} for more information on extending the markup
5042 @cindex metronome mark
5044 One practical application of complicated markup is to fake a metronome
5048 eigthStem = \markup \combine
5049 \musicglyph #"flags-stem"
5050 \translate #'(0.0 . 3.5) \musicglyph #"flags-u3"
5051 eighthNote = \markup
5052 \override #'(word-space . 0.0)
5053 { \musicglyph #"noteheads-2"
5054 \translate #'(-0.05 . 0.1) \eigthStem }
5057 \notes\relative c'' {
5058 a1^\markup { \magnify #0.9 \eighthNote " = 64" }
5067 LilyPond does not account for kerning in its text formatting, so it
5068 spaces texts slightly too wide.
5070 Syntax errors for markup mode are confusing.
5074 @section Global layout
5076 The global layout determined by three factors: the page layout, the
5077 line breaks and the spacing. These all influence each other: The
5078 choice of spacing determines how densely each system of music is set,
5079 where line breaks breaks are chosen, and thus ultimately how many
5080 pages a piece of music takes. In this section we will explain how the
5081 lilypond spacing engine works, and how you can tune its results.
5083 Globally spoken, this procedure happens in three steps: first,
5084 flexible distances (``springs'') are chosen, based on durations. All
5085 possible line breaking combination are tried, and the one with the
5086 best results---a layout that has uniform density and requires as
5087 little stretching or cramping as possible---is chosen. When the score
5088 is processed by @TeX{}, page are filled with systems, and page breaks
5089 are chosen whenever the page gets full.
5092 * Vertical spacing::
5093 * Horizontal spacing::
5100 @node Vertical spacing
5101 @subsection Vertical spacing
5103 @cindex vertical spacing
5104 @cindex distance between staves
5105 @cindex staff distance
5106 @cindex between staves, distance
5107 @cindex staffs per page
5110 The height of each system is determined automatically by lilypond, to
5111 keep systems from bumping into each other, some minimum distances are
5112 set. By changing these, you can put staves closer together, and thus
5113 put more systems onto one page.
5115 Normally staves are stacked vertically. To make
5116 staves maintain a distance, their vertical size is padded. This is
5117 done with the property @code{minimumVerticalExtent}. It takes a pair
5118 of numbers, so if you want to make it smaller from its, then you could
5121 \property Staff.minimumVerticalExtent = #'(-4 . 4)
5123 This sets the vertical size of the current staff to 4 staff-space on
5124 either side of the center staff line. The argument of
5125 @code{minimumVerticalExtent} is interpreted as an interval, where the
5126 center line is the 0, so the first number is generally negative. you
5127 could also make the staff larger at the bottom by setting it to
5128 @code{(-6 . 4)}. The default value is @code{(-6 . 6)}.
5130 Vertical aligment of staves is handled by the
5131 @internalsref{VerticalAlignment} object, which lives at
5132 @internalsref{Score} level.
5134 The piano staves are handled a little differently: to make cross-staff
5135 beaming work correctly, it necessary that the distance between staves
5136 is fixed. This is also done with a @internalsref{VerticalAlignment}
5137 object, created in @internalsref{PianoStaff}, but a forced distance is
5138 set. This is done with the object property #'forced-distance. If you
5139 want to override this, use a @code{\translator} block as follows:
5143 VerticalAlignment \override #'forced-distance = #9
5146 This would bring the staves together at a distance of 9 staff spaces,
5147 and again this is measured from the center line of each staff.
5151 @node Horizontal spacing
5152 @subsection Horizontal Spacing
5154 The spacing engine translates differences in durations into
5155 stretchable distances (``springs'') of differing lengths. Longer
5156 durations get more space, shorter durations get less. The basis for
5157 assigning spaces to durations, is that the shortest durations get a
5158 fixed amount of space, and the longer durations get more: doubling a
5159 duration adds a fixed amount of space to the note.
5161 For example, the following piece contains lots of half, quarter and
5162 8th notes, the eighth note is followed by 1 note head width. The The
5163 quarter note is followed by 2 NHW, the half by 3 NHW, etc.
5164 @lilypond[fragment, verbatim, relative=1]
5165 c2 c4. c8 c4. c8 c4. c8 c8 c8 c4 c4 c4
5168 These two amounts of space are @code{shortest-duration-space}
5169 @code{spacing-increment}, object properties of
5170 @internalsref{SpacingSpanner}. Normally @code{spacing-increment} is
5171 set to 1.2, which is the width of a note head, and
5172 @code{shortest-duration-space} is set to 2.0, meaning that the
5173 shortest note gets 2 noteheads of space. For normal notes, this space
5174 is always counted from the left edge of the symbol, so the short notes
5175 in a score is generally followed by one note head width of space.
5177 If one would follow the above procedure exactly, then adding a single
5178 32th note to a score that uses 8th and 16th notes, would widen up the
5179 entire score a lot. The shortest note is no longer a 16th, but a 64th,
5180 thus adding 2 noteheads of space to every note. To prevent this, the
5181 shortest duration for spacing is not the shortest note in the score,
5182 but the most commonly found shortest note. Notes that are even
5183 shorter this are followed by a space that is proportonial to their
5184 duration relative to the common shortest note. So if we were to add
5185 only a few 16th notes to the example above, they would be followed by
5188 @lilypond[fragment, verbatim, relative=1]
5189 c2 c4. c8 c4. [c16 c] c4. c8 c8 c8 c4 c4 c4
5192 The most common shortest duration is determined as follows: in every
5193 measure, the shortest duration is determined. The most common short
5194 duration, is taken as the basis for the spacing, with the stipulation
5195 that this shortest duration should always be equal to or shorter than
5196 1/8th note. The shortest duration is printed when you run lilypond
5197 with @code{--verbose}. These durations may also be customized. If you
5198 set the @code{common-shortest-duration} in
5199 @internalsref{SpacingSpanner}, then this sets the base duration for
5200 spacing. The maximum duration for this base (normally 1/8th), is set
5201 through @code{base-shortest-duration}.
5203 @cindex @code{common-shortest-duration}
5204 @cindex @code{base-shortest-duration}
5205 @cindex @code{stem-spacing-correction}
5206 @cindex @code{spacing}
5208 In the introduction it was explained that stem directions influence
5209 spacing. This is controlled with @code{stem-spacing-correction} in
5210 @internalsref{NoteSpacing}. The @code{StaffSpacing} object contains the
5211 same property for controlling the stem/barline spacing. In the
5212 following example shows these corrections, once with default settings,
5213 and once with exaggerated corrections.
5219 \property Staff.NoteSpacing \override #'stem-spacing-correction
5221 \property Staff.StaffSpacing \override #'stem-spacing-correction
5226 \paper { linewidth = -1. } }
5233 Spacing is determined on a score wide basis. If you have a score that
5234 changes its character (measured in durations) half way during the
5235 score, the part containing the longer durations will be spaced too
5238 Generating optically pleasing spacing is black magic. LilyPond tries
5239 to deal with a number of frequent cases. Here is an example that is
5240 not handled correctly, due to the combination of chord collisions and
5245 \context PianoStaff \notes \transpose c c'' <
5246 \context Staff = up { s1 }
5247 \context Staff = down { [c8 c \translator Staff=up <<c d>> c
5248 \translator Staff=down c c c] }
5250 \paper { linewidth = -1 }
5257 @subsection Font size
5258 @cindex font size, setting
5259 @cindex staff size, setting
5260 @cindex @code{paper} file
5262 The Feta font provides musical symbols at seven different sizes.
5263 These fonts are 11 point, 13 point, 16 point, 19 pt, 20 point, 23
5264 point, and 26 point. The point size of a font is the height of the
5265 five lines in a staff when displayed in the font.
5267 Definitions for these sizes are the files @file{paperSZ.ly}, where
5268 @code{SZ} is one of 11, 13, 16, 19, 20, 23 and 26. If you include any
5269 of these files, the identifiers @code{paperEleven},
5270 @code{paperThirteen}, @code{paperSixteen}, @code{paperNineteen},
5271 @code{paperTwenty}, @code{paperTwentythree}, and @code{paperTwentysix}
5272 are defined respectively. The default @code{\paper} block is also
5273 set. These files should be imported at toplevel, i.e.
5275 \include "paper26.ly"
5279 The font definitions are generated using a Scheme function. For more
5280 details, see the file @file{scm/font.scm}.
5285 @subsection Line breaking
5288 @cindex breaking lines
5290 Line breaks are normally computed automatically. They are chosen such
5291 that it looks neither cramped nor loose, and that consecutive lines have
5294 Occasionally you might want to override the automatic breaks; you can
5295 do this by specifying @code{\break}. This will force a line break at
5296 this point. Line breaks can only occur at places where there are bar
5297 lines. If you want to have a line break where there is no bar line,
5298 you can force an invisible bar line by entering @code{\bar
5299 ""}. Similarly, @code{\noBreak} forbids a line break at a certain
5303 @cindex regular line breaks
5304 @cindex four bar music.
5306 If you want linebreaks at regular intervals, you can use the following:
5308 < \repeat 7 unfold @{ s1 * 4 \break @}
5312 This makes the following 28 measures (assuming 4/4 time) be broken every
5316 @subsection Page layout
5319 @cindex breaking pages
5321 @cindex @code{indent}
5322 @cindex @code{linewidth}
5324 The most basic settings influencing the spacing are @code{indent} and
5325 @code{linewidth}. They are set in the @code{\paper} block. They
5326 control the indentation of the first line of music, and the lengths of
5327 the lines. If @code{linewidth} set to a negative value, a single
5328 unjustified line is produced. A similar effect for scores that are
5329 longer than one line, can be produced by setting @code{raggedright} to
5330 true in the @code{\paper} block.
5334 The page layout process happens outside lilypond. Ly2dvi sets page
5335 layout instructions. Ly2dvi responds to the following variables in the
5336 @code{\paper} block. The variable @code{textheight} sets the total
5337 height of the music on each page. The spacing between systems is
5338 controlled with @code{interscoreline}, its default is 16pt.
5339 The distance between the score lines will stretch in order to fill the
5340 full page @code{interscorelinefill} is set to a positive number. In
5341 that case @code{interscoreline} specifies the minimum spacing.
5343 @cindex @code{textheight}
5344 @cindex @code{interscoreline}
5345 @cindex @code{interscorelinefill}
5347 If the variable @code{lastpagefill} is defined (that is, it gets any
5348 value assigned in the @code{\paper} block), systems are evenly
5349 distributed vertically on the last page. This might produce ugly
5350 results in case there are not enough systems on the last page. Note
5351 that @command{lilypond-book} ignores @code{lastpagefill}. See
5352 @ref{Integrating text and music with lilypond-book} for
5355 @cindex @code{lastpagefill}
5357 Page breaks are normally computed by @TeX{}, so they are not under
5358 direct control of LilyPond. However, you can insert a commands into
5359 the @file{.tex} output to instruct @TeX{} where to break pages. You
5360 can insert a @code{\newpage} from within lilypond. This is done by
5361 setting the @code{between-systems-strings} on the
5362 @internalsref{NonMusicalPaperColumn} where the system is broken.
5366 @cindex @code{papersize}
5368 To change the paper size, you must first set the
5369 @code{papersize} paper variable variable. Set it to
5370 the strings @code{a4}, @code{letter}, or @code{legal}. After this
5371 specification, you must set the font as described above. If you want
5372 the default font, then use the 20 point font.
5375 \paper@{ papersize = "a4" @}
5376 \include "paper16.ly"
5379 The file @code{paper16.ly} will now include a file named @file{a4.ly}, which
5380 will set the paper variables @code{hsize} and @code{vsize} (used by
5381 Lilypond and @code{ly2dvi})
5391 LilyPond can produce MIDI output. The performance lacks lots of
5392 interesting effects, such as swing, articulation, slurring, etc., but it
5393 is good enough for proof-hearing the music you have entered. Ties,
5394 dynamics and tempo changes are interpreted.
5396 Dynamic marks, crescendi and decrescendi translate into MIDI volume
5397 levels. Dynamic marks translate to a fixed fraction of the available
5398 MIDI volume range, crescendi and decrescendi make the the volume vary
5399 linearly between their two extremities. The fractions be adjusted by
5400 overriding the @code{absolute-volume-alist} defined in
5401 @file{scm/midi.scm}.
5403 For each type of musical instrument (that MIDI supports), a volume range
5404 can be defined. This gives you basic equalizer control, which can
5405 enhance the quality of the MIDI output remarkably. You can add
5406 instruments and ranges or change the default settings by overriding the
5407 @code{instrument-equalizer-alist} defined in @file{scm/midi.scm}.
5409 Both loudness controls are combined to produce the final MIDI volume.
5413 * MIDI instrument names::
5418 @subsection MIDI block
5422 The MIDI block is analogous to the paper block, but it is somewhat
5423 simpler. The @code{\midi} block can contain:
5427 @item a @code{\tempo} definition
5428 @item context definitions
5431 Assignments in the @code{\midi} block are not allowed.
5435 @cindex context definition
5437 Context definitions follow precisely the same syntax as within the
5438 \paper block. Translation modules for sound are called performers.
5439 The contexts for MIDI output are defined in @file{ly/performer-init.ly}.
5442 @node MIDI instrument names
5443 @subsection MIDI instrument names
5445 @cindex instrument names
5446 @cindex @code{Staff.midiInstrument}
5447 @cindex @code{Staff.instrument}
5449 The MIDI instrument name is set by the @code{Staff.midiInstrument}
5450 property or, if that property is not set, the @code{Staff.instrument}
5451 property. The instrument name should be chosen from the list in
5452 @ref{MIDI instruments}.
5456 If the selected string does not exactly match, then LilyPond uses the
5457 default (Grand Piano). It is not possible to select an instrument by