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 #(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 = #(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 #(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 #(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 = #(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 = #(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 * * * *) = #(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{(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 * * * *) = #(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 * * * *) = #(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
1777 \spanrequest \start "text"
1778 \spanrequest \stop "text"
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\spanrequest \start "text" b c a \spanrequest \stop "text" }
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
1923 @cindex @code{\script}
1928 See also @seeinternals{Script} and @seeinternals{Fingering}.
1932 All of these note ornaments appear in the printed output but have no
1933 effect on the MIDI rendering of the music.
1935 Unfortunately, there is no support for adding fingering instructions or
1936 ornaments to individual note heads. Some hacks exist, though. See
1937 @file{input/test/script-horizontal.ly}.
1942 @subsection Text scripts
1943 @cindex Text scripts
1945 In addition, it is possible to place arbitrary strings of text or markup
1946 text (see @ref{Text markup}) above or below notes by using a string:
1949 By default, these indications do not influence the note spacing, but
1950 by using the command @code{\fatText}, the widths will be taken into
1953 @lilypond[fragment,singleline,verbatim] \relative c' {
1954 c4^"longtext" \fatText c4_"longlongtext" c4 }
1957 It is possible to use @TeX{} commands in the strings, but this should be
1958 avoided because it makes it impossible for LilyPond to compute the
1959 exact length of the string, which may lead to collisions. Also, @TeX{}
1960 commands won't work with direct PostScript output.
1961 @c (see @ref{PostScript output}).
1963 Text scripts are created in form of @internalsref{TextScript} objects, in
1964 @internalsref{Voice} context.
1966 @ref{Text markup} describes how to change the font or access
1967 special symbols in text scripts.
1972 @subsection Grace notes
1976 @cindex @code{\grace}
1980 Grace notes are ornaments that are written out
1981 @lilypond[relative=2,verbatim,ifragment] c4 \grace c16 c4 \grace {
1985 In normal notation, grace notes are supposed to take up no logical
1986 time in a measure. Such an idea is practical for normal notation, but
1987 is not strict enough to put it into a program. The model that LilyPond
1988 uses for grace notes internally is that all timing is done in two
1991 Every point in musical time consists of two rational numbers: one
1992 denotes the logical time, one denotes the grace timing. The above
1993 example is shown here with timing tuples.
1996 \score { \notes \relative c''{
1997 c4^"(0,0)" \grace c16_" "_"(1/4,-1/16)" c4^"(1/4,0)" \grace {
1998 [c16_"(2/4,-1/8)" d16^"(2/4,-1/16)" ] } c4_" "_"(2/4,0)"
2000 \paper { linewidth = 8.\cm }
2004 The advantage of this approach is that you can use almost any lilypond
2005 construction together with grace notes, for example slurs and clef
2006 changes may appear halfway in between grace notes:
2008 @lilypond[relative=2,verbatim,fragment]
2009 c4 \grace { [ c16 c, \clef bass c, b(] } )c4
2012 The placement of these grace notes is synchronized between different
2013 staves, using this grace timing.
2015 @lilypond[relative=2,verbatim,fragment]
2016 < \context Staff = SA { e4 \grace { c16 d e f } e4 }
2017 \context Staff = SB { c4 \grace { g8 b } c4 } >
2021 Unbeamed eighth notes and shorter by default have a slash through the
2022 stem. This can be controlled with object property @code{stroke-style} of
2023 @internalsref{Stem}. The change in formatting is accomplished by
2024 inserting @code{\startGraceMusic} before handling the grace notes, and
2025 @code{\stopGraceMusic} after finishing the grace notes. You can add to
2026 these definitions to globally change grace note formatting. The
2027 standard definitions are in @file{ly/grace-init.ly}.
2029 Notice how the @code{\override} is carefully matched with a @code{\revert}.
2034 @lilypond[fragment,verbatim]
2035 \relative c'' \context Voice {
2036 \grace c8 c4 \grace { [c16 c16] } c4
2038 \property Voice.Stem \override #'stroke-style = #'()
2040 \property Voice.Stem \revert #'stroke-style
2047 If you want to end a note with a grace note, then the standard trick
2048 is to put the grace notes before a phantom ``space note'', e.g.
2049 @lilypond[fragment,verbatim, relative=2]
2052 { s2 \grace { [c16 d] } } >
2057 A @code{\grace} section has some default values, and LilyPond will
2058 use those default values unless you specify otherwise inside the
2059 @code{\grace} section. For example, if you specify \slurUp
2060 @emph{before} your @code{\grace} section, a slur which starts inside
2061 the @code{\grace} won't be forced up, even if the slur ends outside
2062 of the @code{\grace}. Note the difference between the first and
2063 second bars in this example:
2065 @lilypond[fragment,verbatim]
2066 \relative c'' \context Voice {
2085 Grace notes can not be used in the smallest size (@file{paper11.ly}).
2087 Grace note synchronization can also lead to surprises. Staff notation,
2088 such as key signatures, barlines, etc. are also synchronized. Take
2089 care when you mix staves with grace notes and staves without.
2091 @lilypond[relative=2,verbatim,fragment]
2092 < \context Staff = SA { e4 \bar "|:" \grace c16 d4 }
2093 \context Staff = SB { c4 \bar "|:" d4 } >
2096 Grace sections should only be used within sequential music
2097 expressions. Nesting, juxtaposing, or ending sequential music with a
2098 grace section is not supported, and might produce crashes or other
2103 @subsection Glissando
2106 @cindex @code{\glissando}
2108 A glissando line can be requested by attaching a @code{\glissando} to
2111 @lilypond[fragment,relative,verbatim]
2117 Printing of an additional text (such as @emph{gliss.}) must be done
2118 manually. See also @seeinternals{Glissando}.
2124 @subsection Dynamics
2137 @cindex @code{\ffff}
2147 Absolute dynamic marks are specified using an identifier after a
2148 note: @code{c4-\ff}. The available dynamic marks are: @code{\ppp},
2149 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2150 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2151 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2153 @lilypond[verbatim,singleline,fragment,relative]
2154 c'\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2160 @cindex @code{\decr}
2161 @cindex @code{\rced}
2167 A crescendo mark is started with @code{\cr} and terminated with
2168 @code{\rc} (the textual reverse of @code{cr}). A decrescendo mark is
2169 started with @code{\decr} and terminated with @code{\rced}. There are
2170 also shorthands for these marks. A crescendo can be started with
2171 @code{\<} and a decrescendo can be started with @code{\>}. Either one
2172 can be terminated with @code{\!}. Note that @code{\!} must go before
2173 the last note of the dynamic mark whereas @code{\rc} and @code{\rced} go
2174 after the last note. Because these marks are bound to notes, if you
2175 want several marks during one note, you have to use spacer notes.
2177 @lilypond[fragment,verbatim,center]
2178 c'' \< \! c'' d'' \decr e'' \rced
2179 < f''1 { s4 s4 \< \! s4 \> \! s4 } >
2182 You can also use a text saying @emph{cresc.} instead of hairpins. Here
2183 is an example how to do it:
2185 @lilypond[fragment,relative=2,verbatim]
2186 c4 \cresc c4 \endcresc c4
2193 You can also supply your own texts:
2194 @lilypond[fragment,relative,verbatim]
2196 \property Voice.crescendoText = "cresc. poco"
2197 \property Voice.crescendoSpanner = #'dashed-line
2204 Dynamics are objects of @internalsref{DynamicText} and
2205 @internalsref{Hairpin}. Vertical positioning of these symbols is
2206 handled by the @internalsref{DynamicLineSpanner} object. If you want to
2207 adjust padding or vertical direction of the dynamics, you must set
2208 properties for the @internalsref{DynamicLineSpanner} object. Predefined
2209 identifiers to set the vertical direction are \dynamicUp and
2212 @cindex direction, of dynamics
2213 @cindex @code{\dynamicDown}
2214 @cindex @code{\dynamicUp}
2222 @cindex @code{\repeat}
2224 To specify repeats, use the @code{\repeat} keyword. Since repeats
2225 should work differently when played or printed, there are a few
2226 different variants of repeats.
2230 Repeated music is fully written (played) out. Useful for MIDI
2231 output, and entering repetitive music.
2234 This is the normal notation: Repeats are not written out, but
2235 alternative endings (voltas) are printed, left to right.
2238 Alternative endings are written stacked. This has limited use but may be
2239 used to typeset two lines of lyrics in songs with repeats, see
2240 @file{input/star-spangled-banner.ly}.
2246 Make beat or measure repeats. These look like percent signs.
2252 * Repeats and MIDI::
2253 * Manual repeat commands::
2255 * Tremolo subdivisions::
2260 @subsection Repeat syntax
2262 The syntax for repeats is
2265 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2268 If you have alternative endings, you may add
2269 @cindex @code{\alternative}
2271 \alternative @code{@{} @var{alternative1}
2273 @var{alternative3} @dots{} @code{@}}
2275 where each @var{alternative} is a music expression.
2277 Normal notation repeats are used like this:
2278 @lilypond[fragment,verbatim]
2280 \repeat volta 2 { c'4 d' e' f' }
2281 \repeat volta 2 { f' e' d' c' }
2284 With alternative endings:
2285 @lilypond[fragment,verbatim]
2287 \repeat volta 2 {c'4 d' e' f'}
2288 \alternative { {d'2 d'} {f' f} }
2291 Folded repeats look like this:
2294 @lilypond[fragment,verbatim]
2296 \repeat fold 2 {c'4 d' e' f'}
2297 \alternative { {d'2 d'} {f' f} }
2301 If you don't give enough alternatives for all of the repeats, then
2302 the first alternative is assumed to be repeated often enough to equal
2303 the specified number of repeats.
2305 @lilypond[fragment,verbatim]
2309 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2310 \alternative { { g4 g g } { a | a a a a | b2. } }
2315 @node Repeats and MIDI
2316 @subsection Repeats and MIDI
2318 @cindex expanding repeats
2320 For instructions on how to unfoldi repeats for MIDI output, see
2321 the example file @file{input/test/unfold-all-repeats.ly}.
2326 Notice that timing information is not remembered at the start of an
2327 alternative, so you have to reset timing information after a repeat,
2328 e.g. using a bar-check (See @ref{Bar check}), setting
2329 @code{Score.measurePosition} or entering @code{\partial}. Slurs or ties
2330 are also not repeated.
2332 It is possible to nest @code{\repeat}s, although this probably is only
2333 meaningful for unfolded repeats.
2335 Folded repeats offer little more over simultaneous music.
2337 @node Manual repeat commands
2338 @subsection Manual repeat commands
2340 @cindex @code{repeatCommands}
2342 The property @code{repeatCommands} can be used to control the layout of
2343 repeats. Its value is a Scheme list of repeat commands, where each repeat
2351 @item (volta . @var{text})
2352 Print a volta bracket saying @var{text}.
2354 Stop a running volta bracket
2357 @lilypond[verbatim, fragment]
2359 \property Score.repeatCommands = #'((volta "93") end-repeat)
2361 \property Score.repeatCommands = #'((volta #f))
2366 Repeats brackets are @internalsref{VoltaBracket} objects.
2368 @node Tremolo repeats
2369 @subsection Tremolo repeats
2370 @cindex tremolo beams
2372 To place tremolo marks between notes, use @code{\repeat} with tremolo
2374 @lilypond[verbatim,center,singleline]
2376 \context Voice \notes\relative c' {
2377 \repeat "tremolo" 8 { c16 d16 }
2378 \repeat "tremolo" 4 { c16 d16 }
2379 \repeat "tremolo" 2 { c16 d16 }
2380 \repeat "tremolo" 4 c16
2385 Tremolo beams are @internalsref{Beam} objects. Single stem tremolos are
2386 @internalsref{StemTremolo}. The single stem tremolo @emph{must} be
2387 entered without @code{@{} and @code{@}}.
2391 Only powers of two and undotted notes are supported repeat counts.
2393 @node Tremolo subdivisions
2394 @subsection Tremolo subdivisions
2395 @cindex tremolo marks
2396 @cindex @code{tremoloFlags}
2398 Tremolo marks can be printed on a single note by adding
2399 `@code{:}[@var{length}]' after the note. The length must be at least 8.
2400 A @var{length} value of 8 gives one line across the note stem. If the
2401 length is omitted, then then the last value (stored in
2402 @code{Voice.tremoloFlags}) is used.
2404 @lilypond[verbatim,fragment,center]
2405 c'2:8 c':32 | c': c': |
2411 Tremolos in this style do not carry over into the MIDI output.
2414 @node Measure repeats
2415 @subsection Measure repeats
2417 @cindex percent repeats
2418 @cindex measure repeats
2420 In the @code{percent} style, a note pattern can be repeated. It is
2421 printed once, and then the pattern is replaced with a special sign.
2422 Patterns of a one and two measures are replaced by percent-like signs,
2423 patterns that divide the measure length are replaced by slashes.
2425 @lilypond[verbatim,singleline]
2426 \context Voice { \repeat "percent" 4 { c'4 }
2427 \repeat "percent" 2 { c'2 es'2 f'4 fis'4 g'4 c''4 }
2431 The signs are represented by these objects: @internalsref{RepeatSlash} and
2432 @internalsref{PercentRepeat} and @internalsref{DoublePercentRepeat}.
2436 You can not nest percent repeats, e.g. by filling in the first measure
2437 with slashes, and repeating that measure with percents.
2439 @node Rhythmic music
2440 @section Rhythmic music
2442 Sometimes you might want to show only the rhythm of a melody. This can
2443 be done with the rhythmic staff. All pitches of notes on such a staff
2444 are squashed, and the staff itself looks has a single staff line:
2446 @lilypond[fragment,relative,verbatim]
2447 \context RhythmicStaff {
2449 c4 e8 f g2 | r4 g r2 | g1:32 | r1 |
2454 * Percussion staves::
2457 @node Percussion staves
2458 @subsection Percussion staves
2461 To typeset more than one piece of percussion to be played by the same
2462 musician one typically uses a multiline staff where each staff
2463 position refers to a specific piece of percussion.
2465 LilyPond is shipped with a bunch of scheme functions which allows you
2466 to do this fairly easily.
2468 The system is based on the general midi drum-pitches.
2469 In order to use the drum pitches you include
2470 @file{ly/drumpitch-init.ly}. This file defines the pitches from the scheme
2471 variable @code{drum-pitch-names} - which definition can be read in
2472 @file{scm/drums.scm}. You see that each piece of percussion has a full
2473 name and an abbreviated name - and you may freely select whether to
2474 refer to the full name or the abbreviation in your music definition.
2476 To typeset the music on a staff you apply the scheme function
2477 @code{drums->paper} to the percussion music. This function takes a
2478 list of percussion instrument names, notehead scripts and staff
2479 positions (that is: pitches relative to the C-clef) and uses this to
2480 transform the input music by moving the pitch, changing the notehead
2481 and (optionally) adding a script:
2482 @lilypond[singleline,verbatim]
2483 \include "drumpitch-init.ly"
2484 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2485 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2487 \apply #(drums->paper 'drums) \context Staff <
2489 \context Voice = up { \voiceOne \up }
2490 \context Voice = down { \voiceTwo \down }
2495 In the above example the music was transformed using the list @code{'drums}.
2496 Currently the following lists are defined in @file{scm/drums.scm}:
2499 To typeset a typical drum kit on a five-line staff.
2502 \include "drumpitch-init.ly"
2503 nam = \lyrics { cymc cyms cymr hh hhc hho hhho hhp cb hc
2504 bd sn ss tomh tommh tomml toml tomfh tomfl }
2505 mus = \notes { cymc cyms cymr hh hhc hho hhho hhp cb hc
2506 bd sn ss tomh tommh tomml toml tomfh tomfl s16 }
2509 \apply #(drums->paper 'drums) \context Staff <
2513 \context Lyrics \nam
2516 linewidth = 100.0\mm
2519 \remove Bar_engraver
2520 \remove Time_signature_engraver
2521 minimumVerticalExtent = #'(-4.0 . 5.0)
2525 \remove Stem_engraver
2531 Notice that the scheme supports six different toms.
2532 If you are using fewer toms then you simply select the toms that produce
2533 the desired result - i.e. to get toms on the three middle lines you
2534 use @code{tommh}, @code{tomml} and @code{tomfh}.
2536 Because the general midi contain no rimshots we use the sidestick for
2537 this purpose instead.
2539 To typeset timbales on a two line staff.
2540 @lilypond[singleline]
2541 \include "drumpitch-init.ly"
2542 nam = \lyrics { timh ssh timl ssl cb }
2543 mus = \notes { timh ssh timl ssl cb s16 }
2546 \apply #(drums->paper 'timbales) \context Staff <
2550 \context Lyrics \nam
2555 \remove Bar_engraver
2556 \remove Time_signature_engraver
2557 StaffSymbol \override #'line-count = #2
2558 StaffSymbol \override #'staff-space = #2
2559 minimumVerticalExtent = #'(-3.0 . 4.0)
2563 \remove Stem_engraver
2570 To typeset congas on a two line staff.
2571 @lilypond[singleline]
2572 \include "drumpitch-init.ly"
2573 nam = \lyrics { cgh cgho cghm ssh cgl cglo cglm ssl }
2574 mus = \notes { cgh cgho cghm ssh cgl cglo cglm ssl s16 }
2577 \apply #(drums->paper 'congas) \context Staff <
2581 \context Lyrics \nam
2586 \remove Bar_engraver
2587 \remove Time_signature_engraver
2588 StaffSymbol \override #'line-count = #2
2589 StaffSymbol \override #'staff-space = #2
2590 minimumVerticalExtent = #'(-3.0 . 4.0)
2594 \remove Stem_engraver
2600 To typeset bongos on a two line staff.
2601 @lilypond[singleline]
2602 \include "drumpitch-init.ly"
2603 nam = \lyrics { boh boho bohm ssh bol bolo bolm ssl }
2604 mus = \notes { boh boho bohm ssh bol bolo bolm ssl s16 }
2607 \apply #(drums->paper 'bongos) \context Staff <
2611 \context Lyrics \nam
2616 \remove Bar_engraver
2617 \remove Time_signature_engraver
2618 StaffSymbol \override #'line-count = #2
2619 StaffSymbol \override #'staff-space = #2
2620 minimumVerticalExtent = #'(-3.0 . 4.0)
2624 \remove Stem_engraver
2630 To typeset all kinds of simple percussion on one line staves.
2631 @lilypond[singleline]
2632 \include "drumpitch-init.ly"
2633 nam = \lyrics { tri trio trim gui guis guil cb cl tamb cab mar hc }
2634 mus = \notes { tri trio trim gui guis guil cb cl tamb cab mar hc s16 }
2637 \apply #(drums->paper 'percussion) \context Staff <
2641 \context Lyrics \nam
2646 \remove Bar_engraver
2647 \remove Time_signature_engraver
2648 StaffSymbol \override #'line-count = #1
2649 minimumVerticalExtent = #'(-2.0 . 3.0)
2653 \remove Stem_engraver
2660 If you don't like any of the predefined lists you can define your own
2661 list at the top of your file:
2663 @lilypond[singleline, verbatim]
2665 (bassdrum default #f ,(make-pitch -1 2 0))
2666 (snare default #f ,(make-pitch 0 1 0))
2667 (hihat cross #f ,(make-pitch 0 5 0))
2668 (pedalhihat xcircle "stopped" ,(make-pitch 0 5 0))
2669 (lowtom diamond #f ,(make-pitch -1 6 0))
2671 \include "drumpitch-init.ly"
2672 up = \notes { hh8 hh hh hh hhp4 hhp }
2673 down = \notes { bd4 sn bd toml8 toml }
2675 \apply #(drums->paper 'mydrums) \context Staff <
2677 \context Voice = up { \voiceOne \up }
2678 \context Voice = down { \voiceTwo \down }
2683 To use a modified existing list instead of building your own from
2684 scratch you can append your modifications to the start of the existing
2688 #(define mydrums (append `(
2689 (bassdrum default #f ,(make-pitch -1 2 0))
2690 (lowtom diamond #f ,(make-pitch -1 6 0))
2694 @c FIXME: Too many levels of headers when using subsubsections.
2695 @c Perhaps junk subsection ``Percussion staves''
2696 @subsubsection Percussion staves with normal staves
2697 When you include @file{drumpitch-init.ly} then the default pitches
2698 are overridden so that you after the inclusion cannot use the common
2699 dutch pitch names anymore. Hence you might wan't to reinclude
2700 @file{nederlands.ly} after the drum-pattern-definitions:
2701 @lilypond[singleline,verbatim]
2702 \include "drumpitch-init.ly"
2703 up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
2704 down = \notes { bassdrum4 snare8 bd r bd sn4 }
2705 \include "nederlands.ly"
2706 bass = \notes \transpose c, { a4. e8 r e g e }
2709 \apply #(drums->paper 'drums) \context Staff = drums <
2711 \context Voice = up { \voiceOne \up }
2712 \context Voice = down { \voiceTwo \down }
2714 \context Staff = bass { \clef "F_8" \bass }
2719 @subsubsection Percussion midi output
2720 In order to produce correct midi output you need to produce two score
2721 blocks - one for the paper and one for the midi.
2722 To use the percussion channel you set the property @code{instrument}
2723 to @code{'drums}. Because the drum-pitches themself are similar to the
2724 general midi pitches all you have to do is to insert the voices with
2725 none of the scheme functions to get the correct midi output:
2729 \apply #(drums->paper 'mydrums) \context Staff <
2731 \context Voice = up @{ \voiceOne \up @}
2732 \context Voice = down @{ \voiceTwo \down @}
2738 \property Staff.instrument = #'drums
2747 This scheme is to be considered a temporary implementation. Even
2748 though the scheme will probably keep on working then the future might
2749 bring some other way of typesetting drums, and probably
2750 there will be made no great efforts in keeping things downwards
2755 @section Piano music
2757 Piano music is an odd type of notation. Piano staves are two normal
2758 staves coupled with a brace. The staves are largely independent, but
2759 sometimes voices can cross between the two staves. The
2760 @internalsref{PianoStaff} is especially built to handle this cross-staffing
2761 behavior. In this section we discuss the @internalsref{PianoStaff} and some
2762 other pianistic peculiarities.
2765 * Automatic staff changes::
2766 * Manual staff switches::
2769 * Voice follower lines::
2773 @c . {Automatic staff changes}
2774 @node Automatic staff changes
2775 @subsection Automatic staff changes
2776 @cindex Automatic staff changes
2778 Voices can switch automatically between the top and the bottom
2779 staff. The syntax for this is
2781 \autochange Staff \context Voice @{ @dots{}@var{music}@dots{} @}
2783 The autochanger switches on basis of pitch (central C is the turning
2784 point), and it looks ahead skipping over rests to switch rests in
2785 advance. Here is a practical example:
2787 @lilypond[verbatim,singleline]
2788 \score { \notes \context PianoStaff <
2789 \context Staff = "up" {
2790 \autochange Staff \context Voice = VA < \relative c' {
2791 g4 a b c d r4 a g } > }
2792 \context Staff = "down" {
2797 Spacer rests are used to prevent the bottom staff from
2798 terminating too soon.
2801 @node Manual staff switches
2802 @subsection Manual staff switches
2804 @cindex manual staff switches
2805 @cindex staff switch, manual
2807 Voices can be switched between staves manually, using the following command:
2809 \translator Staff = @var{staffname} @var{music}
2811 The string @var{staffname} is the name of the staff. It switches the
2812 current voice from its current staff to the Staff called
2813 @var{staffname}. Typically @var{staffname} is @code{"up"} or
2821 Piano pedal instruction can be expressed using
2822 @code{\sustainDown}, @code{\sustainUp}, @code{\unaCorda},
2823 @code{\treCorde}, @code{\sostenutoDown} and @code{\sostenutoUp}.
2825 These identifiers are shorthands for spanner commands of the types
2826 @internalsref{Sustain}, @internalsref{UnaCorda} and @internalsref{Sostenuto}:
2828 @lilypond[fragment,verbatim]
2829 c''4 \spanrequest \start "Sustain" c''4
2830 c''4 \spanrequest \stop "Sustain"
2833 The symbols that are printed can be modified by setting
2834 @code{pedal@var{X}Strings}, where @var{X} is one of the pedal types:
2835 Sustain, Sostenuto or UnaCorda. Refer to the generated documentation of
2836 @rgrob{SustainPedal}, for example, for more information.
2838 Pedals can also be indicated by a sequence of brackets, by setting the
2839 @code{pedal-type} property of SustainPedal objects:
2841 @lilypond[fragment,verbatim]
2842 \property Staff.SustainPedal \override #'pedal-type = #'bracket
2843 c''4 \sustainDown d''4 e''4 a'4
2844 \sustainUp \sustainDown
2845 f'4 g'4 a'4 \sustainUp
2848 A third style of pedal notation is a mixture of text and brackets,
2849 obtained by setting @code{pedal-type} to @code{mixed}:
2851 @lilypond[fragment,verbatim]
2852 \property Staff.SustainPedal \override #'pedal-type = #'mixed
2853 c''4 \sustainDown d''4 e''4 c'4
2854 \sustainUp \sustainDown
2855 f'4 g'4 a'4 \sustainUp
2858 The default '*Ped' style for sustain and damper pedals corresponds to
2859 @code{\pedal-type = #'text}. However, @code{mixed} is the default style
2860 for a sostenuto pedal:
2862 @lilypond[fragment,verbatim]
2863 c''4 \sostenutoDown d''4 e''4 c'4 f'4 g'4 a'4 \sostenutoUp
2866 For fine-tuning of the appearance of a pedal bracket, the properties
2867 @code{edge-width}, @code{edge-height}, and @code{shorten-pair} of
2868 @code{PianoPedalBracket} objects (see the detailed documentation of
2869 @rgrob{PianoPedalBracket}) can be modified. For example, the bracket
2870 may be extended to the end of the note head.
2872 @lilypond[fragment,verbatim]
2873 \property Staff.PianoPedalBracket \override
2874 #'shorten-pair = #'(0 . -1.0)
2875 c''4 \sostenutoDown d''4 e''4 c'4
2876 f'4 g'4 a'4 \sostenutoUp
2883 @subsection Arpeggio
2886 @cindex broken arpeggio
2887 @cindex @code{\arpeggio}
2889 You can specify an arpeggio sign on a chord by attaching an
2890 @code{\arpeggio} to a note of the chord.
2893 @lilypond[fragment,relative,verbatim]
2894 \context Voice <c\arpeggio e g c>
2897 When an arpeggio crosses staves in piano music, you attach an arpeggio
2898 to the chords in both staves, and set
2899 @code{PianoStaff.connectArpeggios}.
2901 @lilypond[fragment,relative,verbatim]
2902 \context PianoStaff <
2903 \property PianoStaff.connectArpeggios = ##t
2904 \context Voice = one { <c'\arpeggio e g c> }
2905 \context Voice = other { \clef bass <c,,\arpeggio e g>}
2909 This command creates @internalsref{Arpeggio} objects. Cross staff arpeggios
2910 are @code{PianoStaff.Arpeggio}.
2912 To add an arrow head to explicitly specify the direction of the
2913 arpeggio, you should set the arpeggio object property
2914 @code{arpeggio-direction}.
2916 @lilypond[fragment,relative,verbatim]
2918 \property Voice.Arpeggio \set #'arpeggio-direction = #1
2920 \property Voice.Arpeggio \set #'arpeggio-direction = #-1
2925 A square bracket on the left indicates that the player should not
2926 arpeggiate the chord. To draw these brackets, set the
2927 @code{molecule-callback} property of @code{Arpeggio} or
2928 @code{PianoStaff.Arpeggio} objects to @code{\arpeggioBracket}, and use
2929 @code{\arpeggio} statements within the chords as before.
2931 @lilypond[fragment,relative,verbatim]
2932 \context PianoStaff <
2933 \property PianoStaff.connectArpeggios = ##t
2934 \property PianoStaff.Arpeggio \override
2935 #'molecule-callback = \arpeggioBracket
2936 \context Voice = one { <c'\arpeggio e g c> }
2937 \context Voice = other { \clef bass <c,,\arpeggio e g>}
2944 It is not possible to mix connected arpeggios and unconnected
2945 arpeggios in one PianoStaff at the same time.
2949 @node Voice follower lines
2950 @subsection Voice follower lines
2952 @cindex follow voice
2953 @cindex staff switching
2956 @cindex @code{followVoice}
2958 Whenever a voice switches to another staff a line connecting the notes
2959 can be printed automatically. This is enabled if the property
2960 @code{PianoStaff.followVoice} is set to true:
2962 @lilypond[fragment,relative,verbatim]
2963 \context PianoStaff <
2964 \property PianoStaff.followVoice = ##t
2965 \context Staff \context Voice {
2967 \translator Staff=two
2970 \context Staff=two {\clef bass \skip 1*2 }
2974 The associated object is @internalsref{VoiceFollower}.
2980 Tablature notation is used for notating music for plucked string
2981 instruments. It notates pitches not by using note heads, but by
2982 indicating on which string and fret a note must be played. LilyPond
2983 offers limited support for tablature.
2986 * Tablatures basic::
2987 * Non-guitar tablatures::
2988 * Tablature in addition to normal staff::
2991 @node Tablatures basic
2992 @subsection Tablatures basic
2993 @cindex Tablatures basic
2995 Tablature can be typeset with Lilypond by using the
2996 @internalsref{TabStaff} and @internalsref{TabVoice} contexts. As
2997 tablature is a recent feature in Lilypond, most of the guitar special
2998 effects such as bend are not yet supported.
3000 With the @internalsref{TabStaff}, the string number associated to a note
3001 is given as a backslash followed by the string number, e.g. @code{c4\3} for a C
3002 quarter on the third string. By default, string 1 is the highest one, and the
3003 tuning defaults to the standard guitar tuning (with 6 strings).
3005 @lilypond[fragment,verbatim]
3014 If you do not specify a string number then lilypond automatically selects one.
3015 The selection is controlled by the translator property @code{minimumFret}. -- LilyPond
3016 simply selects the first string that does not give a fret number less than
3017 @code{minimumFret}. Default is 0.
3019 Notice that LilyPond does not handle chords in any special way, and hence
3020 the automatic string selector may easily select the same string to two notes in a chord.
3023 e8 fis gis a b cis' dis' e'
3024 \property TabStaff.minimumFret = #8
3025 e8 fis gis a b cis' dis' e'
3027 @lilypond[noindent,noquote]
3030 e8 fis gis a b cis' dis' e'
3031 \property TabStaff.minimumFret = #8
3032 e8 fis gis a b cis' dis' e'
3035 \context StaffGroup <
3036 \context Staff { \clef "G_8" \frag }
3037 \context TabStaff { \frag }
3042 @node Non-guitar tablatures
3043 @subsection Non-guitar tablatures
3044 @cindex Non-guitar tablatures
3046 There are many ways to customize Lilypond tablatures.
3048 First you can change the number of strings, by setting the number of
3049 lines in the @internalsref{TabStaff} (the @code{line-count} property
3050 of TabStaff can only be changed using @code{\outputproperty}, for more
3051 information, see @ref{Tuning per object}. You can change the strings
3052 tuning. A string tuning is given as a Scheme list with one integer
3053 number for each string, the number being the pitch of an open string.
3055 (The numbers specified for stringTuning are the numbers of semitons
3056 to subtract --- or add --- starting the specified pitch by default
3057 middle C, in string order: thus the notes are e, a, d & g)
3059 @lilypond[fragment,verbatim]
3062 \outputproperty #(make-type-checker 'staff-symbol-interface)
3064 \property TabStaff.stringTunings = #'(-5 -10 -15 -20)
3067 a,4 c' a e' e c' a e'
3073 Finally, it is possible to change the Scheme function to format the
3074 tablature note text. The default is @var{fret-number-tablature-format},
3075 which uses the fret number, but for some instruments that may not use
3076 this notation, just create your own tablature-format function. This
3077 function takes three argument: the string number, the string tuning and
3081 @node Tablature in addition to normal staff
3082 @subsection Tablature in addition to normal staff
3083 @cindex Tablature in addition to normal staff
3085 It is possible to typeset both tablature and a "normal" staff, as
3086 commonly done in many parts.
3088 A common trick for that is to put the notes in a variables, and to hide
3089 the fingering information (which correspond to the string number) for
3093 @c @lily pond[verbatim]
3100 \context StaffGroup <
3102 % Hide fingering number
3103 \property Staff.Fingering \override #'transparent = ##t
3108 \property Staff.Stem \override #'direction = #1
3122 LilyPond has support for both entering and printing chords.
3123 @lilypond[verbatim,singleline]
3124 twoWays = \notes \transpose c'' {
3134 < \context ChordNames \twoWays
3135 \context Voice \twoWays > }
3138 This example also shows that the chord printing routines do not try to
3139 be intelligent. If you enter @code{f bes d}, it does not interpret
3140 this as an inversion.
3142 As you can see chords really are a set of pitches. They are internally
3143 stored as simultaneous music expressions. This means you can enter
3144 chords by name and print them as notes, enter them as notes and print
3145 them as chord names, or (the most common case) enter them by name, and
3150 * Printing named chords::
3155 @subsection Chords mode
3158 Chord mode is a mode where you can input sets of pitches using common
3159 names. It is introduced by the keyword @code{\chords}. It is similar
3160 to note mode, but words are also looked up in a chord modifier table
3161 (containing @code{maj}, @code{dim}, etc). Dashes and carets are used
3162 to indicate chord additions and subtractions, so articulation scripts
3163 can not be entered in Chord mode.
3165 Throughout these examples, chords have been shifted around the staff
3166 using @code{\transpose}.
3168 @lilypond[fragment,verbatim]
3172 c:9 c:9-.5+.7+ c:3-.5-
3182 The second type of modifier that may appear after the @code{:} is a
3183 named modifier. Named modifiers are listed in the file
3184 @file{chord-modifiers.ly}. The available modifiers are @code{m} and
3185 @code{min} which lower the 3rd half a step, `@code{aug}' which
3186 raises the 5th, `@code{dim}' which lowers the 5th,
3187 `@code{maj}' which adds a raised 7th, and `@code{sus}'
3188 which replaces the 5th with a 4th.
3190 @lilypond[fragment,verbatim]
3193 c1:m c:min7 c:maj c:aug c:dim c:sus
3199 Chord subtractions are used to eliminate notes from a chord. The
3200 notes to be subtracted are listed after a @code{^} character,
3203 @lilypond[fragment,verbatim,center]
3212 Chord inversions can be specified by appending `@code{/}' and the name
3213 of a single note to a chord. In a chord inversion, the inverted note is
3214 transposed down until it is the lowest note in the chord. If the note
3215 is not in the chord, a warning will be printed.
3217 @lilypond[fragment,verbatim,center]
3227 Bass notes can be added by `@code{/+}' and
3228 the name of a single note to a chord. This has the effect of
3229 adding the specified note to the chord, lowered by an octave,
3230 so it becomes the lowest note in the chord.
3232 @lilypond[fragment,verbatim,center]
3241 The formal syntax for named chords is as follows:
3243 @var{tonic}[@var{duration}][@code{-}@var{modifiers}][@code{^}@var{subtractions}][@code{/}@var{inversion}][@code{/+}@var{bass}].
3246 @var{tonic} should be the tonic note of the chord, and @var{duration} is
3247 the chord duration in the usual notation. There are two kinds of
3248 modifiers. One type is formed by @emph{chord additions}. Additions are
3249 obtained by listing intervals separated by dots. An interval is written
3250 by its number with an optional @code{+} or @code{-} to indicate raising
3251 or lowering by half a step. Chord additions have two effects: they adds
3252 the specified interval and all lower odd numbered intervals to the
3253 chord, and they may lower or raise the specified interval.
3258 Implementation details are gory. For example @code{c:4} not only adds
3259 a fourth, but also removes the third.
3262 @c . {Printing named chords}
3263 @node Printing named chords
3264 @subsection Printing named chords
3266 @cindex printing chord names
3270 For displaying printed chord names, use the @internalsref{ChordNames} context.
3271 The chords may be entered either using the notation described above, or
3272 directly using simultaneous music.
3274 @lilypond[verbatim,singleline]
3276 \chords {a1 b c} <d f g> <e g b>
3280 \context ChordNames \scheme
3281 \context Staff \transpose c'' \scheme
3286 You can make the chord changes stand out by setting
3287 @code{ChordNames.chordChanges} to true. This will only display chord
3288 names when there's a change in the chords scheme and at the start of a
3293 c1:m c:m \break c:m c:m d
3297 \context ChordNames {
3298 \property ChordNames.chordChanges = ##t
3300 \context Staff \transpose c'' \scheme
3302 \paper{linewidth= 9.\cm}
3306 LilyPond examines chords specified as lists of notes to determine a name
3307 to give the chord. LilyPond will not try to identify chord inversions or
3308 an added bass note, which may result in strange chord names when chords
3309 are entered as a list of pitches:
3311 @lilypond[verbatim,center,singleline]
3320 \context ChordNames \scheme
3321 \context Staff \scheme
3327 By default, a chord name system proposed by Harald Banter (See
3328 @ref{Literature}) is used. The system is very regular and predictable.
3329 Typical American style chord names may be selected by setting the
3330 @code{style} property of the @code{ChordNames.ChordName} object to
3331 @code{'american}. Similarly @code{'jazz} selects Jazz chordnames.
3333 Routines that determine the names to be printed are written in Scheme,
3334 and may be customized by the user. The code can be found in
3335 @file{scm/chord-name.scm}. Here's an example showing the differences in
3339 @c maybe just junk verbatim option?
3340 @lilypond[verbatim,singleline,noquote]
3350 \context ChordNames = banter \scheme
3351 \context ChordNames = american {
3352 \property ChordNames.ChordName \override
3353 #'style = #'american \scheme }
3354 \context ChordNames = jazz {
3355 \property ChordNames.ChordName \override
3356 #'style = #'jazz \scheme }
3357 \context Staff \transpose c'' \scheme
3364 @section Writing parts
3366 Orchestral music involves some special notation, both in the full score,
3367 as in the individual parts. This section explains how to tackle common
3368 problems in orchestral music.
3375 * Instrument names::
3377 * Multi measure rests::
3378 * Automatic part combining::
3379 * Hara kiri staves::
3380 * Sound output for transposing instruments::
3383 @c . {Rehearsal marks}
3384 @node Rehearsal marks
3385 @subsection Rehearsal marks
3386 @cindex Rehearsal marks
3388 @cindex @code{\mark}
3390 To print a rehearsal mark, use the @code{\mark} command.
3391 @lilypond[fragment,verbatim]
3402 As you can see, the mark is incremented automatically if you use
3403 @code{\mark \default}. The value to use is stored in the property
3404 @code{rehearsalMark} is used and automatically incremented. The object
3405 is @internalsref{RehearsalMark} in @internalsref{Score} context. See
3406 @code{input/test/boxed-molecule.ly} if you need boxes around the
3409 The @code{\mark} command can also be used to put signs like coda,
3410 segno and fermatas on a barline. The trick is to use the text markup
3411 mechanism to access the fermata symbol.
3412 @lilypond[fragment,verbatim,relative=1]
3413 c1 \mark #'(music "scripts-ufermata")
3417 The problem is that marks that occur at a line break are typeset only
3418 at the beginning of the next line, opposite to what you want for the
3419 fermata. This can be corrected by the following property setting
3421 \property Score.RehearsalMark \override
3422 #'visibility-lambda = #begin-of-line-invisible
3428 @cindex barlines, putting symbols on
3432 @subsection Bar numbers
3436 @cindex measure numbers
3437 @cindex currentBarNumber
3439 Bar numbers are printed by default at the start of the line. The
3440 number itself is a property that can be set by modifying the
3441 @code{currentBarNumber} property, i.e.
3443 \property Score.currentBarNumber = #217
3446 To typeset Bar Numbers at regular intervals instead of at the beginning of each line,
3447 you need to change the grob property @code{break-visibility} as well as the translator
3448 property @code{barNumberVisibility}, as illustrated in the following example which also
3449 adds a box around the bar numbers:
3451 \property Score.BarNumber \override #'break-visibility =
3452 #end-of-line-invisible
3453 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3454 \property Score.BarNumber \override #'molecule-callback =
3455 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3456 \property Score.BarNumber \override #'font-relative-size = #0
3458 @lilypond[noindent,noquote]
3460 \context Staff \notes \transpose c''' {
3461 \property Score.BarNumber \override #'break-visibility = #end-of-line-invisible
3462 \property Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
3463 \property Score.BarNumber \override #'molecule-callback =
3464 #(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
3465 \property Score.BarNumber \override #'font-relative-size = #0
3467 \repeat unfold 16 c1 \bar "|."
3472 See also @seeinternals{BarNumber}.
3476 Barnumbers can collide with the StaffGroup, if there is one at the
3477 top. To solve this, You have to twiddle with the
3478 @internalsref{padding} property of @internalsref{BarNumber} if your
3479 score starts with a @internalsref{StaffGroup}.
3481 @node Instrument names
3482 @subsection Instrument names
3484 In scores, the instrument name is printed before the staff. This can
3485 be done by setting @code{Staff.instrument} and
3486 @code{Staff.instr}. This will print a string before the start of the
3487 staff. For the first start, @code{instrument} is used, for the next
3488 ones @code{instr} is used.
3490 @lilypond[verbatim,singleline]
3491 \property Staff.instrument = "ploink " { c''4 }
3494 You can also use markup texts to construct more complicated instrument
3498 @lilypond[verbatim,singleline]
3500 '((font-relative-size . -2 ) (music "accidentals--1")))
3503 \property Staff.instrument = #`((kern . 0.5) (lines
3504 "2 Clarinetti" (columns " (B" ,text-flat ")")))
3512 When you put a name on a grand staff or piano staff the width of the
3513 brace is not taken into account. You must add extra spaces to the end of
3514 the name to avoid a collision.
3517 @subsection Transpose
3519 @cindex transposition of pitches
3520 @cindex @code{\transpose}
3522 A music expression can be transposed with @code{\transpose}. The syntax
3525 \transpose @var{pitch} @var{musicexpr}
3528 This means that middle C in @var{musicexpr} is transposed to
3531 @code{\transpose} distinguishes between enharmonic pitches: both
3532 @code{\transpose cis'} or @code{\transpose des'} will transpose up half
3533 a tone. The first version will print sharps and the second version
3536 @lilypond[singleline, verbatim]
3537 mus =\notes { \key d \major cis d fis g }
3538 \score { \notes \context Staff {
3546 If you want to use both @code{\transpose} and @code{\relative}, then
3547 you must use @code{\transpose} first. @code{\relative} will have no
3548 effect music that appears inside a @code{\transpose}.
3550 @c . {Multi measure rests}
3551 @node Multi measure rests
3552 @subsection Multi measure rests
3553 @cindex Multi measure rests
3557 Multi measure rests are entered using `@code{R}'. It is specifically
3558 meant for full bar rests and for entering parts: the rest can expand to
3560 rests, or it can be printed as a single multimeasure rest This expansion
3561 is controlled by the property @code{Score.skipBars}. If this is set to true,
3562 Lily will not expand empty measures, and the appropriate number is added
3565 @lilypond[fragment,verbatim]
3566 \time 3/4 r2. | R2. | R2.*2
3567 \property Score.skipBars = ##t R2.*17 R2.*4
3570 Notice that the @code{R2.} is printed as a whole rest, centered in the
3573 @cindex whole rests for a full measure
3575 The object for this object is @internalsref{MultiMeasureRest}.
3579 Currently, there is no way to automatically condense multiple rests
3580 into a single multimeasure rest. Multi measure rests do not take part
3583 @cindex condensing rests
3585 @node Automatic part combining
3586 @subsection Automatic part combining
3587 @cindex automatic part combining
3588 @cindex part combiner
3591 Automatic part combining is used to merge two parts of music onto a
3592 staff in an intelligent way. It is aimed primarily at typesetting
3593 orchestral scores. When the two parts are identical for a period of
3594 time, only one is shown. In places where the two parts differ, they
3595 are typeset as separate voices, and stem directions are set
3596 automatically. Also, solo and @emph{a due} parts can be identified
3599 The syntax for part combining is
3602 \partcombine @var{context} @var{musicexpr1} @var{musicexpr2}
3604 where the pieces of music @var{musicexpr1} and @var{musicexpr2} will be
3605 combined into one context of type @var{context}. The music expressions
3606 must be interpreted by contexts whose names should start with @code{one}
3609 The most useful function of the part combiner is to combine parts into
3610 one voice, as common for wind parts in orchestral scores:
3612 @lilypond[verbatim,singleline,fragment]
3614 \context Voice=one \partcombine Voice
3615 \context Thread=one \relative c'' {
3618 \context Thread=two \relative c'' {
3624 Notice that the first @code{g} appears only once, although it was
3625 specified twice (once in each part). Stem, slur and tie directions are
3626 set automatically, depending whether there is a solo or unisono. The
3627 first part (with context called @code{one}) always gets up stems, and
3628 `solo', while the second (called @code{two}) always gets down stems and
3631 If you just want the merging parts, and not the textual markings, you
3632 may set the property @var{soloADue} to false.
3634 @lilypond[verbatim,singleline,fragment]
3636 \property Staff.soloADue = ##f
3637 \context Voice=one \partcombine Voice
3638 \context Thread=one \relative c'' {
3641 \context Thread=two \relative c'' {
3647 There are a number of other properties that you can use to tweak the
3648 behavior of part combining, refer to the automatically generated
3649 documentation of @reng{Thread_devnull_engraver} and
3650 @reng{Voice_devnull_engraver}. Look at the documentation of the
3651 responsible engravers, @code{Thread_devnull_engraver},
3652 @code{Voice_devnull_engraver} and @code{A2_engraver}.
3656 In @code{soloADue} mode, when the two voices play the same notes on and
3657 off, the part combiner may typeset @code{a2} more than once in a
3660 @lilypond[fragment,singleline]
3662 \context Voice=one \partcombine Voice
3663 \context Thread=one \relative c'' {
3666 \context Thread=two \relative c'' {
3672 @cindex @code{Thread_devnull_engraver}
3673 @cindex @code{Voice_engraver}
3674 @cindex @code{A2_engraver}
3676 @node Hara kiri staves
3677 @subsection Hara kiri staves
3679 In orchestral scores, staff lines that only have rests are usually removed.
3680 This saves some space. LilyPond also supports this through the hara
3681 kiri@footnote{Hara kiri, also called Seppuku, is the ritual suicide of
3682 the Japanese Samourai warriors.} staff. This staff commits suicide when
3683 it finds itself to be empty after the line-breaking process. It will
3684 not disappear when it contains normal rests, you must use multi measure
3687 The hara kiri staff is specialized version of the @internalsref{Staff}
3688 context. It is available as the context identifier
3689 @code{\HaraKiriStaffContext}. Observe how the second staff in this
3690 example disappears in the second line.
3694 \notes \relative c' <
3695 \context Staff = SA { e4 f g a \break c1 }
3696 \context Staff = SB { c4 d e f \break R1 }
3700 \translator { \HaraKiriStaffContext }
3706 @node Sound output for transposing instruments
3707 @subsection Sound output for transposing instruments
3709 When you want to make a MIDI file from a score containing transposed
3710 and untransposed instruments, you have to instruct LilyPond the pitch
3711 offset (in semitones) for the transposed instruments. This is done
3712 using the @code{transposing} property. It does not affect printed
3715 @cindex @code{transposing}
3718 \property Staff.instrument = #"Cl. in B-flat"
3719 \property Staff.transposing = #-2
3725 @node Ancient notation
3726 @section Ancient notation
3728 @cindex Vaticana, Editio
3729 @cindex Medicaea, Editio
3735 * Ancient note heads::
3743 @node Ancient note heads
3744 @subsection Ancient note heads
3746 To get a longa note head, you have to use mensural note heads. This
3747 is accomplished by setting the @code{style} property of the
3748 NoteHead object to @code{mensural}. There is also a note head style
3749 @code{baroque} which gives mensural note heads for @code{\longa} and
3750 @code{\breve} but standard note heads for shorter notes.
3752 @lilypond[fragment,singleline,verbatim]
3753 \property Voice.NoteHead \set #'style = #'mensural
3758 @subsection Ancient clefs
3760 LilyPond supports a variety of clefs, many of them ancient.
3762 For modern clefs, see section @ref{Clef}. For the percussion clef, see
3763 section @ref{Percussion staves}. For the @code{TAB} clef, see section
3766 The following table shows all ancient clefs that are supported via the
3767 @code{\clef} command. Some of the clefs use the same glyph, but differ
3768 only with respect to the line they are printed on. In such cases, a
3769 trailing number in the name is used to enumerate these clefs. Still,
3770 you can manually force a clef glyph to be typeset on an arbitrary line,
3771 as described in section @ref{Clef}. The note printed to the right side
3772 of each clef denotes the @code{c'} with respect to the clef.
3776 @c --- This should go somewhere else: ---
3777 @c @item modern style G clef (glyph: @code{clefs-G})
3780 @c @code{treble}, @code{violin}, @code{G}, @code{G2}, @code{french}
3782 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "G" c'}
3784 @c @item modern style F clef (glyph: @code{clefs-F})
3787 @c @code{varbaritone}, @code{bass}, @code{F}, @code{subbass}
3789 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "F" c'}
3791 @c @item modern style C clef (glyph: @code{clefs-C})
3794 @c @code{soprano}, @code{mezzosoprano}, @code{alto}, @code{C},
3795 @c @code{tenor}, @code{baritone}
3797 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "C" c'}
3799 @item modern style mensural C clef (glyph: @code{clefs-neo_mensural_c'})
3802 @code{neo_mensural_c1}, @code{neo_mensural_c2},
3803 @code{neo_mensural_c3}, @code{neo_mensural_c4}
3805 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "neo_mensural_c2" c'}
3807 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c1})
3813 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c1" c'}
3815 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c2})
3821 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c2" c'}
3823 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c3})
3829 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c3" c'}
3831 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c4})
3837 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c4" c'}
3839 @item petrucci style mensural C clef (glyph: @code{clefs-petrucci_c5})
3845 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_c5" c'}
3847 @item petrucci style mensural F clef (glyph: @code{clefs-petrucci_f})
3852 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_f" c'}
3854 @item petrucci style mensural G clef (glyph: @code{clefs-petrucci_g})
3859 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "petrucci_g" c'}
3861 @item historic style mensural C clef (glyph: @code{clefs-mensural_c'})
3864 @code{mensural_c1}, @code{mensural_c2}, @code{mensural_c3},
3867 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_c2" c'}
3869 @item historic style mensural F clef (glyph: @code{clefs-mensural_f})
3874 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_f" c'}
3876 @item historic style mensural G clef (glyph: @code{clefs-mensural_g})
3881 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "mensural_g" c'}
3883 @item Editio Vaticana style do clef (glyph: @code{clefs-vaticana_do})
3886 @code{vaticana_do1}, @code{vaticana_do2}, @code{vaticana_do3}
3888 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_do2" c'}
3890 @item Editio Vaticana style fa clef (glyph: @code{clefs-vaticana_fa})
3893 @code{vaticana_fa1}, @code{vaticana_fa2}
3895 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "vaticana_fa2" c'}
3897 @item Editio Medicaea style do clef (glyph: @code{clefs-medicaea_do})
3900 @code{medicaea_do1}, @code{medicaea_do2}, @code{medicaea_do3}
3902 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_do2" c'}
3904 @item Editio Medicaea style fa clef (glyph: @code{clefs-medicaea_fa})
3907 @code{medicaea_fa1}, @code{medicaea_fa2}
3909 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "medicaea_fa2" c'}
3911 @item historic style hufnagel do clef (glyph: @code{clefs-hufnagel_do})
3914 @code{hufnagel_do1}, @code{hufnagel_do2}, @code{hufnagel_do3}
3916 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do2" c'}
3918 @item historic style hufnagel fa clef (glyph: @code{clefs-hufnagel_fa})
3921 @code{hufnagel_fa1}, @code{hufnagel_fa2}
3923 @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #4 \property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_fa2" c'}
3925 @item historic style hufnagel combined do/fa clef (glyph: @code{clefs-hufnagel_do_fa})
3928 @code{hufnagel_do_fa}
3930 @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "hufnagel_do_fa" c'}
3932 @c --- This should go somewhere else: ---
3933 @c @item modern style percussion clef (glyph: @code{clefs-percussion})
3936 @c @code{percussion}
3938 @c @lilypond[26pt]{\property Staff.TimeSignature \set #'transparent = ##t \clef "percussion" c'}
3940 @c @item modern style tab clef (glyph: @code{clefs-tab})
3945 @c @lilypond[26pt]{\context Staff \outputproperty #(make-type-checker 'staff-symbol-interface) #'line-count = #6 \property Staff.TimeSignature \set #'transparent = ##t \clef "tab" c'}
3949 @emph{Modern style} means ``as is typeset in current editions of
3950 transcribed mensural music''.
3952 @emph{Petrucci style} means ``inspired by printings published by the
3953 famous engraver Petrucci (1466-1539)''.
3955 @emph{Historic style} means ``as was typeset or written in contemporary
3956 historic editions (other than those of Petrucci)''.
3958 @emph{Editio XXX style} means ``as is/was printed in Editio XXX''.
3960 Petrucci used C clefs with differently balanced left-side vertical
3961 beams, depending on which staffline it was printed.
3964 @subsection Custodes
3969 A @emph{custos} (plural: @emph{custodes}; latin word for `guard') is a
3970 staff context symbol that appears at the end of a staff line. It
3971 anticipates the pitch of the first note(s) of the following line and
3972 thus helps the player or singer to manage line breaks during
3973 performance, thus enhancing readability of a score.
3975 @lilypond[verbatim,noquote]
3978 \property Staff.Custos \set #'style = #'mensural
3983 \consists Custos_engraver
3989 Custodes were frequently used in music notation until the 17th century.
3990 There were different appearances for different notation styles.
3991 Nowadays, they have survived only in special forms of musical notation
3992 such as via the @emph{editio vaticana} dating back to the beginning of
3995 For typesetting custodes, just put a @code{Custos_engraver} into the
3996 @internalsref{Staff} context when declaring the @code{\paper} block. In this
3997 block, you can also globally control the appearance of the custos symbol
3998 by setting the custos @code{style} property. Currently supported styles
3999 are @code{vaticana}, @code{medicaea}, @code{hufnagel} and
4006 \consists Custos_engraver
4007 Custos \override #'style = #'mensural
4012 The property can also be set locally, for example in a @code{\notes}
4017 \property Staff.Custos \override #'style = #'vaticana
4018 c'1 d' e' d' \break c' d' e' d'
4023 @subsection Ligatures
4027 @c TODO: Should double check if I recalled things correctly when I wrote
4028 @c down the following paragraph by heart.
4029 In musical terminology, a ligature is a coherent graphical symbol that
4030 represents at least two different notes. Ligatures originally appeared
4031 in the manuscripts of Gregorian chant notation roughly since the 9th
4032 century as an allusion to the accent symbols of greek lyric poetry to
4033 denote ascending or descending sequences of notes. Both, the shape and
4034 the exact meaning of ligatures changed tremendously during the following
4035 centuries: In early notation, ligatures where used for monophonic tunes
4036 (Gregorian chant) and very soon denoted also the way of performance in
4037 the sense of articulation. With upcoming multiphony, the need for a
4038 metric system arised, since multiple voices of a piece have to be
4039 synchronized some way. New notation systems were invented, that used
4040 the manifold shapes of ligatures to now denote rhythmical patterns
4041 (e.g. black mensural notation, mannered notation, ars nova). With the
4042 invention of the metric system of the white mensural notation, the need
4043 for ligatures to denote such patterns disappeared. Nevertheless,
4044 ligatures were still in use in the mensural system for a couple of
4045 decades until they finally disappeared during the late 16th / early 17th
4046 century. Still, ligatures have survived in contemporary editions of
4047 Gregorian chant such as the Editio Vaticana from 1905/08.
4049 Syntactically, ligatures are simply enclosed by @code{\[} and @code{\]}.
4050 Some ligature styles (such as Editio Vaticana) may need additional input
4051 syntax specific for this particular type of ligature. By default, the
4052 @internalsref{LigatureBracket} engraver just marks the start and end of
4053 a ligature by small square angles:
4055 @lilypond[singleline,verbatim]
4057 \notes \transpose c'' {
4065 To select a specific style of ligatures, a proper ligature engraver has
4066 to be added to the @internalsref{Voice} context, as explained in the
4067 following subsections. Currently, Lilypond only supports white mensural
4068 ligatures with certain limitations. Support for Editio Vaticana will be
4069 added in the future.
4072 * White mensural ligatures::
4075 @node White mensural ligatures
4076 @subsubsection White mensural ligatures
4078 @cindex Mensural ligatures
4079 @cindex White mensural ligatures
4081 Lilypond has limited support for white mensural ligatures. The
4082 implementation is still experimental; it currently may output strange
4083 warnings or even crash in some cases or produce weird results on more
4084 complex ligatures. To engrave white mensural ligatures, in the paper
4085 block the @internalsref{MensuralLigature} engraver has to be put into
4086 the @internalsref{Voice} context (and you probably want to remove the
4087 @internalsref{LigatureBracket} engraver). There is no additional input
4088 language to describe the shape of a white mensural ligature. The shape
4089 is rather determined solely from the pitch and duration of the enclosed
4090 notes. While this approach may take a new user quite a while to get
4091 accustomed, it has a great advantage: this way, lily has full musical
4092 information about the ligature. This is not only required for correct
4093 MIDI output, but also allows for automatic transcription of the
4098 @lilypond[singleline,verbatim]
4100 \notes \transpose c'' {
4101 \property Score.timing = ##f
4102 \property Score.defaultBarType = "empty"
4103 \property Voice.NoteHead \set #'style = #'neo_mensural
4104 \property Staff.TimeSignature \set #'style = #'neo_mensural
4106 \[ g\longa c\breve a\breve f\breve d'\longa \]
4108 \[ e1 f1 a\breve g\longa \]
4113 \remove Ligature_bracket_engraver
4114 \consists Mensural_ligature_engraver
4120 Without replacing @code{Ligature_bracket_engraver} with
4121 @code{Mensural_ligature_engraver}, the same music transcribes to the
4124 @lilypond[singleline,verbatim]
4126 \notes \transpose c'' {
4127 \property Score.timing = ##f
4128 \property Score.defaultBarType = "empty"
4129 \property Voice.NoteHead \set #'style = #'neo_mensural
4130 \property Staff.TimeSignature \set #'style = #'neo_mensural
4132 \[ g\longa c\breve a\breve f\breve d'\longa \]
4134 \[ e1 f1 a\breve g\longa \]
4140 @subsection Figured bass
4142 @cindex Basso continuo
4144 LilyPond has limited support for figured bass:
4146 @lilypond[verbatim,fragment]
4148 \context FiguredBass
4153 \context Voice { c4 g8 }
4157 The support for figured bass consists of two parts: there is an input
4158 mode, introduced by @code{\figures}, where you can enter bass figures
4159 as numbers, and there is a context called @internalsref{FiguredBass}
4160 that takes care of making @internalsref{BassFigure} objects.
4162 In figures input mode, a group of bass figures is delimited by
4163 @code{<} and @code{>}. The duration is entered after the @code{>}.
4168 \context FiguredBass
4172 Accidentals are added to the numbers if you alterate them by
4173 appending @code{-}, @code{!} and @code{+}.
4179 \context FiguredBass
4180 \figures { <4- 6+ 7!> }
4183 Spaces or dashes may be inserted by using @code{_}. Brackets are
4184 introduced with @code{[} and @code{]}.
4190 \context FiguredBass
4191 \figures { < [4 6] 8 [_ 12]> }
4194 Although the support for figured bass may superficially resemble chord
4195 support, it works much simpler: in figured bass simply stores the
4196 numbers, and then prints the numbers you entered. There is no
4197 conversion to pitches, and no realizations of the bass are played in
4201 @c . {Tuning output}
4203 @section Tuning output
4205 LilyPond tries to take as much formatting as possible out of your
4206 hands. Nevertheless, there are situations where it needs some help, or
4207 where you want to override its decisions. In this section we discuss
4208 ways to do just that.
4210 Formatting is internally done by manipulating so called objects (graphic
4211 objects). Each object carries with it a set of properties (object
4212 properties) specific to that object. For example, a stem object has
4213 properties that specify its direction, length and thickness.
4215 The most direct way of tuning the output is by altering the values of
4216 these properties. There are two ways of doing that: first, you can
4217 temporarily change the definition of a certain type of object, thus
4218 affecting a whole set of objects. Second, you can select one specific
4219 object, and set a object property in that object.
4222 * Tuning groups of objects ::
4223 * Tuning per object ::
4228 @node Tuning groups of objects
4229 @subsection Tuning groups of objects
4231 @cindex object description
4235 A object definition is a Scheme association list, that is stored in a
4236 context property. By assigning to that property (using plain
4237 @code{\property}), you can change the resulting objects.
4239 @lilypond[verbatim, fragment]
4240 c'4 \property Voice.Stem = #'()
4243 The @code{\property} assignment effectively empties the definition of
4244 the Stem object. One of the effects is that the recipe of how it should be
4245 printed is erased, with the effect of rendering it invisible. The above
4246 assignment is available as a standard identifier, for the case that you
4250 \property Voice.Stem = \turnOff
4257 This mechanism is fairly crude, since you can only set, but not modify,
4258 the definition of a object. For this reason, there is a more advanced
4261 The definition of a object is actually a list of default object
4262 properties. For example, the definition of the Stem object (available in
4263 @file{scm/grob-description.scm}), defines the following values for
4268 (beamed-lengths . (0.0 2.5 2.0 1.5))
4269 (Y-extent-callback . ,Stem::height)
4273 You can add a property on top of the existing definition, or remove a
4274 property, thus overriding the system defaults:
4276 c'4 \property Voice.Stem \override #'thickness = #4.0
4277 c'4 \property Voice.Stem \revert #'thickness
4280 You should balance @code{\override} and @code{\revert}. If that's too
4281 much work, you can use the @code{\set} shorthand. It performs a revert
4282 followed by an override. The following example gives exactly the same
4283 result as the previous one.
4285 c'4 \property Voice.Stem \set #'thickness = #4.0
4286 c'4 \property Voice.Stem \set #'thickness = #0.8
4289 If you use @code{\set}, you must explicitly restore the default.
4292 Formally the syntax for these constructions is
4294 \property @var{context}.@var{grobname} \override @var{symbol} = @var{value}
4295 \property @var{context}.@var{grobname} \set @var{symbol} = @var{value}
4296 \property @var{context}.@var{grobname} \revert @var{symbol}
4298 Here @var{symbol} is a Scheme expression of symbol type, @var{context}
4299 and @var{grobname} are strings and @var{value} is a Scheme expression.
4302 If you revert a setting which was not set in the first place, then it
4303 has no effect. However, if the setting was set as a system default, it
4304 may remove the default value, and this may give surprising results,
4305 including crashes. In other words, @code{\override} and @code{\revert},
4306 must be carefully balanced.
4308 These are examples of correct nesting of @code{\override}, @code{\set},
4311 A clumsy but correct form:
4313 \override \revert \override \revert \override \revert
4316 Shorter version of the same:
4318 \override \set \set \revert
4321 A short form, using only @code{\set}. This requires you to know the
4324 \set \set \set \set @var{to default value}
4327 If there is no default (i.e. by default, the object property is unset),
4330 \set \set \set \revert
4333 For the digirati, the object description is an Scheme association
4334 list. Since a Scheme list is a singly linked list, we can treat it as a
4335 stack, and @code{\override} and @code{\revert} are just push and pop
4336 operations. This pushing and popping is also used for overriding
4337 automatic beaming settings.
4341 LilyPond will hang or crash if @var{value} contains cyclic references.
4342 The backend is not very strict in type-checking object properties. If you
4343 @code{\revert} properties that are expected to be set by default,
4349 @node Tuning per object
4350 @subsection Tuning per object
4352 Tuning a single object is most often done with @code{\property}. The
4355 \once \property @dots{}
4358 applies a setting only during one moment in the score: notice how the
4359 original setting for stem thickness is restored automatically in the
4362 @lilypond[verbatim, fragment, relative=1]
4364 \once \property Voice.Stem \set #'thickness = #4
4370 @cindex \outputproperty
4372 A second way of tuning objects is the more arcane @code{\outputproperty}
4373 feature. The syntax is as follows:
4375 \outputproperty @var{predicate} @var{symbol} = @var{value}
4377 Here @code{predicate} is a Scheme function taking a object argument, and
4378 returning a boolean. This statement is processed by the
4379 @code{Output_property_engraver}. It instructs the engraver to feed all
4380 objects that it sees to @var{predicate}. Whenever the predicate returns
4381 true, the object property @var{symbol} will be set to @var{value}.
4383 This command is only single shot, in contrast to @code{\override} and
4386 You will need to combine this statement with @code{\context} to select
4387 the appropriate context to apply this to.
4389 In the following example, all note heads occurring at current staff
4390 level, are shifted up and right by setting their @code{extra-offset}
4393 @lilypond[fragment,verbatim,singleline]
4395 \context Staff \outputproperty
4396 #(make-type-checker 'note-head-interface)
4397 #'extra-offset = #'(0.5 . 0.75)
4401 @cindex @code{extra-offset}
4403 In this example, the predicate checks the @code{text} object property, to
4404 shift only the `m.d.' text, but not the fingering instruction "2".
4405 @lilypond[verbatim,singleline]
4406 #(define (make-text-checker text)
4407 (lambda (grob) (equal? text (ly-get-grob-property grob 'text))))
4410 \notes\relative c''' {
4411 \property Voice.Stem \set #'direction = #1
4412 \outputproperty #(make-text-checker "m.d.")
4413 #'extra-offset = #'(-3.5 . -4.5)
4421 If possible, avoid this feature: the semantics are not very clean, and
4422 the syntax and semantics are up for rewrite.
4427 @node Font selection
4428 @subsection Font selection
4430 The most common thing to change about the appearance of fonts is
4431 their size. The font size of a @internalsref{Voice},
4432 @internalsref{Staff} or @internalsref{Thread} context, can be easily
4433 changed by setting the @code{fontSize} property for that context:
4434 @lilypond[fragment,relative=1]
4435 c4 c4 \property Voice.fontSize = #-1
4438 This command will not change the size of variable symbols, such as
4439 beams or slurs. You can use this command to get smaller symbol for
4440 cue notes, but that involves some more subtleties. An elaborate
4441 example of those is in @file{input/test/cue-notes.ly}.
4447 The font used for printing a object can be selected by setting
4448 @code{font-name}, e.g.
4450 \property Staff.TimeSignature
4451 \set #'font-name = #"cmr17"
4453 You may use any font which is available to @TeX{}, such as foreign
4454 fonts or fonts that do not belong to the Computer Modern font family.
4455 Font selection for the standard fonts, @TeX{}'s Computer Modern fonts,
4456 can also be adjusted with a more fine-grained mechanism. By setting
4457 the object properties described below, you can select a different font.
4458 All three mechanisms work for every object that supports
4459 @code{font-interface}.
4463 A symbol indicating the general class of the typeface. Supported are
4464 @code{roman} (Computer Modern), @code{braces} (for piano staff
4465 braces), @code{music} (the standard music font), @code{ancient} (the
4466 ancient notation font) @code{dynamic} (font for dynamic signs) and
4470 A symbol indicating the shape of the font, there are typically several
4471 font shapes available for each font family. Choices are @code{italic},
4472 @code{caps} and @code{upright}
4475 A symbol indicating the series of the font. There are typically several
4476 font series for each font family and shape. Choices are @code{medium}
4479 @item font-relative-size
4480 A number indicating the size relative the standard size. For example,
4481 with 20pt staff height, relative size -1 corresponds to 16pt staff
4482 height, and relative size +1 corresponds to 23 pt staff height.
4484 @item font-design-size
4485 A number indicating the design size of the font.
4487 This is a feature of the Computer Modern Font: each point size has a
4488 slightly different design. Smaller design sizes are relatively wider,
4489 which enhances readability.
4492 For any of these properties, the value @code{*} (i.e. the @emph{symbol},
4493 @code{*}, entered as @code{#'*}), acts as a wildcard. This can be used
4494 to override default setting, which are always present. For example:
4496 \property Lyrics.LyricText \override #'font-series = #'bold
4497 \property Lyrics.LyricText \override #'font-family = #'typewriter
4498 \property Lyrics.LyricText \override #'font-shape = #'*
4501 @cindex @code{font-style}
4503 There are also pre-cooked font selection qualifiers. These are
4504 selected through the object property @code{font-style}. For example,
4505 the style @code{finger} selects family @code{number} and relative size
4506 @code{-3}. Styles available include @code{volta}, @code{finger},
4507 @code{tuplet}, @code{timesig}, @code{mmrest}, @code{script},
4508 @code{large}, @code{Large} and @code{dynamic}. The style sheets and
4509 tables for selecting fonts are located in @file{scm/font.scm}. Refer
4510 to this file for more information.
4512 @cindex magnification
4514 The size of the font may be scaled with the object property
4515 @code{font-magnification}. For example, @code{2.0} blows up all
4516 letters by a factor 2 in both directions.
4520 Relative size is not linked to any real size.
4522 There is no style sheet provided for other fonts besides the @TeX{}
4523 family, and the style sheet can not be modified easiyl.
4525 @cindex font selection
4526 @cindex font magnification
4527 @cindex @code{font-interface}
4531 @subsection Text markup
4535 LilyPond has an internal mechanism to typeset texts. You can
4536 form text markup expressions by composing scheme expressions
4537 in the following way.
4539 @lilypond[verbatim, singleline]
4544 c^#'(italic "italic")
4545 d_#'((bold italic) "ff")
4547 f_#'(lines "one" (bold "two"))
4548 g^#'(music "noteheads-2" ((raise . 2.4) "flags-u3"))
4552 Normally, the Scheme markup text is stored in the @code{text} property
4553 of a object. Formally, it is defined as follows:
4556 text: string | (head? text+)
4557 head: markup | (markup+)
4558 markup-item: property | abbrev
4559 property: (@var{key} . @var{value})
4560 abbrev: @code{columns lines roman music bold italic named super sub}
4561 @code{overstrike text finger volta timesig mmrest mark script}
4562 @code{large Large dynamic}
4565 The markup is broken down and converted into a list of object properties,
4566 which are prepended to the property list. The @var{key}-@var{value}
4567 pair is a object property. A list of properties available is included in
4568 the generated documentation for @internalsref{text-interface}.
4570 The following abbreviations are defined:
4573 horizontal mode: set all text on one line (default)
4575 vertical mode: set every text on a new line
4579 selects the Feta font (the standard font for music notation glyphs),
4580 and uses named lookup
4587 lookup by character name
4589 plain text lookup (by character value)
4595 the next text or character overstrikes this one
4597 select fingering number fontstyle
4599 select volta number fontstyle
4601 select time signature number fontstyle
4603 select multi measure rest number fontstyle
4605 select mark number fontstyle
4607 select scriptsize roman fontstyle
4609 select large roman fontstyle
4611 select Large roman fontstyle
4613 select dynamics fontstyle
4617 @cindex metronome mark
4619 One practical application of complicated markup is to fake a metronome
4623 #(define note '(columns
4624 (music "noteheads-2" ((kern . -0.1) "flags-stem"))))
4625 #(define eight-note `(columns ,note ((kern . -0.1)
4626 (music ((raise . 3.5) "flags-u3")))))
4627 #(define dotted-eight-note
4628 `(columns ,eight-note (music "dots-dot")))
4631 \notes\relative c'' {
4632 a1^#`((columns (font-relative-size . -1))
4633 ,dotted-eight-note " = 64")
4639 TextScript \override #'font-shape = #'upright
4647 The syntax and semantics of markup texts are not clean, and both
4648 syntax and semantics are slated for a rewrite.
4650 LilyPond does not do kerning, and there generally spaces texts
4656 @section Global layout
4658 The global layout determined by three factors: the page layout, the
4659 line breaks and the spacing. These all influence each other: The
4660 choice of spacing determines how densely each system of music is set,
4661 where line breaks breaks are chosen, and thus ultimately how many
4662 pages a piece of music takes. In this section we will explain how the
4663 lilypond spacing engine works, and how you can tune its results.
4665 Globally spoken, this procedure happens in three steps: first,
4666 flexible distances (``springs'') are chosen, based on durations. All
4667 possible line breaking combination are tried, and the one with the
4668 best results---a layout that has uniform density and requires as
4669 little stretching or cramping as possible---is chosen. When the score
4670 is processed by @TeX{}, page are filled with systems, and page breaks
4671 are chosen whenever the page gets full.
4674 * Vertical spacing::
4675 * Horizontal spacing::
4682 @node Vertical spacing
4683 @subsection Vertical spacing
4685 @cindex vertical spacing
4686 @cindex distance between staves
4687 @cindex staff distance
4688 @cindex between staves, distance
4690 The height of each system is determined automatically by lilypond, to
4691 keep systems from bumping into each other, some minimum distances are
4692 set. By changing these, you can put staves closer together, and thus
4693 put more systems onto one page.
4695 Normally staves are stacked vertically. To make
4696 staves maintain a distance, their vertical size is padded. This is
4697 done with the property @code{minimumVerticalExtent}. It takes a pair
4698 of numbers, so if you want to make it smaller from its, then you could
4701 \property Staff.minimumVerticalExtent = #'(-4 . 4)
4703 This sets the vertical size of the current staff to 4 staff-space on
4704 either side of the center staff line. The argument of
4705 @code{minimumVerticalExtent} is interpreted as an interval, where the
4706 center line is the 0, so the first number is generally negative. you
4707 could also make the staff larger at the bottom by setting it to
4708 @code{(-6 . 4)}. The default value is @code{(-6 . 6)}.
4710 Vertical aligment of staves is handled by the
4711 @internalsref{VerticalAlignment} object, which lives at
4712 @internalsref{Score} level.
4714 The piano staves are handled a little differently: to make cross-staff
4715 beaming work correctly, it necessary that the distance between staves
4716 is fixed. This is also done with a @internalsref{VerticalAlignment}
4717 object, created in @internalsref{PianoStaff}, but a forced distance is
4718 set. This is done with the object property #'forced-distance. If you
4719 want to override this, use a @code{\translator} block as follows:
4723 VerticalAlignment \override #'forced-distance = #9
4726 This would bring the staves together at a distance of 9 staff spaces,
4727 and again this is measured from the center line of each staff.
4731 @node Horizontal spacing
4732 @subsection Horizontal Spacing
4734 The spacing engine translates differences in durations into
4735 stretchable distances (``springs'') of differing lengths. Longer
4736 durations get more space, shorter durations get less. The basis for
4737 assigning spaces to durations, is that the shortest durations get a
4738 fixed amount of space, and the longer durations get more: doubling a
4739 duration adds a fixed amount of space to the note.
4741 For example, the following piece contains lots of half, quarter and
4742 8th notes, the eighth note is followed by 1 note head width. The The
4743 quarter note is followed by 2 NHW, the half by 3 NHW, etc.
4744 @lilypond[fragment, verbatim, relative=1]
4745 c2 c4. c8 c4. c8 c4. c8 c8 c8 c4 c4 c4
4748 These two amounts of space are @code{shortest-duration-space}
4749 @code{spacing-increment}, object properties of
4750 @internalsref{SpacingSpanner}. Normally @code{spacing-increment} is
4751 set to 1.2, which is the width of a note head, and
4752 @code{shortest-duration-space} is set to 2.0, meaning that the
4753 shortest note gets 2 noteheads of space. For normal notes, this space
4754 is always counted from the left edge of the symbol, so the short notes
4755 in a score is generally followed by one note head width of space.
4757 If one would follow the above procedure exactly, then adding a single
4758 32th note to a score that uses 8th and 16th notes, would widen up the
4759 entire score a lot. The shortest note is no longer a 16th, but a 64th,
4760 thus adding 2 noteheads of space to every note. To prevent this, the
4761 shortest duration for spacing is not the shortest note in the score,
4762 but the most commonly found shortest note. Notes that are even
4763 shorter this are followed by a space that is proportonial to their
4764 duration relative to the common shortest note. So if we were to add
4765 only a few 16th notes to the example above, they would be followed by
4768 @lilypond[fragment, verbatim, relative=1]
4769 c2 c4. c8 c4. [c16 c] c4. c8 c8 c8 c4 c4 c4
4772 The most common shortest duration is determined as follows: in every
4773 measure, the shortest duration is determined. The most common short
4774 duration, is taken as the basis for the spacing, with the stipulation
4775 that this shortest duration should always be equal to or shorter than
4776 1/8th note. The shortest duration is printed when you run lilypond
4777 with @code{--verbose}. These durations may also be customized. If you
4778 set the @code{common-shortest-duration} in
4779 @internalsref{SpacingSpanner}, then this sets the base duration for
4780 spacing. The maximum duration for this base (normally 1/8th), is set
4781 through @code{base-shortest-duration}.
4783 @cindex @code{common-shortest-duration}
4784 @cindex @code{base-shortest-duration}
4785 @cindex @code{stem-spacing-correction}
4786 @cindex @code{spacing}
4788 In the introduction it was explained that stem directions influence
4789 spacing. This is controlled with @code{stem-spacing-correction} in
4790 @internalsref{NoteSpacing}. The @code{StaffSpacing} object contains the
4791 same property for controlling the stem/barline spacing. In the
4792 following example shows these corrections, once with default settings,
4793 and once with exaggerated corrections.
4799 \property Staff.NoteSpacing \override #'stem-spacing-correction
4801 \property Staff.StaffSpacing \override #'stem-spacing-correction
4806 \paper { linewidth = -1. } }
4813 Spacing is determined on a score wide basis. If you have a score that
4814 changes its character (measured in durations) half way during the
4815 score, the part containing the longer durations will be spaced too
4818 Generating optically pleasing spacing is black magic. LilyPond tries
4819 to deal with a number of frequent cases. Here is an example that is
4820 not handled correctly, due to the combination of chord collisions and
4825 \context PianoStaff \notes \transpose c''' <
4826 \context Staff = up { s1 }
4827 \context Staff = down { [c8 c \translator Staff=up <c d> c
4828 \translator Staff=down c c c] }
4830 \paper { linewidth = -1 }
4837 @subsection Font size
4838 @cindex font size, setting
4839 @cindex staff size, setting
4840 @cindex @code{paper} file
4842 The Feta font provides musical symbols at seven different sizes.
4843 These fonts are 11 point, 13 point, 16 point, 19 pt, 20 point, 23
4844 point, and 26 point. The point size of a font is the height of the
4845 five lines in a staff when displayed in the font.
4847 Definitions for these sizes are the files @file{paperSZ.ly}, where
4848 @code{SZ} is one of 11, 13, 16, 19, 20, 23 and 26. If you include any
4849 of these files, the identifiers @code{paperEleven},
4850 @code{paperThirteen}, @code{paperSixteen}, @code{paperNineteen},
4851 @code{paperTwenty}, @code{paperTwentythree}, and @code{paperTwentysix}
4852 are defined respectively. The default @code{\paper} block is also
4853 set. These files should be imported at toplevel, i.e.
4855 \include "paper26.ly"
4859 The font definitions are generated using a Scheme function. For more
4860 details, see the file @file{scm/font.scm}.
4865 @subsection Line breaking
4868 @cindex breaking lines
4870 Line breaks are normally computed automatically. They are chosen such
4871 that it looks neither cramped nor loose, and that consecutive lines have
4874 Occasionally you might want to override the automatic breaks; you can
4875 do this by specifying @code{\break}. This will force a line break at
4876 this point. Line breaks can only occur at places where there are bar
4877 lines. If you want to have a line break where there is no bar line,
4878 you can force an invisible bar line by entering @code{\bar
4879 ""}. Similarly, @code{\noBreak} forbids a line break at a certain
4883 @cindex regular line breaks
4884 @cindex four bar music.
4886 If you want linebreaks at regular intervals, you can use the following:
4888 < \repeat 7 unfold @{ s1 * 4 \break @}
4892 This makes the following 28 measures (assuming 4/4 time) be broken every
4896 @subsection Page layout
4899 @cindex breaking pages
4901 @cindex @code{indent}
4902 @cindex @code{linewidth}
4904 The most basic settings influencing the spacing are @code{linewidth}
4905 and @code{indent}, both set in the @code{\paper} block. They control
4906 the indentation of the first line of music, and the lengths of the
4907 lines. If @code{linewidth} set to a negative value, a single
4908 unjustified line is produced. A similar effect for scores that are
4909 longer than one line, can be produced by setting @code{raggedright} to
4910 true in the @code{\paper} block.
4914 The page layout process happens outside lilypond. Ly2dvi sets page
4915 layout instructions. Ly2dvi responds to the following variables in the
4916 @code{\paper} block. The variable @code{textheight} sets the total
4917 height of the music on each page. The spacing between systems is
4918 controlled with @code{interscoreline}, its default is 16pt.
4919 The distance between the score lines will stretch in order to fill the
4920 full page @code{interscorelinefill} is set to a positive number. In
4921 that case @code{interscoreline} specifies the minimum spacing.
4923 @cindex @code{textheight}
4924 @cindex @code{interscoreline}
4925 @cindex @code{interscorelinefill}
4927 If the variable @code{lastpagefill} is defined (that is, it gets any
4928 value assigned in the @code{\paper} block), systems are evenly
4929 distributed vertically on the last page. This might produce ugly
4930 results in case there are not enough systems on the last page. Note
4931 that @command{lilypond-book} ignores @code{lastpagefill}. See
4932 @ref{Integrating text and music with lilypond-book} for
4935 @cindex @code{lastpagefill}
4937 Page breaks are normally computed by @TeX{}, so they are not under
4938 direct control of LilyPond. However, you can insert a commands into
4939 the @file{.tex} output to instruct @TeX{} where to break pages. You
4940 can insert a @code{\newpage} from within lilypond. This is done by
4941 setting the @code{between-systems-strings} on the
4942 @internalsref{NonMusicalPaperColumn} where the system is broken.
4946 @cindex @code{papersize}
4948 To change the paper size, you must first set the
4949 @code{papersize} paper variable variable. Set it to
4950 the strings @code{a4}, @code{letter}, or @code{legal}. After this
4951 specification, you must set the font as described above. If you want
4952 the default font, then use the 20 point font.
4955 \paper@{ papersize = "a4" @}
4956 \include "paper16.ly"
4959 The file @code{paper16.ly} will now include a file named @file{a4.ly}, which
4960 will set the paper variables @code{hsize} and @code{vsize} (used by
4961 Lilypond and @code{ly2dvi})
4971 LilyPond can produce MIDI output. The performance lacks lots of
4972 interesting effects, such as swing, articulation, slurring, etc., but it
4973 is good enough for proof-hearing the music you have entered. Ties,
4974 dynamics and tempo changes are interpreted.
4976 Dynamic marks, crescendi and decrescendi translate into MIDI volume
4977 levels. Dynamic marks translate to a fixed fraction of the available
4978 MIDI volume range, crescendi and decrescendi make the the volume vary
4979 linearly between their two extremities. The fractions be adjusted by
4980 overriding the @code{absolute-volume-alist} defined in
4981 @file{scm/midi.scm}.
4983 For each type of musical instrument (that MIDI supports), a volume range
4984 can be defined. This gives you basic equalizer control, which can
4985 enhance the quality of the MIDI output remarkably. You can add
4986 instruments and ranges or change the default settings by overriding the
4987 @code{instrument-equalizer-alist} defined in @file{scm/midi.scm}.
4989 Both loudness controls are combined to produce the final MIDI volume.
4995 * MIDI instrument names::
5000 @subsection MIDI block
5004 The MIDI block is analogous to the paper block, but it is somewhat
5005 simpler. The @code{\midi} block can contain:
5009 @item a @code{\tempo} definition
5010 @item context definitions
5013 Assignments in the @code{\midi} block are not allowed.
5017 @cindex context definition
5019 Context definitions follow precisely the same syntax as within the
5020 \paper block. Translation modules for sound are called performers.
5021 The contexts for MIDI output are defined in @file{ly/performer-init.ly}.
5024 @node MIDI instrument names
5025 @subsection MIDI instrument names
5027 @cindex instrument names
5028 @cindex @code{Staff.midiInstrument}
5029 @cindex @code{Staff.instrument}
5031 The MIDI instrument name is set by the @code{Staff.midiInstrument}
5032 property or, if that property is not set, the @code{Staff.instrument}
5033 property. The instrument name should be chosen from the list in
5034 @ref{MIDI instruments}.
5038 If the selected string does not exactly match, then LilyPond uses the
5039 default (Grand Piano). It is not possible to select an instrument by