3 @c A menu is needed before every deeper *section nesting of @node's; run
4 @c M-x texinfo-all-menus-update
5 @c to automagically fill in these menus before saving changes
7 @c FIXME: singular vs. plural: Beams/Beam
15 @c .{Reference Manual}
17 @node Reference Manual
18 @chapter Reference Manual
21 <!--- @@WEB-TITLE@@=Reference Manual --->
24 This document describes GNU LilyPond and its input format. The last
25 revision of this document was made for LilyPond 1.6.2. It assumes
26 that you already know a little bit about LilyPond input (how to
27 make an input file, how to create sheet music from that input file,
28 etc). New users are encouraged to study the tutorial before reading
34 * Easier music entry::
53 @c FIXME: Note entry vs Music entry at top level menu is confusing.
59 Notes constitute the most basic elements of LilyPond input, but they do
60 not form valid input on their own without a @code{\score} block. However,
61 for the sake of brevity and simplicity we will generally omit
62 @code{\score} blocks and @code{\paper} declarations in this manual.
68 * Chromatic alterations::
73 * Automatic note splitting ::
75 * Easy Notation note heads ::
83 A note is printed by specifying its pitch and then its duration.
84 @lilypond[fragment,verbatim]
93 @cindex Note specification
95 @cindex entering notes
97 The verbose syntax for pitch specification is
101 \pitch @var{scmpitch}
104 where @var{scmpitch} is a pitch scheme object.
106 In Note and Chord mode, pitches may be designated by names. The default
107 names are the Dutch note names. The notes are specified by the letters
108 @code{a} through @code{g}, while the octave is formed with notes ranging
109 from @code{c} to @code{b}. The pitch @code{c} is an octave below
110 middle C and the letters span the octave above that C. Here's an example
111 which should make things more clear:
113 @lilypond[fragment,verbatim]
115 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
118 @cindex note names, Dutch
120 In Dutch, a sharp is formed by adding @code{-is} to the end of a pitch
121 name and a flat is formed by adding @code{-es}. Double sharps and double
122 flats are obtained by adding @code{-isis} or @code{-eses}. @code{aes}
123 and @code{ees} are contracted to @code{as} and @code{es} in Dutch, but
124 both forms are accepted.
126 LilyPond has predefined sets of note names for various other languages.
127 To use them, simply include the language specific init file. For
128 example: @code{\include "english.ly"}. The available language files and
129 the note names they define are:
134 Note Names sharp flat
135 nederlands.ly c d e f g a bes b -is -es
136 english.ly c d e f g a bf b -s/-sharp -f/-flat
137 deutsch.ly c d e f g a b h -is -es
138 norsk.ly c d e f g a b h -iss/-is -ess/-es
139 svenska.ly c d e f g a b h -iss -ess
140 italiano.ly do re mi fa sol la sib si -d -b
141 catalan.ly do re mi fa sol la sib si -d/-s -b
142 espanol.ly do re mi fa sol la sib si -s -b
151 The optional octave specification takes the form of a series of
152 single quote (`@code{'}') characters or a series of comma
153 (`@code{,}') characters. Each @code{'} raises the pitch by one
154 octave; each @code{,} lowers the pitch by an octave.
156 @lilypond[fragment,verbatim,center]
157 c' c'' es' g' as' gisis' ais'
160 @node Chromatic alterations
161 @subsection Chromatic alterations
163 Normally accidentals are printed automatically, but you may also
164 print them manually. A reminder accidental
165 @cindex reminder accidental
167 can be forced by adding an exclamation mark @code{!}
168 after the pitch. A cautionary accidental
169 @cindex cautionary accidental
170 @cindex parenthesized accidental
171 (an accidental within parentheses) can be obtained by adding the
172 question mark `@code{?}' after the pitch.
174 @lilypond[fragment,verbatim]
175 cis' cis' cis'! cis'?
179 The automatic production of accidentals can be tuned in many
180 ways. For more information, refer to @ref{Accidentals}.
187 Rests are entered like notes, with a ``note name'' of `@code{r}':
189 @lilypond[singleline,verbatim]
193 Whole bar rests, centered in middle of the bar, are specified using
194 @code{R} (capital R); see @ref{Multi measure rests}. See also
197 For some music, you may wish to explicitly specify the rest's vertical
198 position. This can be achieved by entering a note with the @code{\rest}
199 keyword appended. Rest collision testing will leave these rests alone.
201 @lilypond[singleline,verbatim]
211 @cindex Invisible rest
214 An invisible rest (also called a `skip') can be entered like a note
215 with note name `@code{s}' or with @code{\skip @var{duration}}:
217 @lilypond[singleline,verbatim]
221 @c FIXME: in Lyrics mode, we have " " and _
223 In Lyrics mode, invisible rests are entered using either `@code{" "}'
225 @lilypond[singleline,verbatim]
227 \context Lyrics \lyrics { lah2 di4 " " dah2 _4 di }
228 \notes\relative c'' { a2 a4 a a2 a4 a }
232 Note that the @code{s} syntax is only available in Note mode and Chord
233 mode. In other situations, you should use the @code{\skip} command,
234 which will work outside of those two modes:
236 @lilypond[singleline,verbatim]
239 { \time 4/8 \skip 2 \time 4/4 }
240 \notes\relative c'' { a2 a1 }
245 The skip command is merely an empty musical placeholder. It doesn't
246 produce any output, not even transparent output.
252 @subsection Durations
256 @cindex @code{\duration}
259 In Note, Chord, and Lyrics mode, durations are designated by numbers
260 and dots: durations are entered as their reciprocal values. For example,
261 a quarter note is entered using a @code{4} (since it's a 1/4 note), while
262 a half note is entered using a @code{2} (since it's a 1/2 note). For notes
263 longer than a whole you must use identifiers.
264 @c FIXME: what's an identifier? I don't think it's been introduced yet.
265 @c and if it has, I obviously skipped that part. - Graham
269 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
271 r1 r2 r4 r8 r16 r32 r64 r64
274 @lilypond[noindent,noquote]
276 \notes \relative c'' {
278 a1 a2 a4 a8 a16 a32 a64 a64
280 r1 r2 r4 r8 r16 r32 r64 r64
285 \remove "Clef_engraver"
286 \remove "Staff_symbol_engraver"
287 \remove "Time_signature_engraver"
288 \consists "Pitch_squash_engraver"
295 If the duration is omitted then it is set to the previously entered
296 duration. At the start of parsing, a quarter note is assumed. The
297 duration can be followed by dots (`@code{.}') in order to obtain dotted
301 @lilypond[fragment,verbatim,center]
302 a' b' c''8 b' a'4 a'4. b'4.. c'8.
307 You can alter the length of duration by a fraction @var{N/M}
308 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
309 won't affect the appearance of the notes or rests produced.
311 @lilypond[fragment,verbatim]
312 a'2*2 b'4*2 a'8*4 a'4*3/2 gis'4*3/2 a'4*3/2 a'4
315 Durations can also be produced through GUILE extension mechanism.
316 @lilypond[verbatim,fragment]
317 c'\duration #(ly:make-duration 2 1)
323 Dot placement for chords is not perfect. In some cases, dots overlap:
325 \context Voice { <f,4. c'' d e f> }
336 A tie connects two adjacent note heads of the same pitch. The tie in
337 effect extends the length of a note. Ties should not be confused with
338 slurs, which indicate articulation, or phrasing slurs, which indicate
339 musical phrasing. A tie is entered using the tilde symbol `@code{~}'.
341 @lilypond[fragment,verbatim,center]
342 e' ~ e' <c' e' g'> ~ <c' e' g'>
345 When a tie is applied to a chord, all note heads (whose pitches match) are
346 connected. If you try to tie together chords that have no common pitches,
347 no ties will be created.
349 If you want less ties created for a chord, you can set
350 @code{Voice.sparseTies} to true. In this case, a single tie is used
351 for every tied chord.
352 @lilypond[fragment,verbatim,center]
353 \property Voice.sparseTies = ##t
354 <c' e' g'> ~ <c' e' g'>
357 In its meaning a tie is just a way of extending a note duration, similar
358 to the augmentation dot: the following example are two ways of notating
359 exactly the same concept.
361 @lilypond[fragment, singleline]
362 \time 3/4 c'2. c'2 ~ c'4
364 If you need to tie notes over bars, it may be easier to use
365 @ref{Automatic note splitting}.
367 See also @seeinternals{Tie}.
372 At present, the tie is represented as a separate event, temporally
373 located in between the notes. Tying only a subset of the note heads
374 of a chord is not supported in a simple way. It can be achieved by
375 moving the tie-engraver into the Thread context and turning on and off
378 Switching staves when a tie is active will not work.
380 @node Automatic note splitting
381 @subsection Automatic note splitting
382 @c FIXME: This subsection doesn't belong in @ref{Note entry}.
384 LilyPond can automatically converting long notes to tied notes. This
385 is done by replacing the @code{Note_heads_engraver} by the
386 @code{Completion_heads_engraver}.
388 @lilypond[verbatim,noindent,noquote]
390 \notes\relative c'{ \time 2/4
391 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
395 \remove "Note_heads_engraver"
396 \consists "Completion_heads_engraver"
400 This engraver splits all running notes at the bar line, and inserts
401 ties. One of its uses is to debug complex scores: if the measures are
402 not entirely filled, then the ties exactly show how much each measure
407 Not all durations (especially those containing tuplets) can be
408 represented exactly; the engraver will not insert tuplets.
415 @cindex @code{\times}
417 Tuplets are made out of a music expression by multiplying all durations
420 @cindex @code{\times}
422 \times @var{fraction} @var{musicexpr}
425 The duration of @var{musicexpr} will be multiplied by the fraction.
426 In the sheet music, the fraction's denominator will be printed over
427 the notes, optionally with a bracket. The most common tuplet is the
428 triplet in which 3 notes have the length of 2, so the notes are 2/3
429 of their written length:
431 @lilypond[fragment,verbatim,center]
432 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
435 The property @code{tupletSpannerDuration} specifies how long each bracket
436 should last. With this, you can make lots of tuplets while typing
437 @code{\times} only once, saving you lots of typing.
439 @lilypond[fragment, relative, singleline, verbatim]
440 \property Voice.tupletSpannerDuration = #(ly:make-moment 1 4)
441 \times 2/3 { c'8 c c c c c }
444 The format of the number is determined by the property
445 @code{tupletNumberFormatFunction}. The default prints only the
446 denominator, but if you set it to the Scheme function
447 @code{fraction-tuplet-formatter}, Lilypond will print @var{num}:@var{den}
451 @cindex @code{tupletNumberFormatFunction}
452 @cindex tuplet formatting
454 See also @seeinternals{TupletBracket}.
458 Nested tuplets are not formatted automatically. In this case, outer
459 tuplet brackets should be moved automatically.
461 @node Easy Notation note heads
462 @subsection Easy Notation note heads
464 @cindex easy notation
467 A entirely different type of note head is the "easyplay" note head: a
468 note head that includes a note name. It is used in some publications by
469 Hal-Leonard Inc. music publishers.
471 @lilypond[singleline,verbatim,26pt]
473 \notes { c'2 e'4 f' | g'1 }
474 \paper { \translator { \EasyNotation } }
478 Note that @code{EasyNotation} overrides a @internalsref{Score} context. You
479 probably will want to print it with magnification or a large font size to
480 make it more readable. To print with magnification, you must create a dvi
481 (with @file{ly2dvi}) and then enlarge it with something like @file{dvips -x
482 2000 file.dvi}. See @file{man dvips} for details. To print with a larger
483 font, see @ref{Font Size}.
489 If you view the result with Xdvi, then staff lines will show through
490 the letters. Printing the PostScript file obtained with ly2dvi does
491 produce the correct result.
494 @node Easier music entry
495 @section Easier music entry
498 * Graphical interfaces::
502 * Skipping corrected music::
505 When entering music with LilyPond, it is easy to introduce errors. This
506 section deals with tricks and features that help you enter music, and
507 find and correct mistakes.
509 @node Graphical interfaces
510 @subsection Graphical interfaces
513 @cindex graphical interface
520 One way to avoid entering notes using the keyboard is to use a
521 graphical user interface. The following programs are known to have
522 a lilypond export option:
526 Denemo was once intended as
527 a LilyPond graphical user interface. It run on Gnome/GTK.
530 @uref{http://denemo.sourceforge.net/}
534 Noteedit, a graphical score editor that runs under KDE/Qt.
536 @uref{http://rnvs.informatik.tu-chemnitz.de/~jan/noteedit/noteedit.html,}
540 RoseGarden was once the inspiration for naming LilyPond. Nowadays it
541 has been rewritten from scratch and supports LilyPond export as of
545 @uref{http://rosegarden.sf.net/}
549 Another option is to enter the music using your favorite MIDI
550 sequencer, and then import it using midi2ly. midi2ly is described in
551 @ref{Invoking midi2ly}.
555 @node Relative octaves
556 @subsection Relative octaves
558 @cindex relative octave specification
560 Octaves are specified by adding @code{'} and @code{,} to pitch names.
561 When you copy existing music, it is easy to accidentally put a pitch in
562 the wrong octave and hard to find such an error. To prevent these
563 errors, LilyPond features octave entry.
565 @cindex @code{\relative}
567 \relative @var{startpitch} @var{musicexpr}
570 The octave of notes that appear in @var{musicexpr} are calculated as
571 follows: If no octave changing marks are used, the basic interval
572 between this and the last note is always taken to be a fourth or less
573 (This distance is determined without regarding alterations; a
574 @code{fisis} following a @code{ceses} will be put above the
577 The octave changing marks @code{'} and @code{,} can be added to raise or
578 lower the pitch by an extra octave. Upon entering relative mode, an
579 absolute starting pitch must be specified that will act as the
580 predecessor of the first note of @var{musicexpr}.
582 Entering music that changes octave frequently is easy in relative mode.
583 @lilypond[fragment,singleline,verbatim,center]
589 And octave changing marks are used for intervals greater than a fourth.
590 @lilypond[fragment,verbatim,center]
595 If the preceding item is a chord, the first note of the chord is used
596 to determine the first note of the next chord. However, other notes
597 within the second chord are determined by looking at the immediately
600 @lilypond[fragment,verbatim,center]
607 @cindex @code{\notes}
609 The pitch after the @code{\relative} contains a note name. To parse
610 the pitch as a note name, you have to be in note mode, so there must
611 be a surrounding @code{\notes} keyword (which is not
614 The relative conversion will not affect @code{\transpose},
615 @code{\chords} or @code{\relative} sections in its argument. If you
616 want to use relative within transposed music, you must place an
617 additional @code{\relative} inside the @code{\transpose}.
622 @subsection Bar check
626 @cindex @code{barCheckSynchronize}
630 Whenever a bar check is encountered during interpretation, a warning
631 message is issued if it doesn't fall at a measure boundary. This can
632 help you find errors in the input. Depending on the value of
633 @code{barCheckSynchronize}, the beginning of the measure will be
634 relocated, so this can also be used to shorten measures.
636 A bar check is entered using the bar symbol, @code{|}:
638 \time 3/4 c2 e4 | g2.
643 @cindex skipTypesetting
645 Failed bar checks are most often caused by entering incorrect
646 durations. Incorrect durations often completely garble up the score,
647 especially if it is polyphonic, so you should start correcting the score
648 by scanning for failed bar checks and incorrect durations. To speed up
649 this process, you can use @code{skipTypesetting} (See @ref{Skipping
652 @c . {Point and click}
653 @node Point and click
654 @subsection Point and click
655 @cindex poind and click
657 Point and click lets you find notes in the input by clicking on them in
658 the Xdvi window. This makes it very easy to find input that causes some
659 error in the sheet music.
661 To use it, you need the following software
663 @item A dvi viewer that supports src specials.
665 @item Xdvi, version 22.36 or newer. Available from
666 @uref{ftp://ftp.math.berkeley.edu/pub/Software/TeX/xdvi.tar.gz,ftp.math.berkeley.edu}.
668 Note that most @TeX{} distributions ship with xdvik, which is always
669 a few versions behind the official Xdvi. To find out which xdvi you
670 are running, try @code{xdvi -version} or @code{xdvi.bin -version}.
671 @item KDVI. A dvi viewer for KDE. You need KDVI from KDE 3.0 or
672 newer. Enable option @emph{Inverse search} in the menu @emph{Settings}.
681 @item An editor with a client/server interface (or a lightweight GUI
687 @item Emacs. Emacs is an extensible text-editor. It is available from
688 @uref{http://www.gnu.org/software/emacs/}. You need version 21 to use
691 @c move this elsewhere?
693 LilyPond also comes with support files for emacs: lilypond-mode for
694 emacs provides indentation, syntax coloring and handy compile
695 short-cuts. If lilypond-mode is not installed on your platform, then
696 refer to the installation instructions for more information
700 @cindex lilypond-mode for emacs
701 @cindex syntax coloring
703 @item XEmacs. Xemacs is very similar to emacs.
707 @item NEdit. NEdit runs under Windows, and Unix.
708 It is available from @uref{http://www.nedit.org}.
712 @item GVim. GVim is a GUI variant of VIM, the popular VI
713 clone. It is available from @uref{http://www.vim.org}.
722 Xdvi must be configured to find the @TeX{} fonts and music
723 fonts. Refer to the Xdvi documentation for more information.
725 To use point-and-click, add one of these lines to the top of your .ly
728 #(ly:set-point-and-click 'line)
730 @cindex line-location
732 When viewing, Control-Mousebutton 1 will take you to the originating
733 spot in the @file{.ly} file. Control-Mousebutton 2 will show all
736 If you correct large files with point-and-click, be sure to start
737 correcting at the end of the file. When you start at the top, and
738 insert one line, all following locations will be off by a line.
741 For using point-and-click with emacs, add the following
742 In your emacs startup file (usually @file{~/.emacs}),
747 Make sure that the environment variable @var{XEDITOR} is set to
749 emacsclient --no-wait +%l %f
751 @cindex @var{XEDITOR}
752 If you use xemacs instead of emacs, you use @code{(gnuserve-start)} in
753 your @file{.emacs}, and set @code{XEDITOR} to @code{gnuclient -q +%l %f}
755 For using Vim, set @code{XEDITOR} to @code{gvim --remote +%l %f}, or
756 use this argument with xdvi's @code{-editor} option.
759 For using NEdit, set @code{XEDITOR} to @code{nc -noask +%l %f}, or
760 use this argument with xdvi's @code{-editor} option.
762 If can also make your editor jump to the exact location of the note
763 you clicked. This is only supported on Emacs and VIM. Users of Emacs version
764 20 must apply the patch @file{emacsclient.patch}. Users of version 21
765 must apply @file{server.el.patch} (version 21.2 and earlier). At the
766 top of the @code{ly} file, replace the @code{set-point-and-click} line
767 with the following line,
769 #(ly:set-point-and-click 'line-column)
771 @cindex line-colomn-location
772 and set @code{XEDITOR} to @code{emacsclient --no-wait +%l:%c %f}. Vim
773 users can set @var{XEDITOR} to @code{gvim --remote +:%l:norm%c| %f}.
779 When you convert the @TeX{} file to PostScript using @code{dvips}, it
780 will complain about not finding @code{src:X:Y} files. These complaints
781 are harmless, and can be ignored.
783 @node Skipping corrected music
784 @subsection Skipping corrected music
786 The property @code{Score.skipTypesetting} can be used to switch on and
787 off typesetting completely during the interpretation phase. When
788 typesetting is switched off, the music is processed much more quickly.
789 You can use this to skip over the parts of a score that you have already
792 @lilypond[fragment,singleline,verbatim]
794 \property Score.skipTypesetting = ##t
796 \property Score.skipTypesetting = ##f
804 @section Staff notation
806 This section deals with music notation that occurs on staff level,
807 such as keys, clefs and time signatures.
809 @cindex Staff notation
821 @subsection Staff symbol
824 @cindex adjusting staff symbol
825 @cindex StaffSymbol, using \property
826 @cindex staff lines, setting number of
829 The lines of the staff symbol are formed by the
830 @internalsref{StaffSymbol} object. This object is created at the moment
831 that their context is created. You can not change the appearance of
832 the staff symbol by using @code{\override} or @code{\set}. At the
833 moment that @code{\property Staff} is interpreted, a Staff context is
834 made, and the StaffSymbol is created before any @code{\override} is
835 effective. You can deal with this either overriding properties in a
836 @code{\translator} definition, or by using @code{\outputproperty}.
841 If you end a staff half way a piece, the staff symbol may not end
842 exactly on the barline.
847 @subsection Key signature
852 Setting or changing the key signature is done with the @code{\key}
855 @code{\key} @var{pitch} @var{type}
858 @cindex @code{\minor}
859 @cindex @code{\major}
860 @cindex @code{\minor}
861 @cindex @code{\ionian}
862 @cindex @code{\locrian}
863 @cindex @code{\aeolian}
864 @cindex @code{\mixolydian}
865 @cindex @code{\lydian}
866 @cindex @code{\phrygian}
867 @cindex @code{\dorian}
869 Here, @var{type} should be @code{\major} or @code{\minor} to get
870 @var{pitch}-major or @var{pitch}-minor, respectively.
871 The standard mode names @code{\ionian},
872 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
873 @code{\phrygian}, and @code{\dorian} are also defined.
875 This command sets the context property @code{Staff.keySignature}.
876 Non-standard key signatures can be specified by setting this property
879 The printed signature is a @internalsref{KeySignature} object, typically
880 created in @internalsref{Staff} context.
882 @cindex @code{keySignature}
889 The clef can be set or changed with the @code{\clef} command:
890 @lilypond[fragment,verbatim]
891 \key f\major c''2 \clef alto g'2
894 Supported clef-names include
895 @c Moved standard clefs to the top /MB
897 @item treble, violin, G, G2
906 G clef on 1st line, so-called French violin clef
921 By adding @code{_8} or @code{^8} to the clef name, the clef is
922 transposed one octave down or up, respectively. Note that you have to
923 enclose @var{clefname} in quotes if you use underscores or digits in the
929 The object for this symbol is @internalsref{Clef}.
932 This command is equivalent to setting @code{clefGlyph},
933 @code{clefPosition} (which controls the Y position of the clef),
934 @code{centralCPosition} and @code{clefOctavation}. A clef is created
935 when any of these properties are changed.
938 @c . {Time signature}
940 @subsection Time signature
941 @cindex Time signature
945 The time signature is set or changed by the @code{\time}
947 @lilypond[fragment,verbatim]
948 \time 2/4 c'2 \time 3/4 c'2.
951 The actual symbol that's printed can be customized with the @code{style}
952 property. Setting it to @code{#'()} uses fraction style for 4/4 and
956 The object for this symbol is @internalsref{TimeSignature}. There are
957 many more options for its layout. They are selected through the
958 @code{style} object property. See @file{input/test/time.ly} for more
961 This command sets the property @code{timeSignatureFraction},
962 @code{beatLength} and @code{measureLength} in the @code{Timing}
963 context, which is normally aliased to @internalsref{Score}. The property
964 @code{timeSignatureFraction} determine where bar lines should be
965 inserted, and how automatic beams should be generated. Changing the
966 value of @code{timeSignatureFraction} also causes a time signature
967 symbol to be printed.
974 @cindex partial measure
975 @cindex measure, partial
976 @cindex shorten measures
977 @cindex @code{\partial}
979 Partial measures, for example in upbeats, are entered using the
980 @code{\partial} command:
981 @lilypond[fragment,verbatim]
982 \partial 4* 5/16 c'16 c4 f16 a'2. ~ a'8. a'16 | g'1
985 The syntax for this command is
987 \partial @var{duration}
989 This is internally translated into
991 \property Timing.measurePosition = -@var{length of duration}
994 The property @code{measurePosition} contains a rational number
995 indicating how much of the measure has passed at this point.
998 @node Unmetered music
999 @subsection Unmetered music
1001 Bar lines and bar numbers are calculated automatically. For unmetered
1002 music (e.g. cadenzas), this is not desirable. The commands
1003 @code{\cadenzaOn} and @code{\cadenzaOff} can be used to switch off the
1006 @lilypond[fragment,relative,singleline,verbatim]
1014 The property @code{Score.timing} can be used to switch off this
1019 @subsection Bar lines
1023 @cindex measure lines
1026 Bar lines are inserted automatically, but if you need a special type
1027 of barline, you can force one using the @code{\bar} command:
1028 @lilypond[fragment,verbatim] c4 \bar "|:" c4
1031 The following bar types are available
1032 @lilypond[fragment, relative, singleline, verbatim]
1044 You are encouraged to use @code{\repeat} for repetitions. See
1047 In scores with many staves, the barlines are automatically placed at
1048 top level, and they are connected between different staves of a
1049 @internalsref{StaffGroup}:
1050 @lilypond[fragment, verbatim]
1051 < \context StaffGroup <
1052 \context Staff = up { e'4 d'
1055 \context Staff = down { \clef bass c4 g e g } >
1056 \context Staff = pedal { \clef bass c2 c2 } >
1059 The objects that are created at @internalsref{Staff} level. The name is
1060 @internalsref{BarLine}.
1062 The command @code{\bar @var{bartype}} is a short cut for
1063 doing @code{\property Score.whichBar = @var{bartype}}
1064 Whenever @code{whichBar} is set to a string, a bar line of that type is
1065 created. @code{whichBar} is usually set automatically: at the start of
1066 a measure it is set to @code{defaultBarType}. The contents of
1067 @code{repeatCommands} is used to override default measure bars.
1069 @code{whichBar} can also be set directly, using @code{\property} or
1070 @code{\bar }. These settings take precedence over the automatic
1071 @code{whichBar} settings.
1074 @cindex Bar_line_engraver
1076 @cindex repeatCommands
1077 @cindex defaultBarType
1086 The easiest way to enter such fragments with more than one voice on a
1087 staff is to split chords using the separator @code{\\}. You can use
1088 it for small, short-lived voices (make a chord of voices) or for
1091 @lilypond[verbatim,fragment]
1092 \context Voice = VA \relative c'' {
1093 c4 < { f d e } \\ { b c2 } > c4 < g' \\ b, \\ f \\ d >
1097 The separator causes @internalsref{Voice} contexts to be instantiated,
1098 bearing the names @code{"1"}, @code{"2"}, etc.
1100 Sometimes, it is necessary to instantiate these contexts by hand: For
1101 Instantiate a separate Voice context for each part, and use
1102 @code{\voiceOne}, up to @code{\voiceFour} to assign a stem directions
1103 and horizontal shift for each part.
1106 @lilypond[singleline, verbatim]
1108 \context Staff < \context Voice = VA { \voiceOne cis2 b }
1109 \context Voice = VB { \voiceThree b4 ais ~ ais4 gis4 }
1110 \context Voice = VC { \voiceTwo fis4~ fis4 f ~ f } >
1113 The identifiers @code{\voiceOne} to @code{\voiceFour} set directions
1114 ties, slurs and stems, and set shift directions.
1116 If you want more than four voices, you can also manually set
1117 horizontal shifts and stem directions, as is shown in the following example:
1118 @lilypond[fragment, verbatim]
1119 \context Staff \notes\relative c''<
1120 \context Voice=one {
1121 \shiftOff \stemUp e4
1123 \context Voice=two {
1124 \shiftOn \stemUp cis
1126 \context Voice=three {
1127 \shiftOnn \stemUp ais
1129 \context Voice=four {
1130 \shiftOnnn \stemUp fis
1136 Normally, note heads with a different number of dots are not merged, but
1137 if you set the object property @code{merge-differently-dotted}, they are:
1138 @lilypond[verbatim,fragment,singleline]
1141 \property Staff.NoteCollision \override
1142 #'merge-differently-dotted = ##t
1144 } \\ { [g'8. f16] [g'8. f'16] }
1148 Similarly, you can merge half note heads with eighth notes, by setting
1149 @code{merge-differently-headed}:
1150 @lilypond[fragment, relative=2,verbatim]
1153 \property Staff.NoteCollision
1154 \override #'merge-differently-headed = ##t
1155 c8 c4. } \\ { c2 c2 } >
1158 LilyPond also vertically shifts rests that are opposite of a stem.
1160 @lilypond[singleline,fragment,verbatim]
1161 \context Voice < c''4 \\ r4 >
1164 See also @internalsref{NoteCollision} and @internalsref{RestCollision}
1168 Resolving collisions is a very intricate subject, and LilyPond only
1169 handles a few situations. When it can not cope, you are advised to use
1170 @code{force-hshift} of the @internalsref{NoteColumn} object and pitched
1171 rests to override typesetting decisions.
1176 Beams are used to group short notes into chunks that are aligned with
1177 the metrum. They are inserted automatically in most cases.
1179 @lilypond[fragment,verbatim, relative=2]
1180 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1183 If you're not satisfied with the automatic beaming, you can enter the
1184 beams explicitly. If you have beaming patterns that differ from the
1185 defaults, you can also set the patterns for automatic beamer.
1187 See also @internalsref{Beam}.
1190 @cindex Automatic beams
1191 @subsection Manual beams
1192 @cindex beams, manual
1196 In some cases it may be necessary to override LilyPond's automatic
1197 beaming algorithm. For example, the auto beamer will not beam over
1198 rests or bar lines, If you want that, specify the begin and end point
1199 manually using a @code{[} before the first beamed note and a @code{]}
1200 after the last note:
1202 @lilypond[fragment,relative,verbatim]
1204 r4 [r8 g' a r8] r8 [g | a] r8
1208 @cindex @code{stemLeftBeamCount}
1210 Normally, beaming patterns within a beam are determined automatically.
1211 When this mechanism fouls up, the properties
1212 @code{Voice.stemLeftBeamCount} and @code{Voice.stemRightBeamCount} can
1213 be used to control the beam subdivision on a stem. If you set either
1214 property, its value will be used only once, and then it is erased.
1216 @lilypond[fragment,relative,verbatim]
1219 [f8 r16 \property Voice.stemLeftBeamCount = #1 f g a]
1222 @cindex @code{stemRightBeamCount}
1225 The property @code{subdivideBeams} can be set in order to subdivide
1226 all 16th or shorter beams at beat positions. This accomplishes the
1227 same effect as twiddling with @code{stemLeftBeamCount} and
1228 @code{stemRightBeamCount}, but it take less typing.
1233 \property Voice.subdivideBeams = ##t
1235 [c32 c c c c c c c c c c c c c c c]
1236 \property Score.beatLength = #(ly:make-moment 1 8)
1237 [c32 c c c c c c c c c c c c c c c]
1239 @lilypond[noindent,noquote]
1241 \notes \relative c' {
1243 \property Voice.subdivideBeams = ##t
1245 [c32 c c c c c c c c c c c c c c c]
1246 \property Score.beatLength = #(ly:make-moment 1 8)
1247 [c32 c c c c c c c c c c c c c c c]
1251 @cindex subdivideBeams
1253 Kneed beams are inserted automatically, when a large gap between two
1254 adjacent beamed notes is detected. This behavior can be tuned through
1255 the object property @code{auto-knee-gap}.
1257 @cindex beams, kneed
1259 @cindex auto-knee-gap
1263 @c TODO -> why this ref? Document?
1264 @cindex @code{neutral-direction}
1268 Auto knee beams can not be used together with hara kiri staves.
1272 The Automatic beamer does not put @strong{unfinished} beams on the
1273 last notes of a score.
1275 Formatting of ties is a difficult subject. LilyPond often does not
1276 give optimal results.
1279 * Setting automatic beam behavior ::
1283 @no de Beam typography
1284 @sub section Beam typography
1286 One of the strong points of LilyPond is how beams are formatted. Beams
1287 are quantized, meaning that the left and right endpoints beams start
1288 exactly on staff lines. Without quantization, small wedges of white
1289 space appear between the beam and staff line, and this looks untidy.
1291 Beams are also slope-damped: melodies that go up or down should also
1292 have beams that go up or down, but the slope of the beams should be
1293 less than the slope of the notes themselves.
1295 Some beams should be horizontal. These are so-called concave beams.
1297 [TODO: some pictures.]
1300 @c . {Automatic beams}
1301 @node Setting automatic beam behavior
1302 @subsection Setting automatic beam behavior
1304 @cindex @code{autoBeamSettings}
1305 @cindex @code{(end * * * *)}
1306 @cindex @code{(begin * * * *)}
1307 @cindex automatic beams, tuning
1308 @cindex tuning automatic beaming
1310 In normal time signatures, automatic beams can start on any note but can
1311 only end in a few positions within the measure: beams can end on a beat,
1312 or at durations specified by the properties in
1313 @code{Voice.autoBeamSettings}. The defaults for @code{autoBeamSettings}
1314 are defined in @file{scm/auto-beam.scm}.
1316 The value of @code{autoBeamSettings} is changed using
1317 @code{\override} and unset using @code{\revert}:
1319 \property Voice.autoBeamSettings \override #'(@var{BE} @var{P} @var{Q} @var{N} @var{M}) = @var{dur}
1320 \property Voice.autoBeamSettings \revert #'(@var{BE} @var{P} @var{Q} @var{N} @var{M})
1322 Here, @var{BE} is the symbol @code{begin} or @code{end}. It determines
1323 whether the rule applies to begin or end-points. The quantity
1324 @var{P}/@var{Q} refers to the length of the beamed notes (and `@code{*
1325 *}' designates notes of any length), @var{N}/@var{M} refers to a time
1326 signature (wildcards, `@code{* *}' may be entered to designate all time
1329 For example, if you want automatic beams to end on every quarter note,
1330 you can use the following:
1332 \property Voice.autoBeamSettings \override
1333 #'(end * * * *) = #(ly:make-moment 1 4)
1335 Since the duration of a quarter note is 1/4 of a whole note, it is
1336 entered as @code{(ly:make-moment 1 4)}.
1338 The same syntax can be used to specify beam starting points. In this
1339 example, automatic beams can only end on a dotted quarter note.
1341 \property Voice.autoBeamSettings \override
1342 #'(end * * * *) = #(ly:make-moment 3 8)
1344 In 4/4 time signature, this means that automatic beams could end only on
1345 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
1346 3/8 has passed within the measure).
1348 You can also restrict rules to specific time signatures. A rule that
1349 should only be applied in @var{N}/@var{M} time signature is formed by
1350 replacing the second asterisks by @var{N} and @var{M}. For example, a
1351 rule for 6/8 time exclusively looks like
1353 \property Voice.autoBeamSettings \override
1354 #'(begin * * 6 8) = ...
1357 If you want a rule to apply to certain types of beams, you can use the
1358 first pair of asterisks. Beams are classified according to the shortest
1359 note they contain. For a beam ending rule that only applies to beams
1360 with 32nd notes (and no shorter notes), you would use @code{(end 1
1364 @c Automatic beams can not be put on the last note in a score.
1366 If a score ends while an automatic beam has not been ended and is still
1367 accepting notes, this last beam will not be typeset at all.
1369 @cindex automatic beam generation
1371 @cindex @code{Voice.autoBeaming}
1374 For melodies that have lyrics, you may want to switch off
1375 automatic beaming. This is done by setting @code{Voice.autoBeaming} to
1381 It is not possible to specify beaming parameters for beams with mixed
1382 durations, that differ from the beaming parameters of all separate
1383 durations, i.e., you'll have to specify manual beams to get:
1385 @lilypond[singleline,fragment,relative,noverbatim]
1386 \property Voice.autoBeamSettings
1387 \override #'(end * * * *) = #(ly:make-moment 3 8)
1388 \time 12/8 c'8 c c c16 c c c c c [c c c c] c8 c c4
1390 It is not possible to specify beaming parameters that act differently in
1391 different parts of a measure. This means that it is not possible to use
1392 automatic beaming in irregular meters such as @code{5/8}.
1395 @section Accidentals
1397 This section describes how to change the way that LilyPond automatically
1398 inserts accidentals before the running notes.
1401 * Using the predefined accidental macros::
1402 * Defining your own accidental typesettings::
1405 @node Using the predefined accidental macros
1406 @subsection Using the predefined accidental macros
1407 The constructs for describing the accidental typesetting rules are
1408 quite hairy, so non-experts should stick to the macros defined in
1409 @file{ly/property-init.ly}.
1410 @cindex @file{property-init.ly}
1412 The macros operate on the ``Current'' context (see @ref{Context properties}). This
1413 means that the macros shuold normally be invoked right after the
1414 creation of the context in which the accidental typesetting described
1415 by the macro is to take effect. I.e. if you want to use
1416 piano-accidentals in a pianostaff then you issue
1417 @code{\pianoAccidentals} first thing after the creation of the piano
1421 \notes \relative c'' <
1422 \context Staff = sa @{ cis4 d e2 @}
1423 \context GrandStaff <
1425 \context Staff = sb @{ cis4 d e2 @}
1426 \context Staff = sc @{ es2 c @}
1428 \context Staff = sd @{ es2 c @}
1432 @lilypond[singleline]
1434 \notes \relative c'' <
1435 \context Staff = sa { cis4 d e2 }
1436 \context GrandStaff <
1438 \context Staff = sb { cis4 d e2 }
1439 \context Staff = sc { es2 c }
1441 \context Staff = sd { es2 c }
1446 minimumVerticalExtent = #'(-4.0 . 4.0)
1454 @item \defaultAccidentals
1455 @cindex @code{\defaultAccidentals}
1456 This is the default typesetting behaviour. It should correspond
1457 to 18th century common practice: Accidentals are
1458 remembered to the end of the measure in which they occur and
1459 only on their own octave.
1461 @item \voiceAccidentals
1462 @cindex @code{\voiceAccidentals}
1463 The normal behaviour is to remember the accidentals on
1465 This macro, however, typesets accidentals individually for each
1467 Apart from that the rule is similar to
1468 @code{\defaultAccidentals}.
1470 Warning: This leads to some weird and often unwanted results
1471 because accidentals from one voice DO NOT get cancelled in other
1473 @lilypond[singleline,relative,fragment,verbatim]
1476 \context Voice=va { \voiceOne es g }
1477 \context Voice=vb { \voiceTwo c, e }
1480 Hence you should only use @code{\voiceAccidentals}
1481 if the voices are to be read solely by
1482 individual musicians. if the staff should be readable also
1483 by one musician/conductor then you should use
1484 @code{\modernVoiceAccidentals} or @code{\modernVoiceCautionaries}
1487 @item \modernAccidentals
1488 @cindex @code{\modernAccidentals}
1489 This rule should correspond to the common practice in the 20th
1491 The rule is a bit more complex than @code{\defaultAccidentals}:
1492 You get all the same accidentals, but temporary
1493 accidentals also get cancelled in other octaves. Further more,
1494 in the same octave, they also get cancelled in the following measure:
1495 @lilypond[singleline,fragment,verbatim]
1497 cis' c'' cis'2 | c'' c'
1500 @item \modernCautionaries
1501 @cindex @code{\modernCautionaries}
1502 This rule is similar to @code{\modernAccidentals}, but the
1503 ``extra'' accidentals (the ones not typeset by
1504 @code{\defaultAccidentals}) are typeset as cautionary accidentals
1505 (i.e. in reduced size):
1506 @lilypond[singleline,fragment,verbatim]
1508 cis' c'' cis'2 | c'' c'
1511 @item \modernVoiceAccidentals
1512 @cindex @code{\modernVoiceAccidentals}
1513 Multivoice accidentals to be read both by musicians playing one voice
1514 and musicians playing all voices.
1516 Accidentals are typeset for each voice, but they ARE cancelled
1517 across voices in the same @internalsref{Staff}.
1519 @item \modernVoiceCautionaries
1520 @cindex @code{\modernVoiceCautionaries}
1521 The same as @code{\modernVoiceAccidentals}, but with the
1522 extra accidentals (the ones not typeset by
1523 @code{\voiceAccidentals}) typeset as cautionaries.
1524 Notice that even though all accidentals typeset by
1525 @code{\defaultAccidentals} ARE typeset by this macro then some
1526 of them are typeset as cautionaries.
1528 @item \pianoAccidentals
1529 @cindex @code{\pianoAccidentals}
1530 20th century practice for piano notation. Very similar to
1531 @code{\modernAccidentals} but accidentals also get cancelled
1532 across the staves in the same @internalsref{GrandStaff} or
1533 @internalsref{PianoStaff}.
1535 @item \pianoCautionaries
1536 @cindex @code{\pianoCautionaries}
1537 As @code{\pianoAccidentals} but with the extra accidentals
1538 typeset as cationaries.
1541 @cindex @code{\noResetKey}
1542 Same as @code{\defaultAccidentals} but with accidentals lasting
1543 ``forever'' and not only until the next measure:
1544 @lilypond[singleline,fragment,verbatim,relative]
1549 @item \forgetAccidentals
1550 @cindex @code{\forgetAccidentals}
1551 This is sort of the opposite of @code{\noResetKey}: Accidentals
1552 are not remembered at all - and hence all accidentals are
1553 typeset relative to the key signature, regardless of what was
1554 before in the music:
1555 @lilypond[singleline,fragment,verbatim,relative]
1557 \key d\major c4 c cis cis d d dis dis
1561 @node Defining your own accidental typesettings
1562 @subsection Defining your own accidental typesettings
1564 This section must be considered gurus-only, and hence it must be
1565 sufficient with a short description of the system and a reference to
1566 the internal documentation.
1568 The idea of the algorithm is to try several different rules and then
1569 use the rule that gives the highest number of accidentals.
1570 Each rule cosists of
1573 In which context is the rule applied. I.e. if context is
1574 @internalsref{Score} then all staves share accidentals, and if
1575 context is @internalsref{Staff} then all voices in the same
1576 staff share accidentals, but staves don't - like normally.
1578 Whether the accidental changes all octaves or only the current
1581 Over how many barlines the accidental lasts.
1582 If lazyness is @code{-1} then the accidental is forget
1583 immidiately, and if lazyness is @code{#t} then the accidental
1587 As described in the internal documentation of
1588 @reng{Accidental_engraver}, the properties @code{autoAccidentals} and
1589 @code{autoCautionaries} contain lists of rule descriptions. Notice
1590 that the contexts must be listed from in to out - that is
1591 @internalsref{Thread} before @internalsref{Voice},
1592 @internalsref{Voice} before @internalsref{Staff}, etc.
1593 see the macros in @file{ly/property-init.ly} for examples of how the
1598 Currently the simultaneous notes are considered to be entered in
1599 sequential mode. This means that in a chord the accidentals are
1600 typeset as if the notes in the chord happened one at a time - in the
1601 order in which they appear in the input file.
1603 Of course this is only a problem when you have simultainous notes
1604 which accidentals should depend on each other.
1605 Notice that the problem only occurs when using non-default accidentals
1606 - as the default accidentals only depend on other accidentals on the
1607 same staff and same pitch and hence cannot depend on other
1610 This example shows two examples of the same music giving different
1611 accidentals depending on the order in which the notes occur in the
1614 @lilypond[singleline,fragment,verbatim]
1615 \property Staff.autoAccidentals = #'( Staff (any-octave . 0) )
1616 cis'4 <c'' c'> r2 | cis'4 <c' c''> r2 | <cis' c''> r | <c'' cis'> r |
1619 The only solution is to manually insert the problematic
1620 accidentals using @code{!} and @code{?}.
1622 @node Expressive marks
1623 @section Expressive marks
1638 A slur indicates that notes are to be played bound or @emph{legato}.
1639 They are entered using parentheses:
1640 @lilypond[fragment,verbatim,center]
1641 f'()g'()a' [a'8 b'(] a'4 g'2 )f'4
1644 See also @seeinternals{Slur}.
1646 Slurs avoid crossing stems, and are generally attached to note heads.
1647 However, in some situations with beams, slurs may be attached to stem
1648 ends. If you want to override this layout you can do this through the
1649 object property @code{attachment} of @internalsref{Slur} in
1650 @internalsref{Voice} context It's value is a pair of symbols, specifying
1651 the attachment type of the left and right end points.
1653 @lilypond[fragment,relative,verbatim]
1655 \property Voice.Stem \set #'length = #5.5
1657 \property Voice.Slur \set #'attachment = #'(stem . stem)
1661 If a slur would strike through a stem or beam, the slur will be moved
1662 away upward or downward. If this happens, attaching the slur to the
1663 stems might look better:
1665 @lilypond[fragment,relative,verbatim]
1668 \property Voice.Slur \set #'attachment = #'(stem . stem)
1673 Similarly, the curvature of a slur is adjusted to stay clear of note
1674 heads and stems. When that would increase the curvature too much, the
1675 slur is reverted to its default shape. The threshold for this
1676 decision is in @internalsref{Slur}'s object property @code{beautiful}.
1677 It is loosely related to the enclosed area between the slur and the
1678 notes. Usually, the default setting works well, but in some cases you
1679 may prefer a curved slur when LilyPond decides for a vertically moved
1680 one. You can indicate this preference by increasing the
1681 @code{beautiful} value:
1683 @lilyp ond[verbatim,singleline,relative]
1685 c16( a' f' a a f a, )c,
1686 c( a' f' a a f d, )c
1687 \property Voice.Slur \override #'beautiful = #5.0
1688 c( a' f' a a f d, )c
1694 Producing nice slurs is a difficult problem, and LilyPond currently
1695 uses a simple, empiric method to produce slurs. In some cases, the
1696 results of this method are ugly.
1699 This is reflected by the
1700 @code{beautiful} property, which it is an arbitrary parameter in the
1701 slur formatter. Useful values can only be determined by trial and
1705 @cindex Adjusting slurs
1707 @node Phrasing slurs
1708 @subsection Phrasing slurs
1710 @cindex phrasing slurs
1711 @cindex phrasing marks
1713 A phrasing slur (or phrasing mark) connects chords and is used to
1714 indicate a musical sentence. It is started using @code{\(} and @code{\)}
1717 @lilypond[fragment,verbatim,center,relative]
1718 \time 6/4 c' \( d () e f () e \) d
1721 Typographically, the phrasing slur behaves almost exactly like a normal
1722 slur. See also @seeinternals{PhrasingSlur}. But although they behave
1723 similarily to normal slurs, phrasing slurs count as different objects.
1724 A @code{\slurUp} will have no effect on a phrasing slur; instead, you
1725 should use @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1726 @code{\phrasingSlurBoth}.
1728 Note that the commands
1729 @code{\slurUp}, @code{\slurDown}, and @code{\slurBoth} will only affect
1730 normal slurs and not phrasing slurs.
1733 @subsection Breath marks
1735 Breath marks are entered using @code{\breathe}. See also
1736 @seeinternals{BreathingSign}.
1738 @lilypond[fragment,relative]
1747 @cindex beats per minute
1748 @cindex metronome marking
1750 Metronome settings can be entered as follows:
1752 @cindex @code{\tempo}
1754 \tempo @var{duration} = @var{perminute}
1757 For example, @code{\tempo 4 = 76} requests output with 76 quarter notes
1762 The tempo setting is not printed, but is only used in the MIDI
1763 output. You can trick lily into producing a metronome mark,
1764 though. Details are in @ref{Text markup}.
1769 @subsection Text spanners
1770 @cindex Text spanners
1772 Some textual indications, e.g. rallentando or accelerando, often extend
1773 over many measures. This is indicated by following the text with a
1774 dotted line. You can create such texts using text spanners. The syntax
1780 LilyPond will respond by creating a @internalsref{TextSpanner} object (typically
1781 in @internalsref{Voice} context). The string to be printed, as well as the
1782 style is set through object properties.
1784 An application---or rather, a hack---is to fake octavation indications.
1785 @lilypond[fragment,relative,verbatim]
1786 \relative c' { a''' b c a
1787 \property Voice.TextSpanner \set #'type = #'dotted-line
1788 \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
1789 \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
1790 \property Staff.centralCPosition = #-13
1791 a\startTextSpan b c a \stopTextSpan }
1809 @subsection Articulations
1810 @cindex Articulations
1812 @cindex articulations
1816 A variety of symbols can appear above and below notes to indicate
1817 different characteristics of the performance. They are added to a note
1818 by adding a dash and the the character signifying the
1819 articulation. They are demonstrated here.
1820 @lilypond[singleline]
1822 \notes \context Voice {
1823 \property Voice.TextScript \set #'font-family = #'typewriter
1824 \property Voice.TextScript \set #'font-shape = #'upright
1830 c''4-^_"c-\\^{ }" s4
1836 The script is automatically placed, but if you need to force
1837 directions, you can use @code{_} to force them down, or @code{^} to
1839 @lilypond[fragment, verbatim]
1844 Other symbols can be added using the syntax
1845 @var{note}@code{-\}@var{name}. Again, they can be forced up or down
1846 using @code{^} and @code{_}.
1850 @cindex staccatissimo
1859 @cindex organ pedal marks
1868 @cindex prallmordent
1872 @cindex thumb marking
1879 \property Score.LyricText \override #'font-family =#'typewriter
1880 \property Score.LyricText \override #'font-shape = #'upright
1881 \context Staff \notes {
1882 c''-\accent c''-\marcato c''-\staccatissimo c''^\fermata
1883 c''-\stopped c''-\staccato c''-\tenuto c''-\portato
1885 c''-\downbow c''^\lheel c''-\rheel c''^\ltoe
1886 c''-\rtoe c''-\turn c''-\open c''-\flageolet
1887 c''-\reverseturn c''-\trill c''-\prall c''-\mordent
1888 c''-\prallprall c''-\prallmordent c''-\upprall c''-\downprall
1889 c''-\upmordent c''-\downmordent c''-\pralldown c''-\prallup
1890 c''-\lineprall c''-\thumb c''-\segno c''-\coda
1892 \context Lyrics \lyrics {
1893 accent__ marcato__ staccatissimo__ fermata
1894 stopped__ staccato__ tenuto__ portato
1896 downbow__ lheel__ rheel__ ltoe
1897 rtoe__ turn__ open__ flageolet
1898 reverseturn__ trill__ prall__ mordent
1899 prallprall__ prallmordent__ uprall__ downprall
1900 upmordent__ downmordent__ pralldown__ prallup__
1901 lineprall__ thumb__ segno__ coda
1914 Fingering instructions can also be entered in this shorthand. For
1915 finger changes, use markup texts:
1917 @lilypond[verbatim, singleline, fragment]
1918 c'4-1 c'4-2 c'4-3 c'4-4
1927 See also @seeinternals{Script} and @seeinternals{Fingering}.
1931 All of these note ornaments appear in the printed output but have no
1932 effect on the MIDI rendering of the music.
1934 Unfortunately, there is no support for adding fingering instructions or
1935 ornaments to individual note heads. Some hacks exist, though. See
1936 @file{input/test/script-horizontal.ly}.
1941 @subsection Text scripts
1942 @cindex Text scripts
1944 In addition, it is possible to place arbitrary strings of text or markup
1945 text (see @ref{Text markup}) above or below notes by using a string:
1948 By default, these indications do not influence the note spacing, but
1949 by using the command @code{\fatText}, the widths will be taken into
1952 @lilypond[fragment,singleline,verbatim] \relative c' {
1953 c4^"longtext" \fatText c4_"longlongtext" c4 }
1956 It is possible to use @TeX{} commands in the strings, but this should be
1957 avoided because it makes it impossible for LilyPond to compute the
1958 exact length of the string, which may lead to collisions. Also, @TeX{}
1959 commands won't work with direct PostScript output.
1960 @c (see @ref{PostScript output}).
1962 Text scripts are created in form of @internalsref{TextScript} objects, in
1963 @internalsref{Voice} context.
1965 @ref{Text markup} describes how to change the font or access
1966 special symbols in text scripts.
1971 @subsection Grace notes
1975 @cindex @code{\grace}
1979 Grace notes are ornaments that are written out
1980 @lilypond[relative=2,verbatim,ifragment] c4 \grace c16 c4 \grace {
1984 In normal notation, grace notes are supposed to take up no logical
1985 time in a measure. Such an idea is practical for normal notation, but
1986 is not strict enough to put it into a program. The model that LilyPond
1987 uses for grace notes internally is that all timing is done in two
1990 Every point in musical time consists of two rational numbers: one
1991 denotes the logical time, one denotes the grace timing. The above
1992 example is shown here with timing tuples.
1995 \score { \notes \relative c''{
1996 c4^"(0,0)" \grace c16_" "_"(1/4,-1/16)" c4^"(1/4,0)" \grace {
1997 [c16_"(2/4,-1/8)" d16^"(2/4,-1/16)" ] } c4_" "_"(2/4,0)"
1999 \paper { linewidth = 8.\cm }
2003 The advantage of this approach is that you can use almost any lilypond
2004 construction together with grace notes, for example slurs and clef
2005 changes may appear halfway in between grace notes:
2007 @lilypond[relative=2,verbatim,fragment]
2008 c4 \grace { [ c16 c, \clef bass c, b(] } )c4
2011 The placement of these grace notes is synchronized between different
2012 staves, using this grace timing.
2014 @lilypond[relative=2,verbatim,fragment]
2015 < \context Staff = SA { e4 \grace { c16 d e f } e4 }
2016 \context Staff = SB { c4 \grace { g8 b } c4 } >
2020 Unbeamed eighth notes and shorter by default have a slash through the
2021 stem. This can be controlled with object property @code{stroke-style} of
2022 @internalsref{Stem}. The change in formatting is accomplished by
2023 inserting @code{\startGraceMusic} before handling the grace notes, and
2024 @code{\stopGraceMusic} after finishing the grace notes.
2025 You can add to these definitions to globally change grace note
2026 formatting. The standard definitions are in @file{ly/grace-init.ly}.
2028 [TODO discuss Scheme functionality.]
2031 Notice how the @code{\override} is carefully matched with a @code{\revert}.
2036 @lilypond[fragment,verbatim]
2037 \relative c'' \context Voice {
2038 \grace c8 c4 \grace { [c16 c16] } c4
2040 \property Voice.Stem \override #'stroke-style = #'()
2042 \property Voice.Stem \revert #'stroke-style
2049 If you want to end a note with a grace note, then the standard trick
2050 is to put the grace notes before a phantom ``space note'', e.g.
2051 @lilypond[fragment,verbatim, relative=2]
2054 { s2 \grace { [c16 d] } } >
2059 A @code{\grace} section has some default values, and LilyPond will
2060 use those default values unless you specify otherwise inside the
2061 @code{\grace} section. For example, if you specify \slurUp
2062 @emph{before} your @code{\grace} section, a slur which starts inside
2063 the @code{\grace} won't be forced up, even if the slur ends outside
2064 of the @code{\grace}. Note the difference between the first and
2065 second bars in this example:
2067 @lilypond[fragment,verbatim]
2068 \relative c'' \context Voice {
2087 Grace notes can not be used in the smallest size (@file{paper11.ly}).
2089 Grace note synchronization can also lead to surprises. Staff notation,
2090 such as key signatures, barlines, etc. are also synchronized. Take
2091 care when you mix staves with grace notes and staves without.
2093 @lilypond[relative=2,verbatim,fragment]
2094 < \context Staff = SA { e4 \bar "|:" \grace c16 d4 }
2095 \context Staff = SB { c4 \bar "|:" d4 } >
2098 Grace sections should only be used within sequential music
2099 expressions. Nesting, juxtaposing, or ending sequential music with a
2100 grace section is not supported, and might produce crashes or other
2105 @subsection Glissando
2108 @cindex @code{\glissando}
2110 A glissando line can be requested by attaching a @code{\glissando} to
2113 @lilypond[fragment,relative,verbatim]
2119 Printing of an additional text (such as @emph{gliss.}) must be done
2120 manually. See also @seeinternals{Glissando}.
2126 @subsection Dynamics
2139 @cindex @code{\ffff}
2149 Absolute dynamic marks are specified using an identifier after a
2150 note: @code{c4-\ff}. The available dynamic marks are: @code{\ppp},
2151 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2152 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2153 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2155 @lilypond[verbatim,singleline,fragment,relative]
2156 c'\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2162 @cindex @code{\decr}
2163 @cindex @code{\rced}
2169 A crescendo mark is started with @code{\cr} and terminated with
2170 @code{\rc} (the textual reverse of @code{cr}). A decrescendo mark is
2171 started with @code{\decr} and terminated with @code{\rced}. There are
2172 also shorthands for these marks. A crescendo can be started with
2173 @code{\<} and a decrescendo can be started with @code{\>}. Either one
2174 can be terminated with @code{\!}. Note that @code{\!} must go before
2175 the last note of the dynamic mark whereas @code{\rc} and @code{\rced} go
2176 after the last note. Because these marks are bound to notes, if you
2177 want several marks during one note, you have to use spacer notes.
2179 @lilypond[fragment,verbatim,center]
2180 c'' \< \! c'' d'' \decr e'' \rced
2181 < f''1 { s4 s4 \< \! s4 \> \! s4 } >
2184 You can also use a text saying @emph{cresc.} instead of hairpins. Here
2185 is an example how to do it:
2187 @lilypond[fragment,relative=2,verbatim]
2188 c4 \cresc c4 \endcresc c4
2195 You can also supply your own texts:
2196 @lilypond[fragment,relative,verbatim]
2198 \property Voice.crescendoText = "cresc. poco"
2199 \property Voice.crescendoSpanner = #'dashed-line
2206 Dynamics are objects of @internalsref{DynamicText} and
2207 @internalsref{Hairpin}. Vertical positioning of these symbols is
2208 handled by the @internalsref{DynamicLineSpanner} object. If you want to
2209 adjust padding or vertical direction of the dynamics, you must set
2210 properties for the @internalsref{DynamicLineSpanner} object. Predefined
2211 identifiers to set the vertical direction are \dynamicUp and
2214 @cindex direction, of dynamics
2215 @cindex @code{\dynamicDown}
2216 @cindex @code{\dynamicUp}
2224 @cindex @code{\repeat}
2226 To specify repeats, use the @code{\repeat} keyword. Since repeats
2227 should work differently when played or printed, there are a few
2228 different variants of repeats.
2232 Repeated music is fully written (played) out. Useful for MIDI
2233 output, and entering repetitive music.
2236 This is the normal notation: Repeats are not written out, but
2237 alternative endings (voltas) are printed, left to right.
2240 Alternative endings are written stacked. This has limited use but may be
2241 used to typeset two lines of lyrics in songs with repeats, see
2242 @file{input/star-spangled-banner.ly}.
2248 Make beat or measure repeats. These look like percent signs.
2254 * Repeats and MIDI::
2255 * Manual repeat commands::
2257 * Tremolo subdivisions::
2262 @subsection Repeat syntax
2264 The syntax for repeats is
2267 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2270 If you have alternative endings, you may add
2271 @cindex @code{\alternative}
2273 \alternative @code{@{} @var{alternative1}
2275 @var{alternative3} @dots{} @code{@}}
2277 where each @var{alternative} is a music expression.
2279 Normal notation repeats are used like this:
2280 @lilypond[fragment,verbatim]
2282 \repeat volta 2 { c'4 d' e' f' }
2283 \repeat volta 2 { f' e' d' c' }
2286 With alternative endings:
2287 @lilypond[fragment,verbatim]
2289 \repeat volta 2 {c'4 d' e' f'}
2290 \alternative { {d'2 d'} {f' f} }
2293 Folded repeats look like this:
2296 @lilypond[fragment,verbatim]
2298 \repeat fold 2 {c'4 d' e' f'}
2299 \alternative { {d'2 d'} {f' f} }
2303 If you don't give enough alternatives for all of the repeats, then
2304 the first alternative is assumed to be repeated often enough to equal
2305 the specified number of repeats.
2307 @lilypond[fragment,verbatim]
2311 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2312 \alternative { { g4 g g } { a | a a a a | b2. } }
2317 @node Repeats and MIDI
2318 @subsection Repeats and MIDI
2320 @cindex expanding repeats
2322 For instructions on how to unfoldi repeats for MIDI output, see
2323 the example file @file{input/test/unfold-all-repeats.ly}.
2328 Notice that timing information is not remembered at the start of an
2329 alternative, so you have to reset timing information after a repeat,
2330 e.g. using a bar-check (See @ref{Bar check}), setting
2331 @code{Score.measurePosition} or entering @code{\partial}. Slurs or ties
2332 are also not repeated.
2334 It is possible to nest @code{\repeat}s, although this probably is only
2335 meaningful for unfolded repeats.
2337 Folded repeats offer little more over simultaneous music.
2339 @node Manual repeat commands
2340 @subsection Manual repeat commands
2342 @cindex @code{repeatCommands}
2344 The property @code{repeatCommands} can be used to control the layout of
2345 repeats. Its value is a Scheme list of repeat commands, where each repeat
2353 @item (volta . @var{text})
2354 Print a volta bracket saying @var{text}.
2356 Stop a running volta bracket
2359 @lilypond[verbatim, fragment]
2361 \property Score.repeatCommands = #'((volta "93") end-repeat)
2363 \property Score.repeatCommands = #'((volta #f))
2368 Repeats brackets are @internalsref{VoltaBracket} objects.
2370 @node Tremolo repeats
2371 @subsection Tremolo repeats
2372 @cindex tremolo beams
2374 To place tremolo marks between notes, use @code{\repeat} with tremolo
2376 @lilypond[verbatim,center,singleline]
2378 \context Voice \notes\relative c' {
2379 \repeat "tremolo" 8 { c16 d16 }
2380 \repeat "tremolo" 4 { c16 d16 }
2381 \repeat "tremolo" 2 { c16 d16 }
2382 \repeat "tremolo" 4 c16
2387 Tremolo beams are @internalsref{Beam} objects. Single stem tremolos are
2388 @internalsref{StemTremolo}. The single stem tremolo @emph{must} be
2389 entered without @code{@{} and @code{@}}.
2393 Only powers of two and undotted notes are supported repeat counts.
2395 @node Tremolo subdivisions
2396 @subsection Tremolo subdivisions
2397 @cindex tremolo marks
2398 @cindex @code{tremoloFlags}
2400 Tremolo marks can be printed on a single note by adding
2401 `@code{:}[@var{length}]' after the note. The length must be at least 8.
2402 A @var{length} value of 8 gives one line across the note stem. If the
2403 length is omitted, then then the last value (stored in
2404 @code{Voice.tremoloFlags}) is used.
2406 @lilypond[verbatim,fragment,center]
2407 c'2:8 c':32 | c': c': |
2413 Tremolos in this style do not carry over into the MIDI output.
2416 @node Measure repeats
2417 @subsection Measure repeats
2419 @cindex percent repeats
2420 @cindex measure repeats
2422 In the @code{percent} style, a note pattern can be repeated. It is
2423 printed once, and then the pattern is replaced with a special sign.
2424 Patterns of a one and two measures are replaced by percent-like signs,
2425 patterns that divide the measure length are replaced by slashes.
2427 @lilypond[verbatim,singleline]
2428 \context Voice { \repeat "percent" 4 { c'4 }
2429 \repeat "percent" 2 { c'2 es'2 f'4 fis'4 g'4 c''4 }
2433 The signs are represented by these objects: @internalsref{RepeatSlash} and
2434 @internalsref{PercentRepeat} and @internalsref{DoublePercentRepeat}.
2438 You can not nest percent repeats, e.g. by filling in the first measure
2439 with slashes, and repeating that measure with percents.
2441 @node Rhythmic music
2442 @section Rhythmic music
2444 Sometimes you might want to show only the rhythm of a melody. This can
2445 be done with the rhythmic staff. All pitches of notes on such a staff
2446 are squashed, and the staff itself looks has a single staff line:
2448 @lilypond[fragment,relative,verbatim]
2449 \context RhythmicStaff {
2451 c4 e8 f g2 | r4 g r2 | g1:32 | r1 |
2456 * Percussion staves::
2459 @node Percussion staves
2460 @subsection Percussion staves
2463 To typeset more than one piece of percussion to be played by the same
2464 musician one typically uses a multiline staff where each staff
2465 position refers to a specific piece of percussion.
2467 LilyPond is shipped with a bunch of scheme functions which allows you
2468 to do this fairly easily.
2470 The system is based on the general midi drum-pitches.
2471 In order to use the drum pitches you include
2472 @file{ly/drumpitch-init.ly}. This file defines the pitches from the scheme
2473 variable @code{drum-pitch-names} - which definition can be read in
2474 @file{scm/drums.scm}. You see that each piece of percussion has a full
2475 name and an abbreviated name - and you may freely select whether to
2476 refer to the full name or the abbreviation in your music definition.
2478 To typeset the music on a staff you apply the scheme function
2479 @code{drums->paper} to the percussion music. This function takes a
2480 list of percussion instrument names, notehead scripts and staff
2481 positions (that is: pitches relative to the C-clef) and uses this to
2482 transform the input music by moving the pitch, changing the notehead
2483 and (optionally) adding a script:
2484 @lilypond[singleline,verbatim]
2485 \include "drumpitch-init.ly"
2486 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2487 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2489 \apply #(drums->paper 'drums) \context Staff <
2491 \context Voice = up { \voiceOne \up }
2492 \context Voice = down { \voiceTwo \down }
2497 In the above example the music was transformed using the list @code{'drums}.
2498 Currently the following lists are defined in @file{scm/drums.scm}:
2501 To typeset a typical drum kit on a five-line staff.
2504 \include "drumpitch-init.ly"
2505 nam = \lyrics { cymc cyms cymr hh hhc hho hhho hhp cb hc
2506 bd sn ss tomh tommh tomml toml tomfh tomfl }
2507 mus = \notes { cymc cyms cymr hh hhc hho hhho hhp cb hc
2508 bd sn ss tomh tommh tomml toml tomfh tomfl s16 }
2511 \apply #(drums->paper 'drums) \context Staff <
2515 \context Lyrics \nam
2518 linewidth = 100.0\mm
2521 \remove Bar_engraver
2522 \remove Time_signature_engraver
2523 minimumVerticalExtent = #'(-4.0 . 5.0)
2527 \remove Stem_engraver
2533 Notice that the scheme supports six different toms.
2534 If you are using fewer toms then you simply select the toms that produce
2535 the desired result - i.e. to get toms on the three middle lines you
2536 use @code{tommh}, @code{tomml} and @code{tomfh}.
2538 Because the general midi contain no rimshots we use the sidestick for
2539 this purpose instead.
2541 To typeset timbales on a two line staff.
2542 @lilypond[singleline]
2543 \include "drumpitch-init.ly"
2544 nam = \lyrics { timh ssh timl ssl cb }
2545 mus = \notes { timh ssh timl ssl cb s16 }
2548 \apply #(drums->paper 'timbales) \context Staff <
2552 \context Lyrics \nam
2557 \remove Bar_engraver
2558 \remove Time_signature_engraver
2559 StaffSymbol \override #'line-count = #2
2560 StaffSymbol \override #'staff-space = #2
2561 minimumVerticalExtent = #'(-3.0 . 4.0)
2565 \remove Stem_engraver
2572 To typeset congas on a two line staff.
2573 @lilypond[singleline]
2574 \include "drumpitch-init.ly"
2575 nam = \lyrics { cgh cgho cghm ssh cgl cglo cglm ssl }
2576 mus = \notes { cgh cgho cghm ssh cgl cglo cglm ssl s16 }
2579 \apply #(drums->paper 'congas) \context Staff <
2583 \context Lyrics \nam
2588 \remove Bar_engraver
2589 \remove Time_signature_engraver
2590 StaffSymbol \override #'line-count = #2
2591 StaffSymbol \override #'staff-space = #2
2592 minimumVerticalExtent = #'(-3.0 . 4.0)
2596 \remove Stem_engraver
2602 To typeset bongos on a two line staff.
2603 @lilypond[singleline]
2604 \include "drumpitch-init.ly"
2605 nam = \lyrics { boh boho bohm ssh bol bolo bolm ssl }
2606 mus = \notes { boh boho bohm ssh bol bolo bolm ssl s16 }
2609 \apply #(drums->paper 'bongos) \context Staff <
2613 \context Lyrics \nam
2618 \remove Bar_engraver
2619 \remove Time_signature_engraver
2620 StaffSymbol \override #'line-count = #2
2621 StaffSymbol \override #'staff-space = #2
2622 minimumVerticalExtent = #'(-3.0 . 4.0)
2626 \remove Stem_engraver
2632 To typeset all kinds of simple percussion on one line staves.
2633 @lilypond[singleline]
2634 \include "drumpitch-init.ly"
2635 nam = \lyrics { tri trio trim gui guis guil cb cl tamb cab mar hc }
2636 mus = \notes { tri trio trim gui guis guil cb cl tamb cab mar hc s16 }
2639 \apply #(drums->paper 'percussion) \context Staff <
2643 \context Lyrics \nam
2648 \remove Bar_engraver
2649 \remove Time_signature_engraver
2650 StaffSymbol \override #'line-count = #1
2651 minimumVerticalExtent = #'(-2.0 . 3.0)
2655 \remove Stem_engraver
2662 If you don't like any of the predefined lists you can define your own
2663 list at the top of your file:
2665 @lilypond[singleline, verbatim]
2667 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2668 (snare default #f ,(ly:make-pitch 0 1 0))
2669 (hihat cross #f ,(ly:make-pitch 0 5 0))
2670 (pedalhihat xcircle "stopped" ,(ly:make-pitch 0 5 0))
2671 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2673 \include "drumpitch-init.ly"
2674 up = \notes { hh8 hh hh hh hhp4 hhp }
2675 down = \notes { bd4 sn bd toml8 toml }
2677 \apply #(drums->paper 'mydrums) \context Staff <
2679 \context Voice = up { \voiceOne \up }
2680 \context Voice = down { \voiceTwo \down }
2685 To use a modified existing list instead of building your own from
2686 scratch you can append your modifications to the start of the existing
2690 #(define mydrums (append `(
2691 (bassdrum default #f ,(ly:make-pitch -1 2 0))
2692 (lowtom diamond #f ,(ly:make-pitch -1 6 0))
2696 @c FIXME: Too many levels of headers when using subsubsections.
2697 @c Perhaps junk subsection ``Percussion staves''
2698 @subsubsection Percussion staves with normal staves
2699 When you include @file{drumpitch-init.ly} then the default pitches
2700 are overridden so that you after the inclusion cannot use the common
2701 dutch pitch names anymore. Hence you might wan't to reinclude
2702 @file{nederlands.ly} after the drum-pattern-definitions:
2703 @lilypond[singleline,verbatim]
2704 \include "drumpitch-init.ly"
2705 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2706 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2707 \include "nederlands.ly"
2708 bass = \notes \transpose c c,, { a4. e8 r e g e }
2711 \apply #(drums->paper 'drums) \context Staff = drums <
2713 \context Voice = up { \voiceOne \up }
2714 \context Voice = down { \voiceTwo \down }
2716 \context Staff = bass { \clef "F_8" \bass }
2721 @subsubsection Percussion midi output
2722 In order to produce correct midi output you need to produce two score
2723 blocks - one for the paper and one for the midi.
2724 To use the percussion channel you set the property @code{instrument}
2725 to @code{'drums}. Because the drum-pitches themself are similar to the
2726 general midi pitches all you have to do is to insert the voices with
2727 none of the scheme functions to get the correct midi output:
2731 \apply #(drums->paper 'mydrums) \context Staff <
2733 \context Voice = up @{ \voiceOne \up @}
2734 \context Voice = down @{ \voiceTwo \down @}
2740 \property Staff.instrument = #'drums
2749 This scheme is to be considered a temporary implementation. Even
2750 though the scheme will probably keep on working then the future might
2751 bring some other way of typesetting drums, and probably
2752 there will be made no great efforts in keeping things downwards
2757 @section Piano music
2759 Piano music is an odd type of notation. Piano staves are two normal
2760 staves coupled with a brace. The staves are largely independent, but
2761 sometimes voices can cross between the two staves. The
2762 @internalsref{PianoStaff} is especially built to handle this cross-staffing
2763 behavior. In this section we discuss the @internalsref{PianoStaff} and some
2764 other pianistic peculiarities.
2768 * Automatic staff changes::
2769 * Manual staff switches::
2772 * Voice follower lines::
2777 There is no support for putting chords across staves. You can get
2778 this result by increasing the length of the stem in the lower stave so
2779 it reaches the stem in the upper stave, or vice versa. An example is
2780 included with the distribution as @file{input/test/stem-cross-staff.ly}.
2782 @cindex cross staff stem
2783 @cindex stem, cross staff
2786 @c fixme: should have hyperlinks as well.
2791 @c . {Automatic staff changes}
2792 @node Automatic staff changes
2793 @subsection Automatic staff changes
2794 @cindex Automatic staff changes
2796 Voices can switch automatically between the top and the bottom
2797 staff. The syntax for this is
2799 \autochange Staff \context Voice @{ @dots{}@var{music}@dots{} @}
2801 The autochanger switches on basis of pitch (central C is the turning
2802 point), and it looks ahead skipping over rests to switch rests in
2803 advance. Here is a practical example:
2805 @lilypond[verbatim,singleline]
2806 \score { \notes \context PianoStaff <
2807 \context Staff = "up" {
2808 \autochange Staff \context Voice = VA < \relative c' {
2809 g4 a b c d r4 a g } > }
2810 \context Staff = "down" {
2815 Spacer rests are used to prevent the bottom staff from
2816 terminating too soon.
2819 @node Manual staff switches
2820 @subsection Manual staff switches
2822 @cindex manual staff switches
2823 @cindex staff switch, manual
2825 Voices can be switched between staves manually, using the following command:
2827 \translator Staff = @var{staffname} @var{music}
2829 The string @var{staffname} is the name of the staff. It switches the
2830 current voice from its current staff to the Staff called
2831 @var{staffname}. Typically @var{staffname} is @code{"up"} or
2839 Piano pedal instruction can be expressed using
2840 @code{\sustainDown}, @code{\sustainUp}, @code{\unaCorda},
2841 @code{\treCorde}, @code{\sostenutoDown} and @code{\sostenutoUp}.
2843 The symbols that are printed can be modified by setting
2844 @code{pedal@var{X}Strings}, where @var{X} is one of the pedal types:
2845 Sustain, Sostenuto or UnaCorda. Refer to the generated documentation of
2846 @rgrob{SustainPedal}, for example, for more information.
2848 Pedals can also be indicated by a sequence of brackets, by setting the
2849 @code{pedal-type} property of SustainPedal objects:
2851 @lilypond[fragment,verbatim]
2852 \property Staff.SustainPedal \override #'pedal-type = #'bracket
2853 c''4 \sustainDown d''4 e''4 a'4
2854 \sustainUp \sustainDown
2855 f'4 g'4 a'4 \sustainUp
2858 A third style of pedal notation is a mixture of text and brackets,
2859 obtained by setting @code{pedal-type} to @code{mixed}:
2861 @lilypond[fragment,verbatim]
2862 \property Staff.SustainPedal \override #'pedal-type = #'mixed
2863 c''4 \sustainDown d''4 e''4 c'4
2864 \sustainUp \sustainDown
2865 f'4 g'4 a'4 \sustainUp
2868 The default '*Ped' style for sustain and damper pedals corresponds to
2869 @code{\pedal-type = #'text}. However, @code{mixed} is the default style
2870 for a sostenuto pedal:
2872 @lilypond[fragment,verbatim]
2873 c''4 \sostenutoDown d''4 e''4 c'4 f'4 g'4 a'4 \sostenutoUp
2876 For fine-tuning of the appearance of a pedal bracket, the properties
2877 @code{edge-width}, @code{edge-height}, and @code{shorten-pair} of
2878 @code{PianoPedalBracket} objects (see the detailed documentation of
2879 @rgrob{PianoPedalBracket}) can be modified. For example, the bracket
2880 may be extended to the end of the note head.
2882 @lilypond[fragment,verbatim]
2883 \property Staff.PianoPedalBracket \override
2884 #'shorten-pair = #'(0 . -1.0)
2885 c''4 \sostenutoDown d''4 e''4 c'4
2886 f'4 g'4 a'4 \sostenutoUp
2890 @subsection Arpeggio
2893 @cindex broken arpeggio
2894 @cindex @code{\arpeggio}
2896 You can specify an arpeggio sign on a chord by attaching an
2897 @code{\arpeggio} to a note of the chord.
2900 @lilypond[fragment,relative,verbatim]
2901 \context Voice <c\arpeggio e g c>
2904 When an arpeggio crosses staves in piano music, you attach an arpeggio
2905 to the chords in both staves, and set
2906 @code{PianoStaff.connectArpeggios}.
2908 @lilypond[fragment,relative,verbatim]
2909 \context PianoStaff <
2910 \property PianoStaff.connectArpeggios = ##t
2911 \context Voice = one { <c'\arpeggio e g c> }
2912 \context Voice = other { \clef bass <c,,\arpeggio e g>}
2916 This command creates @internalsref{Arpeggio} objects. Cross staff arpeggios
2917 are @code{PianoStaff.Arpeggio}.
2919 To add an arrow head to explicitly specify the direction of the
2920 arpeggio, you should set the arpeggio object property
2921 @code{arpeggio-direction}.
2923 @lilypond[fragment,relative,verbatim]
2925 \property Voice.Arpeggio \set #'arpeggio-direction = #1
2927 \property Voice.Arpeggio \set #'arpeggio-direction = #-1
2932 A square bracket on the left indicates that the player should not
2933 arpeggiate the chord. To draw these brackets, set the
2934 @code{molecule-callback} property of @code{Arpeggio} or
2935 @code{PianoStaff.Arpeggio} objects to @code{\arpeggioBracket}, and use
2936 @code{\arpeggio} statements within the chords as before.
2938 @lilypond[fragment,relative,verbatim]
2939 \context PianoStaff <
2940 \property PianoStaff.connectArpeggios = ##t
2941 \property PianoStaff.Arpeggio \override
2942 #'molecule-callback = \arpeggioBracket
2943 \context Voice = one { <c'\arpeggio e g c> }
2944 \context Voice = other { \clef bass <c,,\arpeggio e g>}
2951 It is not possible to mix connected arpeggios and unconnected
2952 arpeggios in one PianoStaff at the same time.
2956 @node Voice follower lines
2957 @subsection Voice follower lines
2959 @cindex follow voice
2960 @cindex staff switching
2963 @cindex @code{followVoice}
2965 Whenever a voice switches to another staff a line connecting the notes
2966 can be printed automatically. This is enabled if the property
2967 @code{PianoStaff.followVoice} is set to true:
2969 @lilypond[fragment,relative,verbatim]
2970 \context PianoStaff <
2971 \property PianoStaff.followVoice = ##t
2972 \context Staff \context Voice {
2974 \translator Staff=two
2977 \context Staff=two {\clef bass \skip 1*2 }
2981 The associated object is @internalsref{VoiceFollower}.
2987 Tablature notation is used for notating music for plucked string
2988 instruments. It notates pitches not by using note heads, but by
2989 indicating on which string and fret a note must be played. LilyPond
2990 offers limited support for tablature.
2993 * Tablatures basic::
2994 * Non-guitar tablatures::
2995 * Tablature in addition to normal staff::
2998 @node Tablatures basic
2999 @subsection Tablatures basic
3000 @cindex Tablatures basic
3002 Tablature can be typeset with Lilypond by using the
3003 @internalsref{TabStaff} and @internalsref{TabVoice} contexts. As
3004 tablature is a recent feature in Lilypond, most of the guitar special
3005 effects such as bend are not yet supported.
3007 With the @internalsref{TabStaff}, the string number associated to a note
3008 is given as a backslash followed by the string number, e.g. @code{c4\3} for a C
3009 quarter on the third string. By default, string 1 is the highest one, and the
3010 tuning defaults to the standard guitar tuning (with 6 strings).
3012 @lilypond[fragment,verbatim]
3021 If you do not specify a string number then lilypond automatically selects one.
3022 The selection is controlled by the translator property @code{minimumFret}. -- LilyPond
3023 simply selects the first string that does not give a fret number less than
3024 @code{minimumFret}. Default is 0.
3026 Notice that LilyPond does not handle chords in any special way, and hence
3027 the automatic string selector may easily select the same string to two notes in a chord.
3030 e8 fis gis a b cis' dis' e'
3031 \property TabStaff.minimumFret = #8
3032 e8 fis gis a b cis' dis' e'
3034 @lilypond[noindent,noquote]
3037 e8 fis gis a b cis' dis' e'
3038 \property TabStaff.minimumFret = #8
3039 e8 fis gis a b cis' dis' e'
3042 \context StaffGroup <
3043 \context Staff { \clef "G_8" \frag }
3044 \context TabStaff { \frag }
3049 @node Non-guitar tablatures
3050 @subsection Non-guitar tablatures
3051 @cindex Non-guitar tablatures
3053 There are many ways to customize Lilypond tablatures.
3055 First you can change the number of strings, by setting the number of
3056 lines in the @internalsref{TabStaff} (the @code{line-count} property
3057 of TabStaff can only be changed using @code{\outputproperty}, for more
3058 information, see @ref{Tuning per object}. You can change the strings
3059 tuning. A string tuning is given as a Scheme list with one integer
3060 number for each string, the number being the pitch of an open string.
3062 (The numbers specified for stringTuning are the numbers of semitons
3063 to subtract --- or add --- starting the specified pitch by default
3064 middle C, in string order: thus the notes are e, a, d & g)
3066 @lilypond[fragment,verbatim]
3069 \outputproperty #(make-type-checker 'staff-symbol-interface)
3071 \property TabStaff.stringTunings = #'(-5 -10 -15 -20)
3074 a,4 c' a e' e c' a e'
3080 Finally, it is possible to change the Scheme function to format the
3081 tablature note text. The default is @var{fret-number-tablature-format},
3082 which uses the fret number, but for some instruments that may not use
3083 this notation, just create your own tablature-format function. This
3084 function takes three argument: the string number, the string tuning and
3088 @node Tablature in addition to normal staff
3089 @subsection Tablature in addition to normal staff
3090 @cindex Tablature in addition to normal staff
3092 It is possible to typeset both tablature and a "normal" staff, as
3093 commonly done in many parts.
3095 A common trick for that is to put the notes in a variables, and to hide
3096 the fingering information (which correspond to the string number) for
3100 @c @lily pond[verbatim]
3107 \context StaffGroup <
3109 % Hide fingering number
3110 \property Staff.Fingering \override #'transparent = ##t
3115 \property Staff.Stem \override #'direction = #1
3129 LilyPond has support for both entering and printing chords.
3130 @lilypond[verbatim,singleline]
3131 twoWays = \notes \transpose c c' {
3141 < \context ChordNames \twoWays
3142 \context Voice \twoWays > }
3145 This example also shows that the chord printing routines do not try to
3146 be intelligent. If you enter @code{f bes d}, it does not interpret
3147 this as an inversion.
3149 As you can see chords really are a set of pitches. They are internally
3150 stored as simultaneous music expressions. This means you can enter
3151 chords by name and print them as notes, enter them as notes and print
3152 them as chord names, or (the most common case) enter them by name, and
3157 * Printing named chords::
3162 @subsection Chords mode
3165 Chord mode is a mode where you can input sets of pitches using common
3166 names. It is introduced by the keyword @code{\chords}. It is similar
3167 to note mode, but words are also looked up in a chord modifier table
3168 (containing @code{maj}, @code{dim}, etc). Dashes and carets are used
3169 to indicate chord additions and subtractions, so articulation scripts
3170 can not be entered in Chord mode.
3172 Throughout these examples, chords have been shifted around the staff
3173 using @code{\transpose}.
3175 @lilypond[fragment,verbatim]
3179 c:9 c:9-.5+.7+ c:3-.5-
3189 The second type of modifier that may appear after the @code{:} is a
3190 named modifier. Named modifiers are listed in the file
3191 @file{chord-modifiers.ly}. The available modifiers are @code{m} and
3192 @code{min} which lower the 3rd half a step, `@code{aug}' which
3193 raises the 5th, `@code{dim}' which lowers the 5th,
3194 `@code{maj}' which adds a raised 7th, and `@code{sus}'
3195 which replaces the 5th with a 4th.
3197 @lilypond[fragment,verbatim]
3200 c1:m c:min7 c:maj c:aug c:dim c:sus
3206 Chord subtractions are used to eliminate notes from a chord. The
3207 notes to be subtracted are listed after a @code{^} character,
3210 @lilypond[fragment,verbatim,center]
3219 Chord inversions can be specified by appending `@code{/}' and the name
3220 of a single note to a chord. In a chord inversion, the inverted note is
3221 transposed down until it is the lowest note in the chord. If the note
3222 is not in the chord, a warning will be printed.
3224 @lilypond[fragment,verbatim,center]
3234 Bass notes can be added by `@code{/+}' and
3235 the name of a single note to a chord. This has the effect of
3236 adding the specified note to the chord, lowered by an octave,
3237 so it becomes the lowest note in the chord.
3239 @lilypond[fragment,verbatim,center]
3248 The formal syntax for named chords is as follows:
3250 @var{tonic}[@var{duration}][@code{-}@var{modifiers}][@code{^}@var{subtractions}][@code{/}@var{inversion}][@code{/+}@var{bass}].
3253 @var{tonic} should be the tonic note of the chord, and @var{duration} is
3254 the chord duration in the usual notation. There are two kinds of
3255 modifiers. One type is formed by @emph{chord additions}. Additions are
3256 obtained by listing intervals separated by dots. An interval is written
3257 by its number with an optional @code{+} or @code{-} to indicate raising
3258 or lowering by half a step. Chord additions have two effects: they adds
3259 the specified interval and all lower odd numbered intervals to the
3260 chord, and they may lower or raise the specified interval.
3265 Implementation details are gory. For example @code{c:4} not only adds
3266 a fourth, but also removes the third.
3269 @c . {Printing named chords}
3270 @node Printing named chords
3271 @subsection Printing named chords
3273 @cindex printing chord names
3277 For displaying printed chord names, use the @internalsref{ChordNames} context.
3278 The chords may be entered either using the notation described above, or
3279 directly using simultaneous music.
3281 @lilypond[verbatim,singleline]
3283 \chords {a1 b c} <d f g> <e g b>
3287 \context ChordNames \scheme
3288 \context Staff \transpose c c' \scheme
3293 You can make the chord changes stand out by setting
3294 @code{ChordNames.chordChanges} to true. This will only display chord
3295 names when there's a change in the chords scheme and at the start of a
3300 c1:m c:m \break c:m c:m d
3304 \context ChordNames {
3305 \property ChordNames.chordChanges = ##t
3307 \context Staff \transpose c c' \scheme
3309 \paper{linewidth= 9.\cm}
3313 LilyPond examines chords specified as lists of notes to determine a name
3314 to give the chord. LilyPond will not try to identify chord inversions or
3315 an added bass note, which may result in strange chord names when chords
3316 are entered as a list of pitches:
3318 @lilypond[verbatim,center,singleline]
3327 \context ChordNames \scheme
3328 \context Staff \scheme
3334 By default, a chord name system proposed by Harald Banter (See
3335 @ref{Literature}) is used. The system is very regular and predictable.
3336 Typical American style chord names may be selected by setting the
3337 @code{style} property of the @code{ChordNames.ChordName} object to
3338 @code{'american}. Similarly @code{'jazz} selects Jazz chordnames.
3340 Routines that determine the names to be printed are written in Scheme,
3341 and may be customized by the user. The code can be found in
3342 @file{scm/chord-name.scm}. Here's an example showing the differences in
3346 @c maybe just junk verbatim option?
3347 @lilypond[verbatim,singleline,noquote]
3357 \context ChordNames = banter \scheme
3358 \context ChordNames = american {
3359 \property ChordNames.ChordName \override
3360 #'style = #'american \scheme }
3361 \context ChordNames = jazz {
3362 \property ChordNames.ChordName \override
3363 #'style = #'jazz \scheme }
3364 \context Staff \transpose c c' \scheme
3371 @section Writing parts
3373 Orchestral music involves some special notation, both in the full score,
3374 as in the individual parts. This section explains how to tackle common
3375 problems in orchestral music.
3382 * Instrument names::
3384 * Multi measure rests::
3385 * Automatic part combining::
3386 * Hara kiri staves::
3387 * Sound output for transposing instruments::
3390 @c . {Rehearsal marks}
3391 @node Rehearsal marks
3392 @subsection Rehearsal marks
3393 @cindex Rehearsal marks
3395 @cindex @code{\mark}
3397 To print a rehearsal mark, use the @code{\mark} command.
3398 @lilypond[fragment,verbatim]
3409 As you can see, the mark is incremented automatically if you use
3410 @code{\mark \default}. The value to use is stored in the property
3411 @code{rehearsalMark} is used and automatically incremented. The object
3412 is @internalsref{RehearsalMark} in @internalsref{Score} context. See
3413 @code{input/test/boxed-molecule.ly} if you need boxes around the
3416 The @code{\mark} command can also be used to put signs like coda,
3417 segno and fermatas on a barline. The trick is to use the text markup
3418 mechanism to access the fermata symbol.
3419 @lilypond[fragment,verbatim,relative=1]
3420 c1 \mark #'(music "scripts-ufermata")
3424 The problem is that marks that occur at a line break are typeset only
3425 at the beginning of the next line, opposite to what you want for the
3426 fermata. This can be corrected by the following property setting
3428 \property Score.RehearsalMark \override
3429 #'visibility-lambda = #begin-of-line-invisible
3435 @cindex barlines, putting symbols on
3439 @subsection Bar numbers
3443 @cindex measure numbers
3444 @cindex currentBarNumber
3446 Bar numbers are printed by default at the start of the line. The
3447 number itself is a property that can be set by modifying the
3448 @code{currentBarNumber} property, although that is usually not
3451 \property Score.currentBarNumber = #217
3454 To typeset Bar Numbers at regular intervals instead of at the beginning of each line,
3455 you need to change the grob property @code{break-visibility} as well as the translator
3456 property @code{barNumberVisibility}, as illustrated in the following example which also
3457 adds a box around the bar numbers:
3459 \property Score.BarNumber \override #'break-visibility =
3460 #end-of-line-invisible
3461 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3462 \property Score.BarNumber \override #'molecule-callback =
3463 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3464 \property Score.BarNumber \override #'font-relative-size = #0
3466 @lilypond[noindent,noquote]
3468 \context Staff \notes \transpose c c'' {
3469 \property Score.BarNumber \override #'break-visibility = #end-of-line-invisible
3470 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3471 \property Score.BarNumber \override #'molecule-callback =
3472 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3473 \property Score.BarNumber \override #'font-relative-size = #0
3475 \repeat unfold 16 c1 \bar "|."
3480 See also @seeinternals{BarNumber}.
3484 Barnumbers can collide with the StaffGroup, if there is one at the
3485 top. To solve this, You have to twiddle with the
3486 @internalsref{padding} property of @internalsref{BarNumber} if your
3487 score starts with a @internalsref{StaffGroup}.
3489 @node Instrument names
3490 @subsection Instrument names
3492 In scores, the instrument name is printed before the staff. This can
3493 be done by setting @code{Staff.instrument} and
3494 @code{Staff.instr}. This will print a string before the start of the
3495 staff. For the first start, @code{instrument} is used, for the next
3496 ones @code{instr} is used.
3498 @lilypond[verbatim,singleline]
3499 \property Staff.instrument = "ploink " { c''4 }
3502 You can also use markup texts to construct more complicated instrument
3506 @lilypond[verbatim,singleline]
3508 '((font-relative-size . -2 ) (music "accidentals--1")))
3511 \property Staff.instrument = #`((kern . 0.5) (lines
3512 "2 Clarinetti" (columns " (B" ,text-flat ")")))
3520 When you put a name on a grand staff or piano staff the width of the
3521 brace is not taken into account. You must add extra spaces to the end of
3522 the name to avoid a collision.
3525 @subsection Transpose
3527 @cindex transposition of pitches
3528 @cindex @code{\transpose}
3530 A music expression can be transposed with @code{\transpose}. The syntax
3533 \transpose @var{from} @var{to} @var{musicexpr}
3536 This means that @var{musicexpr} is transposed to by the interval
3537 between @var{from} is @var{to}.
3539 @code{\transpose} distinguishes between enharmonic pitches: both
3540 @code{\transpose c cis} or @code{\transpose c des} will transpose up
3541 half a tone. The first version will print sharps and the second
3542 version will print flats.
3544 @lilypond[singleline, verbatim]
3545 mus =\notes { \key d \major cis d fis g }
3546 \score { \notes \context Staff {
3549 \transpose c g' \mus
3550 \transpose c f' \mus
3554 If you want to use both @code{\transpose} and @code{\relative}, then
3555 you must use @code{\transpose} first. @code{\relative} will have no
3556 effect music that appears inside a @code{\transpose}.
3558 @c . {Multi measure rests}
3559 @node Multi measure rests
3560 @subsection Multi measure rests
3561 @cindex Multi measure rests
3565 Multi measure rests are entered using `@code{R}'. It is specifically
3566 meant for full bar rests and for entering parts: the rest can expand to
3568 rests, or it can be printed as a single multimeasure rest This expansion
3569 is controlled by the property @code{Score.skipBars}. If this is set to true,
3570 Lily will not expand empty measures, and the appropriate number is added
3573 @lilypond[fragment,verbatim]
3574 \time 4/4 r1 | R1 | R1*2
3575 \property Score.skipBars = ##t R1*17 R1*4
3578 The @code{1} in @code{R1} is similar to the duration notation used for
3579 notes. Hence, for time signatures other than 4/4, you must enter other
3580 durations. This can be done with augmentation dots, or with
3583 @lilypond[fragment,verbatim]
3584 \property Score.skipBars = ##t
3591 Notice that a @code{R} spanning a single measure is printed as a whole
3592 rest centered in the measure, regardless of the time signature.
3594 [ add note about breves.]
3597 @cindex whole rests for a full measure
3599 The object for this object is @internalsref{MultiMeasureRest}.
3603 Currently, there is no way to automatically condense multiple rests
3604 into a single multimeasure rest. Multi measure rests do not take part
3605 in rest collisions. There is no way to put texts centered on
3606 multi-measure rests.
3608 @cindex condensing rests
3610 @node Automatic part combining
3611 @subsection Automatic part combining
3612 @cindex automatic part combining
3613 @cindex part combiner
3616 Automatic part combining is used to merge two parts of music onto a
3617 staff in an intelligent way. It is aimed primarily at typesetting
3618 orchestral scores. When the two parts are identical for a period of
3619 time, only one is shown. In places where the two parts differ, they
3620 are typeset as separate voices, and stem directions are set
3621 automatically. Also, solo and @emph{a due} parts can be identified
3624 The syntax for part combining is
3627 \partcombine @var{context} @var{musicexpr1} @var{musicexpr2}
3629 where the pieces of music @var{musicexpr1} and @var{musicexpr2} will be
3630 combined into one context of type @var{context}. The music expressions
3631 must be interpreted by contexts whose names should start with @code{one}
3634 The most useful function of the part combiner is to combine parts into
3635 one voice, as common for wind parts in orchestral scores:
3637 @lilypond[verbatim,singleline,fragment]
3639 \context Voice=one \partcombine Voice
3640 \context Thread=one \relative c'' {
3643 \context Thread=two \relative c'' {
3649 Notice that the first @code{g} appears only once, although it was
3650 specified twice (once in each part). Stem, slur and tie directions are
3651 set automatically, depending whether there is a solo or unisono. The
3652 first part (with context called @code{one}) always gets up stems, and
3653 `solo', while the second (called @code{two}) always gets down stems and
3656 If you just want the merging parts, and not the textual markings, you
3657 may set the property @var{soloADue} to false.
3659 @lilypond[verbatim,singleline,fragment]
3661 \property Staff.soloADue = ##f
3662 \context Voice=one \partcombine Voice
3663 \context Thread=one \relative c'' {
3666 \context Thread=two \relative c'' {
3672 There are a number of other properties that you can use to tweak the
3673 behavior of part combining, refer to the automatically generated
3674 documentation of @reng{Thread_devnull_engraver} and
3675 @reng{Voice_devnull_engraver}. Look at the documentation of the
3676 responsible engravers, @code{Thread_devnull_engraver},
3677 @code{Voice_devnull_engraver} and @code{A2_engraver}.
3681 In @code{soloADue} mode, when the two voices play the same notes on and
3682 off, the part combiner may typeset @code{a2} more than once in a
3685 @lilypond[fragment,singleline]
3687 \context Voice=one \partcombine Voice
3688 \context Thread=one \relative c'' {
3691 \context Thread=two \relative c'' {
3697 @cindex @code{Thread_devnull_engraver}
3698 @cindex @code{Voice_engraver}
3699 @cindex @code{A2_engraver}
3701 @node Hara kiri staves
3702 @subsection Hara kiri staves
3704 In orchestral scores, staff lines that only have rests are usually removed.
3705 This saves some space. LilyPond also supports this through the hara
3706 kiri@footnote{Hara kiri, also called Seppuku, is the ritual suicide of
3707 the Japanese Samourai warriors.} staff. This staff commits suicide when
3708 it finds itself to be empty after the line-breaking process. It will
3709 not disappear when it contains normal rests, you must use multi measure
3712 The hara kiri staff is specialized version of the @internalsref{Staff}
3713 context. It is available as the context identifier
3714 @code{\HaraKiriStaffContext}. Observe how the second staff in this
3715 example disappears in the second line.
3719 \notes \relative c' <
3720 \context Staff = SA { e4 f g a \break c1 }
3721 \context Staff = SB { c4 d e f \break R1 }
3725 \translator { \HaraKiriStaffContext }
3731 @node Sound output for transposing instruments
3732 @subsection Sound output for transposing instruments
3734 When you want to make a MIDI file from a score containing transposed
3735 and untransposed instruments, you have to instruct LilyPond the pitch
3736 offset (in semitones) for the transposed instruments. This is done
3737 using the @code{transposing} property. It does not affect printed
3740 @cindex @code{transposing}
3743 \property Staff.instrument = #"Cl. in B-flat"
3744 \property Staff.transposing = #-2
3750 @node Ancient notation
3751 @section Ancient notation
3753 @cindex Vaticana, Editio
3754 @cindex Medicaea, Editio
3760 * Ancient note heads::
3768 @node Ancient note heads
3769 @subsection Ancient note heads
3771 To get a longa note head, you have to use mensural note heads. This
3772 is accomplished by setting the @code{style} property of the
3773 NoteHead object to @code{mensural}. There is also a note head style
3774 @code{baroque} which gives mensural note heads for @code{\longa} and
3775 @code{\breve} but standard note heads for shorter notes.
3777 @lilypond[fragment,singleline,verbatim]
3778 \property Voice.NoteHead \set #'style = #'mensural
3783 @subsection Ancient clefs
3785 LilyPond supports a variety of clefs, many of them ancient.
3787 For modern clefs, see section @ref{Clef}. For the percussion clef, see
3788 section @ref{Percussion staves}. For the @code{TAB} clef, see section
3791 The following table shows all ancient clefs that are supported via the
3792 @code{\clef} command. Some of the clefs use the same glyph, but differ
3793 only with respect to the line they are printed on. In such cases, a
3794 trailing number in the name is used to enumerate these clefs. Still,
3795 you can manually force a clef glyph to be typeset on an arbitrary line,
3796 as described in section @ref{Clef}. The note printed to the right side
3797 of each clef denotes the @code{c'} with respect to the clef.
3801 @c --- This should go somewhere else: ---
3802 @c @item modern style G clef (glyph: @code{clefs-G})
3805 @c @code{treble}, @code{violin}, @code{G}, @code{G2}, @code{french}
3807 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "G" c'}
3809 @c @item modern style F clef (glyph: @code{clefs-F})
3812 @c @code{varbaritone}, @code{bass}, @code{F}, @code{subbass}
3814 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "F" c'}
3816 @c @item modern style C clef (glyph: @code{clefs-C})
3819 @c @code{soprano}, @code{mezzosoprano}, @code{alto}, @code{C},
3820 @c @code{tenor}, @code{baritone}
3822 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "C" c'}
3824 @item modern style mensural C clef (glyph: @code{clefs-neo_mensural_c'})
3827 @code{neo_mensural_c1}, @code{neo_mensural_c2},
3828 @code{neo_mensural_c3}, @code{neo_mensural_c4}
3830 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "neo_mensural_c2" c'}
3832 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c1})
3838 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c1" c'}
3840 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c2})
3846 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c2" c'}
3848 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c3})
3854 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c3" c'}
3856 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c4})
3862 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c4" c'}
3864 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c5})
3870 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c5" c'}
3872 @item petrucci style mensural F clef (glyph: @code{clefs-petrucci_f})
3877 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_f" c'}
3879 @item petrucci style mensural G clef (glyph: @code{clefs-petrucci_g})
3884 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_g" c'}
3886 @item historic style mensural C clef (glyph: @code{clefs-mensural_c'})
3889 @code{mensural_c1}, @code{mensural_c2}, @code{mensural_c3},
3892 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_c2" c'}
3894 @item historic style mensural F clef (glyph: @code{clefs-mensural_f})
3899 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_f" c'}
3901 @item historic style mensural G clef (glyph: @code{clefs-mensural_g})
3906 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_g" c'}
3908 @item Editio Vaticana style do clef (glyph: @code{clefs-vaticana_do})
3911 @code{vaticana_do1}, @code{vaticana_do2}, @code{vaticana_do3}
3913 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_do2" c'}
3915 @item Editio Vaticana style fa clef (glyph: @code{clefs-vaticana_fa})
3918 @code{vaticana_fa1}, @code{vaticana_fa2}
3920 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_fa2" c'}
3922 @item Editio Medicaea style do clef (glyph: @code{clefs-medicaea_do})
3925 @code{medicaea_do1}, @code{medicaea_do2}, @code{medicaea_do3}
3927 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_do2" c'}
3929 @item Editio Medicaea style fa clef (glyph: @code{clefs-medicaea_fa})
3932 @code{medicaea_fa1}, @code{medicaea_fa2}
3934 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_fa2" c'}
3936 @item historic style hufnagel do clef (glyph: @code{clefs-hufnagel_do})
3939 @code{hufnagel_do1}, @code{hufnagel_do2}, @code{hufnagel_do3}
3941 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do2" c'}
3943 @item historic style hufnagel fa clef (glyph: @code{clefs-hufnagel_fa})
3946 @code{hufnagel_fa1}, @code{hufnagel_fa2}
3948 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_fa2" c'}
3950 @item historic style hufnagel combined do/fa clef (glyph: @code{clefs-hufnagel_do_fa})
3953 @code{hufnagel_do_fa}
3955 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do_fa" c'}
3957 @c --- This should go somewhere else: ---
3958 @c @item modern style percussion clef (glyph: @code{clefs-percussion})
3961 @c @code{percussion}
3963 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "percussion" c'}
3965 @c @item modern style tab clef (glyph: @code{clefs-tab})
3970 @c @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #6 \property Staff.TimeSignature \set #'transparent = ##t \clef "tab" c'}
3974 @emph{Modern style} means ``as is typeset in current editions of
3975 transcribed mensural music''.
3977 @emph{Petrucci style} means ``inspired by printings published by the
3978 famous engraver Petrucci (1466-1539)''.
3980 @emph{Historic style} means ``as was typeset or written in contemporary
3981 historic editions (other than those of Petrucci)''.
3983 @emph{Editio XXX style} means ``as is/was printed in Editio XXX''.
3985 Petrucci used C clefs with differently balanced left-side vertical
3986 beams, depending on which staffline it was printed.
3989 @subsection Custodes
3994 A @emph{custos} (plural: @emph{custodes}; latin word for `guard') is a
3995 staff context symbol that appears at the end of a staff line. It
3996 anticipates the pitch of the first note(s) of the following line and
3997 thus helps the player or singer to manage line breaks during
3998 performance, thus enhancing readability of a score.
4000 @lilypond[verbatim,noquote]
4003 \property Staff.Custos \set #'style = #'mensural
4008 \consists Custos_engraver
4014 Custodes were frequently used in music notation until the 17th century.
4015 There were different appearances for different notation styles.
4016 Nowadays, they have survived only in special forms of musical notation
4017 such as via the @emph{editio vaticana} dating back to the beginning of
4020 For typesetting custodes, just put a @code{Custos_engraver} into the
4021 @internalsref{Staff} context when declaring the @code{\paper} block. In this
4022 block, you can also globally control the appearance of the custos symbol
4023 by setting the custos @code{style} property. Currently supported styles
4024 are @code{vaticana}, @code{medicaea}, @code{hufnagel} and
4031 \consists Custos_engraver
4032 Custos \override #'style = #'mensural
4037 The property can also be set locally, for example in a @code{\notes}
4042 \property Staff.Custos \override #'style = #'vaticana
4043 c'1 d' e' d' \break c' d' e' d'
4048 @subsection Ligatures
4052 @c TODO: Should double check if I recalled things correctly when I wrote
4053 @c down the following paragraph by heart.
4054 In musical terminology, a ligature is a coherent graphical symbol that
4055 represents at least two different notes. Ligatures originally appeared
4056 in the manuscripts of Gregorian chant notation roughly since the 9th
4057 century as an allusion to the accent symbols of greek lyric poetry to
4058 denote ascending or descending sequences of notes. Both, the shape and
4059 the exact meaning of ligatures changed tremendously during the following
4060 centuries: In early notation, ligatures where used for monophonic tunes
4061 (Gregorian chant) and very soon denoted also the way of performance in
4062 the sense of articulation. With upcoming multiphony, the need for a
4063 metric system arised, since multiple voices of a piece have to be
4064 synchronized some way. New notation systems were invented, that used
4065 the manifold shapes of ligatures to now denote rhythmical patterns
4066 (e.g. black mensural notation, mannered notation, ars nova). With the
4067 invention of the metric system of the white mensural notation, the need
4068 for ligatures to denote such patterns disappeared. Nevertheless,
4069 ligatures were still in use in the mensural system for a couple of
4070 decades until they finally disappeared during the late 16th / early 17th
4071 century. Still, ligatures have survived in contemporary editions of
4072 Gregorian chant such as the Editio Vaticana from 1905/08.
4074 Syntactically, ligatures are simply enclosed by @code{\[} and @code{\]}.
4075 Some ligature styles (such as Editio Vaticana) may need additional input
4076 syntax specific for this particular type of ligature. By default, the
4077 @internalsref{LigatureBracket} engraver just marks the start and end of
4078 a ligature by small square angles:
4080 @lilypond[singleline,verbatim]
4082 \notes \transpose c c' {
4090 To select a specific style of ligatures, a proper ligature engraver has
4091 to be added to the @internalsref{Voice} context, as explained in the
4092 following subsections. Currently, Lilypond only supports white mensural
4093 ligatures with certain limitations. Support for Editio Vaticana will be
4094 added in the future.
4097 * White mensural ligatures::
4100 @node White mensural ligatures
4101 @subsubsection White mensural ligatures
4103 @cindex Mensural ligatures
4104 @cindex White mensural ligatures
4106 Lilypond has limited support for white mensural ligatures. The
4107 implementation is still experimental; it currently may output strange
4108 warnings or even crash in some cases or produce weird results on more
4109 complex ligatures. To engrave white mensural ligatures, in the paper
4110 block the @internalsref{MensuralLigature} engraver has to be put into
4111 the @internalsref{Voice} context (and you probably want to remove the
4112 @internalsref{LigatureBracket} engraver). There is no additional input
4113 language to describe the shape of a white mensural ligature. The shape
4114 is rather determined solely from the pitch and duration of the enclosed
4115 notes. While this approach may take a new user quite a while to get
4116 accustomed, it has a great advantage: this way, lily has full musical
4117 information about the ligature. This is not only required for correct
4118 MIDI output, but also allows for automatic transcription of the
4123 @lilypond[singleline,verbatim]
4125 \notes \transpose c c' {
4126 \property Score.timing = ##f
4127 \property Score.defaultBarType = "empty"
4128 \property Voice.NoteHead \set #'style = #'neo_mensural
4129 \property Staff.TimeSignature \set #'style = #'neo_mensural
4131 \[ g\longa c\breve a\breve f\breve d'\longa \]
4133 \[ e1 f1 a\breve g\longa \]
4138 \remove Ligature_bracket_engraver
4139 \consists Mensural_ligature_engraver
4145 Without replacing @code{Ligature_bracket_engraver} with
4146 @code{Mensural_ligature_engraver}, the same music transcribes to the
4149 @lilypond[singleline,verbatim]
4151 \notes \transpose c c' {
4152 \property Score.timing = ##f
4153 \property Score.defaultBarType = "empty"
4154 \property Voice.NoteHead \set #'style = #'neo_mensural
4155 \property Staff.TimeSignature \set #'style = #'neo_mensural
4157 \[ g\longa c\breve a\breve f\breve d'\longa \]
4159 \[ e1 f1 a\breve g\longa \]
4165 @subsection Figured bass
4167 @cindex Basso continuo
4169 LilyPond has limited support for figured bass:
4171 @lilypond[verbatim,fragment]
4173 \context FiguredBass
4178 \context Voice { c4 g8 }
4182 The support for figured bass consists of two parts: there is an input
4183 mode, introduced by @code{\figures}, where you can enter bass figures
4184 as numbers, and there is a context called @internalsref{FiguredBass}
4185 that takes care of making @internalsref{BassFigure} objects.
4187 In figures input mode, a group of bass figures is delimited by
4188 @code{<} and @code{>}. The duration is entered after the @code{>}.
4193 \context FiguredBass
4197 Accidentals are added to the numbers if you alterate them by
4198 appending @code{-}, @code{!} and @code{+}.
4204 \context FiguredBass
4205 \figures { <4- 6+ 7!> }
4208 Spaces or dashes may be inserted by using @code{_}. Brackets are
4209 introduced with @code{[} and @code{]}.
4215 \context FiguredBass
4216 \figures { < [4 6] 8 [_ 12]> }
4219 Although the support for figured bass may superficially resemble chord
4220 support, it works much simpler: in figured bass simply stores the
4221 numbers, and then prints the numbers you entered. There is no
4222 conversion to pitches, and no realizations of the bass are played in
4226 @c . {Tuning output}
4228 @section Tuning output
4230 LilyPond tries to take as much formatting as possible out of your
4231 hands. Nevertheless, there are situations where it needs some help, or
4232 where you want to override its decisions. In this section we discuss
4233 ways to do just that.
4235 Formatting is internally done by manipulating so called objects (graphic
4236 objects). Each object carries with it a set of properties (object
4237 properties) specific to that object. For example, a stem object has
4238 properties that specify its direction, length and thickness.
4240 The most direct way of tuning the output is by altering the values of
4241 these properties. There are two ways of doing that: first, you can
4242 temporarily change the definition of a certain type of object, thus
4243 affecting a whole set of objects. Second, you can select one specific
4244 object, and set a object property in that object.
4247 * Tuning groups of objects ::
4248 * Tuning per object ::
4253 @node Tuning groups of objects
4254 @subsection Tuning groups of objects
4256 @cindex object description
4258 A object definition is a Scheme association list, that is stored in a
4259 context property. By assigning to that property (using plain
4260 @code{\property}), you can change the resulting objects.
4262 @lilypond[verbatim, fragment]
4263 c'4 \property Voice.Stem = #'()
4266 The @code{\property} assignment effectively empties the definition of
4267 the Stem object. One of the effects is that the recipe of how it should be
4268 printed is erased, with the effect of rendering it invisible. The above
4269 assignment is available as a standard identifier, for the case that you
4273 \property Voice.Stem = \turnOff
4280 This mechanism is fairly crude, since you can only set, but not modify,
4281 the definition of a object. For this reason, there is a more advanced
4284 The definition of a object is actually a list of default object
4285 properties. For example, the definition of the Stem object (available in
4286 @file{scm/grob-description.scm}), defines the following values for
4291 (beamed-lengths . (0.0 2.5 2.0 1.5))
4292 (Y-extent-callback . ,Stem::height)
4296 You can add a property on top of the existing definition, or remove a
4297 property, thus overriding the system defaults:
4299 c'4 \property Voice.Stem \override #'thickness = #4.0
4300 c'4 \property Voice.Stem \revert #'thickness
4303 You should balance @code{\override} and @code{\revert}. If that's too
4304 much work, you can use the @code{\set} shorthand. It performs a revert
4305 followed by an override. The following example gives exactly the same
4306 result as the previous one.
4308 c'4 \property Voice.Stem \set #'thickness = #4.0
4309 c'4 \property Voice.Stem \set #'thickness = #0.8
4312 If you use @code{\set}, you must explicitly restore the default.
4315 Formally the syntax for these constructions is
4317 \property @var{context}.@var{grobname} \override @var{symbol} = @var{value}
4318 \property @var{context}.@var{grobname} \set @var{symbol} = @var{value}
4319 \property @var{context}.@var{grobname} \revert @var{symbol}
4321 Here @var{symbol} is a Scheme expression of symbol type, @var{context}
4322 and @var{grobname} are strings and @var{value} is a Scheme expression.
4325 If you revert a setting which was not set in the first place, then it
4326 has no effect. However, if the setting was set as a system default, it
4327 may remove the default value, and this may give surprising results,
4328 including crashes. In other words, @code{\override} and @code{\revert},
4329 must be carefully balanced.
4331 These are examples of correct nesting of @code{\override}, @code{\set},
4334 A clumsy but correct form:
4336 \override \revert \override \revert \override \revert
4339 Shorter version of the same:
4341 \override \set \set \revert
4344 A short form, using only @code{\set}. This requires you to know the
4347 \set \set \set \set @var{to default value}
4350 If there is no default (i.e. by default, the object property is unset),
4353 \set \set \set \revert
4356 For the digirati, the object description is an Scheme association
4357 list. Since a Scheme list is a singly linked list, we can treat it as a
4358 stack, and @code{\override} and @code{\revert} are just push and pop
4359 operations. This pushing and popping is also used for overriding
4360 automatic beaming settings.
4364 LilyPond will hang or crash if @var{value} contains cyclic references.
4365 The backend is not very strict in type-checking object properties. If you
4366 @code{\revert} properties that are expected to be set by default,
4372 @node Tuning per object
4373 @subsection Tuning per object
4376 Tuning a single object is most often done with @code{\property}. The
4379 \once \property @dots{}
4382 applies a setting only during one moment in the score: notice how the
4383 original setting for stem thickness is restored automatically in the
4386 @lilypond[verbatim, fragment, relative=1]
4388 \once \property Voice.Stem \set #'thickness = #4
4394 @cindex \outputproperty
4396 A second way of tuning objects is the more arcane @code{\outputproperty}
4397 feature. The syntax is as follows:
4399 \outputproperty @var{predicate} @var{symbol} = @var{value}
4401 Here @code{predicate} is a Scheme function taking a object argument, and
4402 returning a boolean. This statement is processed by the
4403 @code{Output_property_engraver}. It instructs the engraver to feed all
4404 objects that it sees to @var{predicate}. Whenever the predicate returns
4405 true, the object property @var{symbol} will be set to @var{value}.
4407 This command is only single shot, in contrast to @code{\override} and
4410 You will need to combine this statement with @code{\context} to select
4411 the appropriate context to apply this to.
4413 In the following example, all note heads occurring at current staff
4414 level, are shifted up and right by setting their @code{extra-offset}
4417 @lilypond[fragment,verbatim,singleline]
4419 \context Staff \outputproperty
4420 #(make-type-checker 'note-head-interface)
4421 #'extra-offset = #'(0.5 . 0.75)
4425 @cindex @code{extra-offset}
4427 In this example, the predicate checks the @code{text} object property, to
4428 shift only the `m.d.' text, but not the fingering instruction "2".
4429 @lilypond[verbatim,singleline]
4430 #(define (make-text-checker text)
4431 (lambda (grob) (equal? text (ly:get-grob-property grob 'text))))
4434 \notes\relative c''' {
4435 \property Voice.Stem \set #'direction = #1
4436 \outputproperty #(make-text-checker "m.d.")
4437 #'extra-offset = #'(-3.5 . -4.5)
4445 If possible, avoid this feature: the semantics are not very clean, and
4446 the syntax and semantics are up for rewrite.
4451 @node Font selection
4452 @subsection Font selection
4454 The most common thing to change about the appearance of fonts is
4455 their size. The font size of a @internalsref{Voice},
4456 @internalsref{Staff} or @internalsref{Thread} context, can be easily
4457 changed by setting the @code{fontSize} property for that context:
4458 @lilypond[fragment,relative=1]
4459 c4 c4 \property Voice.fontSize = #-1
4462 This command will not change the size of variable symbols, such as
4463 beams or slurs. You can use this command to get smaller symbol for
4464 cue notes, but that involves some more subtleties. An elaborate
4465 example of those is in @file{input/test/cue-notes.ly}.
4473 The font used for printing a object can be selected by setting
4474 @code{font-name}, e.g.
4476 \property Staff.TimeSignature
4477 \set #'font-name = #"cmr17"
4479 You may use any font which is available to @TeX{}, such as foreign
4480 fonts or fonts that do not belong to the Computer Modern font family.
4481 Font selection for the standard fonts, @TeX{}'s Computer Modern fonts,
4482 can also be adjusted with a more fine-grained mechanism. By setting
4483 the object properties described below, you can select a different font.
4484 All three mechanisms work for every object that supports
4485 @code{font-interface}.
4489 A symbol indicating the general class of the typeface. Supported are
4490 @code{roman} (Computer Modern), @code{braces} (for piano staff
4491 braces), @code{music} (the standard music font), @code{ancient} (the
4492 ancient notation font) @code{dynamic} (font for dynamic signs) and
4496 A symbol indicating the shape of the font, there are typically several
4497 font shapes available for each font family. Choices are @code{italic},
4498 @code{caps} and @code{upright}
4501 A symbol indicating the series of the font. There are typically several
4502 font series for each font family and shape. Choices are @code{medium}
4505 @item font-relative-size
4506 A number indicating the size relative the standard size. For example,
4507 with 20pt staff height, relative size -1 corresponds to 16pt staff
4508 height, and relative size +1 corresponds to 23 pt staff height.
4510 @item font-design-size
4511 A number indicating the design size of the font.
4513 This is a feature of the Computer Modern Font: each point size has a
4514 slightly different design. Smaller design sizes are relatively wider,
4515 which enhances readability.
4518 For any of these properties, the value @code{*} (i.e. the @emph{symbol},
4519 @code{*}, entered as @code{#'*}), acts as a wildcard. This can be used
4520 to override default setting, which are always present. For example:
4522 \property Lyrics.LyricText \override #'font-series = #'bold
4523 \property Lyrics.LyricText \override #'font-family = #'typewriter
4524 \property Lyrics.LyricText \override #'font-shape = #'*
4527 @cindex @code{font-style}
4529 There are also pre-cooked font selection qualifiers. These are
4530 selected through the object property @code{font-style}. For example,
4531 the style @code{finger} selects family @code{number} and relative size
4532 @code{-3}. Styles available include @code{volta}, @code{finger},
4533 @code{tuplet}, @code{timesig}, @code{mmrest}, @code{script},
4534 @code{large}, @code{Large} and @code{dynamic}. The style sheets and
4535 tables for selecting fonts are located in @file{scm/font.scm}. Refer
4536 to this file for more information.
4538 @cindex magnification
4540 The size of the font may be scaled with the object property
4541 @code{font-magnification}. For example, @code{2.0} blows up all
4542 letters by a factor 2 in both directions.
4546 Relative size is not linked to any real size.
4548 There is no style sheet provided for other fonts besides the @TeX{}
4549 family, and the style sheet can not be modified easiyl.
4551 @cindex font selection
4552 @cindex font magnification
4553 @cindex @code{font-interface}
4557 @subsection Text markup
4561 LilyPond has an internal mechanism to typeset texts. You can
4562 form text markup expressions by composing scheme expressions
4563 in the following way.
4565 @lilypond[verbatim, singleline]
4570 c^#'(italic "italic")
4571 d_#'((bold italic) "ff")
4573 f_#'(lines "one" (bold "two"))
4574 g^#'(music "noteheads-2" ((raise . 2.4) "flags-u3"))
4578 Normally, the Scheme markup text is stored in the @code{text} property
4579 of a object. Formally, it is defined as follows:
4582 text: string | (head? text+)
4583 head: markup | (markup+)
4584 markup-item: property | abbrev
4585 property: (@var{key} . @var{value})
4586 abbrev: @code{columns lines roman music bold italic named super sub}
4587 @code{overstrike text finger volta timesig mmrest mark script}
4588 @code{large Large dynamic}
4591 The markup is broken down and converted into a list of object properties,
4592 which are prepended to the property list. The @var{key}-@var{value}
4593 pair is a object property. A list of properties available is included in
4594 the generated documentation for @internalsref{text-interface}.
4596 The following abbreviations are defined:
4599 horizontal mode: set all text on one line (default)
4601 vertical mode: set every text on a new line
4605 selects the Feta font (the standard font for music notation glyphs),
4606 and uses named lookup
4613 lookup by character name
4615 plain text lookup (by character value)
4621 the next text or character overstrikes this one
4623 select fingering number fontstyle
4625 select volta number fontstyle
4627 select time signature number fontstyle
4629 select multi measure rest number fontstyle
4631 select mark number fontstyle
4633 select scriptsize roman fontstyle
4635 select large roman fontstyle
4637 select Large roman fontstyle
4639 select dynamics fontstyle
4643 @cindex metronome mark
4645 One practical application of complicated markup is to fake a metronome
4649 #(define note '(columns
4650 (music "noteheads-2" ((kern . -0.1) "flags-stem"))))
4651 #(define eight-note `(columns ,note ((kern . -0.1)
4652 (music ((raise . 3.5) "flags-u3")))))
4653 #(define dotted-eight-note
4654 `(columns ,eight-note (music "dots-dot")))
4657 \notes\relative c'' {
4658 a1^#`((columns (font-relative-size . -1))
4659 ,dotted-eight-note " = 64")
4665 TextScript \override #'font-shape = #'upright
4673 The syntax and semantics of markup texts are not clean, and both
4674 syntax and semantics are slated for a rewrite.
4676 LilyPond does not do kerning, and there generally spaces texts
4682 @section Global layout
4684 The global layout determined by three factors: the page layout, the
4685 line breaks and the spacing. These all influence each other: The
4686 choice of spacing determines how densely each system of music is set,
4687 where line breaks breaks are chosen, and thus ultimately how many
4688 pages a piece of music takes. In this section we will explain how the
4689 lilypond spacing engine works, and how you can tune its results.
4691 Globally spoken, this procedure happens in three steps: first,
4692 flexible distances (``springs'') are chosen, based on durations. All
4693 possible line breaking combination are tried, and the one with the
4694 best results---a layout that has uniform density and requires as
4695 little stretching or cramping as possible---is chosen. When the score
4696 is processed by @TeX{}, page are filled with systems, and page breaks
4697 are chosen whenever the page gets full.
4700 * Vertical spacing::
4701 * Horizontal spacing::
4708 @node Vertical spacing
4709 @subsection Vertical spacing
4711 @cindex vertical spacing
4712 @cindex distance between staves
4713 @cindex staff distance
4714 @cindex between staves, distance
4715 @cindex staffs per page
4718 The height of each system is determined automatically by lilypond, to
4719 keep systems from bumping into each other, some minimum distances are
4720 set. By changing these, you can put staves closer together, and thus
4721 put more systems onto one page.
4723 Normally staves are stacked vertically. To make
4724 staves maintain a distance, their vertical size is padded. This is
4725 done with the property @code{minimumVerticalExtent}. It takes a pair
4726 of numbers, so if you want to make it smaller from its, then you could
4729 \property Staff.minimumVerticalExtent = #'(-4 . 4)
4731 This sets the vertical size of the current staff to 4 staff-space on
4732 either side of the center staff line. The argument of
4733 @code{minimumVerticalExtent} is interpreted as an interval, where the
4734 center line is the 0, so the first number is generally negative. you
4735 could also make the staff larger at the bottom by setting it to
4736 @code{(-6 . 4)}. The default value is @code{(-6 . 6)}.
4738 Vertical aligment of staves is handled by the
4739 @internalsref{VerticalAlignment} object, which lives at
4740 @internalsref{Score} level.
4742 The piano staves are handled a little differently: to make cross-staff
4743 beaming work correctly, it necessary that the distance between staves
4744 is fixed. This is also done with a @internalsref{VerticalAlignment}
4745 object, created in @internalsref{PianoStaff}, but a forced distance is
4746 set. This is done with the object property #'forced-distance. If you
4747 want to override this, use a @code{\translator} block as follows:
4751 VerticalAlignment \override #'forced-distance = #9
4754 This would bring the staves together at a distance of 9 staff spaces,
4755 and again this is measured from the center line of each staff.
4759 @node Horizontal spacing
4760 @subsection Horizontal Spacing
4762 The spacing engine translates differences in durations into
4763 stretchable distances (``springs'') of differing lengths. Longer
4764 durations get more space, shorter durations get less. The basis for
4765 assigning spaces to durations, is that the shortest durations get a
4766 fixed amount of space, and the longer durations get more: doubling a
4767 duration adds a fixed amount of space to the note.
4769 For example, the following piece contains lots of half, quarter and
4770 8th notes, the eighth note is followed by 1 note head width. The The
4771 quarter note is followed by 2 NHW, the half by 3 NHW, etc.
4772 @lilypond[fragment, verbatim, relative=1]
4773 c2 c4. c8 c4. c8 c4. c8 c8 c8 c4 c4 c4
4776 These two amounts of space are @code{shortest-duration-space}
4777 @code{spacing-increment}, object properties of
4778 @internalsref{SpacingSpanner}. Normally @code{spacing-increment} is
4779 set to 1.2, which is the width of a note head, and
4780 @code{shortest-duration-space} is set to 2.0, meaning that the
4781 shortest note gets 2 noteheads of space. For normal notes, this space
4782 is always counted from the left edge of the symbol, so the short notes
4783 in a score is generally followed by one note head width of space.
4785 If one would follow the above procedure exactly, then adding a single
4786 32th note to a score that uses 8th and 16th notes, would widen up the
4787 entire score a lot. The shortest note is no longer a 16th, but a 64th,
4788 thus adding 2 noteheads of space to every note. To prevent this, the
4789 shortest duration for spacing is not the shortest note in the score,
4790 but the most commonly found shortest note. Notes that are even
4791 shorter this are followed by a space that is proportonial to their
4792 duration relative to the common shortest note. So if we were to add
4793 only a few 16th notes to the example above, they would be followed by
4796 @lilypond[fragment, verbatim, relative=1]
4797 c2 c4. c8 c4. [c16 c] c4. c8 c8 c8 c4 c4 c4
4800 The most common shortest duration is determined as follows: in every
4801 measure, the shortest duration is determined. The most common short
4802 duration, is taken as the basis for the spacing, with the stipulation
4803 that this shortest duration should always be equal to or shorter than
4804 1/8th note. The shortest duration is printed when you run lilypond
4805 with @code{--verbose}. These durations may also be customized. If you
4806 set the @code{common-shortest-duration} in
4807 @internalsref{SpacingSpanner}, then this sets the base duration for
4808 spacing. The maximum duration for this base (normally 1/8th), is set
4809 through @code{base-shortest-duration}.
4811 @cindex @code{common-shortest-duration}
4812 @cindex @code{base-shortest-duration}
4813 @cindex @code{stem-spacing-correction}
4814 @cindex @code{spacing}
4816 In the introduction it was explained that stem directions influence
4817 spacing. This is controlled with @code{stem-spacing-correction} in
4818 @internalsref{NoteSpacing}. The @code{StaffSpacing} object contains the
4819 same property for controlling the stem/barline spacing. In the
4820 following example shows these corrections, once with default settings,
4821 and once with exaggerated corrections.
4827 \property Staff.NoteSpacing \override #'stem-spacing-correction
4829 \property Staff.StaffSpacing \override #'stem-spacing-correction
4834 \paper { linewidth = -1. } }
4841 Spacing is determined on a score wide basis. If you have a score that
4842 changes its character (measured in durations) half way during the
4843 score, the part containing the longer durations will be spaced too
4846 Generating optically pleasing spacing is black magic. LilyPond tries
4847 to deal with a number of frequent cases. Here is an example that is
4848 not handled correctly, due to the combination of chord collisions and
4853 \context PianoStaff \notes \transpose c c'' <
4854 \context Staff = up { s1 }
4855 \context Staff = down { [c8 c \translator Staff=up <c d> c
4856 \translator Staff=down c c c] }
4858 \paper { linewidth = -1 }
4865 @subsection Font size
4866 @cindex font size, setting
4867 @cindex staff size, setting
4868 @cindex @code{paper} file
4870 The Feta font provides musical symbols at seven different sizes.
4871 These fonts are 11 point, 13 point, 16 point, 19 pt, 20 point, 23
4872 point, and 26 point. The point size of a font is the height of the
4873 five lines in a staff when displayed in the font.
4875 Definitions for these sizes are the files @file{paperSZ.ly}, where
4876 @code{SZ} is one of 11, 13, 16, 19, 20, 23 and 26. If you include any
4877 of these files, the identifiers @code{paperEleven},
4878 @code{paperThirteen}, @code{paperSixteen}, @code{paperNineteen},
4879 @code{paperTwenty}, @code{paperTwentythree}, and @code{paperTwentysix}
4880 are defined respectively. The default @code{\paper} block is also
4881 set. These files should be imported at toplevel, i.e.
4883 \include "paper26.ly"
4887 The font definitions are generated using a Scheme function. For more
4888 details, see the file @file{scm/font.scm}.
4893 @subsection Line breaking
4896 @cindex breaking lines
4898 Line breaks are normally computed automatically. They are chosen such
4899 that it looks neither cramped nor loose, and that consecutive lines have
4902 Occasionally you might want to override the automatic breaks; you can
4903 do this by specifying @code{\break}. This will force a line break at
4904 this point. Line breaks can only occur at places where there are bar
4905 lines. If you want to have a line break where there is no bar line,
4906 you can force an invisible bar line by entering @code{\bar
4907 ""}. Similarly, @code{\noBreak} forbids a line break at a certain
4911 @cindex regular line breaks
4912 @cindex four bar music.
4914 If you want linebreaks at regular intervals, you can use the following:
4916 < \repeat 7 unfold @{ s1 * 4 \break @}
4920 This makes the following 28 measures (assuming 4/4 time) be broken every
4924 @subsection Page layout
4927 @cindex breaking pages
4929 @cindex @code{indent}
4930 @cindex @code{linewidth}
4932 The most basic settings influencing the spacing are @code{indent} and
4933 @code{linewidth}. They are set in the @code{\paper} block. They
4934 control the indentation of the first line of music, and the lengths of
4935 the lines. If @code{linewidth} set to a negative value, a single
4936 unjustified line is produced. A similar effect for scores that are
4937 longer than one line, can be produced by setting @code{raggedright} to
4938 true in the @code{\paper} block.
4942 The page layout process happens outside lilypond. Ly2dvi sets page
4943 layout instructions. Ly2dvi responds to the following variables in the
4944 @code{\paper} block. The variable @code{textheight} sets the total
4945 height of the music on each page. The spacing between systems is
4946 controlled with @code{interscoreline}, its default is 16pt.
4947 The distance between the score lines will stretch in order to fill the
4948 full page @code{interscorelinefill} is set to a positive number. In
4949 that case @code{interscoreline} specifies the minimum spacing.
4951 @cindex @code{textheight}
4952 @cindex @code{interscoreline}
4953 @cindex @code{interscorelinefill}
4955 If the variable @code{lastpagefill} is defined (that is, it gets any
4956 value assigned in the @code{\paper} block), systems are evenly
4957 distributed vertically on the last page. This might produce ugly
4958 results in case there are not enough systems on the last page. Note
4959 that @command{lilypond-book} ignores @code{lastpagefill}. See
4960 @ref{Integrating text and music with lilypond-book} for
4963 @cindex @code{lastpagefill}
4965 Page breaks are normally computed by @TeX{}, so they are not under
4966 direct control of LilyPond. However, you can insert a commands into
4967 the @file{.tex} output to instruct @TeX{} where to break pages. You
4968 can insert a @code{\newpage} from within lilypond. This is done by
4969 setting the @code{between-systems-strings} on the
4970 @internalsref{NonMusicalPaperColumn} where the system is broken.
4974 @cindex @code{papersize}
4976 To change the paper size, you must first set the
4977 @code{papersize} paper variable variable. Set it to
4978 the strings @code{a4}, @code{letter}, or @code{legal}. After this
4979 specification, you must set the font as described above. If you want
4980 the default font, then use the 20 point font.
4983 \paper@{ papersize = "a4" @}
4984 \include "paper16.ly"
4987 The file @code{paper16.ly} will now include a file named @file{a4.ly}, which
4988 will set the paper variables @code{hsize} and @code{vsize} (used by
4989 Lilypond and @code{ly2dvi})
4999 LilyPond can produce MIDI output. The performance lacks lots of
5000 interesting effects, such as swing, articulation, slurring, etc., but it
5001 is good enough for proof-hearing the music you have entered. Ties,
5002 dynamics and tempo changes are interpreted.
5004 Dynamic marks, crescendi and decrescendi translate into MIDI volume
5005 levels. Dynamic marks translate to a fixed fraction of the available
5006 MIDI volume range, crescendi and decrescendi make the the volume vary
5007 linearly between their two extremities. The fractions be adjusted by
5008 overriding the @code{absolute-volume-alist} defined in
5009 @file{scm/midi.scm}.
5011 For each type of musical instrument (that MIDI supports), a volume range
5012 can be defined. This gives you basic equalizer control, which can
5013 enhance the quality of the MIDI output remarkably. You can add
5014 instruments and ranges or change the default settings by overriding the
5015 @code{instrument-equalizer-alist} defined in @file{scm/midi.scm}.
5017 Both loudness controls are combined to produce the final MIDI volume.
5021 * MIDI instrument names::
5026 @subsection MIDI block
5030 The MIDI block is analogous to the paper block, but it is somewhat
5031 simpler. The @code{\midi} block can contain:
5035 @item a @code{\tempo} definition
5036 @item context definitions
5039 Assignments in the @code{\midi} block are not allowed.
5043 @cindex context definition
5045 Context definitions follow precisely the same syntax as within the
5046 \paper block. Translation modules for sound are called performers.
5047 The contexts for MIDI output are defined in @file{ly/performer-init.ly}.
5050 @node MIDI instrument names
5051 @subsection MIDI instrument names
5053 @cindex instrument names
5054 @cindex @code{Staff.midiInstrument}
5055 @cindex @code{Staff.instrument}
5057 The MIDI instrument name is set by the @code{Staff.midiInstrument}
5058 property or, if that property is not set, the @code{Staff.instrument}
5059 property. The instrument name should be chosen from the list in
5060 @ref{MIDI instruments}.
5064 If the selected string does not exactly match, then LilyPond uses the
5065 default (Grand Piano). It is not possible to select an instrument by