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
17 @c .{Reference Manual}
19 @node Reference Manual
20 @chapter Reference Manual
23 <!--- @@WEB-TITLE@@=Reference Manual --->
27 This document describes GNU LilyPond and its input format. The last
28 revision of this document was made for LilyPond 1.7.10. It assumes
29 that you already know a little bit about LilyPond input (how to
30 make an input file, how to create sheet music from that input file,
31 etc). New users are encouraged to study the tutorial before reading
37 * Easier music entry::
52 * Contemporary notation::
58 @c FIXME: Note entry vs Music entry at top level menu is confusing.
64 Notes constitute the most basic elements of LilyPond input, but they do
65 not form valid input on their own without a @code{\score} block. However,
66 for the sake of brevity and simplicity we will generally omit
67 @code{\score} blocks and @code{\paper} declarations in this manual.
73 * Chromatic alterations::
78 * Automatic note splitting ::
80 * Easy Notation note heads ::
88 A note is printed by specifying its pitch and then its duration.
89 @lilypond[fragment,verbatim]
98 @cindex Note specification
100 @cindex entering notes
102 The verbose syntax for pitch specification is
104 @cindex @code{\pitch}
106 \pitch @var{scmpitch}
109 where @var{scmpitch} is a pitch scheme object.
111 In Note and Chord mode, pitches may be designated by names. The default
112 names are the Dutch note names. The notes are specified by the letters
113 @code{a} through @code{g}, while the octave is formed with notes ranging
114 from @code{c} to @code{b}. The pitch @code{c} is an octave below
115 middle C and the letters span the octave above that C. Here's an example
116 which should make things more clear:
118 @lilypond[fragment,verbatim]
120 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
123 @cindex note names, Dutch
125 In Dutch, a sharp is formed by adding @code{-is} to the end of a pitch
126 name and a flat is formed by adding @code{-es}. Double sharps and double
127 flats are obtained by adding @code{-isis} or @code{-eses}. @code{aes}
128 and @code{ees} are contracted to @code{as} and @code{es} in Dutch, but
129 both forms are accepted.
131 LilyPond has predefined sets of note names for various other languages.
132 To use them, simply include the language specific init file. For
133 example: @code{\include "english.ly"}. The available language files and
134 the note names they define are:
139 Note Names sharp flat
140 nederlands.ly c d e f g a bes b -is -es
141 english.ly c d e f g a bf b -s/-sharp -f/-flat
142 deutsch.ly c d e f g a b h -is -es
143 norsk.ly c d e f g a b h -iss/-is -ess/-es
144 svenska.ly c d e f g a b h -iss -ess
145 italiano.ly do re mi fa sol la sib si -d -b
146 catalan.ly do re mi fa sol la sib si -d/-s -b
147 espanol.ly do re mi fa sol la sib si -s -b
156 The optional octave specification takes the form of a series of
157 single quote (`@code{'}') characters or a series of comma
158 (`@code{,}') characters. Each @code{'} raises the pitch by one
159 octave; each @code{,} lowers the pitch by an octave.
161 @lilypond[fragment,verbatim,center]
162 c' c'' es' g' as' gisis' ais'
165 @node Chromatic alterations
166 @subsection Chromatic alterations
168 Normally accidentals are printed automatically, but you may also
169 print them manually. A reminder accidental
170 @cindex reminder accidental
172 can be forced by adding an exclamation mark @code{!}
173 after the pitch. A cautionary accidental
174 @cindex cautionary accidental
175 @cindex parenthesized accidental
176 (an accidental within parentheses) can be obtained by adding the
177 question mark `@code{?}' after the pitch.
179 @lilypond[fragment,verbatim]
180 cis' cis' cis'! cis'?
184 The automatic production of accidentals can be tuned in many
185 ways. For more information, refer to @ref{Accidentals}.
192 Rests are entered like notes, with a ``note name'' of `@code{r}':
194 @lilypond[singleline,verbatim]
198 Whole bar rests, centered in middle of the bar, are specified using
199 @code{R} (capital R); see @ref{Multi measure rests}. See also
202 For some music, you may wish to explicitly specify the rest's vertical
203 position. This can be achieved by entering a note with the @code{\rest}
204 keyword appended. Rest collision testing will leave these rests alone.
206 @lilypond[singleline,verbatim]
216 @cindex Invisible rest
219 An invisible rest (also called a `skip') can be entered like a note
220 with note name `@code{s}' or with @code{\skip @var{duration}}:
222 @lilypond[singleline,verbatim]
226 @c FIXME: in Lyrics mode, we have " " and _
228 In Lyrics mode, you can make invisible syllables by entering `@code{" "}'
230 @lilypond[singleline,verbatim,quote]
232 \context Lyrics \lyrics { lah2 di4 " " dah2 _4 di }
233 \notes\relative c'' { a2 a4 a a2 a4 a }
236 In this case, syllables containing a space will be printed. In the
237 case that you really need an invisible space (i.e. something taking up
238 time, but not space), you should use @code{\skip}.
240 Note that the @code{s} syntax is only available in Note mode and Chord
241 mode. In other situations, you should use the @code{\skip} command,
242 which will work outside of those two modes:
244 @lilypond[singleline,verbatim]
247 { \time 4/8 \skip 2 \time 4/4 }
248 \notes\relative c'' { a2 a1 }
253 The skip command is merely an empty musical placeholder. It doesn't
254 produce any output, not even transparent output.
260 @subsection Durations
264 @cindex @code{\duration}
267 In Note, Chord, and Lyrics mode, durations are designated by numbers
268 and dots: durations are entered as their reciprocal values. For example,
269 a quarter note is entered using a @code{4} (since it's a 1/4 note), while
270 a half note is entered using a @code{2} (since it's a 1/2 note). For notes
271 longer than a whole you must use identifiers.
272 @c FIXME: what's an identifier? I don't think it's been introduced yet.
273 @c and if it has, I obviously skipped that part. - Graham
277 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
279 r1 r2 r4 r8 r16 r32 r64 r64
284 \notes \relative c'' {
286 a1 a2 a4 a8 a16 a32 a64 a64
288 r1 r2 r4 r8 r16 r32 r64 r64
293 \remove "Clef_engraver"
294 \remove "Staff_symbol_engraver"
295 \remove "Time_signature_engraver"
296 \consists "Pitch_squash_engraver"
303 If the duration is omitted then it is set to the previously entered
304 duration. At the start of parsing, a quarter note is assumed. The
305 duration can be followed by dots (`@code{.}') in order to obtain dotted
309 @lilypond[fragment,verbatim,center]
310 a' b' c''8 b' a'4 a'4. b'4.. c'8.
315 You can alter the length of duration by a fraction @var{N/M}
316 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
317 won't affect the appearance of the notes or rests produced.
319 @lilypond[fragment,verbatim]
320 a'2*2 b'4*2 a'8*4 a'4*3/2 gis'4*3/2 a'4*3/2 a'4
323 Durations can also be produced through GUILE extension mechanism.
324 @lilypond[verbatim,fragment]
325 c'\duration #(ly:make-duration 2 1)
331 Dot placement for chords is not perfect. In some cases, dots overlap:
344 A tie connects two adjacent note heads of the same pitch. The tie in
345 effect extends the length of a note. Ties should not be confused with
346 slurs, which indicate articulation, or phrasing slurs, which indicate
347 musical phrasing. A tie is entered using the tilde symbol `@code{~}'.
349 @lilypond[fragment,verbatim,center]
350 e' ~ e' <<c' e' g'>> ~ <<c' e' g'>>
353 When a tie is applied to a chord, all note heads (whose pitches match) are
354 connected. If you try to tie together chords that have no common pitches,
355 no ties will be created.
357 If you want less ties created for a chord, you can set
358 @code{Voice.sparseTies} to true. In this case, a single tie is used
359 for every tied chord.
360 @lilypond[fragment,verbatim,center]
361 \property Voice.sparseTies = ##t
362 <<c' e' g'>> ~ <<c' e' g'>>
365 In its meaning a tie is just a way of extending a note duration, similar
366 to the augmentation dot: the following example are two ways of notating
367 exactly the same concept.
369 @lilypond[fragment, singleline,quote]
370 \time 3/4 c'2. c'2 ~ c'4
372 If you need to tie notes over bars, it may be easier to use
373 @ref{Automatic note splitting}.
375 See also @seeinternals{Tie}.
380 At present, the tie is represented as a separate event, temporally
381 located in between the notes. Tying only a subset of the note heads
382 of a chord is not supported in a simple way. It can be achieved by
383 moving the tie-engraver into the Thread context and turning on and off
386 Switching staves when a tie is active will not work.
388 @node Automatic note splitting
389 @subsection Automatic note splitting
390 @c FIXME: This subsection doesn't belong in @ref{Note entry}.
392 LilyPond can automatically converting long notes to tied notes. This
393 is done by replacing the @code{Note_heads_engraver} by the
394 @code{Completion_heads_engraver}.
396 @lilypond[verbatim,noindent]
398 \notes\relative c'{ \time 2/4
399 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
403 \remove "Note_heads_engraver"
404 \consists "Completion_heads_engraver"
408 This engraver splits all running notes at the bar line, and inserts
409 ties. One of its uses is to debug complex scores: if the measures are
410 not entirely filled, then the ties exactly show how much each measure
415 Not all durations (especially those containing tuplets) can be
416 represented exactly; the engraver will not insert tuplets.
423 @cindex @code{\times}
425 Tuplets are made out of a music expression by multiplying all durations
428 @cindex @code{\times}
430 \times @var{fraction} @var{musicexpr}
433 The duration of @var{musicexpr} will be multiplied by the fraction.
434 In the sheet music, the fraction's denominator will be printed over
435 the notes, optionally with a bracket. The most common tuplet is the
436 triplet in which 3 notes have the length of 2, so the notes are 2/3
437 of their written length:
439 @lilypond[fragment,verbatim,center]
440 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
443 The property @code{tupletSpannerDuration} specifies how long each bracket
444 should last. With this, you can make lots of tuplets while typing
445 @code{\times} only once, saving you lots of typing.
447 @lilypond[fragment, relative, singleline, verbatim]
448 \property Voice.tupletSpannerDuration = #(ly:make-moment 1 4)
449 \times 2/3 { c'8 c c c c c }
452 The format of the number is determined by the property
453 @code{tupletNumberFormatFunction}. The default prints only the
454 denominator, but if you set it to the Scheme function
455 @code{fraction-tuplet-formatter}, Lilypond will print @var{num}:@var{den}
459 @cindex @code{tupletNumberFormatFunction}
460 @cindex tuplet formatting
462 See also @seeinternals{TupletBracket}.
466 Nested tuplets are not formatted automatically. In this case, outer
467 tuplet brackets should be moved automatically.
469 @node Easy Notation note heads
470 @subsection Easy Notation note heads
472 @cindex easy notation
475 An entirely different type of note head is the "easyplay" note head: a
476 note head that includes a note name. It is used in some publications by
477 Hal-Leonard Inc. music publishers.
479 @lilypond[singleline,verbatim,26pt]
481 \notes { c'2 e'4 f' | g'1 }
482 \paper { \translator { \EasyNotation } }
486 Note that @code{EasyNotation} overrides a @internalsref{Score} context. You
487 probably will want to print it with magnification or a large font size to
488 make it more readable. To print with magnification, you must create a dvi
489 (with @file{ly2dvi}) and then enlarge it with something like @file{dvips -x
490 2000 file.dvi}. See @file{man dvips} for details. To print with a larger
491 font, see @ref{Font Size}.
497 If you view the result with Xdvi, then staff lines will show through
498 the letters. Printing the PostScript file obtained with ly2dvi does
499 produce the correct result.
502 @node Easier music entry
503 @section Easier music entry
506 * Graphical interfaces::
510 * Skipping corrected music::
513 When entering music with LilyPond, it is easy to introduce errors. This
514 section deals with tricks and features that help you enter music, and
515 find and correct mistakes.
517 @node Graphical interfaces
518 @subsection Graphical interfaces
521 @cindex graphical interface
528 One way to avoid entering notes using the keyboard is to use a
529 graphical user interface. The following programs are known to have
530 a lilypond export option:
534 Denemo was once intended as
535 a LilyPond graphical user interface. It run on Gnome/GTK.
538 @uref{http://denemo.sourceforge.net/}
542 Noteedit, a graphical score editor that runs under KDE/Qt.
544 @uref{http://rnvs.informatik.tu-chemnitz.de/~jan/noteedit/noteedit.html,}
548 RoseGarden was once the inspiration for naming LilyPond. Nowadays it
549 has been rewritten from scratch and supports LilyPond export as of
553 @uref{http://rosegarden.sf.net/}
557 Another option is to enter the music using your favorite
558 sequencer/notation editor, and then export it as MIDI or MusicXML.
559 You can then import it in lilypond by using either midi2ly or
561 xml2ly. midi2ly is described in @ref{Invoking midi2ly}. @code{xml2ly}
563 is a tool to convert from the MusicXML music representation format
564 (@uref{http://www.musicxml.org}) to LilyPond format. @code{xml2ly} is
565 described at @uref{http://www.nongnu.org/xml2ly/}.
569 @node Relative octaves
570 @subsection Relative octaves
572 @cindex relative octave specification
574 Octaves are specified by adding @code{'} and @code{,} to pitch names.
575 When you copy existing music, it is easy to accidentally put a pitch in
576 the wrong octave and hard to find such an error. To prevent these
577 errors, LilyPond features octave entry.
579 @cindex @code{\relative}
581 \relative @var{startpitch} @var{musicexpr}
584 The octave of notes that appear in @var{musicexpr} are calculated as
585 follows: If no octave changing marks are used, the basic interval
586 between this and the last note is always taken to be a fourth or less
587 (This distance is determined without regarding alterations; a
588 @code{fisis} following a @code{ceses} will be put above the
591 The octave changing marks @code{'} and @code{,} can be added to raise or
592 lower the pitch by an extra octave. Upon entering relative mode, an
593 absolute starting pitch must be specified that will act as the
594 predecessor of the first note of @var{musicexpr}.
596 Entering music that changes octave frequently is easy in relative mode.
597 @lilypond[fragment,singleline,verbatim,center]
603 And octave changing marks are used for intervals greater than a fourth.
604 @lilypond[fragment,verbatim,center]
609 If the preceding item is a chord, the first note of the chord is used
610 to determine the first note of the next chord. However, other notes
611 within the second chord are determined by looking at the immediately
614 @lilypond[fragment,verbatim,center]
621 @cindex @code{\notes}
623 The pitch after the @code{\relative} contains a note name. To parse
624 the pitch as a note name, you have to be in note mode, so there must
625 be a surrounding @code{\notes} keyword (which is not
628 The relative conversion will not affect @code{\transpose},
629 @code{\chords} or @code{\relative} sections in its argument. If you
630 want to use relative within transposed music, you must place an
631 additional @code{\relative} inside the @code{\transpose}.
636 @subsection Bar check
640 @cindex @code{barCheckSynchronize}
644 Whenever a bar check is encountered during interpretation, a warning
645 message is issued if it doesn't fall at a measure boundary. This can
646 help you find errors in the input. Depending on the value of
647 @code{barCheckSynchronize}, the beginning of the measure will be
648 relocated, so this can also be used to shorten measures.
650 A bar check is entered using the bar symbol, @code{|}:
652 \time 3/4 c2 e4 | g2.
657 @cindex skipTypesetting
659 Failed bar checks are most often caused by entering incorrect
660 durations. Incorrect durations often completely garble up the score,
661 especially if it is polyphonic, so you should start correcting the score
662 by scanning for failed bar checks and incorrect durations. To speed up
663 this process, you can use @code{skipTypesetting} (See @ref{Skipping
666 @c . {Point and click}
667 @node Point and click
668 @subsection Point and click
669 @cindex poind and click
671 Point and click lets you find notes in the input by clicking on them in
672 the Xdvi window. This makes it very easy to find input that causes some
673 error in the sheet music.
675 To use it, you need the following software
677 @item A dvi viewer that supports src specials.
679 @item Xdvi, version 22.36 or newer. Available from
680 @uref{ftp://ftp.math.berkeley.edu/pub/Software/TeX/xdvi.tar.gz,ftp.math.berkeley.edu}.
682 Note that most @TeX{} distributions ship with xdvik, which is always
683 a few versions behind the official Xdvi. To find out which xdvi you
684 are running, try @code{xdvi -version} or @code{xdvi.bin -version}.
685 @item KDVI. A dvi viewer for KDE. You need KDVI from KDE 3.0 or
686 newer. Enable option @emph{Inverse search} in the menu @emph{Settings}.
695 @item An editor with a client/server interface (or a lightweight GUI
701 @item Emacs. Emacs is an extensible text-editor. It is available from
702 @uref{http://www.gnu.org/software/emacs/}. You need version 21 to use
705 @c move this elsewhere?
707 LilyPond also comes with support files for emacs: lilypond-mode for
708 emacs provides indentation, autocompletion, syntax coloring, handy
709 compile short-cuts and reading Info documents of lilypond inside emacs.
710 If lilypond-mode is not installed on your platform,
711 then refer to the installation instructions for more information.
715 @cindex lilypond-mode for emacs
716 @cindex syntax coloring
718 @item XEmacs. Xemacs is very similar to emacs.
722 @item NEdit. NEdit runs under Windows, and Unix.
723 It is available from @uref{http://www.nedit.org}.
727 @item GVim. GVim is a GUI variant of VIM, the popular VI
728 clone. It is available from @uref{http://www.vim.org}.
737 Xdvi must be configured to find the @TeX{} fonts and music
738 fonts. Refer to the Xdvi documentation for more information.
740 To use point-and-click, add one of these lines to the top of your .ly
743 #(ly:set-point-and-click 'line)
745 @cindex line-location
747 When viewing, Control-Mousebutton 1 will take you to the originating
748 spot in the @file{.ly} file. Control-Mousebutton 2 will show all
751 If you correct large files with point-and-click, be sure to start
752 correcting at the end of the file. When you start at the top, and
753 insert one line, all following locations will be off by a line.
756 For using point-and-click with emacs, add the following
757 In your emacs startup file (usually @file{~/.emacs}),
762 Make sure that the environment variable @var{XEDITOR} is set to
764 emacsclient --no-wait +%l %f
766 @cindex @var{XEDITOR}
767 If you use xemacs instead of emacs, you use @code{(gnuserve-start)} in
768 your @file{.emacs}, and set @code{XEDITOR} to @code{gnuclient -q +%l %f}
770 For using Vim, set @code{XEDITOR} to @code{gvim --remote +%l %f}, or
771 use this argument with xdvi's @code{-editor} option.
774 For using NEdit, set @code{XEDITOR} to @code{nc -noask +%l %f}, or
775 use this argument with xdvi's @code{-editor} option.
777 If can also make your editor jump to the exact location of the note
778 you clicked. This is only supported on Emacs and VIM. Users of Emacs version
779 20 must apply the patch @file{emacsclient.patch}. Users of version 21
780 must apply @file{server.el.patch} (version 21.2 and earlier). At the
781 top of the @code{ly} file, replace the @code{set-point-and-click} line
782 with the following line,
784 #(ly:set-point-and-click 'line-column)
786 @cindex line-colomn-location
787 and set @code{XEDITOR} to @code{emacsclient --no-wait +%l:%c %f}. Vim
788 users can set @var{XEDITOR} to @code{gvim --remote +:%l:norm%c| %f}.
794 When you convert the @TeX{} file to PostScript using @code{dvips}, it
795 will complain about not finding @code{src:X:Y} files. These complaints
796 are harmless, and can be ignored.
798 @node Skipping corrected music
799 @subsection Skipping corrected music
801 The property @code{Score.skipTypesetting} can be used to switch on and
802 off typesetting completely during the interpretation phase. When
803 typesetting is switched off, the music is processed much more quickly.
804 You can use this to skip over the parts of a score that you have already
807 @lilypond[fragment,singleline,verbatim]
809 \property Score.skipTypesetting = ##t
811 \property Score.skipTypesetting = ##f
819 @section Staff notation
821 This section deals with music notation that occurs on staff level,
822 such as keys, clefs and time signatures.
824 @cindex Staff notation
836 @subsection Staff symbol
839 @cindex adjusting staff symbol
840 @cindex StaffSymbol, using \property
841 @cindex staff lines, setting number of
844 The lines of the staff symbol are formed by the
845 @internalsref{StaffSymbol} object. This object is created at the moment
846 that their context is created. You can not change the appearance of
847 the staff symbol by using @code{\override} or @code{\set}. At the
848 moment that @code{\property Staff} is interpreted, a Staff context is
849 made, and the StaffSymbol is created before any @code{\override} is
850 effective. You can deal with this either overriding properties in a
851 @code{\translator} definition, or by using @code{\outputproperty}.
856 If you end a staff half way a piece, the staff symbol may not end
857 exactly on the barline.
862 @subsection Key signature
867 Setting or changing the key signature is done with the @code{\key}
870 @code{\key} @var{pitch} @var{type}
873 @cindex @code{\minor}
874 @cindex @code{\major}
875 @cindex @code{\minor}
876 @cindex @code{\ionian}
877 @cindex @code{\locrian}
878 @cindex @code{\aeolian}
879 @cindex @code{\mixolydian}
880 @cindex @code{\lydian}
881 @cindex @code{\phrygian}
882 @cindex @code{\dorian}
884 Here, @var{type} should be @code{\major} or @code{\minor} to get
885 @var{pitch}-major or @var{pitch}-minor, respectively.
886 The standard mode names @code{\ionian},
887 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
888 @code{\phrygian}, and @code{\dorian} are also defined.
890 This command sets the context property @code{Staff.keySignature}.
891 Non-standard key signatures can be specified by setting this property
894 The printed signature is a @internalsref{KeySignature} object, typically
895 created in @internalsref{Staff} context.
897 @cindex @code{keySignature}
904 The clef can be set or changed with the @code{\clef} command:
905 @lilypond[fragment,verbatim]
906 \key f\major c''2 \clef alto g'2
909 Supported clef-names include
910 @c Moved standard clefs to the top /MB
912 @item treble, violin, G, G2
921 G clef on 1st line, so-called French violin clef
936 By adding @code{_8} or @code{^8} to the clef name, the clef is
937 transposed one octave down or up, respectively. Note that you have to
938 enclose @var{clefname} in quotes if you use underscores or digits in the
944 The object for this symbol is @internalsref{Clef}.
947 This command is equivalent to setting @code{clefGlyph},
948 @code{clefPosition} (which controls the Y position of the clef),
949 @code{centralCPosition} and @code{clefOctavation}. A clef is created
950 when any of these properties are changed.
953 @c . {Time signature}
955 @subsection Time signature
956 @cindex Time signature
960 The time signature is set or changed by the @code{\time}
962 @lilypond[fragment,verbatim]
963 \time 2/4 c'2 \time 3/4 c'2.
966 The actual symbol that's printed can be customized with the @code{style}
967 property. Setting it to @code{#'()} uses fraction style for 4/4 and
971 The object for this symbol is @internalsref{TimeSignature}. There are
972 many more options for its layout. They are selected through the
973 @code{style} object property. See @inputfileref{input/test,time.ly} for more
976 This command sets the property @code{timeSignatureFraction},
977 @code{beatLength} and @code{measureLength} in the @code{Timing}
978 context, which is normally aliased to @internalsref{Score}. The property
979 @code{timeSignatureFraction} determine where bar lines should be
980 inserted, and how automatic beams should be generated. Changing the
981 value of @code{timeSignatureFraction} also causes a time signature
982 symbol to be printed.
984 More options are available through the Scheme function
985 @code{set-time-signature}. In combination with the
986 @internalsref{Measure_grouping_engraver}, it will create
987 @internalsref{MeasureGrouping} signs. Such signs ease reading
988 rhythmically complex modern music. In the following example, the 9/8
989 measure is subdivided in 2, 2, 2 and 3. This is passed to
990 @code{set-time-signature} as the third argument @code{(2 2 2 3)}.
993 \score { \notes \relative c'' {
994 #(set-time-signature 9 8 '(2 2 2 3))
995 g8 g d d g g a8-[-( bes g-]-) |
996 #(set-time-signature 5 8 '(3 2))
1001 \translator { \StaffContext
1002 \consists "Measure_grouping_engraver"
1011 @cindex partial measure
1012 @cindex measure, partial
1013 @cindex shorten measures
1014 @cindex @code{\partial}
1016 Partial measures, for example in upbeats, are entered using the
1017 @code{\partial} command:
1018 @lilypond[fragment,verbatim]
1019 \partial 4* 5/16 c'16 c4 f16 a'2. ~ a'8. a'16 | g'1
1022 The syntax for this command is
1024 \partial @var{duration}
1026 This is internally translated into
1028 \property Timing.measurePosition = -@var{length of duration}
1031 The property @code{measurePosition} contains a rational number
1032 indicating how much of the measure has passed at this point.
1035 @node Unmetered music
1036 @subsection Unmetered music
1038 Bar lines and bar numbers are calculated automatically. For unmetered
1039 music (e.g. cadenzas), this is not desirable. The commands
1040 @code{\cadenzaOn} and @code{\cadenzaOff} can be used to switch off the
1043 @lilypond[fragment,relative,singleline,verbatim]
1051 The property @code{Score.timing} can be used to switch off this
1056 @subsection Bar lines
1060 @cindex measure lines
1063 Bar lines are inserted automatically, but if you need a special type
1064 of barline, you can force one using the @code{\bar} command:
1065 @lilypond[fragment,verbatim] c4 \bar "|:" c4
1068 The following bar types are available
1069 @lilypond[fragment, relative, singleline, verbatim]
1081 You are encouraged to use @code{\repeat} for repetitions. See
1084 In scores with many staves, the barlines are automatically placed at
1085 top level, and they are connected between different staves of a
1086 @internalsref{StaffGroup}:
1087 @lilypond[fragment, verbatim]
1088 < \context StaffGroup <
1089 \context Staff = up { e'4 d'
1092 \context Staff = down { \clef bass c4 g e g } >
1093 \context Staff = pedal { \clef bass c2 c2 } >
1096 The objects that are created at @internalsref{Staff} level. The name is
1097 @internalsref{BarLine}.
1099 The command @code{\bar @var{bartype}} is a short cut for
1100 doing @code{\property Score.whichBar = @var{bartype}}
1101 Whenever @code{whichBar} is set to a string, a bar line of that type is
1102 created. @code{whichBar} is usually set automatically: at the start of
1103 a measure it is set to @code{defaultBarType}. The contents of
1104 @code{repeatCommands} is used to override default measure bars.
1106 @code{whichBar} can also be set directly, using @code{\property} or
1107 @code{\bar }. These settings take precedence over the automatic
1108 @code{whichBar} settings.
1111 @cindex Bar_line_engraver
1113 @cindex repeatCommands
1114 @cindex defaultBarType
1123 The easiest way to enter such fragments with more than one voice on a
1124 staff is to split chords using the separator @code{\\}. You can use
1125 it for small, short-lived voices (make a chord of voices) or for
1128 @lilypond[verbatim,fragment]
1129 \context Voice = VA \relative c'' {
1130 c4 < { f d e } \\ { b c2 } > c4 < g' \\ b, \\ f \\ d >
1134 The separator causes @internalsref{Voice} contexts to be instantiated,
1135 bearing the names @code{"1"}, @code{"2"}, etc.
1137 Sometimes, it is necessary to instantiate these contexts by hand: For
1138 Instantiate a separate Voice context for each part, and use
1139 @code{\voiceOne}, up to @code{\voiceFour} to assign a stem directions
1140 and horizontal shift for each part.
1143 @lilypond[singleline, verbatim]
1145 \context Staff < \context Voice = VA { \voiceOne cis2 b }
1146 \context Voice = VB { \voiceThree b4 ais ~ ais4 gis4 }
1147 \context Voice = VC { \voiceTwo fis4~ fis4 f ~ f } >
1150 The identifiers @code{\voiceOne} to @code{\voiceFour} set directions
1151 ties, slurs and stems, and set shift directions.
1153 If you want more than four voices, you can also manually set
1154 horizontal shifts and stem directions, as is shown in the following example:
1155 @lilypond[fragment, verbatim]
1156 \context Staff \notes\relative c''<
1157 \context Voice=one {
1158 \shiftOff \stemUp e4
1160 \context Voice=two {
1161 \shiftOn \stemUp cis
1163 \context Voice=three {
1164 \shiftOnn \stemUp ais
1166 \context Voice=four {
1167 \shiftOnnn \stemUp fis
1173 Normally, note heads with a different number of dots are not merged, but
1174 if you set the object property @code{merge-differently-dotted}, they are:
1175 @lilypond[verbatim,fragment,singleline]
1178 \property Staff.NoteCollision \override
1179 #'merge-differently-dotted = ##t
1181 } \\ { [g'8. f16] [g'8. f'16] }
1185 Similarly, you can merge half note heads with eighth notes, by setting
1186 @code{merge-differently-headed}:
1187 @lilypond[fragment, relative=2,verbatim]
1190 \property Staff.NoteCollision
1191 \override #'merge-differently-headed = ##t
1192 c8 c4. } \\ { c2 c2 } >
1195 LilyPond also vertically shifts rests that are opposite of a stem.
1197 @lilypond[singleline,fragment,verbatim]
1198 \context Voice < c''4 \\ r4 >
1201 See also @internalsref{NoteCollision} and @internalsref{RestCollision}
1205 Resolving collisions is a very intricate subject, and LilyPond only
1206 handles a few situations. When it can not cope, you are advised to use
1207 @code{force-hshift} of the @internalsref{NoteColumn} object and pitched
1208 rests to override typesetting decisions.
1213 Beams are used to group short notes into chunks that are aligned with
1214 the metrum. They are inserted automatically in most cases.
1216 @lilypond[fragment,verbatim, relative=2]
1217 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1220 If you're not satisfied with the automatic beaming, you can enter the
1221 beams explicitly. If you have beaming patterns that differ from the
1222 defaults, you can also set the patterns for automatic beamer.
1224 See also @internalsref{Beam}.
1227 @cindex Automatic beams
1228 @subsection Manual beams
1229 @cindex beams, manual
1233 In some cases it may be necessary to override LilyPond's automatic
1234 beaming algorithm. For example, the auto beamer will not beam over
1235 rests or bar lines, If you want that, specify the begin and end point
1236 manually using a @code{[} before the first beamed note and a @code{]}
1237 after the last note:
1239 @lilypond[fragment,relative,verbatim]
1241 r4 r8-[ g' a r8-] r8 g-[ | a-] r8
1245 @cindex @code{stemLeftBeamCount}
1247 Normally, beaming patterns within a beam are determined automatically.
1248 When this mechanism fouls up, the properties
1249 @code{Voice.stemLeftBeamCount} and @code{Voice.stemRightBeamCount} can
1250 be used to control the beam subdivision on a stem. If you set either
1251 property, its value will be used only once, and then it is erased.
1253 @lilypond[fragment,relative,verbatim]
1256 f8-[ r16 \property Voice.stemLeftBeamCount = #1 f g a-]
1259 @cindex @code{stemRightBeamCount}
1262 The property @code{subdivideBeams} can be set in order to subdivide
1263 all 16th or shorter beams at beat positions. This accomplishes the
1264 same effect as twiddling with @code{stemLeftBeamCount} and
1265 @code{stemRightBeamCount}, but it take less typing.
1269 c16-[ c c c c c c c-]
1270 \property Voice.subdivideBeams = ##t
1271 c16-[ c c c c c c c-]
1272 c32-[ c c c c c c c c c c c c c c c-]
1273 \property Score.beatLength = #(ly:make-moment 1 8)
1274 c32-[ c c c c c c c c c c c c c c c-]
1278 \notes \relative c' {
1279 c16-[ c c c c c c c-]
1280 \property Voice.subdivideBeams = ##t
1281 c16-[ c c c c c c c-]
1282 c32-[ c c c c c c c c c c c c c c c-]
1283 \property Score.beatLength = #(ly:make-moment 1 8)
1284 c32-[ c c c c c c c c c c c c c c c-]
1288 @cindex subdivideBeams
1290 Kneed beams are inserted automatically, when a large gap between two
1291 adjacent beamed notes is detected. This behavior can be tuned through
1292 the object property @code{auto-knee-gap}.
1294 @cindex beams, kneed
1296 @cindex auto-knee-gap
1299 @c TODO -> why this ref? Document?
1300 @cindex @code{neutral-direction}
1306 Auto knee beams can not be used together with hara kiri staves.
1310 The Automatic beamer does not put @strong{unfinished} beams on the
1311 last notes of a score.
1313 Formatting of ties is a difficult subject. LilyPond often does not
1314 give optimal results.
1317 * Setting automatic beam behavior ::
1321 @no de Beam typography
1322 @sub section Beam typography
1324 One of the strong points of LilyPond is how beams are formatted. Beams
1325 are quantized, meaning that the left and right endpoints beams start
1326 exactly on staff lines. Without quantization, small wedges of white
1327 space appear between the beam and staff line, and this looks untidy.
1329 Beams are also slope-damped: melodies that go up or down should also
1330 have beams that go up or down, but the slope of the beams should be
1331 less than the slope of the notes themselves.
1333 Some beams should be horizontal. These are so-called concave beams.
1335 [TODO: some pictures.]
1338 @c . {Automatic beams}
1339 @node Setting automatic beam behavior
1340 @subsection Setting automatic beam behavior
1342 @cindex @code{autoBeamSettings}
1343 @cindex @code{(end * * * *)}
1344 @cindex @code{(begin * * * *)}
1345 @cindex automatic beams, tuning
1346 @cindex tuning automatic beaming
1348 In normal time signatures, automatic beams can start on any note but can
1349 only end in a few positions within the measure: beams can end on a beat,
1350 or at durations specified by the properties in
1351 @code{Voice.autoBeamSettings}. The defaults for @code{autoBeamSettings}
1352 are defined in @file{scm/auto-beam.scm}.
1354 The value of @code{autoBeamSettings} is changed using
1355 @code{\override} and unset using @code{\revert}:
1357 \property Voice.autoBeamSettings \override #'(@var{BE} @var{P} @var{Q} @var{N} @var{M}) = @var{dur}
1358 \property Voice.autoBeamSettings \revert #'(@var{BE} @var{P} @var{Q} @var{N} @var{M})
1360 Here, @var{BE} is the symbol @code{begin} or @code{end}. It determines
1361 whether the rule applies to begin or end-points. The quantity
1362 @var{P}/@var{Q} refers to the length of the beamed notes (and `@code{*
1363 *}' designates notes of any length), @var{N}/@var{M} refers to a time
1364 signature (wildcards, `@code{* *}' may be entered to designate all time
1367 For example, if you want automatic beams to end on every quarter note,
1368 you can use the following:
1370 \property Voice.autoBeamSettings \override
1371 #'(end * * * *) = #(ly:make-moment 1 4)
1373 Since the duration of a quarter note is 1/4 of a whole note, it is
1374 entered as @code{(ly:make-moment 1 4)}.
1376 The same syntax can be used to specify beam starting points. In this
1377 example, automatic beams can only end on a dotted quarter note.
1379 \property Voice.autoBeamSettings \override
1380 #'(end * * * *) = #(ly:make-moment 3 8)
1382 In 4/4 time signature, this means that automatic beams could end only on
1383 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1384 3/8 has passed within the measure).
1386 You can also restrict rules to specific time signatures. A rule that
1387 should only be applied in @var{N}/@var{M} time signature is formed by
1388 replacing the second asterisks by @var{N} and @var{M}. For example, a
1389 rule for 6/8 time exclusively looks like
1391 \property Voice.autoBeamSettings \override
1392 #'(begin * * 6 8) = ...
1395 If you want a rule to apply to certain types of beams, you can use the
1396 first pair of asterisks. Beams are classified according to the shortest
1397 note they contain. For a beam ending rule that only applies to beams
1398 with 32nd notes (and no shorter notes), you would use @code{(end 1
1402 @c Automatic beams can not be put on the last note in a score.
1404 If a score ends while an automatic beam has not been ended and is still
1405 accepting notes, this last beam will not be typeset at all.
1407 @cindex automatic beam generation
1409 @cindex @code{Voice.autoBeaming}
1412 For melodies that have lyrics, you may want to switch off
1413 automatic beaming. This is done by setting @code{Voice.autoBeaming} to
1419 It is not possible to specify beaming parameters for beams with mixed
1420 durations, that differ from the beaming parameters of all separate
1421 durations, i.e., you'll have to specify manual beams to get:
1423 @lilypond[singleline,fragment,relative,noverbatim,quote]
1424 \property Voice.autoBeamSettings
1425 \override #'(end * * * *) = #(ly:make-moment 3 8)
1426 \time 12/8 c'8 c c c16 c c c c c c-[ c c c-] c8 c c4
1428 It is not possible to specify beaming parameters that act differently in
1429 different parts of a measure. This means that it is not possible to use
1430 automatic beaming in irregular meters such as @code{5/8}.
1433 @section Accidentals
1435 This section describes how to change the way that LilyPond automatically
1436 inserts accidentals before the running notes.
1439 * Using the predefined accidental macros::
1440 * Defining your own accidental typesettings::
1443 @node Using the predefined accidental macros
1444 @subsection Using the predefined accidental macros
1445 The constructs for describing the accidental typesetting rules are
1446 quite hairy, so non-experts should stick to the macros defined in
1447 @file{ly/property-init.ly}.
1448 @cindex @file{property-init.ly}
1450 The macros operate on the ``Current'' context (see @ref{Context properties}). This
1451 means that the macros shuold normally be invoked right after the
1452 creation of the context in which the accidental typesetting described
1453 by the macro is to take effect. I.e. if you want to use
1454 piano-accidentals in a pianostaff then you issue
1455 @code{\pianoAccidentals} first thing after the creation of the piano
1459 \notes \relative c'' <
1460 \context Staff = sa @{ cis4 d e2 @}
1461 \context GrandStaff <
1463 \context Staff = sb @{ cis4 d e2 @}
1464 \context Staff = sc @{ es2 c @}
1466 \context Staff = sd @{ es2 c @}
1470 @lilypond[singleline]
1472 \notes \relative c'' <
1473 \context Staff = sa { cis4 d e2 }
1474 \context GrandStaff <
1476 \context Staff = sb { cis4 d e2 }
1477 \context Staff = sc { es2 c }
1479 \context Staff = sd { es2 c }
1484 minimumVerticalExtent = #'(-4.0 . 4.0)
1492 @item \defaultAccidentals
1493 @cindex @code{\defaultAccidentals}
1494 This is the default typesetting behaviour. It should correspond
1495 to 18th century common practice: Accidentals are
1496 remembered to the end of the measure in which they occur and
1497 only on their own octave.
1499 @item \voiceAccidentals
1500 @cindex @code{\voiceAccidentals}
1501 The normal behaviour is to remember the accidentals on
1503 This macro, however, typesets accidentals individually for each
1505 Apart from that the rule is similar to
1506 @code{\defaultAccidentals}.
1508 Warning: This leads to some weird and often unwanted results
1509 because accidentals from one voice DO NOT get cancelled in other
1511 @lilypond[singleline,relative,fragment,verbatim,quote]
1514 \context Voice=va { \voiceOne es g }
1515 \context Voice=vb { \voiceTwo c, e }
1518 Hence you should only use @code{\voiceAccidentals}
1519 if the voices are to be read solely by
1520 individual musicians. if the staff should be readable also
1521 by one musician/conductor then you should use
1522 @code{\modernVoiceAccidentals} or @code{\modernVoiceCautionaries}
1525 @item \modernAccidentals
1526 @cindex @code{\modernAccidentals}
1527 This rule should correspond to the common practice in the 20th
1529 The rule is a bit more complex than @code{\defaultAccidentals}:
1530 You get all the same accidentals, but temporary
1531 accidentals also get cancelled in other octaves. Further more,
1532 in the same octave, they also get cancelled in the following measure:
1533 @lilypond[singleline,fragment,verbatim]
1535 cis' c'' cis'2 | c'' c'
1538 @item \modernCautionaries
1539 @cindex @code{\modernCautionaries}
1540 This rule is similar to @code{\modernAccidentals}, but the
1541 ``extra'' accidentals (the ones not typeset by
1542 @code{\defaultAccidentals}) are typeset as cautionary accidentals
1543 (i.e. in reduced size):
1544 @lilypond[singleline,fragment,verbatim]
1546 cis' c'' cis'2 | c'' c'
1549 @item \modernVoiceAccidentals
1550 @cindex @code{\modernVoiceAccidentals}
1551 Multivoice accidentals to be read both by musicians playing one voice
1552 and musicians playing all voices.
1554 Accidentals are typeset for each voice, but they ARE cancelled
1555 across voices in the same @internalsref{Staff}.
1557 @item \modernVoiceCautionaries
1558 @cindex @code{\modernVoiceCautionaries}
1559 The same as @code{\modernVoiceAccidentals}, but with the
1560 extra accidentals (the ones not typeset by
1561 @code{\voiceAccidentals}) typeset as cautionaries.
1562 Notice that even though all accidentals typeset by
1563 @code{\defaultAccidentals} ARE typeset by this macro then some
1564 of them are typeset as cautionaries.
1566 @item \pianoAccidentals
1567 @cindex @code{\pianoAccidentals}
1568 20th century practice for piano notation. Very similar to
1569 @code{\modernAccidentals} but accidentals also get cancelled
1570 across the staves in the same @internalsref{GrandStaff} or
1571 @internalsref{PianoStaff}.
1573 @item \pianoCautionaries
1574 @cindex @code{\pianoCautionaries}
1575 As @code{\pianoAccidentals} but with the extra accidentals
1576 typeset as cautionaries.
1579 @cindex @code{\noResetKey}
1580 Same as @code{\defaultAccidentals} but with accidentals lasting
1581 ``forever'' and not only until the next measure:
1582 @lilypond[singleline,fragment,verbatim,relative]
1587 @item \forgetAccidentals
1588 @cindex @code{\forgetAccidentals}
1589 This is sort of the opposite of @code{\noResetKey}: Accidentals
1590 are not remembered at all - and hence all accidentals are
1591 typeset relative to the key signature, regardless of what was
1592 before in the music:
1593 @lilypond[singleline,fragment,verbatim,relative]
1595 \key d\major c4 c cis cis d d dis dis
1599 @node Defining your own accidental typesettings
1600 @subsection Defining your own accidental typesettings
1602 This section must be considered gurus-only, and hence it must be
1603 sufficient with a short description of the system and a reference to
1604 the internal documentation.
1606 The idea of the algorithm is to try several different rules and then
1607 use the rule that gives the highest number of accidentals.
1608 Each rule cosists of
1611 In which context is the rule applied. I.e. if context is
1612 @internalsref{Score} then all staves share accidentals, and if
1613 context is @internalsref{Staff} then all voices in the same
1614 staff share accidentals, but staves don't - like normally.
1616 Whether the accidental changes all octaves or only the current
1619 Over how many barlines the accidental lasts.
1620 If lazyness is @code{-1} then the accidental is forget
1621 immidiately, and if lazyness is @code{#t} then the accidental
1625 As described in the internal documentation of
1626 @internalsref{Accidental_engraver}, the properties @code{autoAccidentals} and
1627 @code{autoCautionaries} contain lists of rule descriptions. Notice
1628 that the contexts must be listed from in to out - that is
1629 @internalsref{Thread} before @internalsref{Voice},
1630 @internalsref{Voice} before @internalsref{Staff}, etc.
1631 see the macros in @file{ly/property-init.ly} for examples of how the
1636 Currently the simultaneous notes are considered to be entered in
1637 sequential mode. This means that in a chord the accidentals are
1638 typeset as if the notes in the chord happened one at a time - in the
1639 order in which they appear in the input file.
1641 Of course this is only a problem when you have simultainous notes
1642 which accidentals should depend on each other.
1643 Notice that the problem only occurs when using non-default accidentals
1644 - as the default accidentals only depend on other accidentals on the
1645 same staff and same pitch and hence cannot depend on other
1648 This example shows two examples of the same music giving different
1649 accidentals depending on the order in which the notes occur in the
1652 @lilypond[singleline,fragment,verbatim]
1653 \property Staff.autoAccidentals = #'( Staff (any-octave . 0) )
1654 cis'4 <<c'' c'>> r2 | cis'4 <<c' c''>> r2 | <<cis' c''>> r | <<c'' cis'>> r |
1657 The only solution is to manually insert the problematic
1658 accidentals using @code{!} and @code{?}.
1660 @node Expressive marks
1661 @section Expressive marks
1670 * Analysis brackets::
1677 A slur indicates that notes are to be played bound or @emph{legato}.
1678 They are entered using parentheses:
1679 @lilypond[fragment,verbatim,center]
1680 f'-( g'-)-( a'-) [a'8 b'-(-] a'4 g'2 f'4-)
1681 <<c' e'>>2-( <<b d'>>2-)
1684 See also @seeinternals{Slur}.
1686 Slurs avoid crossing stems, and are generally attached to note heads.
1687 However, in some situations with beams, slurs may be attached to stem
1688 ends. If you want to override this layout you can do this through the
1689 object property @code{attachment} of @internalsref{Slur} in
1690 @internalsref{Voice} context It's value is a pair of symbols, specifying
1691 the attachment type of the left and right end points.
1693 @lilypond[fragment,relative,verbatim]
1695 \property Voice.Stem \set #'length = #5.5
1697 \property Voice.Slur \set #'attachment = #'(stem . stem)
1701 If a slur would strike through a stem or beam, the slur will be moved
1702 away upward or downward. If this happens, attaching the slur to the
1703 stems might look better:
1705 @lilypond[fragment,relative,verbatim]
1708 \property Voice.Slur \set #'attachment = #'(stem . stem)
1713 Similarly, the curvature of a slur is adjusted to stay clear of note
1714 heads and stems. When that would increase the curvature too much, the
1715 slur is reverted to its default shape. The threshold for this
1716 decision is in @internalsref{Slur}'s object property @code{beautiful}.
1717 It is loosely related to the enclosed area between the slur and the
1718 notes. Usually, the default setting works well, but in some cases you
1719 may prefer a curved slur when LilyPond decides for a vertically moved
1720 one. You can indicate this preference by increasing the
1721 @code{beautiful} value:
1723 @lilyp ond[verbatim,singleline,relative]
1725 c16-( a' f' a a f a, c,-)
1726 c-( a' f' a a f d, c-)
1727 \property Voice.Slur \override #'beautiful = #5.0
1728 c-( a' f' a a f d, c-)
1734 Producing nice slurs is a difficult problem, and LilyPond currently
1735 uses a simple, empiric method to produce slurs. In some cases, the
1736 results of this method are ugly.
1739 This is reflected by the
1740 @code{beautiful} property, which it is an arbitrary parameter in the
1741 slur formatter. Useful values can only be determined by trial and
1745 @cindex Adjusting slurs
1747 @node Phrasing slurs
1748 @subsection Phrasing slurs
1750 @cindex phrasing slurs
1751 @cindex phrasing marks
1753 A phrasing slur (or phrasing mark) connects chords and is used to
1754 indicate a musical sentence. It is started using @code{\(} and @code{\)}
1757 @lilypond[fragment,verbatim,center,relative]
1758 \time 6/4 c' \( d ( e-) f ( e-) d-\)
1761 Typographically, the phrasing slur behaves almost exactly like a normal
1762 slur. See also @seeinternals{PhrasingSlur}. But although they behave
1763 similarily to normal slurs, phrasing slurs count as different objects.
1764 A @code{\slurUp} will have no effect on a phrasing slur; instead, you
1765 should use @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1766 @code{\phrasingSlurBoth}.
1768 Note that the commands
1769 @code{\slurUp}, @code{\slurDown}, and @code{\slurBoth} will only affect
1770 normal slurs and not phrasing slurs.
1773 @subsection Breath marks
1775 Breath marks are entered using @code{\breathe}. See also
1776 @seeinternals{BreathingSign}.
1778 @lilypond[fragment,relative]
1787 @cindex beats per minute
1788 @cindex metronome marking
1790 Metronome settings can be entered as follows:
1792 @cindex @code{\tempo}
1794 \tempo @var{duration} = @var{perminute}
1797 For example, @code{\tempo 4 = 76} requests output with 76 quarter notes
1802 The tempo setting is not printed, but is only used in the MIDI
1803 output. You can trick lily into producing a metronome mark,
1804 though. Details are in @ref{Text markup}.
1809 @subsection Text spanners
1810 @cindex Text spanners
1812 Some textual indications, e.g. rallentando or accelerando, often extend
1813 over many measures. This is indicated by following the text with a
1814 dotted line. You can create such texts using text spanners. The syntax
1820 LilyPond will respond by creating a @internalsref{TextSpanner} object (typically
1821 in @internalsref{Voice} context). The string to be printed, as well as the
1822 style is set through object properties.
1824 An application---or rather, a hack---is to fake octavation indications.
1825 @lilypond[fragment,relative,verbatim]
1826 \relative c' { a''' b c a
1827 \property Voice.TextSpanner \set #'type = #'dotted-line
1828 \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
1829 \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
1830 \property Staff.centralCPosition = #-13
1831 a\startTextSpan b c a \stopTextSpan }
1835 @node Analysis brackets
1836 @subsection Analysis brackets
1838 @cindex phrasing brackets
1839 @cindex musicological analysis
1840 @cindex note grouping bracket
1842 Brackets are used in musical analysis to indicate structure in musical
1843 pieces. LilyPond supports a simple form of nested horizontal brackets.
1844 To use this, add the @internalsref{Horizontal_bracket_engraver} to
1845 @internalsref{Staff} context. A bracket is started with
1846 @code{\groupOpen} and closed with @code{\groupClose}. This produces
1847 @internalsref{HorizontalBracket} objects.
1849 @lilypond[singleline,verbatim]
1850 \score { \notes \relative c'' {
1851 c4-\groupOpen-\groupOpen
1854 c4-\groupClose-\groupClose
1856 \paper { \translator {
1857 \StaffContext \consists "Horizontal_bracket_engraver"
1875 @subsection Articulations
1876 @cindex Articulations
1878 @cindex articulations
1882 A variety of symbols can appear above and below notes to indicate
1883 different characteristics of the performance. They are added to a note
1884 by adding a dash and the the character signifying the
1885 articulation. They are demonstrated here.
1886 @lilypond[singleline]
1888 \notes \context Voice {
1889 \property Voice.TextScript \set #'font-family = #'typewriter
1890 \property Voice.TextScript \set #'font-shape = #'upright
1896 c''4-^_"c-\\^{ }" s4
1902 The script is automatically placed, but if you need to force
1903 directions, you can use @code{_} to force them down, or @code{^} to
1905 @lilypond[fragment, verbatim]
1910 Other symbols can be added using the syntax
1911 @var{note}@code{-\}@var{name}. Again, they can be forced up or down
1912 using @code{^} and @code{_}.
1916 @cindex staccatissimo
1925 @cindex organ pedal marks
1934 @cindex prallmordent
1938 @cindex thumb marking
1946 \property Score.LyricText \override #'font-family = #'typewriter
1947 \property Score.LyricText \override #'font-shape = #'upright
1948 \context Staff \notes {
1949 \property Score.timing = ##f
1950 \property Score.barAlways = ##t
1951 \property Staff.BarLine \override #'transparent = ##t
1952 c''-\accent c''-\marcato c''-\staccatissimo
1953 c''-\staccato c''-\tenuto c''-\portato
1954 c''-\upbow c''-\downbow c''-\flageolet
1955 c''-\thumb c''^\lheel c''-\rheel
1956 c''^\ltoe c''-\rtoe c''-\open
1957 c''-\stopped c''-\turn c''-\reverseturn
1958 c''-\trill c''-\prall c''-\mordent
1959 c''-\prallprall c''-\prallmordent c''-\upprall
1960 c''-\downprall c''-\upmordent c''-\downmordent
1961 c''-\pralldown c''-\prallup c''-\lineprall
1962 c''-\shortfermata c''-\fermata c''-\longfermata
1963 c''-\verylongfermata c''-\segno c''-\coda
1966 \context Lyrics \lyrics {
1967 accent__ marcato__ staccatissimo__
1968 staccato__ tenuto__ portato__
1969 upbow__ downbow__ flageolet__
1970 thumb__ lheel__ rheel__
1971 ltoe__ rtoe__ open__
1972 stopped__ turn__ reverseturn__
1973 trill__ prall__ mordent__
1974 prallprall__ prallmordent__ uprall__
1975 downprall__ upmordent__ downmordent__
1976 pralldown__ prallup__ lineprall__
1977 shortfermata__ fermata__ longfermata__
1978 verylongfermata__ segno__ coda__
1992 Fingering instructions can also be entered in this shorthand. For
1993 finger changes, use markup texts:
1995 @lilypond[verbatim, singleline, fragment]
1996 c'4-1 c'4-2 c'4-3 c'4-4
1997 c'^\markup { \fontsize #-3 \number "2-3" }
2000 @cindex finger change
2005 See also @seeinternals{Script} and @seeinternals{Fingering}.
2009 All of these note ornaments appear in the printed output but have no
2010 effect on the MIDI rendering of the music.
2012 Unfortunately, there is no support for adding fingering instructions or
2013 ornaments to individual note heads. Some hacks exist, though. See
2014 @inputfileref{input/test,script-horizontal.ly}.
2019 @subsection Text scripts
2020 @cindex Text scripts
2022 In addition, it is possible to place arbitrary strings of text or markup
2023 text (see @ref{Text markup}) above or below notes by using a string:
2026 By default, these indications do not influence the note spacing, but
2027 by using the command @code{\fatText}, the widths will be taken into
2030 @lilypond[fragment,singleline,verbatim] \relative c' {
2031 c4^"longtext" \fatText c4_"longlongtext" c4 }
2034 It is possible to use @TeX{} commands in the strings, but this should be
2035 avoided because it makes it impossible for LilyPond to compute the
2036 exact length of the string, which may lead to collisions. Also, @TeX{}
2037 commands won't work with direct PostScript output.
2038 @c (see @ref{PostScript output}).
2040 Text scripts are created in form of @internalsref{TextScript} objects, in
2041 @internalsref{Voice} context.
2043 @ref{Text markup} describes how to change the font or access
2044 special symbols in text scripts.
2049 @subsection Grace notes
2053 @cindex @code{\grace}
2057 Grace notes are ornaments that are written out
2058 @lilypond[relative=2,verbatim,ifragment] c4 \grace c16 c4 \grace {
2062 In normal notation, grace notes are supposed to take up no logical
2063 time in a measure. Such an idea is practical for normal notation, but
2064 is not strict enough to put it into a program. The model that LilyPond
2065 uses for grace notes internally is that all timing is done in two
2068 Every point in musical time consists of two rational numbers: one
2069 denotes the logical time, one denotes the grace timing. The above
2070 example is shown here with timing tuples.
2073 \score { \notes \relative c''{
2074 c4^"(0,0)" \grace c16_" "_"(1/4,-1/16)" c4^"(1/4,0)" \grace {
2075 [c16_"(2/4,-1/8)" d16^"(2/4,-1/16)" ] } c4_" "_"(2/4,0)"
2077 \paper { linewidth = 8.\cm }
2081 The advantage of this approach is that you can use almost any lilypond
2082 construction together with grace notes, for example slurs and clef
2083 changes may appear halfway in between grace notes:
2085 @lilypond[relative=2,verbatim,fragment]
2086 c4 \grace { [ c16 c, \clef bass c, b(] } )c4
2089 The placement of these grace notes is synchronized between different
2090 staves, using this grace timing.
2092 @lilypond[relative=2,verbatim,fragment]
2093 < \context Staff = SA { e4 \grace { c16 d e f } e4 }
2094 \context Staff = SB { c4 \grace { g8 b } c4 } >
2098 Unbeamed eighth notes and shorter by default have a slash through the
2099 stem. This can be controlled with object property @code{stroke-style} of
2100 @internalsref{Stem}. The change in formatting is accomplished by
2101 inserting @code{\startGraceMusic} before handling the grace notes, and
2102 @code{\stopGraceMusic} after finishing the grace notes.
2103 You can add to these definitions to globally change grace note
2104 formatting. The standard definitions are in @file{ly/grace-init.ly}.
2106 [TODO discuss Scheme functionality.]
2109 Notice how the @code{\override} is carefully matched with a @code{\revert}.
2114 @lilypond[fragment,verbatim]
2115 \relative c'' \context Voice {
2116 \grace c8 c4 \grace { [c16 c16] } c4
2118 \property Voice.Stem \override #'stroke-style = #'()
2120 \property Voice.Stem \revert #'stroke-style
2127 If you want to end a note with a grace note, then the standard trick
2128 is to put the grace notes before a phantom ``space note'', e.g.
2129 @lilypond[fragment,verbatim, relative=2]
2132 { s2 \grace { [c16 d] } } >
2137 A @code{\grace} section has some default values, and LilyPond will
2138 use those default values unless you specify otherwise inside the
2139 @code{\grace} section. For example, if you specify \slurUp
2140 @emph{before} your @code{\grace} section, a slur which starts inside
2141 the @code{\grace} won't be forced up, even if the slur ends outside
2142 of the @code{\grace}. Note the difference between the first and
2143 second bars in this example:
2145 @lilypond[fragment,verbatim]
2146 \relative c'' \context Voice {
2165 Grace notes can not be used in the smallest size (@file{paper11.ly}).
2167 Grace note synchronization can also lead to surprises. Staff notation,
2168 such as key signatures, barlines, etc. are also synchronized. Take
2169 care when you mix staves with grace notes and staves without.
2171 @lilypond[relative=2,verbatim,fragment]
2172 < \context Staff = SA { e4 \bar "|:" \grace c16 d4 }
2173 \context Staff = SB { c4 \bar "|:" d4 } >
2176 Grace sections should only be used within sequential music
2177 expressions. Nesting, juxtaposing, or ending sequential music with a
2178 grace section is not supported, and might produce crashes or other
2183 @subsection Glissando
2186 @cindex @code{\glissando}
2188 A glissando line can be requested by attaching a @code{\glissando} to
2191 @lilypond[fragment,relative,verbatim]
2197 Printing of an additional text (such as @emph{gliss.}) must be done
2198 manually. See also @seeinternals{Glissando}.
2204 @subsection Dynamics
2217 @cindex @code{\ffff}
2227 Absolute dynamic marks are specified using an identifier after a
2228 note: @code{c4-\ff}. The available dynamic marks are: @code{\ppp},
2229 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2230 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2231 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2233 @lilypond[verbatim,singleline,fragment,relative]
2234 c'\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2240 @cindex @code{\decr}
2241 @cindex @code{\rced}
2247 A crescendo mark is started with @code{\cr} and terminated with
2248 @code{\rc} (the textual reverse of @code{cr}). A decrescendo mark is
2249 started with @code{\decr} and terminated with @code{\rced}. There are
2250 also shorthands for these marks. A crescendo can be started with
2251 @code{\<} and a decrescendo can be started with @code{\>}. Either one
2252 can be terminated with @code{\!}. Note that @code{\!} must go before
2253 the last note of the dynamic mark whereas @code{\rc} and @code{\rced} go
2254 after the last note. Because these marks are bound to notes, if you
2255 want several marks during one note, you have to use spacer notes.
2257 @lilypond[fragment,verbatim,center,quote]
2258 c'' \< \! c'' d'' \decr e'' \rced
2259 < f''1 { s4 s4 \< \! s4 \> \! s4 } >
2261 This may give rise to very short hairpins. Use @code{minimum-length}
2262 in Voice.HairPin to lengthen these, e.g.
2265 \property Staff.Hairpin \override #'minimum-length = #5
2268 You can also use a text saying @emph{cresc.} instead of hairpins. Here
2269 is an example how to do it:
2271 @lilypond[fragment,relative=2,verbatim]
2272 c4 \cresc c4 \endcresc c4
2279 You can also supply your own texts:
2280 @lilypond[fragment,relative,verbatim]
2282 \property Voice.crescendoText = "cresc. poco"
2283 \property Voice.crescendoSpanner = #'dashed-line
2290 Dynamics are objects of @internalsref{DynamicText} and
2291 @internalsref{Hairpin}. Vertical positioning of these symbols is
2292 handled by the @internalsref{DynamicLineSpanner} object. If you want to
2293 adjust padding or vertical direction of the dynamics, you must set
2294 properties for the @internalsref{DynamicLineSpanner} object. Predefined
2295 identifiers to set the vertical direction are \dynamicUp and
2298 @cindex direction, of dynamics
2299 @cindex @code{\dynamicDown}
2300 @cindex @code{\dynamicUp}
2308 @cindex @code{\repeat}
2310 To specify repeats, use the @code{\repeat} keyword. Since repeats
2311 should work differently when played or printed, there are a few
2312 different variants of repeats.
2316 Repeated music is fully written (played) out. Useful for MIDI
2317 output, and entering repetitive music.
2320 This is the normal notation: Repeats are not written out, but
2321 alternative endings (voltas) are printed, left to right.
2324 Alternative endings are written stacked. This has limited use but may be
2325 used to typeset two lines of lyrics in songs with repeats, see
2326 @inputfileref{input,star-spangled-banner.ly}.
2332 Make beat or measure repeats. These look like percent signs.
2338 * Repeats and MIDI::
2339 * Manual repeat commands::
2341 * Tremolo subdivisions::
2346 @subsection Repeat syntax
2348 The syntax for repeats is
2351 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2354 If you have alternative endings, you may add
2355 @cindex @code{\alternative}
2357 \alternative @code{@{} @var{alternative1}
2359 @var{alternative3} @dots{} @code{@}}
2361 where each @var{alternative} is a music expression.
2363 Normal notation repeats are used like this:
2364 @lilypond[fragment,verbatim]
2366 \repeat volta 2 { c'4 d' e' f' }
2367 \repeat volta 2 { f' e' d' c' }
2370 With alternative endings:
2371 @lilypond[fragment,verbatim]
2373 \repeat volta 2 {c'4 d' e' f'}
2374 \alternative { {d'2 d'} {f' f} }
2377 Folded repeats look like this:
2380 @lilypond[fragment,verbatim]
2382 \repeat fold 2 {c'4 d' e' f'}
2383 \alternative { {d'2 d'} {f' f} }
2387 If you don't give enough alternatives for all of the repeats, then
2388 the first alternative is assumed to be repeated often enough to equal
2389 the specified number of repeats.
2391 @lilypond[fragment,verbatim]
2395 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2396 \alternative { { g4 g g } { a | a a a a | b2. } }
2401 @node Repeats and MIDI
2402 @subsection Repeats and MIDI
2404 @cindex expanding repeats
2406 For instructions on how to unfoldi repeats for MIDI output, see
2407 the example file @inputfileref{input/test,unfold-all-repeats.ly}.
2412 Notice that timing information is not remembered at the start of an
2413 alternative, so you have to reset timing information after a repeat,
2414 e.g. using a bar-check (See @ref{Bar check}), setting
2415 @code{Score.measurePosition} or entering @code{\partial}. Slurs or ties
2416 are also not repeated.
2418 It is possible to nest @code{\repeat}s, although this probably is only
2419 meaningful for unfolded repeats.
2421 Folded repeats offer little more over simultaneous music.
2423 @node Manual repeat commands
2424 @subsection Manual repeat commands
2426 @cindex @code{repeatCommands}
2428 The property @code{repeatCommands} can be used to control the layout of
2429 repeats. Its value is a Scheme list of repeat commands, where each repeat
2437 @item (volta . @var{text})
2438 Print a volta bracket saying @var{text}. The text can be specified as
2439 a text string or as a markup text, see @ref{Text markup}. Do not
2440 forget to change the font, as the default number font does not contain
2441 alphabetic characters.
2443 Stop a running volta bracket
2446 @lilypond[verbatim, fragment]
2448 \property Score.repeatCommands = #'((volta "93") end-repeat)
2450 \property Score.repeatCommands = #'((volta #f))
2455 Repeats brackets are @internalsref{VoltaBracket} objects.
2457 @node Tremolo repeats
2458 @subsection Tremolo repeats
2459 @cindex tremolo beams
2461 To place tremolo marks between notes, use @code{\repeat} with tremolo
2463 @lilypond[verbatim,center,singleline]
2465 \context Voice \notes\relative c' {
2466 \repeat "tremolo" 8 { c16 d16 }
2467 \repeat "tremolo" 4 { c16 d16 }
2468 \repeat "tremolo" 2 { c16 d16 }
2469 \repeat "tremolo" 4 c16
2474 Tremolo beams are @internalsref{Beam} objects. Single stem tremolos are
2475 @internalsref{StemTremolo}. The single stem tremolo @emph{must} be
2476 entered without @code{@{} and @code{@}}.
2480 Only powers of two and undotted notes are supported repeat counts.
2482 @node Tremolo subdivisions
2483 @subsection Tremolo subdivisions
2484 @cindex tremolo marks
2485 @cindex @code{tremoloFlags}
2487 Tremolo marks can be printed on a single note by adding
2488 `@code{:}[@var{length}]' after the note. The length must be at least 8.
2489 A @var{length} value of 8 gives one line across the note stem. If the
2490 length is omitted, then then the last value (stored in
2491 @code{Voice.tremoloFlags}) is used.
2493 @lilypond[verbatim,fragment,center]
2494 c'2:8 c':32 | c': c': |
2500 Tremolos in this style do not carry over into the MIDI output.
2503 @node Measure repeats
2504 @subsection Measure repeats
2506 @cindex percent repeats
2507 @cindex measure repeats
2509 In the @code{percent} style, a note pattern can be repeated. It is
2510 printed once, and then the pattern is replaced with a special sign.
2511 Patterns of a one and two measures are replaced by percent-like signs,
2512 patterns that divide the measure length are replaced by slashes.
2514 @lilypond[verbatim,singleline]
2515 \context Voice { \repeat "percent" 4 { c'4 }
2516 \repeat "percent" 2 { c'2 es'2 f'4 fis'4 g'4 c''4 }
2520 The signs are represented by these objects: @internalsref{RepeatSlash} and
2521 @internalsref{PercentRepeat} and @internalsref{DoublePercentRepeat}.
2525 You can not nest percent repeats, e.g. by filling in the first measure
2526 with slashes, and repeating that measure with percents.
2528 @node Rhythmic music
2529 @section Rhythmic music
2531 Sometimes you might want to show only the rhythm of a melody. This can
2532 be done with the rhythmic staff. All pitches of notes on such a staff
2533 are squashed, and the staff itself looks has a single staff line:
2535 @lilypond[fragment,relative,verbatim]
2536 \context RhythmicStaff {
2538 c4 e8 f g2 | r4 g r2 | g1:32 | r1 |
2543 * Percussion staves::
2546 @node Percussion staves
2547 @subsection Percussion staves
2550 To typeset more than one piece of percussion to be played by the same
2551 musician one typically uses a multiline staff where each staff
2552 position refers to a specific piece of percussion.
2554 LilyPond is shipped with a bunch of scheme functions which allows you
2555 to do this fairly easily.
2557 The system is based on the general midi drum-pitches.
2558 In order to use the drum pitches you include
2559 @file{ly/drumpitch-init.ly}. This file defines the pitches from the scheme
2560 variable @code{drum-pitch-names} - which definition can be read in
2561 @file{scm/drums.scm}. You see that each piece of percussion has a full
2562 name and an abbreviated name - and you may freely select whether to
2563 refer to the full name or the abbreviation in your music definition.
2565 To typeset the music on a staff you apply the scheme function
2566 @code{drums->paper} to the percussion music. This function takes a
2567 list of percussion instrument names, notehead scripts and staff
2568 positions (that is: pitches relative to the C-clef) and uses this to
2569 transform the input music by moving the pitch, changing the notehead
2570 and (optionally) adding a script:
2571 @lilypond[singleline,verbatim,quote]
2572 \include "drumpitch-init.ly"
2573 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2574 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2576 \apply #(drums->paper 'drums) \context Staff <
2578 \context Voice = up { \voiceOne \up }
2579 \context Voice = down { \voiceTwo \down }
2584 In the above example the music was transformed using the list @code{'drums}.
2585 Currently the following lists are defined in @file{scm/drums.scm}:
2588 To typeset a typical drum kit on a five-line staff.
2591 \include "drumpitch-init.ly"
2592 nam = \lyrics { cymc cyms cymr hh hhc hho hhho hhp cb hc
2593 bd sn ss tomh tommh tomml toml tomfh tomfl }
2594 mus = \notes { cymc cyms cymr hh hhc hho hhho hhp cb hc
2595 bd sn ss tomh tommh tomml toml tomfh tomfl s16 }
2598 \apply #(drums->paper 'drums) \context Staff <
2602 \context Lyrics \nam
2605 linewidth = 100.0\mm
2608 \remove Bar_engraver
2609 \remove Time_signature_engraver
2610 minimumVerticalExtent = #'(-4.0 . 5.0)
2614 \remove Stem_engraver
2620 Notice that the scheme supports six different toms.
2621 If you are using fewer toms then you simply select the toms that produce
2622 the desired result - i.e. to get toms on the three middle lines you
2623 use @code{tommh}, @code{tomml} and @code{tomfh}.
2625 Because the general midi contain no rimshots we use the sidestick for
2626 this purpose instead.
2628 To typeset timbales on a two line staff.
2629 @lilypond[singleline]
2630 \include "drumpitch-init.ly"
2631 nam = \lyrics { timh ssh timl ssl cb }
2632 mus = \notes { timh ssh timl ssl cb s16 }
2635 \apply #(drums->paper 'timbales) \context Staff <
2639 \context Lyrics \nam
2644 \remove Bar_engraver
2645 \remove Time_signature_engraver
2646 StaffSymbol \override #'line-count = #2
2647 StaffSymbol \override #'staff-space = #2
2648 minimumVerticalExtent = #'(-3.0 . 4.0)
2652 \remove Stem_engraver
2659 To typeset congas on a two line staff.
2660 @lilypond[singleline]
2661 \include "drumpitch-init.ly"
2662 nam = \lyrics { cgh cgho cghm ssh cgl cglo cglm ssl }
2663 mus = \notes { cgh cgho cghm ssh cgl cglo cglm ssl s16 }
2666 \apply #(drums->paper 'congas) \context Staff <
2670 \context Lyrics \nam
2675 \remove Bar_engraver
2676 \remove Time_signature_engraver
2677 StaffSymbol \override #'line-count = #2
2678 StaffSymbol \override #'staff-space = #2
2679 minimumVerticalExtent = #'(-3.0 . 4.0)
2683 \remove Stem_engraver
2689 To typeset bongos on a two line staff.
2690 @lilypond[singleline]
2691 \include "drumpitch-init.ly"
2692 nam = \lyrics { boh boho bohm ssh bol bolo bolm ssl }
2693 mus = \notes { boh boho bohm ssh bol bolo bolm ssl s16 }
2696 \apply #(drums->paper 'bongos) \context Staff <
2700 \context Lyrics \nam
2705 \remove Bar_engraver
2706 \remove Time_signature_engraver
2707 StaffSymbol \override #'line-count = #2
2708 StaffSymbol \override #'staff-space = #2
2709 minimumVerticalExtent = #'(-3.0 . 4.0)
2713 \remove Stem_engraver
2719 To typeset all kinds of simple percussion on one line staves.
2720 @lilypond[singleline]
2721 \include "drumpitch-init.ly"
2722 nam = \lyrics { tri trio trim gui guis guil cb cl tamb cab mar hc }
2723 mus = \notes { tri trio trim gui guis guil cb cl tamb cab mar hc s16 }
2726 \apply #(drums->paper 'percussion) \context Staff <
2730 \context Lyrics \nam
2735 \remove Bar_engraver
2736 \remove Time_signature_engraver
2737 StaffSymbol \override #'line-count = #1
2738 minimumVerticalExtent = #'(-2.0 . 3.0)
2742 \remove Stem_engraver
2749 If you don't like any of the predefined lists you can define your own
2750 list at the top of your file:
2752 @lilypond[singleline, verbatim]
2754 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2755 (snare default #f ,(ly:make-pitch 0 1 0))
2756 (hihat cross #f ,(ly:make-pitch 0 5 0))
2757 (pedalhihat xcircle "stopped" ,(ly:make-pitch 0 5 0))
2758 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2760 \include "drumpitch-init.ly"
2761 up = \notes { hh8 hh hh hh hhp4 hhp }
2762 down = \notes { bd4 sn bd toml8 toml }
2764 \apply #(drums->paper 'mydrums) \context Staff <
2766 \context Voice = up { \voiceOne \up }
2767 \context Voice = down { \voiceTwo \down }
2772 To use a modified existing list instead of building your own from
2773 scratch you can append your modifications to the start of the existing
2777 #(define mydrums (append `(
2778 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2779 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2783 @c FIXME: Too many levels of headers when using subsubsections.
2784 @c Perhaps junk subsection ``Percussion staves''
2785 @subsubsection Percussion staves with normal staves
2786 When you include @file{drumpitch-init.ly} then the default pitches
2787 are overridden so that you after the inclusion cannot use the common
2788 dutch pitch names anymore. Hence you might wan't to reinclude
2789 @file{nederlands.ly} after the drum-pattern-definitions:
2790 @lilypond[singleline,verbatim]
2791 \include "drumpitch-init.ly"
2792 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2793 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2794 \include "nederlands.ly"
2795 bass = \notes \transpose c c,, { a4. e8 r e g e }
2798 \apply #(drums->paper 'drums) \context Staff = drums <
2800 \context Voice = up { \voiceOne \up }
2801 \context Voice = down { \voiceTwo \down }
2803 \context Staff = bass { \clef "F_8" \bass }
2808 @subsubsection Percussion midi output
2809 In order to produce correct midi output you need to produce two score
2810 blocks - one for the paper and one for the midi.
2811 To use the percussion channel you set the property @code{instrument}
2812 to @code{'drums}. Because the drum-pitches themself are similar to the
2813 general midi pitches all you have to do is to insert the voices with
2814 none of the scheme functions to get the correct midi output:
2818 \apply #(drums->paper 'mydrums) \context Staff <
2820 \context Voice = up @{ \voiceOne \up @}
2821 \context Voice = down @{ \voiceTwo \down @}
2827 \property Staff.instrument = #'drums
2836 This scheme is to be considered a temporary implementation. Even
2837 though the scheme will probably keep on working then the future might
2838 bring some other way of typesetting drums, and probably
2839 there will be made no great efforts in keeping things downwards
2844 @section Piano music
2846 Piano music is an odd type of notation. Piano staves are two normal
2847 staves coupled with a brace. The staves are largely independent, but
2848 sometimes voices can cross between the two staves. The
2849 @internalsref{PianoStaff} is especially built to handle this cross-staffing
2850 behavior. In this section we discuss the @internalsref{PianoStaff} and some
2851 other pianistic peculiarities.
2855 * Automatic staff changes::
2856 * Manual staff switches::
2859 * Voice follower lines::
2864 There is no support for putting chords across staves. You can get
2865 this result by increasing the length of the stem in the lower stave so
2866 it reaches the stem in the upper stave, or vice versa. An example is
2867 included with the distribution as @inputfileref{input/test,stem-cross-staff.ly}.
2869 @cindex cross staff stem
2870 @cindex stem, cross staff
2873 @c fixme: should have hyperlinks as well.
2878 @c . {Automatic staff changes}
2879 @node Automatic staff changes
2880 @subsection Automatic staff changes
2881 @cindex Automatic staff changes
2883 Voices can switch automatically between the top and the bottom
2884 staff. The syntax for this is
2886 \autochange Staff \context Voice @{ @dots{}@var{music}@dots{} @}
2888 The autochanger switches on basis of pitch (central C is the turning
2889 point), and it looks ahead skipping over rests to switch rests in
2890 advance. Here is a practical example:
2892 @lilypond[verbatim,singleline,quote]
2893 \score { \notes \context PianoStaff <
2894 \context Staff = "up" {
2895 \autochange Staff \context Voice = VA < \relative c' {
2896 g4 a b c d r4 a g } > }
2897 \context Staff = "down" {
2902 Spacer rests are used to prevent the bottom staff from
2903 terminating too soon.
2906 @node Manual staff switches
2907 @subsection Manual staff switches
2909 @cindex manual staff switches
2910 @cindex staff switch, manual
2912 Voices can be switched between staves manually, using the following command:
2914 \translator Staff = @var{staffname} @var{music}
2916 The string @var{staffname} is the name of the staff. It switches the
2917 current voice from its current staff to the Staff called
2918 @var{staffname}. Typically @var{staffname} is @code{"up"} or
2926 Piano pedal instruction can be expressed using
2927 @code{\sustainDown}, @code{\sustainUp}, @code{\unaCorda},
2928 @code{\treCorde}, @code{\sostenutoDown} and @code{\sostenutoUp}.
2930 The symbols that are printed can be modified by setting
2931 @code{pedal@var{X}Strings}, where @var{X} is one of the pedal types:
2932 Sustain, Sostenuto or UnaCorda. Refer to the generated documentation of
2933 @internalsref{SustainPedal}, for example, for more information.
2935 Pedals can also be indicated by a sequence of brackets, by setting the
2936 @code{pedal-type} property of SustainPedal objects:
2938 @lilypond[fragment,verbatim]
2939 \property Staff.SustainPedal \override #'pedal-type = #'bracket
2940 c''4 \sustainDown d''4 e''4 a'4
2941 \sustainUp \sustainDown
2942 f'4 g'4 a'4 \sustainUp
2945 A third style of pedal notation is a mixture of text and brackets,
2946 obtained by setting @code{pedal-type} to @code{mixed}:
2948 @lilypond[fragment,verbatim]
2949 \property Staff.SustainPedal \override #'pedal-type = #'mixed
2950 c''4 \sustainDown d''4 e''4 c'4
2951 \sustainUp \sustainDown
2952 f'4 g'4 a'4 \sustainUp
2955 The default '*Ped' style for sustain and damper pedals corresponds to
2956 @code{\pedal-type = #'text}. However, @code{mixed} is the default style
2957 for a sostenuto pedal:
2959 @lilypond[fragment,verbatim]
2960 c''4 \sostenutoDown d''4 e''4 c'4 f'4 g'4 a'4 \sostenutoUp
2963 For fine-tuning of the appearance of a pedal bracket, the properties
2964 @code{edge-width}, @code{edge-height}, and @code{shorten-pair} of
2965 @code{PianoPedalBracket} objects (see the detailed documentation of
2966 @internalsref{PianoPedalBracket}) can be modified. For example, the bracket
2967 may be extended to the end of the note head.
2969 @lilypond[fragment,verbatim]
2970 \property Staff.PianoPedalBracket \override
2971 #'shorten-pair = #'(0 . -1.0)
2972 c''4 \sostenutoDown d''4 e''4 c'4
2973 f'4 g'4 a'4 \sostenutoUp
2977 @subsection Arpeggio
2980 @cindex broken arpeggio
2981 @cindex @code{\arpeggio}
2983 You can specify an arpeggio sign on a chord by attaching an
2984 @code{\arpeggio} to a chord.
2987 @lilypond[fragment,relative,verbatim]
2988 <<c e g c>>-\arpeggio
2991 When an arpeggio crosses staves in piano music, you attach an arpeggio
2992 to the chords in both staves, and set
2993 @code{PianoStaff.connectArpeggios}.
2995 @lilypond[fragment,relative,verbatim]
2996 \context PianoStaff <
2997 \property PianoStaff.connectArpeggios = ##t
2998 \context Voice = one { <<c' e g c>>-\arpeggio }
2999 \context Voice = other { \clef bass <<c,, e g>>-\arpeggio}
3003 This command creates @internalsref{Arpeggio} objects. Cross staff arpeggios
3004 are @code{PianoStaff.Arpeggio}.
3006 To add an arrow head to explicitly specify the direction of the
3007 arpeggio, you should set the arpeggio object property
3008 @code{arpeggio-direction}.
3010 @lilypond[fragment,relative,verbatim]
3012 \property Voice.Arpeggio \set #'arpeggio-direction = #1
3013 <<c e g c>>-\arpeggio
3014 \property Voice.Arpeggio \set #'arpeggio-direction = #-1
3015 <<c e g c>>-\arpeggio
3019 A square bracket on the left indicates that the player should not
3020 arpeggiate the chord. To draw these brackets, set the
3021 @code{molecule-callback} property of @code{Arpeggio} or
3022 @code{PianoStaff.Arpeggio} objects to @code{\arpeggioBracket}, and use
3023 @code{\arpeggio} statements within the chords as before.
3025 @lilypond[fragment,relative,verbatim]
3026 \context PianoStaff <
3027 \property PianoStaff.connectArpeggios = ##t
3028 \property PianoStaff.Arpeggio \override
3029 #'molecule-callback = \arpeggioBracket
3030 \context Voice = one { <<c' e g c>>-\arpeggio }
3031 \context Voice = other { \clef bass <<c,, e g>>-\arpeggio }
3038 It is not possible to mix connected arpeggios and unconnected
3039 arpeggios in one PianoStaff at the same time.
3043 @node Voice follower lines
3044 @subsection Voice follower lines
3046 @cindex follow voice
3047 @cindex staff switching
3050 @cindex @code{followVoice}
3052 Whenever a voice switches to another staff a line connecting the notes
3053 can be printed automatically. This is enabled if the property
3054 @code{PianoStaff.followVoice} is set to true:
3056 @lilypond[fragment,relative,verbatim]
3057 \context PianoStaff <
3058 \property PianoStaff.followVoice = ##t
3059 \context Staff \context Voice {
3061 \translator Staff=two
3064 \context Staff=two {\clef bass \skip 1*2 }
3068 The associated object is @internalsref{VoiceFollower}.
3072 @section Vocal music
3074 For a discussion of how to put lyrics into a score, see section
3075 @code{Printing lyrics} in the tutorial.
3077 [TODO: Move lyrics section from tutorial to here?]
3079 See also the sections on @ref{Slurs} and @ref{Breath marks}.
3081 [TODO: Move slurs / breath marks section to here?]
3083 [TODO: Write subsection upon usage of ChoirStaff.]
3085 For entering quotes in Lyrics mode, use the following
3087 "\"God\"" is "`King'"
3090 You can use empty syllables, e.g. @code{_4} or @code{" "4} to enter
3091 lyrics. This can confuse the LilyPond -- for example, this might put
3092 (empty) lyrics under rests. To remedy this, use @code{\skip}.
3103 The term @emph{ambitus} denotes a range of pitches for a given voice in
3104 a part of music. It also may denote the pitch range that a musical
3105 instrument is capable of playing. Most musical instruments have their
3106 ambitus standardized (or at least there is agreement upon the minimal
3107 ambitus of a particular type of instrument), such that a composer or
3108 arranger of a piece of music can easily meet the ambitus constraints of
3109 the targeted instrument. However, the ambitus of the human voice
3110 depends on individual physiological state, including education and
3111 training of the voice. Therefore, a singer potentially has to check for
3112 each piece of music if the ambitus of that piece meets his individual
3113 capabilities. This is why the ambitus of a piece may be of particular
3114 value to vocal performers.
3116 The ambitus is typically notated on a per-voice basis at the very
3117 beginning of a piece, e.g. nearby the initial clef or time signature of
3118 each staff. The range is graphically specified by two noteheads, that
3119 represent the minimum and maximum pitch. Some publishers use a textual
3120 notation: they put the range in words in front of the corresponding
3121 staff. Lilypond currently only supports the graphical ambitus notation.
3123 To apply, simply add the @internalsref{Ambitus_engraver} to the
3124 @internalsref{Voice} context, as shown in the below example:
3126 @lilypond[singleline,verbatim]
3127 upper = \notes \relative c {
3130 as'' c e2 bes f cis d4 e f2 g
3132 lower = \notes \relative c {
3135 e'4 b g a c es fis a cis b a g f e d2
3138 \context ChoirStaff {
3140 \context Staff = one { \upper }
3141 \context Staff = three { \lower }
3147 \consists Ambitus_engraver
3153 The shape of the note heads to use can be changed via the
3154 @code{note-head-style} property, which holds the glyph name of the note
3155 head (see also @ref{Ancient note heads}). The vertical line between the
3156 upper and lower head can be switched on or off via the @code{join-heads}
3162 \consists Ambitus_engraver
3163 Ambitus \set #'note-head-style = #'noteheads-2mensural
3164 Ambitus \set #'join-heads = ##f
3168 By default, the ambitus grob is put before the clef. You can control
3169 this behaviour through the @code{breakAlignOrder} property of the score
3170 context by redefining the order, e.g. with the following addition to the
3176 breakAlignOrder = #'(
3194 Tablature notation is used for notating music for plucked string
3195 instruments. It notates pitches not by using note heads, but by
3196 indicating on which string and fret a note must be played. LilyPond
3197 offers limited support for tablature.
3200 * Tablatures basic::
3201 * Non-guitar tablatures::
3202 * Tablature in addition to normal staff::
3205 @node Tablatures basic
3206 @subsection Tablatures basic
3207 @cindex Tablatures basic
3209 Tablature can be typeset with Lilypond by using the
3210 @internalsref{TabStaff} and @internalsref{TabVoice} contexts. As
3211 tablature is a recent feature in Lilypond, most of the guitar special
3212 effects such as bend are not yet supported.
3214 With the @internalsref{TabStaff}, the string number associated to a note
3215 is given as a backslash followed by the string number, e.g. @code{c4\3} for a C
3216 quarter on the third string. By default, string 1 is the highest one, and the
3217 tuning defaults to the standard guitar tuning (with 6 strings).
3219 @lilypond[fragment,verbatim]
3228 If you do not specify a string number then lilypond automatically selects one.
3229 The selection is controlled by the translator property @code{minimumFret}. -- LilyPond
3230 simply selects the first string that does not give a fret number less than
3231 @code{minimumFret}. Default is 0.
3233 Notice that LilyPond does not handle chords in any special way, and hence
3234 the automatic string selector may easily select the same string to two notes in a chord.
3237 e8 fis gis a b cis' dis' e'
3238 \property TabStaff.minimumFret = #8
3239 e8 fis gis a b cis' dis' e'
3244 e8 fis gis a b cis' dis' e'
3245 \property TabStaff.minimumFret = #8
3246 e8 fis gis a b cis' dis' e'
3249 \context StaffGroup <
3250 \context Staff { \clef "G_8" \frag }
3251 \context TabStaff { \frag }
3256 @node Non-guitar tablatures
3257 @subsection Non-guitar tablatures
3258 @cindex Non-guitar tablatures
3260 There are many ways to customize Lilypond tablatures.
3262 First you can change the number of strings, by setting the number of
3263 lines in the @internalsref{TabStaff} (the @code{line-count} property
3264 of TabStaff can only be changed using @code{\outputproperty}, for more
3265 information, see @ref{Tuning per object}. You can change the strings
3266 tuning. A string tuning is given as a Scheme list with one integer
3267 number for each string, the number being the pitch of an open string.
3269 (The numbers specified for stringTuning are the numbers of semitons
3270 to subtract --- or add --- starting the specified pitch by default
3271 middle C, in string order: thus the notes are e, a, d & g)
3273 @lilypond[fragment,verbatim]
3276 \outputproperty #(make-type-checker 'staff-symbol-interface)
3278 \property TabStaff.stringTunings = #'(-5 -10 -15 -20)
3281 a,4 c' a e' e c' a e'
3286 Finally, it is possible to change the Scheme function to format the
3287 tablature note text. The default is @var{fret-number-tablature-format},
3288 which uses the fret number, but for some instruments that may not use
3289 this notation, just create your own tablature-format function. This
3290 function takes three argument: the string number, the string tuning and
3294 @node Tablature in addition to normal staff
3295 @subsection Tablature in addition to normal staff
3296 @cindex Tablature in addition to normal staff
3298 It is possible to typeset both tablature and a "normal" staff, as
3299 commonly done in many parts.
3301 A common trick for that is to put the notes in a variables, and to hide
3302 the fingering information (which correspond to the string number) for
3306 @c @lily pond[verbatim]
3313 \context StaffGroup <
3315 % Hide fingering number
3316 \property Staff.Fingering \override #'transparent = ##t
3321 \property Staff.Stem \override #'direction = #1
3335 LilyPond has support for both entering and printing chords.
3336 @lilypond[verbatim,singleline]
3337 twoWays = \notes \transpose c c' {
3347 < \context ChordNames \twoWays
3348 \context Voice \twoWays > }
3351 This example also shows that the chord printing routines do not try to
3352 be intelligent. If you enter @code{f bes d}, it does not interpret
3353 this as an inversion.
3355 As you can see chords really are a set of pitches. They are internally
3356 stored as simultaneous music expressions. This means you can enter
3357 chords by name and print them as notes, enter them as notes and print
3358 them as chord names, or (the most common case) enter them by name, and
3363 * Printing named chords::
3368 @subsection Chords mode
3371 Chord mode is a mode where you can input sets of pitches using common
3372 names. It is introduced by the keyword @code{\chords}.
3373 In chords mode, a chord is entered by the root, which is entered
3374 like a common pitch, for example,
3375 @lilypond[fragment,verbatim,quote]
3378 is the notation for an E-flat major chord.
3383 Other chords may be entered
3384 by suffixing a colon, and introducing a modifier, and optionally, a
3386 @lilypond[fragment,verbatim,quote]
3387 \chords { e1:m e1:7 e1:m7 }
3389 The first number following the root is taken to be the `type' of the
3390 chord, thirds are added to the root until it reaches the specified
3391 number, for example.
3392 @lilypond[fragment,verbatim]
3393 \chords { c:3 c:5 c:6 c:7 c:8 c:9 c:10 c:11 }
3396 @cindex root of chord
3397 @cindex additions, in chords
3398 @cindex removals, in chords
3400 More complex chords may also be constructed adding separate steps
3401 to a chord. Additions are added after the number following
3402 the colon, and are separated by dots. For example
3404 @lilypond[verbatim,fragment,quote]
3405 \chords { c:5.6 c:3.7.8 c:3.6.13 }
3407 Chord steps can be altered by suffixing a @code{-} or @code{+} sign
3408 to the number, for example:
3409 @lilypond[verbatim,fragment,quote]
3410 \chords { c:7+ c:5+.3- c:3-.5-.7- }
3412 Removals are specified similarly, and are introduced by a caret. They
3413 must come after the additions.
3414 @lilypond[verbatim,fragment]
3415 \chords { c^3 c:7^5 c:9^3.5 }
3418 Modifiers can be used to change pitches. The following modifiers are
3422 Minor chord. Lowers the 3rd and (if present) the 7th step.
3424 Diminished chord. Lowers the 3rd, 5th and (if present) the 7th step
3426 Augmented chord. Raises the 5th step.
3428 Major 7th chord. Raises the 7th step, if present.
3430 Suspended 4th or 2nd. This modifier removes the 3rd step. Append
3431 either @code{2} or @code{4} to add the 2nd or 4th step to the chord.
3433 Modifiers can be mixed with additions.
3434 @lilypond[verbatim,fragment]
3435 \chords { c:sus4 c:7sus4 c:dim7 c:m6 }
3438 @cindex modifiers, in chords.
3445 Since the unaltered 11 does sound well when combined with the
3446 unaltered 3, the 11 is removed in this case, unless it is added
3447 explicitly). For example,
3448 @lilypond[fragment,verbatim]
3449 \chords { c:13 c:13.11 c:m13 }
3454 An inversion (putting one pitch of the chord on the bottom), as well
3455 as bass notes, can be specified by appending
3456 @code{/}@var{pitch} to the chord.
3457 @lilypond[fragment,verbatim,center]
3458 \chords { c1 c/g c/f }
3461 If you do not want to remove the bass note from the chord, but rather
3462 add the note, then you can use @code{/+}@var{pitch}.
3464 @lilypond[fragment,verbatim,center]
3465 \chords { c1 c/+g c/+f }
3468 The chords mode is a mode similar to @code{\lyrics}, @code{\notes}
3469 etc. Most of the commands continue to work, for example, @code{r} and
3470 @code{\skip} can be used to insert spaces, and @code{\property} to
3471 change various settings.
3477 Each step can only be present in a chord once. The following
3478 simply produces the augmented chord, since @code{5+} is interpreted
3481 @lilypond[verbatim,fragment]
3482 \chords { c:5.5-.5+ }
3485 In chord mode, dashes and carets are used to indicate chord additions
3486 and subtractions, so articulation scripts can not be entered.
3492 @c . {Printing named chords}
3493 @node Printing named chords
3494 @subsection Printing named chords
3496 @cindex printing chord names
3500 For displaying printed chord names, use the @internalsref{ChordNames} context.
3501 The chords may be entered either using the notation described above, or
3502 directly using simultaneous music.
3504 @lilypond[verbatim,singleline]
3506 \chords {a1 b c} <<d f g>> <<e g b>>
3510 \context ChordNames \scheme
3511 \context Staff \transpose c c' \scheme
3516 You can make the chord changes stand out by setting
3517 @code{ChordNames.chordChanges} to true. This will only display chord
3518 names when there's a change in the chords scheme and at the start of a
3523 c1:m c:m \break c:m c:m d
3527 \context ChordNames {
3528 \property ChordNames.chordChanges = ##t
3530 \context Staff \transpose c c' \scheme
3532 \paper{linewidth= 9.\cm}
3536 LilyPond examines chords specified as lists of notes to determine a name
3537 to give the chord. LilyPond will not try to identify chord inversions or
3538 an added bass note, which may result in strange chord names when chords
3539 are entered as a list of pitches:
3541 @lilypond[verbatim,center,singleline]
3550 \context ChordNames \scheme
3551 \context Staff \scheme
3556 The default chord name layout is a system for Jazz music, proposed by
3557 Klaus Ignatzek (See @ref{Literature}).
3559 [TODO: add description for banter other jazz.]
3561 The Ignatzek chord name formatting can be tuned in a number of ways
3562 through the following properties:
3564 @item chordNameExceptions
3565 This is a list that contains the chords that have special formatting.
3567 @lilypond[verbatim,singleline]
3568 chExceptionMusic = \notes { <<c f g bes>>1-\markup { \super "7" "wahh" }}
3569 chExceptions = #(append
3570 (sequential-music-to-chord-exceptions chExceptionMusic)
3573 \score { \context ChordNames
3576 \property ChordNames.chordNameExceptions = #chExceptions
3580 Putting the exceptions list encoded as
3582 \notes @{ <<c f g bes>>1-\markup @{ \super "7" "wahh" @} @}
3584 into the property takes a little manoeuvring. The following code
3585 transforms @code{chExceptionMusic} (which is a sequential music)
3586 into a list of exceptions.
3588 (sequential-music-to-chord-exceptions chExceptionMusic)
3593 ... ignatzekExceptions)
3595 adds the new exceptions to the default ones, which are defined in
3596 @file{ly/chord-modifier-init.ly}.
3598 @item majorSevenSymbol
3599 This property contains the markup object used for the 7th step, when
3600 it is major. Predefined options are @code{whiteTriangleMarkup},
3601 @code{blackTriangleMarkup}. The following uses another popular shorthand.
3602 @lilypond[fragment,verbatim]
3603 \context ChordNames \chords {
3605 \property ChordNames.majorSevenSymbol = \markup { "j7" }
3608 @item chordNameSeparator
3609 Different parts of a chord name are normally separated by a
3610 slash. By setting @code{chordNameSeparator}, you can specify other
3612 @lilypond[fragment,verbatim]
3613 \context ChordNames \chords {
3615 \property ChordNames.chordNameSeparator = \markup { "|" }
3625 @section Writing parts
3627 Orchestral music involves some special notation, both in the full score,
3628 as in the individual parts. This section explains how to tackle common
3629 problems in orchestral music.
3636 * Instrument names::
3638 * Multi measure rests::
3639 * Automatic part combining::
3640 * Hara kiri staves::
3641 * Sound output for transposing instruments::
3644 @c . {Rehearsal marks}
3645 @node Rehearsal marks
3646 @subsection Rehearsal marks
3647 @cindex Rehearsal marks
3649 @cindex @code{\mark}
3651 To print a rehearsal mark, use the @code{\mark} command.
3652 @lilypond[fragment,verbatim]
3663 As you can see, the mark is incremented automatically if you use
3664 @code{\mark \default}. The value to use is stored in the property
3665 @code{rehearsalMark} is used and automatically incremented. The object
3666 is @internalsref{RehearsalMark} in @internalsref{Score} context. See
3667 @inputfileref{input/test,boxed-molecule.ly} if you need boxes around the
3670 The @code{\mark} command can also be used to put signs like coda,
3671 segno and fermatas on a barline. The trick is to use the text markup
3672 mechanism to access the fermata symbol.
3673 @lilypond[fragment,verbatim,relative=1]
3674 c1 \mark \markup { \musicglyph #"scripts-ufermata" }
3679 The problem is that marks that occur at a line break are typeset only
3680 at the beginning of the next line, opposite to what you want for the
3681 fermata. This can be corrected by the following property setting
3683 \property Score.RehearsalMark \override
3684 #'break-visibility = #begin-of-line-invisible
3690 @cindex barlines, putting symbols on
3694 @subsection Bar numbers
3698 @cindex measure numbers
3699 @cindex currentBarNumber
3701 Bar numbers are printed by default at the start of the line. The
3702 number itself is a property that can be set by modifying the
3703 @code{currentBarNumber} property, although that is usually not
3706 \property Score.currentBarNumber = #217
3709 To typeset Bar Numbers at regular intervals instead of at the beginning of each line,
3710 you need to change the grob property @code{break-visibility} as well as the translator
3711 property @code{barNumberVisibility}, as illustrated in the following example which also
3712 adds a box around the bar numbers:
3714 \property Score.BarNumber \override #'break-visibility =
3715 #end-of-line-invisible
3716 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3717 \property Score.BarNumber \override #'molecule-callback =
3718 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3719 \property Score.BarNumber \override #'font-relative-size = #0
3723 \context Staff \notes \transpose c c'' {
3724 \property Score.BarNumber \override #'break-visibility = #end-of-line-invisible
3725 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3726 \property Score.BarNumber \override #'molecule-callback =
3727 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3728 \property Score.BarNumber \override #'font-relative-size = #0
3730 \repeat unfold 16 c1 \bar "|."
3735 If you would like the bar numbers to appear at regular intervals, but
3736 not starting from measure zero, you can use the context function,
3737 @code{set-bar-number-visibility}, to automatically set
3738 @code{barNumberVisibility} so that the bar numbers appear at regular
3739 intervals, starting from the @code{\applycontext}:
3742 resetBarnum = \context Score \applycontext
3743 #(set-bar-number-visibility 4)
3745 \property Score.BarNumber \override #'break-visibility =
3746 #end-of-line-invisible
3747 \mark "A" \resetBarnum
3748 \repeat unfold 10 c1
3749 \mark \default \resetBarnum
3753 resetBarnum = \context Score \applycontext
3754 #(set-bar-number-visibility 4)
3757 \notes \transpose c c'' {
3758 \property Score.BarNumber \override #'break-visibility =#end-of-line-invisible
3759 \property Score.RehearsalMark \override #'padding = #2.5
3760 \mark "A" \resetBarnum
3761 \repeat unfold 10 c1
3762 \mark \default \resetBarnum
3770 See also @seeinternals{BarNumber}.
3774 Barnumbers can collide with the StaffGroup, if there is one at the
3775 top. To solve this, You have to twiddle with the
3776 @internalsref{padding} property of @internalsref{BarNumber} if your
3777 score starts with a @internalsref{StaffGroup}.
3779 @node Instrument names
3780 @subsection Instrument names
3782 In scores, the instrument name is printed before the staff. This can
3783 be done by setting @code{Staff.instrument} and
3784 @code{Staff.instr}. This will print a string before the start of the
3785 staff. For the first start, @code{instrument} is used, for the next
3786 ones @code{instr} is used.
3788 @lilypond[verbatim,singleline]
3789 \property Staff.instrument = "ploink " { c''4 }
3792 You can also use markup texts to construct more complicated instrument
3796 @lilypond[verbatim,singleline]
3798 \notes \context Staff = treble {
3799 \property Staff.instrument
3800 = \markup { \column << "Clarinetti" { "in B" \smaller \musicglyph #"accidentals--1" } >> }
3803 \paper { linewidth= 8.0\cm }
3810 When you put a name on a grand staff or piano staff the width of the
3811 brace is not taken into account. You must add extra spaces to the end of
3812 the name to avoid a collision.
3815 @subsection Transpose
3817 @cindex transposition of pitches
3818 @cindex @code{\transpose}
3820 A music expression can be transposed with @code{\transpose}. The syntax
3823 \transpose @var{from} @var{to} @var{musicexpr}
3826 This means that @var{musicexpr} is transposed to by the interval
3827 between @var{from} is @var{to}.
3829 @code{\transpose} distinguishes between enharmonic pitches: both
3830 @code{\transpose c cis} or @code{\transpose c des} will transpose up
3831 half a tone. The first version will print sharps and the second
3832 version will print flats.
3834 @lilypond[singleline, verbatim]
3835 mus =\notes { \key d \major cis d fis g }
3836 \score { \notes \context Staff {
3839 \transpose c g' \mus
3840 \transpose c f' \mus
3844 If you want to use both @code{\transpose} and @code{\relative}, then
3845 you must use @code{\transpose} first. @code{\relative} will have no
3846 effect music that appears inside a @code{\transpose}.
3848 @c . {Multi measure rests}
3849 @node Multi measure rests
3850 @subsection Multi measure rests
3851 @cindex Multi measure rests
3855 Multi measure rests are entered using `@code{R}'. It is specifically
3856 meant for full bar rests and for entering parts: the rest can expand to
3857 fill a score with rests, or it can be printed as a single multimeasure
3858 rest This expansion is controlled by the property
3859 @code{Score.skipBars}. If this is set to true, Lily will not expand
3860 empty measures, and the appropriate number is added automatically.
3862 @lilypond[fragment,verbatim]
3863 \time 4/4 r1 | R1 | R1*2
3864 \property Score.skipBars = ##t R1*17 R1*4
3867 The @code{1} in @code{R1} is similar to the duration notation used for
3868 notes. Hence, for time signatures other than 4/4, you must enter other
3869 durations. This can be done with augmentation dots, or with
3872 @lilypond[fragment,verbatim]
3873 \property Score.skipBars = ##t
3881 Notice that a @code{R} spanning a single measure is printed as a whole
3882 rest centered in the measure, regardless of the time signature.
3884 [ add note about breves.]
3887 @cindex text on multi-measure rest
3888 @cindex script on multi-measure rest
3889 @cindex fermata on multi-measure rest
3891 Texts can be added to multi-measure rests by using the
3892 @var{note}-@code{markup} syntax. An identifier
3893 is provided for a fermata.
3895 @lilypond[verbatim,fragment]
3897 R2._\markup { \roman "Ad lib" }
3901 By default, the multi-measure rest uses the number font, which does
3902 not contain any letters. This is the reason for the explicit
3903 @code{\roman} in the above example.
3905 @cindex whole rests for a full measure
3907 The object for this object is @internalsref{MultiMeasureRest}, and
3908 @internalsref{MultiMeasureRestNumber}.
3912 Only one text can be put on a multi-measure rest with
3913 @var{note}-@var{text} syntax, since this is internally converted to
3914 setting @code{#'text} in @internalsref{MultiMeasureRestNumber}. It is
3915 not possible to use fingerings (e.g. @code{R1-4}) to put numbers over
3916 multi-measure rests.
3919 @cindex condensing rests
3921 Currently, there is no way to automatically condense multiple rests
3922 into a single multimeasure rest. Multi measure rests do not take part
3926 @node Automatic part combining
3927 @subsection Automatic part combining
3928 @cindex automatic part combining
3929 @cindex part combiner
3932 Automatic part combining is used to merge two parts of music onto a
3933 staff in an intelligent way. It is aimed primarily at typesetting
3934 orchestral scores. When the two parts are identical for a period of
3935 time, only one is shown. In places where the two parts differ, they
3936 are typeset as separate voices, and stem directions are set
3937 automatically. Also, solo and @emph{a due} parts can be identified
3940 The syntax for part combining is
3943 \partcombine @var{context} @var{musicexpr1} @var{musicexpr2}
3945 where the pieces of music @var{musicexpr1} and @var{musicexpr2} will be
3946 combined into one context of type @var{context}. The music expressions
3947 must be interpreted by contexts whose names should start with @code{one}
3950 The most useful function of the part combiner is to combine parts into
3951 one voice, as common for wind parts in orchestral scores:
3953 @lilypond[verbatim,singleline,fragment]
3955 \context Voice=one \partcombine Voice
3956 \context Thread=one \relative c'' {
3959 \context Thread=two \relative c'' {
3965 Notice that the first @code{g} appears only once, although it was
3966 specified twice (once in each part). Stem, slur and tie directions are
3967 set automatically, depending whether there is a solo or unisono. The
3968 first part (with context called @code{one}) always gets up stems, and
3969 `solo', while the second (called @code{two}) always gets down stems and
3972 If you just want the merging parts, and not the textual markings, you
3973 may set the property @var{soloADue} to false.
3975 @lilypond[verbatim,singleline,fragment]
3977 \property Staff.soloADue = ##f
3978 \context Voice=one \partcombine Voice
3979 \context Thread=one \relative c'' {
3982 \context Thread=two \relative c'' {
3988 There are a number of other properties that you can use to tweak the
3989 behavior of part combining, refer to the automatically generated
3990 documentation of @internalsref{Thread_devnull_engraver} and
3991 @internalsref{Voice_devnull_engraver}. Look at the documentation of the
3992 responsible engravers, @code{Thread_devnull_engraver},
3993 @code{Voice_devnull_engraver} and @code{A2_engraver}.
3997 In @code{soloADue} mode, when the two voices play the same notes on and
3998 off, the part combiner may typeset @code{a2} more than once in a
4001 @lilypond[fragment,singleline]
4003 \context Voice=one \partcombine Voice
4004 \context Thread=one \relative c'' {
4007 \context Thread=two \relative c'' {
4013 @cindex @code{Thread_devnull_engraver}
4014 @cindex @code{Voice_engraver}
4015 @cindex @code{A2_engraver}
4017 @node Hara kiri staves
4018 @subsection Hara kiri staves
4020 In orchestral scores, staff lines that only have rests are usually removed.
4021 This saves some space. LilyPond also supports this through the hara
4022 kiri@footnote{Hara kiri, also called Seppuku, is the ritual suicide of
4023 the Japanese Samourai warriors.} staff. This staff commits suicide when
4024 it finds itself to be empty after the line-breaking process. It will
4025 not disappear when it contains normal rests, you must use multi measure
4028 The hara kiri staff is specialized version of the @internalsref{Staff}
4029 context. It is available as the context identifier
4030 @code{\HaraKiriStaffContext}. Observe how the second staff in this
4031 example disappears in the second line.
4035 \notes \relative c' <
4036 \context Staff = SA { e4 f g a \break c1 }
4037 \context Staff = SB { c4 d e f \break R1 }
4041 \translator { \HaraKiriStaffContext }
4046 For @internalsref{Lyrics}, @internalsref{LyricsVoice},
4047 @internalsref{ChordNames} and @internalsref{FiguredBass}, hara-kiri is
4048 switched on by default.
4051 @node Sound output for transposing instruments
4052 @subsection Sound output for transposing instruments
4054 When you want to make a MIDI file from a score containing transposed
4055 and untransposed instruments, you have to instruct LilyPond the pitch
4056 offset (in semitones) for the transposed instruments. This is done
4057 using the @code{transposing} property. It does not affect printed
4060 @cindex @code{transposing}
4063 \property Staff.instrument = #"Cl. in B-flat"
4064 \property Staff.transposing = #-2
4068 @node Ancient notation
4069 @section Ancient notation
4071 @cindex Vaticana, Editio
4072 @cindex Medicaea, Editio
4078 * Ancient note heads::
4087 @node Ancient note heads
4088 @subsection Ancient note heads
4090 To get a longa note head, you have to use mensural note heads. This
4091 is accomplished by setting the @code{style} property of the
4092 NoteHead object to @code{mensural}. There is also a note head style
4093 @code{baroque} which gives mensural note heads for @code{\longa} and
4094 @code{\breve} but standard note heads for shorter notes.
4096 @lilypond[fragment,singleline,verbatim]
4097 \property Voice.NoteHead \set #'style = #'mensural
4102 @subsection Ancient clefs
4104 LilyPond supports a variety of clefs, many of them ancient.
4106 For modern clefs, see section @ref{Clef}. For the percussion clef, see
4107 section @ref{Percussion staves}. For the @code{TAB} clef, see section
4110 The following table shows all ancient clefs that are supported via the
4111 @code{\clef} command. Some of the clefs use the same glyph, but differ
4112 only with respect to the line they are printed on. In such cases, a
4113 trailing number in the name is used to enumerate these clefs. Still,
4114 you can manually force a clef glyph to be typeset on an arbitrary line,
4115 as described in section @ref{Clef}. The note printed to the right side
4116 of each clef denotes the @code{c'} with respect to the clef.
4120 @c --- This should go somewhere else: ---
4121 @c @item modern style G clef (glyph: @code{clefs-G})
4124 @c @code{treble}, @code{violin}, @code{G}, @code{G2}, @code{french}
4126 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "G" c'}
4128 @c @item modern style F clef (glyph: @code{clefs-F})
4131 @c @code{varbaritone}, @code{bass}, @code{F}, @code{subbass}
4133 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "F" c'}
4135 @c @item modern style C clef (glyph: @code{clefs-C})
4138 @c @code{soprano}, @code{mezzosoprano}, @code{alto}, @code{C},
4139 @c @code{tenor}, @code{baritone}
4141 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "C" c'}
4143 @item modern style mensural C clef (glyph: @code{clefs-neo_mensural_c'})
4146 @code{neo_mensural_c1}, @code{neo_mensural_c2},
4147 @code{neo_mensural_c3}, @code{neo_mensural_c4}
4149 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "neo_mensural_c2" c'}
4151 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c1})
4157 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c1" c'}
4159 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c2})
4165 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c2" c'}
4167 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c3})
4173 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c3" c'}
4175 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c4})
4181 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c4" c'}
4183 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c5})
4189 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c5" c'}
4191 @item petrucci style mensural F clef (glyph: @code{clefs-petrucci_f})
4196 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_f" c'}
4198 @item petrucci style mensural G clef (glyph: @code{clefs-petrucci_g})
4203 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_g" c'}
4205 @item historic style mensural C clef (glyph: @code{clefs-mensural_c'})
4208 @code{mensural_c1}, @code{mensural_c2}, @code{mensural_c3},
4211 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_c2" c'}
4213 @item historic style mensural F clef (glyph: @code{clefs-mensural_f})
4218 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_f" c'}
4220 @item historic style mensural G clef (glyph: @code{clefs-mensural_g})
4225 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_g" c'}
4227 @item Editio Vaticana style do clef (glyph: @code{clefs-vaticana_do})
4230 @code{vaticana_do1}, @code{vaticana_do2}, @code{vaticana_do3}
4232 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_do2" c'}
4234 @item Editio Vaticana style fa clef (glyph: @code{clefs-vaticana_fa})
4237 @code{vaticana_fa1}, @code{vaticana_fa2}
4239 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_fa2" c'}
4241 @item Editio Medicaea style do clef (glyph: @code{clefs-medicaea_do})
4244 @code{medicaea_do1}, @code{medicaea_do2}, @code{medicaea_do3}
4246 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_do2" c'}
4248 @item Editio Medicaea style fa clef (glyph: @code{clefs-medicaea_fa})
4251 @code{medicaea_fa1}, @code{medicaea_fa2}
4253 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_fa2" c'}
4255 @item historic style hufnagel do clef (glyph: @code{clefs-hufnagel_do})
4258 @code{hufnagel_do1}, @code{hufnagel_do2}, @code{hufnagel_do3}
4260 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do2" c'}
4262 @item historic style hufnagel fa clef (glyph: @code{clefs-hufnagel_fa})
4265 @code{hufnagel_fa1}, @code{hufnagel_fa2}
4267 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_fa2" c'}
4269 @item historic style hufnagel combined do/fa clef (glyph: @code{clefs-hufnagel_do_fa})
4272 @code{hufnagel_do_fa}
4274 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do_fa" c'}
4276 @c --- This should go somewhere else: ---
4277 @c @item modern style percussion clef (glyph: @code{clefs-percussion})
4280 @c @code{percussion}
4282 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "percussion" c'}
4284 @c @item modern style tab clef (glyph: @code{clefs-tab})
4289 @c @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #6 \property Staff.TimeSignature \set #'transparent = ##t \clef "tab" c'}
4293 @emph{Modern style} means ``as is typeset in current editions of
4294 transcribed mensural music''.
4296 @emph{Petrucci style} means ``inspired by printings published by the
4297 famous engraver Petrucci (1466-1539)''.
4299 @emph{Historic style} means ``as was typeset or written in contemporary
4300 historic editions (other than those of Petrucci)''.
4302 @emph{Editio XXX style} means ``as is/was printed in Editio XXX''.
4304 Petrucci used C clefs with differently balanced left-side vertical
4305 beams, depending on which staffline it was printed.
4309 @subsection Custodes
4314 A @emph{custos} (plural: @emph{custodes}; latin word for `guard') is a
4315 staff context symbol that appears at the end of a staff line. It
4316 anticipates the pitch of the first note(s) of the following line and
4317 thus helps the player or singer to manage line breaks during
4318 performance, thus enhancing readability of a score.
4323 \property Staff.Custos \set #'style = #'mensural
4328 \consists Custos_engraver
4334 Custodes were frequently used in music notation until the 17th century.
4335 There were different appearances for different notation styles.
4336 Nowadays, they have survived only in special forms of musical notation
4337 such as via the @emph{editio vaticana} dating back to the beginning of
4340 For typesetting custodes, just put a @code{Custos_engraver} into the
4341 Staff context when declaring the @code{\paper} block, as shown in the
4342 following example. In the @code{\paper} block, you can also globally
4343 control the appearance of the custos symbol by setting the custos
4344 @code{style} property.
4350 \consists Custos_engraver
4351 Custos \override #'style = #'mensural
4356 The property can also be set locally, for example in a @code{\notes}
4361 \property Staff.Custos \override #'style = #'vaticana
4362 c'1 d' e' d' \break c' d' e' d'
4366 Currently, the following styles are supported:
4373 ^\markup { "vaticana" }
4374 ^\markup { \musicglyph #"custodes-vaticana-u0" }
4376 ^\markup { "medicaea" }
4377 ^\markup { \musicglyph #"custodes-medicaea-u0" }
4379 ^\markup { "hufnagel" }
4380 ^\markup { \musicglyph #"custodes-hufnagel-u0" }
4382 ^\markup { "mensural" }
4383 ^\markup { \musicglyph #"custodes-mensural-u0" }
4390 \remove "Bar_number_engraver"
4391 TextScript \override #'extra-X-extent = #'(-1 . 1)
4395 \remove "Clef_engraver"
4396 \remove "Key_engraver"
4397 \remove "Time_signature_engraver"
4398 \remove "Staff_symbol_engraver"
4399 minimumVerticalExtent = ##f
4405 If the boolean property @code{adjust-if-on-staffline} is set to
4406 @code{#t} (which it is by default), lily typesets slightly different
4407 variants of the custos glyph, depending on the pitch of the custos,
4408 i.e. depending on the glyph being typeset either on a staffline or
4409 between two stafflines. The idea is that the glyph will optically fit
4410 well into the staff, with the appendage on the right of the custos
4411 always ending at the same vertical position between two stafflines
4412 regardless of the pitch. If you set @code{adjust-if-on-staffline} to
4413 @code{#f}, then lily takes regardless of the pitch always a glyph that
4414 is a compromise of the former two variants.
4416 Just like stems can be attached to noteheads in two directions
4417 @emph{up} and @emph{down}, each custos glyph is available with its
4418 appendage pointing either up or down. If the pitch of a custos is
4419 above a selectable position, the appendage will point downwards; if
4420 the pitch is below this position, the appendage will point upwards.
4421 Use property @code{neutral-position} to select this position. By
4422 default, it is set to @code{0}, such that the neutral position is the
4423 center of the staff. Use property @code{neutral-direction} to control
4424 what happens if a custos is typeset on the neutral position itself.
4425 By default, this property is set to @code{-1}, such that the appendage
4426 will point downwards. If set to @code{1}, the appendage will point
4427 upwards. Other values such as @code{0} are reserved for future
4428 extensions and should not be used.
4431 @subsection Divisiones
4437 A @emph{divisio} (plural: @emph{divisiones}; latin word for
4438 `division') is a staff context symbol that is used to structure
4439 Gregorian music into phrases and sections. The musical meaning of
4440 @emph{divisio minima}, @emph{divisio maior} and @emph{divisio maxima}
4441 can be characterized as short, medium and long pause, somewhat like
4442 @ref{Breath marks}. The @emph{finalis} sign not only marks the end of
4443 a chant, but is also frequently used within a single
4444 antiphonal/responsorial chant to mark the end of each section.
4446 To use divisiones, just include the file @code{gregorian-init.ly}. It
4447 contains definitions that you can apply by just inserting
4448 @code{\divisiominima}, @code{\divisiomaior}, @code{\divisiomaxima},
4449 and @code{\finalis} at proper places into your lilypond files.
4452 \include "gregorian-init.ly"
4455 \context Staff = staff \addlyrics \notes \transpose c c' {
4456 \property Score.timing = ##f
4457 \property Score.barAlways = ##t
4458 \property Staff.BarLine \override #'transparent = ##t
4459 \property Voice.Stem \override #'transparent = ##t
4461 ^\markup { "divisio minima" }
4464 ^\markup { "divisio maior" }
4467 ^\markup { "divisio maxima" }
4470 ^\markup { "finalis" }
4474 \context Lyrics = lyrics \lyrics {
4475 Blah blub, blah blam.
4476 Blah blub, blah blam.
4477 Blah blub, blah blam.
4478 Blah blub, blah blam.
4479 Blah blub, blah blam.
4485 Some editions use @emph{virgula} or @emph{caesura} instead of divisio
4486 minima. Therefore, @code{gregorian-init.ly} also defines
4487 @code{\virgula} and @code{\caesura}.
4490 \include "gregorian-init.ly"
4493 \context Staff = staff \addlyrics \notes \transpose c c' {
4494 \property Score.timing = ##f
4495 \property Score.barAlways = ##t
4496 \property Staff.BarLine \override #'transparent = ##t
4497 \property Voice.Stem \override #'transparent = ##t
4499 ^\markup { "virgula" }
4502 ^\markup { "caesura" }
4506 \context Lyrics = lyrics \lyrics {
4507 Blah blub, blah blam.
4508 Blah blub, blah blam.
4509 Blah blub, blah blam.
4516 @subsection Ligatures
4520 @c TODO: Should double check if I recalled things correctly when I wrote
4521 @c down the following paragraph by heart.
4522 In musical terminology, a ligature is a coherent graphical symbol that
4523 represents at least two different notes. Ligatures originally appeared
4524 in the manuscripts of Gregorian chant notation roughly since the 9th
4525 century as an allusion to the accent symbols of greek lyric poetry to
4526 denote ascending or descending sequences of notes. Both, the shape and
4527 the exact meaning of ligatures changed tremendously during the following
4528 centuries: In early notation, ligatures where used for monophonic tunes
4529 (Gregorian chant) and very soon denoted also the way of performance in
4530 the sense of articulation. With upcoming multiphony, the need for a
4531 metric system arised, since multiple voices of a piece have to be
4532 synchronized some way. New notation systems were invented, that used
4533 the manifold shapes of ligatures to now denote rhythmical patterns
4534 (e.g. black mensural notation, mannered notation, ars nova). With the
4535 invention of the metric system of the white mensural notation, the need
4536 for ligatures to denote such patterns disappeared. Nevertheless,
4537 ligatures were still in use in the mensural system for a couple of
4538 decades until they finally disappeared during the late 16th / early 17th
4539 century. Still, ligatures have survived in contemporary editions of
4540 Gregorian chant such as the Editio Vaticana from 1905/08.
4542 Syntactically, ligatures are simply enclosed by @code{\[} and @code{\]}.
4543 Some ligature styles (such as Editio Vaticana) may need additional input
4544 syntax specific for this particular type of ligature. By default, the
4545 @internalsref{LigatureBracket} engraver just marks the start and end of
4546 a ligature by small square angles:
4548 @lilypond[singleline,verbatim]
4550 \notes \transpose c c' {
4558 To select a specific style of ligatures, a proper ligature engraver has
4559 to be added to the @internalsref{Voice} context, as explained in the
4560 following subsections. Currently, Lilypond only supports white mensural
4561 ligatures with certain limitations. Support for Editio Vaticana will be
4562 added in the future.
4565 * White mensural ligatures::
4568 @node White mensural ligatures
4569 @subsubsection White mensural ligatures
4571 @cindex Mensural ligatures
4572 @cindex White mensural ligatures
4574 Lilypond has limited support for white mensural ligatures. The
4575 implementation is still experimental; it currently may output strange
4576 warnings or even crash in some cases or produce weird results on more
4577 complex ligatures. To engrave white mensural ligatures, in the paper
4578 block the @internalsref{MensuralLigature} engraver has to be put into
4579 the @internalsref{Voice} context (and you probably want to remove the
4580 @internalsref{LigatureBracket} engraver). There is no additional input
4581 language to describe the shape of a white mensural ligature. The shape
4582 is rather determined solely from the pitch and duration of the enclosed
4583 notes. While this approach may take a new user quite a while to get
4584 accustomed, it has a great advantage: this way, lily has full musical
4585 information about the ligature. This is not only required for correct
4586 MIDI output, but also allows for automatic transcription of the
4591 @lilypond[singleline,verbatim]
4593 \notes \transpose c c' {
4594 \property Score.timing = ##f
4595 \property Score.defaultBarType = "empty"
4596 \property Voice.NoteHead \set #'style = #'neo_mensural
4597 \property Staff.TimeSignature \set #'style = #'neo_mensural
4599 \[ g\longa c\breve a\breve f\breve d'\longa \]
4601 \[ e1 f1 a\breve g\longa \]
4606 \remove Ligature_bracket_engraver
4607 \consists Mensural_ligature_engraver
4613 Without replacing @code{Ligature_bracket_engraver} with
4614 @code{Mensural_ligature_engraver}, the same music transcribes to the
4617 @lilypond[singleline,verbatim]
4619 \notes \transpose c c' {
4620 \property Score.timing = ##f
4621 \property Score.defaultBarType = "empty"
4622 \property Voice.NoteHead \set #'style = #'neo_mensural
4623 \property Staff.TimeSignature \set #'style = #'neo_mensural
4625 \[ g\longa c\breve a\breve f\breve d'\longa \]
4627 \[ e1 f1 a\breve g\longa \]
4633 @subsection Figured bass
4635 @cindex Basso continuo
4637 LilyPond has limited support for figured bass:
4639 @lilypond[verbatim,fragment]
4641 \context Voice \notes { \clef bass dis4 c d ais}
4642 \context FiguredBass
4644 < 6 >4 < 7 >8 < 6+ [_!] >
4650 The support for figured bass consists of two parts: there is an input
4651 mode, introduced by @code{\figures}, where you can enter bass figures
4652 as numbers, and there is a context called @internalsref{FiguredBass}
4653 that takes care of making @internalsref{BassFigure} objects.
4655 In figures input mode, a group of bass figures is delimited by
4656 @code{<} and @code{>}. The duration is entered after the @code{>}.
4661 \context FiguredBass
4665 Accidentals are added to the numbers if you alterate them by
4666 appending @code{-}, @code{!} and @code{+}.
4672 \context FiguredBass
4673 \figures { <4- 6+ 7!> }
4676 Spaces or dashes may be inserted by using @code{_}. Brackets are
4677 introduced with @code{[} and @code{]}.
4683 \context FiguredBass
4684 \figures { < [4 6] 8 [_ 12]> }
4687 Although the support for figured bass may superficially resemble chord
4688 support, it works much simpler: in figured bass simply stores the
4689 numbers, and then prints the numbers you entered. There is no
4690 conversion to pitches, and no realizations of the bass are played in
4693 Internally, the code produces markup texts internally. You can use any
4694 of the markup text properties to override formatting. For example, the
4695 vertical spacing of the figures may be set with @code{baseline-skip}.
4697 @c . {Contemporary notation}
4698 @node Contemporary notation
4699 @section Contemporary notation
4707 @subsection Clusters
4711 In musical terminology, a @emph{cluster} denotes a range of
4712 simultaneously sounding pitches that may change over time. The set of
4713 available pitches to apply usually depends on the accoustic source.
4714 Thus, in piano music, a cluster typically consists of a continous range
4715 of the semitones as provided by the piano's fixed set of a chromatic
4716 scale. In choral music, each singer of the choir typically may sing an
4717 arbitrary pitch within the cluster's range that is not bound to any
4718 diatonic, chromatic or other scale. In electronic music, a cluster
4719 (theoretically) may even cover a continuous range of pitches, thus
4720 resulting in coloured noise, such as pink noise.
4722 Clusters can be notated in the context of ordinary staff notation by
4723 engraving simple geometrical shapes that replace ordinary notation of
4724 notes. Ordinary notes as musical events specify starting time and
4725 duration of pitches; however, the duration of a note is expressed by the
4726 shape of the note head rather than by the horizontal graphical extent of
4727 the note symbol. In contrast, the shape of a cluster geometrically
4728 describes the development of a range of pitches (vertical extent) over
4729 time (horizontal extent). Still, the geometrical shape of a cluster
4730 covers the area in wich any single pitch contained in the cluster would
4731 be notated as an ordinary note. From this point of view, it is
4732 reasonable to specify a cluster as the envelope of a set of notes. This
4733 is exactly how to construct a cluster with lilypond.
4735 @lilypond[singleline,verbatim]
4737 \context PianoStaff <
4738 \context Voice = voiceI { % same as voiceII, but with ordinary notes
4739 \notes \relative c' {
4741 a4 <e4 d'4> | \break
4742 < g8 a8 > < e8 a8 > a4 c1 < d4 b4 > e4 |
4746 \context Voice = voiceII { % same as voiceI, but with cluster notation
4747 \notes \relative c' {
4749 % hide notes, accidentals, etc.
4750 \property Thread.NoteHead \set #'transparent = ##t
4751 \property Voice.Stem \set #'transparent = ##t
4752 \property Voice.Beam \set #'transparent = ##t
4753 \property Staff.Accidental \set #'transparent = ##t
4755 \property Voice.Cluster \set #'padding = #0.01
4756 \property Voice.Cluster \set #'shape = #'ramp
4760 a4 <e4 d'4> | \break
4761 < g8 a8 > < e8 a8 > a4 c1 < d4 b4 > e4 |
4762 c4 \stopCluster a4 f4 g4 a4
4769 Note that the second voice differs from the first one only by the
4770 additional keywords @code{\startCluster} and @code{\stopCluster} and the
4771 fact that notes, accidentals, etc. are hidden. A future version of
4772 lilypond may automatically hide notes, accidentals, etc. within the
4775 Also note that a music expression like @code{< @{ g8 e8 @} a4 >} is
4776 illegal; in such a case, you can instead use the expression @code{< g8
4779 By default, cluster engraver is in the voice context. This allows
4780 putting ordinary notes and clusters together in the same staff, even
4781 simultaneously. However, in such a case no attempt is made to
4782 automatically avoid collisions between ordinary notes and clusters.
4784 The geometrical shape can be further controlled with grob properties
4785 @code{padding} and @code{shape}. @code{padding} adds to the vertical
4786 extent of the shape (top and bottom) and is expressed in units of
4787 staffspace. Since the pitch range of a single pitch is infinitely
4788 small, if padding is set to @code{0.0}, this possibly results in an
4789 invisible shape, if you,for example, say @code{ \startCluster c d e
4790 \endCluster}. The default value for @code{padding} therefore is
4791 @code{0.25}, such that a single pitch roughly shows the same height as a
4792 note head. Property @code{shape} controls how the overall shape of the
4793 cluster is constructed from the set of notes. Currently supported
4794 values are @code{leftsided-stairs}, @code{rightsided-stairs},
4795 @code{centered-stairs}, and @code{ramp}.
4798 @subsection Fermatas
4802 Currently, lilypond supports the following fermata symbols that are
4803 frequently used in contemporary music notation:
4805 @lilypond[singleline,verbatim]
4812 ^\markup { short fermata }
4817 ^\markup { fermata }
4822 ^\markup { long fermata }
4827 ^\markup { very long fermata }
4833 See @ref{Articulations} for general instructions how to apply scripts
4834 such as fermatas to a @code{\notes@{@}} block.
4836 @c . {Tuning output}
4838 @section Tuning output
4840 LilyPond tries to take as much formatting as possible out of your
4841 hands. Nevertheless, there are situations where it needs some help, or
4842 where you want to override its decisions. In this section we discuss
4843 ways to do just that.
4845 Formatting is internally done by manipulating so called objects (graphic
4846 objects). Each object carries with it a set of properties (object
4847 properties) specific to that object. For example, a stem object has
4848 properties that specify its direction, length and thickness.
4850 The most direct way of tuning the output is by altering the values of
4851 these properties. There are two ways of doing that: first, you can
4852 temporarily change the definition of a certain type of object, thus
4853 affecting a whole set of objects. Second, you can select one specific
4854 object, and set a object property in that object.
4857 * Tuning groups of objects ::
4858 * Tuning per object ::
4863 @node Tuning groups of objects
4864 @subsection Tuning groups of objects
4866 @cindex object description
4868 A object definition is a Scheme association list, that is stored in a
4869 context property. By assigning to that property (using plain
4870 @code{\property}), you can change the resulting objects.
4872 @lilypond[verbatim, fragment,quote]
4873 c'4 \property Voice.NoteHead = #'() c'4
4875 This mechanism is fairly crude, since you can only set, but not modify,
4876 the definition of an object. Also, it will thoroughly confuse LilyPond.
4878 The definition of an object is actually a list of default object
4879 properties. For example, the definition of the Stem object (available
4880 in @file{scm/grob-description.scm}), includes the following definitions for
4885 (beamed-lengths . (0.0 2.5 2.0 1.5))
4886 (Y-extent-callback . ,Stem::height)
4890 You can add a property on top of the existing definition, or remove a
4891 property, thus overriding the system defaults:
4892 @lilypond[verbatim,quote]
4893 c'4 \property Voice.Stem \override #'thickness = #4.0
4894 c'4 \property Voice.Stem \revert #'thickness
4897 You should balance @code{\override} and @code{\revert}. If that's too
4898 much work, you can use the @code{\set} shorthand. It performs a revert
4899 followed by an override. The following example gives exactly the same
4900 result as the previous one.
4901 @lilypond[verbatim,quote]
4902 c'4 \property Voice.Stem \set #'thickness = #4.0
4903 c'4 \property Voice.Stem \set #'thickness = #0.8
4906 If you use @code{\set}, you must explicitly restore the default.
4909 Formally the syntax for these constructions is
4911 \property @var{context}.@var{grobname} \override @var{symbol} = @var{value}
4912 \property @var{context}.@var{grobname} \set @var{symbol} = @var{value}
4913 \property @var{context}.@var{grobname} \revert @var{symbol}
4915 Here @var{symbol} is a Scheme expression of symbol type, @var{context}
4916 and @var{grobname} are strings and @var{value} is a Scheme expression.
4919 If you revert a setting which was not set in the first place, then it
4920 has no effect. However, if the setting was set as a system default, it
4921 may remove the default value, and this may give surprising results,
4922 including crashes. In other words, @code{\override} and @code{\revert},
4923 must be carefully balanced.
4925 These are examples of correct nesting of @code{\override}, @code{\set},
4928 A clumsy but correct form:
4930 \override \revert \override \revert \override \revert
4933 Shorter version of the same:
4935 \override \set \set \revert
4938 A short form, using only @code{\set}. This requires you to know the
4941 \set \set \set \set @var{to default value}
4944 If there is no default (i.e. by default, the object property is unset),
4947 \set \set \set \revert
4950 For the digirati, the object description is an Scheme association
4951 list. Since a Scheme list is a singly linked list, we can treat it as a
4952 stack, and @code{\override} and @code{\revert} are just push and pop
4953 operations. This pushing and popping is also used for overriding
4954 automatic beaming settings.
4958 LilyPond will hang or crash if @var{value} contains cyclic references.
4959 The backend is not very strict in type-checking object properties. If you
4960 @code{\revert} properties that are expected to be set by default,
4966 @node Tuning per object
4967 @subsection Tuning per object
4970 Tuning a single object is most often done with @code{\property}. The
4973 \once \property @dots{}
4976 applies a setting only during one moment in the score: notice how the
4977 original setting for stem thickness is restored automatically in the
4980 @lilypond[verbatim, fragment, relative=1]
4982 \once \property Voice.Stem \set #'thickness = #4
4988 @cindex \outputproperty
4990 A second way of tuning objects is the more arcane @code{\outputproperty}
4991 feature. The syntax is as follows:
4993 \outputproperty @var{predicate} @var{symbol} = @var{value}
4995 Here @code{predicate} is a Scheme function taking a object argument, and
4996 returning a boolean. This statement is processed by the
4997 @code{Output_property_engraver}. It instructs the engraver to feed all
4998 objects that it sees to @var{predicate}. Whenever the predicate returns
4999 true, the object property @var{symbol} will be set to @var{value}.
5001 This command is only single shot, in contrast to @code{\override} and
5004 You will need to combine this statement with @code{\context} to select
5005 the appropriate context to apply this to.
5007 In the following example, all note heads occurring at current staff
5008 level, are shifted up and right by setting their @code{extra-offset}
5011 @lilypond[fragment,verbatim,singleline]
5013 \context Staff \outputproperty
5014 #(make-type-checker 'note-head-interface)
5015 #'extra-offset = #'(0.5 . 0.75)
5019 @cindex @code{extra-offset}
5021 In this example, the predicate checks the @code{text} object property, to
5022 shift only the `m.d.' text, but not the fingering instruction "2".
5023 @lilypond[verbatim,singleline]
5024 #(define (make-text-checker text)
5025 (lambda (grob) (equal? text (ly:get-grob-property grob 'text))))
5028 \notes\relative c''' {
5029 \property Voice.Stem \set #'direction = #1
5030 \outputproperty #(make-text-checker "m.d.")
5031 #'extra-offset = #'(-3.5 . -4.5)
5039 If possible, avoid this feature: the semantics are not very clean, and
5040 the syntax and semantics are up for rewrite.
5045 @node Font selection
5046 @subsection Font selection
5048 The most common thing to change about the appearance of fonts is
5049 their size. The font size of a @internalsref{Voice},
5050 @internalsref{Staff} or @internalsref{Thread} context, can be easily
5051 changed by setting the @code{fontSize} property for that context:
5052 @lilypond[fragment,relative=1,verbatim,quote]
5053 c4 c4 \property Voice.fontSize = #-1
5056 This command will not change the size of variable symbols, such as
5057 beams or slurs. You can use this command to get smaller symbol for
5058 cue notes, but that involves some more subtleties. An elaborate
5059 example of those is in @inputfileref{input/test,cue-notes.ly}.
5067 The font used for printing a object can be selected by setting
5068 @code{font-name}, e.g.
5070 \property Staff.TimeSignature
5071 \set #'font-name = #"cmr17"
5073 You may use any font which is available to @TeX{}, such as foreign
5074 fonts or fonts that do not belong to the Computer Modern font family.
5075 Font selection for the standard fonts, @TeX{}'s Computer Modern fonts,
5076 can also be adjusted with a more fine-grained mechanism. By setting
5077 the object properties described below, you can select a different font.
5078 All three mechanisms work for every object that supports
5079 @code{font-interface}.
5083 A symbol indicating the general class of the typeface. Supported are
5084 @code{roman} (Computer Modern), @code{braces} (for piano staff
5085 braces), @code{music} (the standard music font), @code{ancient} (the
5086 ancient notation font) @code{dynamic} (font for dynamic signs) and
5090 A symbol indicating the shape of the font, there are typically several
5091 font shapes available for each font family. Choices are @code{italic},
5092 @code{caps} and @code{upright}
5095 A symbol indicating the series of the font. There are typically several
5096 font series for each font family and shape. Choices are @code{medium}
5099 @item font-relative-size
5100 A number indicating the size relative the standard size. For example,
5101 with 20pt staff height, relative size -1 corresponds to 16pt staff
5102 height, and relative size +1 corresponds to 23 pt staff height.
5104 @item font-design-size
5105 A number indicating the design size of the font.
5107 This is a feature of the Computer Modern Font: each point size has a
5108 slightly different design. Smaller design sizes are relatively wider,
5109 which enhances readability.
5112 For any of these properties, the value @code{*} (i.e. the @emph{symbol},
5113 @code{*}, entered as @code{#'*}), acts as a wildcard. This can be used
5114 to override default setting, which are always present. For example:
5116 \property Lyrics.LyricText \override #'font-series = #'bold
5117 \property Lyrics.LyricText \override #'font-family = #'typewriter
5118 \property Lyrics.LyricText \override #'font-shape = #'*
5121 @cindex @code{font-style}
5123 There are also pre-cooked font selection qualifiers. These are
5124 selected through the object property @code{font-style}. For example,
5125 the style @code{finger} selects family @code{number} and relative size
5126 @code{-3}. Styles available include @code{volta}, @code{finger},
5127 @code{tuplet}, @code{timesig}, @code{mmrest}, @code{script},
5128 @code{large}, @code{Large} and @code{dynamic}. The style sheets and
5129 tables for selecting fonts are located in @file{scm/font.scm}. Refer
5130 to this file for more information.
5132 @cindex magnification
5134 The size of the font may be scaled with the object property
5135 @code{font-magnification}. For example, @code{2.0} blows up all
5136 letters by a factor 2 in both directions.
5140 Relative size is not linked to any real size.
5142 There is no style sheet provided for other fonts besides the @TeX{}
5143 family, and the style sheet can not be modified easily.
5145 @cindex font selection
5146 @cindex font magnification
5147 @cindex @code{font-interface}
5151 @subsection Text markup
5156 @cindex typeset text
5158 LilyPond has an internal mechanism to typeset texts. You can access it
5159 with the keyword @code{\markup}. Within markup mode, you can enter texts
5160 similar to lyrics: simply enter them, surrounded by spaces.
5163 @lilypond[verbatim,fragment,relative=1]
5164 c1^\markup { hello }
5165 c1_\markup { hi there }
5166 c1^\markup { hi \bold there, is \italic anyone home? }
5169 @cindex font switching
5171 The line of the example demonstrates font switching commands. Notice
5172 that the command only apply to the first following word; enclose a set
5173 of texts with braces to apply a command to more words.
5175 \markup @{ \bold @{ hi there @} @}
5177 For clarity, you can also do this for single arguments, e.g.
5179 \markup @{ is \italic @{ anyone @} home @}
5182 @cindex font size, texts
5185 The following size commands set abolute sizes
5201 You can also make letter larger or smaller relative to their neighbors,
5202 with the commands @code{\larger} and @code{\smaller}.
5206 @cindex font style, for texts
5212 The following font change commands are defined:
5215 This changes to the font used for dynamic signs. Note that this font
5216 doesn't contain all characters of the alphabet.
5218 This changes to the font used for time signatures. It only contains
5219 numbers and a few punctuation marks.
5224 @cindex raising text
5225 @cindex lowering text
5227 @cindex translating text
5232 Raising and lowering texts can be done with @code{\super} and
5235 @lilypond[verbatim,fragment,relative=1]
5236 c1^\markup { E "=" mc \super "2" }
5241 If you want to give an explicit amount for lowering or raising, use
5242 @code{\raise}. This command takes a Scheme valued argument,
5243 @lilypond[verbatim,fragment,relative=1,quote]
5244 c1^\markup { C \small \raise #1.0 { "9/7+" }}
5246 The argument to @code{\raise} is the vertical displacement amount,
5247 measured in (global) staff spaces.
5249 Other commands taking single arguments include
5252 @item \bracket, \hbracket
5253 Bracket the argument markup.
5257 This is converted to a musical symbol, e.g. @code{\musicglyph
5258 #"accidentals-0"} will select the natural sign from the music font.
5259 See @ref{The Feta font} for a complete listing of the possible glyphs.
5261 This produces a single character, e.g. @code{\char #65} produces the
5264 @item \hspace #@var{amount}
5266 This produces a invisible object taking horizontal space.
5268 \markup @{ A \hspace #2.0 B @}
5270 will put extra space between A and B. Note that lilypond
5271 inserts space before and after @code{\hspace}.
5273 @item \fontsize #@var{size}
5275 This sets the relative font size, eg.
5277 A \fontsize #2 @{ B C @} D
5281 This will enlarge the B and the C by two steps.
5282 @item \translate #(cons @var{x} @var{y})
5284 This translates an object. It's first argument is a cons of numbers
5286 A \translate #(cons 2 -3) @{ B C @} D
5288 This moves `B C' 2 spaces to the right, and 3 down.
5290 @item \magnify #@var{mag}
5292 This sets the font magnification for the its argument. In the following
5293 example, the middle A will be 10% larger.
5295 A \magnify #1.1 @{ A @} A
5299 @item \override #(@var{key} . @var{value})
5301 This overrides a formatting property for its argument. The argument
5302 should be a key/value pair, e.g.
5304 m \override #'(font-family . math) m m
5308 In markup mode you can compose expressions, similar to mathematical
5309 expressions, XML documents and music expressions. The braces group
5310 notes into horizontal lines. Other types of lists also exist: you can
5311 stack expressions grouped with @code{<<}, and @code{>>} vertically with
5312 the command @code{\column}. Similarly, @code{\center} aligns texts by
5315 @lilypond[verbatim,fragment,relative=1]
5316 c1^\markup { \column << a bbbb c >> }
5317 c1^\markup { \center << a bbbb c >> }
5318 c1^\markup { \line << a b c >> }
5323 The markup mechanism is very flexible and extensible. Refer to
5324 @file{scm/new-markup.scm} for more information on extending the markup
5328 @cindex metronome mark
5330 One practical application of complicated markup is to fake a metronome
5334 eighthStem = \markup \combine
5335 \musicglyph #"flags-stem"
5336 \translate #'(0.0 . 3.5) \musicglyph #"flags-u3"
5337 eighthNote = \markup
5338 \override #'(word-space . 0.0)
5339 { \musicglyph #"noteheads-2"
5340 \translate #'(-0.05 . 0.1) \eighthStem }
5343 \notes\relative c'' {
5344 a1^\markup { \magnify #0.9 \eighthNote " = 64" }
5353 LilyPond does not account for kerning in its text formatting, so it
5354 spaces texts slightly too wide.
5356 Syntax errors for markup mode are confusing.
5360 @section Global layout
5362 The global layout determined by three factors: the page layout, the
5363 line breaks and the spacing. These all influence each other: The
5364 choice of spacing determines how densely each system of music is set,
5365 where line breaks breaks are chosen, and thus ultimately how many
5366 pages a piece of music takes. In this section we will explain how the
5367 lilypond spacing engine works, and how you can tune its results.
5369 Globally spoken, this procedure happens in three steps: first,
5370 flexible distances (``springs'') are chosen, based on durations. All
5371 possible line breaking combination are tried, and the one with the
5372 best results---a layout that has uniform density and requires as
5373 little stretching or cramping as possible---is chosen. When the score
5374 is processed by @TeX{}, page are filled with systems, and page breaks
5375 are chosen whenever the page gets full.
5378 * Vertical spacing::
5379 * Horizontal spacing::
5386 @node Vertical spacing
5387 @subsection Vertical spacing
5389 @cindex vertical spacing
5390 @cindex distance between staves
5391 @cindex staff distance
5392 @cindex between staves, distance
5393 @cindex staffs per page
5396 The height of each system is determined automatically by lilypond, to
5397 keep systems from bumping into each other, some minimum distances are
5398 set. By changing these, you can put staves closer together, and thus
5399 put more systems onto one page.
5401 Normally staves are stacked vertically. To make
5402 staves maintain a distance, their vertical size is padded. This is
5403 done with the property @code{minimumVerticalExtent}. It takes a pair
5404 of numbers, so if you want to make it smaller from its, then you could
5407 \property Staff.minimumVerticalExtent = #'(-4 . 4)
5409 This sets the vertical size of the current staff to 4 staff-space on
5410 either side of the center staff line. The argument of
5411 @code{minimumVerticalExtent} is interpreted as an interval, where the
5412 center line is the 0, so the first number is generally negative. you
5413 could also make the staff larger at the bottom by setting it to
5414 @code{(-6 . 4)}. The default value is @code{(-6 . 6)}.
5416 Vertical aligment of staves is handled by the
5417 @internalsref{VerticalAlignment} object, which lives at
5418 @internalsref{Score} level.
5420 The piano staves are handled a little differently: to make cross-staff
5421 beaming work correctly, it necessary that the distance between staves
5422 is fixed. This is also done with a @internalsref{VerticalAlignment}
5423 object, created in @internalsref{PianoStaff}, but a forced distance is
5424 set. This is done with the object property #'forced-distance. If you
5425 want to override this, use a @code{\translator} block as follows:
5429 VerticalAlignment \override #'forced-distance = #9
5432 This would bring the staves together at a distance of 9 staff spaces,
5433 and again this is measured from the center line of each staff.
5437 @node Horizontal spacing
5438 @subsection Horizontal Spacing
5440 The spacing engine translates differences in durations into
5441 stretchable distances (``springs'') of differing lengths. Longer
5442 durations get more space, shorter durations get less. The basis for
5443 assigning spaces to durations, is that the shortest durations get a
5444 fixed amount of space, and the longer durations get more: doubling a
5445 duration adds a fixed amount of space to the note.
5447 For example, the following piece contains lots of half, quarter and
5448 8th notes, the eighth note is followed by 1 note head width. The The
5449 quarter note is followed by 2 NHW, the half by 3 NHW, etc.
5450 @lilypond[fragment, verbatim, relative=1]
5451 c2 c4. c8 c4. c8 c4. c8 c8 c8 c4 c4 c4
5454 These two amounts of space are @code{shortest-duration-space}
5455 @code{spacing-increment}, object properties of
5456 @internalsref{SpacingSpanner}. Normally @code{spacing-increment} is
5457 set to 1.2, which is the width of a note head, and
5458 @code{shortest-duration-space} is set to 2.0, meaning that the
5459 shortest note gets 2 noteheads of space. For normal notes, this space
5460 is always counted from the left edge of the symbol, so the short notes
5461 in a score is generally followed by one note head width of space.
5463 If one would follow the above procedure exactly, then adding a single
5464 32th note to a score that uses 8th and 16th notes, would widen up the
5465 entire score a lot. The shortest note is no longer a 16th, but a 64th,
5466 thus adding 2 noteheads of space to every note. To prevent this, the
5467 shortest duration for spacing is not the shortest note in the score,
5468 but the most commonly found shortest note. Notes that are even
5469 shorter this are followed by a space that is proportonial to their
5470 duration relative to the common shortest note. So if we were to add
5471 only a few 16th notes to the example above, they would be followed by
5474 @lilypond[fragment, verbatim, relative=1]
5475 c2 c4. c8 c4. [c16 c] c4. c8 c8 c8 c4 c4 c4
5478 The most common shortest duration is determined as follows: in every
5479 measure, the shortest duration is determined. The most common short
5480 duration, is taken as the basis for the spacing, with the stipulation
5481 that this shortest duration should always be equal to or shorter than
5482 1/8th note. The shortest duration is printed when you run lilypond
5483 with @code{--verbose}. These durations may also be customized. If you
5484 set the @code{common-shortest-duration} in
5485 @internalsref{SpacingSpanner}, then this sets the base duration for
5486 spacing. The maximum duration for this base (normally 1/8th), is set
5487 through @code{base-shortest-duration}.
5489 @cindex @code{common-shortest-duration}
5490 @cindex @code{base-shortest-duration}
5491 @cindex @code{stem-spacing-correction}
5492 @cindex @code{spacing}
5494 In the introduction it was explained that stem directions influence
5495 spacing. This is controlled with @code{stem-spacing-correction} in
5496 @internalsref{NoteSpacing}. The @code{StaffSpacing} object contains the
5497 same property for controlling the stem/barline spacing. In the
5498 following example shows these corrections, once with default settings,
5499 and once with exaggerated corrections.
5505 \property Staff.NoteSpacing \override #'stem-spacing-correction
5507 \property Staff.StaffSpacing \override #'stem-spacing-correction
5512 \paper { linewidth = -1. } }
5515 @cindex SpacingSpanner, overriding properties
5517 The @internalsref{SpacingSpanner}, is score wide, so its properties
5518 must be overriden from the @code{\paper} block, e.g.
5520 \paper @{ \translator @{
5522 SpacingSpanner \override #'spacing-increment = #3.0
5529 Spacing is determined on a score wide basis. If you have a score that
5530 changes its character (measured in durations) half way during the
5531 score, the part containing the longer durations will be spaced too
5534 Generating optically pleasing spacing is black magic. LilyPond tries
5535 to deal with a number of frequent cases. Here is an example that is
5536 not handled correctly, due to the combination of chord collisions and
5541 \context PianoStaff \notes \transpose c c'' <
5542 \context Staff = up { s1 }
5543 \context Staff = down { [c8 c \translator Staff=up <<c d>> c
5544 \translator Staff=down c c c] }
5546 \paper { linewidth = -1 }
5553 @subsection Font size
5554 @cindex font size, setting
5555 @cindex staff size, setting
5556 @cindex @code{paper} file
5558 The Feta font provides musical symbols at seven different sizes.
5559 These fonts are 11 point, 13 point, 16 point, 19 pt, 20 point, 23
5560 point, and 26 point. The point size of a font is the height of the
5561 five lines in a staff when displayed in the font.
5563 Definitions for these sizes are the files @file{paperSZ.ly}, where
5564 @code{SZ} is one of 11, 13, 16, 19, 20, 23 and 26. If you include any
5565 of these files, the identifiers @code{paperEleven},
5566 @code{paperThirteen}, @code{paperSixteen}, @code{paperNineteen},
5567 @code{paperTwenty}, @code{paperTwentythree}, and @code{paperTwentysix}
5568 are defined respectively. The default @code{\paper} block is also
5569 set. These files should be imported at toplevel, i.e.
5571 \include "paper26.ly"
5575 The font definitions are generated using a Scheme function. For more
5576 details, see the file @file{scm/font.scm}.
5581 @subsection Line breaking
5584 @cindex breaking lines
5586 Line breaks are normally computed automatically. They are chosen such
5587 that it looks neither cramped nor loose, and that consecutive lines have
5590 Occasionally you might want to override the automatic breaks; you can
5591 do this by specifying @code{\break}. This will force a line break at
5592 this point. Line breaks can only occur at places where there are bar
5593 lines. If you want to have a line break where there is no bar line,
5594 you can force an invisible bar line by entering @code{\bar
5595 ""}. Similarly, @code{\noBreak} forbids a line break at a certain
5599 @cindex regular line breaks
5600 @cindex four bar music.
5602 If you want linebreaks at regular intervals, you can use the following:
5604 < \repeat 7 unfold @{ s1 * 4 \break @}
5608 This makes the following 28 measures (assuming 4/4 time) be broken every
5612 @subsection Page layout
5615 @cindex breaking pages
5617 @cindex @code{indent}
5618 @cindex @code{linewidth}
5620 The most basic settings influencing the spacing are @code{indent} and
5621 @code{linewidth}. They are set in the @code{\paper} block. They
5622 control the indentation of the first line of music, and the lengths of
5623 the lines. If @code{linewidth} set to a negative value, a single
5624 unjustified line is produced. A similar effect for scores that are
5625 longer than one line, can be produced by setting @code{raggedright} to
5626 true in the @code{\paper} block.
5629 @cindex vertical spacing
5631 The page layout process happens outside lilypond. Ly2dvi sets page
5632 layout instructions. Ly2dvi responds to the following variables in the
5633 @code{\paper} block. The variable @code{textheight} sets the total
5634 height of the music on each page. The spacing between systems is
5635 controlled with @code{interscoreline}, its default is 16pt.
5636 The distance between the score lines will stretch in order to fill the
5637 full page @code{interscorelinefill} is set to a positive number. In
5638 that case @code{interscoreline} specifies the minimum spacing.
5640 @cindex @code{textheight}
5641 @cindex @code{interscoreline}
5642 @cindex @code{interscorelinefill}
5644 If the variable @code{lastpagefill} is defined (that is, it gets any
5645 value assigned in the @code{\paper} block), systems are evenly
5646 distributed vertically on the last page. This might produce ugly
5647 results in case there are not enough systems on the last page. Note
5648 that @command{lilypond-book} ignores @code{lastpagefill}. See
5649 @ref{Integrating text and music with lilypond-book} for
5652 @cindex @code{lastpagefill}
5654 Page breaks are normally computed by @TeX{}, so they are not under
5655 direct control of LilyPond. However, you can insert a commands into
5656 the @file{.tex} output to instruct @TeX{} where to break pages. You
5657 can insert a @code{\newpage} from within lilypond. This is done by
5658 setting the @code{between-systems-strings} on the
5659 @internalsref{NonMusicalPaperColumn} where the system is broken.
5663 @cindex @code{papersize}
5665 To change the paper size, you must first set the
5666 @code{papersize} paper variable variable. Set it to
5667 the strings @code{a4}, @code{letter}, or @code{legal}. After this
5668 specification, you must set the font as described above. If you want
5669 the default font, then use the 20 point font.
5672 \paper@{ papersize = "a4" @}
5673 \include "paper16.ly"
5676 The file @code{paper16.ly} will now include a file named @file{a4.ly}, which
5677 will set the paper variables @code{hsize} and @code{vsize} (used by
5678 Lilypond and @code{ly2dvi})
5688 LilyPond can produce MIDI output. The performance lacks lots of
5689 interesting effects, such as swing, articulation, slurring, etc., but it
5690 is good enough for proof-hearing the music you have entered. Ties,
5691 dynamics and tempo changes are interpreted.
5693 Dynamic marks, crescendi and decrescendi translate into MIDI volume
5694 levels. Dynamic marks translate to a fixed fraction of the available
5695 MIDI volume range, crescendi and decrescendi make the the volume vary
5696 linearly between their two extremities. The fractions be adjusted by
5697 overriding the @code{absolute-volume-alist} defined in
5698 @file{scm/midi.scm}.
5700 For each type of musical instrument (that MIDI supports), a volume range
5701 can be defined. This gives you basic equalizer control, which can
5702 enhance the quality of the MIDI output remarkably. You can add
5703 instruments and ranges or change the default settings by overriding the
5704 @code{instrument-equalizer-alist} defined in @file{scm/midi.scm}.
5706 Both loudness controls are combined to produce the final MIDI volume.
5710 * MIDI instrument names::
5715 @subsection MIDI block
5719 The MIDI block is analogous to the paper block, but it is somewhat
5720 simpler. The @code{\midi} block can contain:
5724 @item a @code{\tempo} definition
5725 @item context definitions
5728 Assignments in the @code{\midi} block are not allowed.
5732 @cindex context definition
5734 Context definitions follow precisely the same syntax as within the
5735 \paper block. Translation modules for sound are called performers.
5736 The contexts for MIDI output are defined in @file{ly/performer-init.ly}.
5739 @node MIDI instrument names
5740 @subsection MIDI instrument names
5742 @cindex instrument names
5743 @cindex @code{Staff.midiInstrument}
5744 @cindex @code{Staff.instrument}
5746 The MIDI instrument name is set by the @code{Staff.midiInstrument}
5747 property or, if that property is not set, the @code{Staff.instrument}
5748 property. The instrument name should be chosen from the list in
5749 @ref{MIDI instruments}.
5753 If the selected string does not exactly match, then LilyPond uses the
5754 default (Grand Piano). It is not possible to select an instrument by