@c -*- coding: utf-8; mode: texinfo; -*-
@c This file is part of lilypond.tely
@ignore
    Translation of GIT committish: FILL-IN-HEAD-COMMITTISH

    When revising a translation, copy the HEAD committish of the
    version that you are working on.  See TRANSLATION for details.
@end ignore


@c A menu is needed before every deeper *section nesting of @node's; run
@c     M-x texinfo-all-menus-update
@c to automatically fill in these menus before saving changes

@node Instrument-specific notation
@chapter Instrument-specific notation

This chapter explains how to use notation for specific instruments.

@menu
* Piano music::                 
* Chord names::                 
* Vocal music::                 
* Rhythmic music::              
* Guitar::                      
* Bagpipe::                     
* Ancient notation::            
* Other instrument specific notation::  
@end menu



@node Piano music
@section Piano music

Piano staves are two normal staves coupled with a brace.  The staves
are largely independent, but sometimes voices can cross between the
two staves.  The same notation is also used for harps and other key
instruments.  The @internalsref{PianoStaff} is especially built to
handle this cross-staffing behavior.  In this section we discuss the
@internalsref{PianoStaff} and some other pianistic peculiarities.

@menu
* Automatic staff changes::     
* Manual staff switches::       
* Pedals::                      
* Staff switch lines::          
* Cross staff stems::           
@end menu

@refbugs

Dynamics are not centered, but workarounds do exist.  See the
@q{piano centered dynamics} template in @ref{Piano templates}.

@cindex cross staff stem
@cindex stem, cross staff
@cindex distance between staves in piano music


@node Automatic staff changes
@subsection Automatic staff changes
@cindex Automatic staff changes

Voices can be made to switch automatically between the top and the bottom
staff.  The syntax for this is

@quotation
@example
\autochange @dots{}@var{music}@dots{}
@end example
@end quotation

@noindent
This will create two staves inside the current PianoStaff, called
@code{up} and @code{down}.  The lower staff will be in bass clef by
default.

A @code{\relative} section that is outside of @code{\autochange} has
no effect on the pitches of @var{music}, so, if necessary, put
@code{\relative} inside @code{\autochange} like

@quotation
@example
\autochange \relative @dots{} @dots{}
@end example
@end quotation


The autochanger switches on basis of the pitch (middle C is the turning
point), and it looks ahead skipping over rests to switch in
advance.  Here is a practical example

@lilypond[quote,verbatim,ragged-right]
\new PianoStaff
  \autochange \relative c'
  {
    g4 a b c d r4 a g
  }
@end lilypond


@seealso

In this manual: @ref{Manual staff switches}.

Program reference: @internalsref{AutoChangeMusic}.



@refbugs

The staff switches may not end up in optimal places.  For high
quality output, staff switches should be specified manually.


@code{\autochange} cannot be inside @code{\times}.


@node Manual staff switches
@subsection Manual staff switches

@cindex manual staff switches
@cindex staff switch, manual

Voices can be switched between staves manually, using the command
@example
\change Staff = @var{staffname} @var{music}
@end example

@noindent
The string @var{staffname} is the name of the staff.  It switches the
current voice from its current staff to the Staff called
@var{staffname}.  Typically @var{staffname} is @code{"up"} or
@code{"down"}.  The @context{Staff} referred to must already exist, so
usually the setup for a score will start with a setup of the staves,

@example
<<
  \new Staff = "up" @{
    \skip 1 * 10  % @emph{keep staff alive}
    @}
  \new Staff = "down" @{
    \skip 1 * 10  % @emph{idem}
    @}
>>
@end example


and the @context{Voice} is inserted afterwards

@example
\context Staff = down
  \new Voice @{ @dots{} \change Staff = up @dots{} @}
@end example


@node Pedals
@subsection Pedals
@cindex Pedals

Pianos have pedals that alter the way sound is produced.  Generally, a
piano has three pedals, sustain, una corda, and sostenuto.


Piano pedal instruction can be expressed by attaching
@code{\sustainDown}, @code{\sustainUp}, @code{\unaCorda},
@code{\treCorde}, @code{\sostenutoDown} and @code{\sostenutoUp} to a
note or chord

@lilypond[quote,ragged-right,fragment,verbatim]
c'4\sustainDown c'4\sustainUp
@end lilypond

What is printed can be modified by setting @code{pedal@var{X}Strings},
where @var{X} is one of the pedal types: @code{Sustain},
@code{Sostenuto} or @code{UnaCorda}.  Refer to
@internalsref{SustainPedal} in the program reference for more
information.

Pedals can also be indicated by a sequence of brackets, by setting the
@code{pedalSustainStyle} property to bracket objects

@lilypond[quote,ragged-right,fragment,verbatim,relative=2]
\set Staff.pedalSustainStyle = #'bracket
c\sustainDown d e
b\sustainUp\sustainDown
b g \sustainUp a \sustainDown \bar "|."
@end lilypond

A third style of pedal notation is a mixture of text and brackets,
obtained by setting the @code{pedalSustainStyle} property to
@code{mixed}

@lilypond[quote,ragged-right,fragment,verbatim,relative=2]
\set Staff.pedalSustainStyle = #'mixed
c\sustainDown d e
b\sustainUp\sustainDown
b g \sustainUp a \sustainDown \bar "|."
@end lilypond

The default @q{*Ped.} style for sustain and damper pedals corresponds to
style @code{#'text}.  The sostenuto pedal uses @code{mixed} style by
default.

@lilypond[quote,ragged-right,fragment,verbatim,relative=2]
c\sostenutoDown d e c, f g a\sostenutoUp
@end lilypond

For fine-tuning the appearance of a pedal bracket, the properties
@code{edge-width}, @code{edge-height}, and @code{shorten-pair} of
@code{PianoPedalBracket} objects (see
@internalsref{PianoPedalBracket} in the Program reference) can be
modified.  For example, the bracket may be extended to the right edge
of the note head

@lilypond[quote,ragged-right,fragment,verbatim,relative=2]
\override Staff.PianoPedalBracket #'shorten-pair = #'(0 . -1.0)
c\sostenutoDown d e c, f g a\sostenutoUp
@end lilypond

@seealso

In this manual: @ref{Laissez vibrer ties}

@node Staff switch lines
@subsection Staff switch lines


@cindex follow voice
@cindex staff switching
@cindex cross staff

@funindex followVoice

Whenever a voice switches to another staff, a line connecting the notes
can be printed automatically.  This is switched on by setting
@code{followVoice} to true

@lilypond[quote,ragged-right,fragment,relative=1,verbatim]
\new PianoStaff <<
  \new Staff="one" {
    \set followVoice = ##t
    c1
    \change Staff=two
    b2 a
  }
  \new Staff="two" { \clef bass \skip 1*2 }
>>
@end lilypond

@seealso

Program reference: @internalsref{VoiceFollower}.

@refcommands

@funindex \showStaffSwitch
@code{\showStaffSwitch},
@funindex \hideStaffSwitch
@code{\hideStaffSwitch}.


@node Cross staff stems
@subsection Cross staff stems

Chords that cross staves may be produced by increasing the length
of the stem in the lower staff, so it reaches the stem in the upper
staff, or vice versa.

@lilypond[ragged-right,verbatim,quote]
stemExtend = {
  \once \override Stem #'length = #10
  \once \override Stem #'cross-staff = ##t
}
noFlag = \once \override Stem #'flag-style = #'no-flag
\new PianoStaff <<
  \new Staff {
    \stemDown \stemExtend
    f'4
    \stemExtend \noFlag
    f'8
  }
  \new Staff {
    \clef bass
    a4 a8
  }
>>
@end lilypond



@node Chord names
@section Chord names

@menu
* Introducing chord names::     
* Chords mode::                 
* Printing chord names::        
@end menu


@c  awkward name; awkward section name.
@c  still, the Basic "chords" seems like a good name...  :(
@node Introducing chord names
@subsection Introducing chord names
@cindex chord names

LilyPond has support for printing chord names.  Chords may be entered
in musical chord notation, i.e., @code{< .. >}, but they can also be
entered by name.  Internally, the chords are represented as a set of
pitches, so they can be transposed


@lilypond[quote,ragged-right,verbatim,ragged-right]
twoWays = \transpose c c' {
  \chordmode {
    c1 f:sus4 bes/f
  }
  <c e g>
  <f bes c'>
  <f bes d'>
}

<< \new ChordNames \twoWays
   \new Voice \twoWays >>
@end lilypond

This example also shows that the chord printing routines do not try to
be intelligent.  The last chord (@code{f bes d}) is not interpreted as
an inversion.

Note that the duration of chords must be specified outside the
@code{<>}.

@example
<c e g>2
@end example


@node Chords mode
@subsection Chords mode
@cindex Chords mode

In chord mode sets of pitches (chords) are entered with normal note
names.  A chord is entered by the root, which is entered like a
normal pitch

@lilypond[quote,ragged-right,fragment,verbatim]
\chordmode { es4. d8 c2 }
@end lilypond

@noindent
The mode is introduced by the keyword @code{\chordmode}.

@cindex chord entry
@cindex chord mode

Other chords may be entered by suffixing a colon and introducing a
modifier (which may include a number if desired)
@lilypond[quote,fragment,verbatim]
\chordmode { e1:m e1:7 e1:m7 }
@end lilypond
The first number following the root is taken to be the @q{type} of the
chord, thirds are added to the root until it reaches the specified
number
@lilypond[quote,fragment,verbatim]
\chordmode { c:3 c:5 c:6 c:7 c:8 c:9 c:10 c:11 }
@end lilypond

@cindex root of chord
@cindex additions, in chords
@cindex removals, in chords

More complex chords may also be constructed adding separate steps
to a chord.  Additions are added after the number following
the colon and are separated by dots
@lilypond[quote,verbatim,fragment]
\chordmode { c:5.6 c:3.7.8 c:3.6.13 }
@end lilypond
Chord steps can be altered by suffixing a @code{-} or @code{+} sign
to the number
@lilypond[quote,verbatim,fragment]
\chordmode { c:7+ c:5+.3- c:3-.5-.7- }
@end lilypond
Removals are specified similarly and are introduced by a caret.  They
must come after the additions
@lilypond[quote,verbatim,fragment]
\chordmode { c^3 c:7^5 c:9^3.5 }
@end lilypond

Modifiers can be used to change pitches.  The following modifiers are
supported

@table @code
@item m
The minor chord.  This modifier lowers the 3rd and (if present) the 7th step.

@item dim
The diminished chord.  This modifier lowers the 3rd, 5th and (if present)
the 7th step.

@item aug
The augmented chord.  This modifier raises the 5th step.

@item maj
The major 7th chord.  This modifier raises the 7th step if present.

@item sus
The suspended 4th or 2nd.  This modifier removes the 3rd
step.  Append either @code{2} or @code{4} to add the 2nd or 4th step to
the chord.
@end table

Modifiers can be mixed with additions
@lilypond[quote,verbatim,fragment]
  \chordmode { c:sus4 c:7sus4 c:dim7 c:m6 }
@end lilypond

@cindex modifiers, in chords.
@funindex aug
@funindex dim
@funindex maj
@funindex sus
@funindex m

Since an unaltered 11 does not sound good when combined with an
unaltered 3, the 11 is removed in this case (unless it is added
explicitly)
@lilypond[quote,ragged-right,fragment,verbatim]
\chordmode { c:13 c:13.11 c:m13 }
@end lilypond

@funindex /

An inversion (putting one pitch of the chord on the bottom), as well
as bass notes, can be specified by appending
@code{/}@var{pitch} to the chord
@lilypond[quote,ragged-right,fragment,verbatim]
\chordmode { c1 c/g c/f }
@end lilypond
@funindex /+

A bass note can be added instead transposed out of the chord,
by using @code{/+}@var{pitch}.

@lilypond[quote,ragged-right,fragment,verbatim]
\chordmode { c1 c/+g c/+f }
@end lilypond

Chords is a mode similar to @code{\lyricmode}, etc.  Most
of the commands continue to work, for example, @code{r} and
@code{\skip} can be used to insert rests and spaces, and property
commands may be used to change various settings.



@refbugs

Each step can only be present in a chord once.  The following
simply produces the augmented chord, since @code{5+} is interpreted
last
@cindex clusters
@lilypond[quote,ragged-right,verbatim,fragment]
\chordmode { c:5.5-.5+ }
@end lilypond


@node Printing chord names
@subsection Printing chord names

@cindex printing chord names
@cindex chord names
@cindex chords

For displaying printed chord names, use the @internalsref{ChordNames} context.
The chords may be entered either using the notation
described above, or directly using @code{<} and @code{>}

@lilypond[quote,verbatim,ragged-right]
harmonies = {
  \chordmode {a1 b c} <d' f' a'> <e' g' b'>
}
<<
  \new ChordNames \harmonies
  \new Staff \harmonies
>>
@end lilypond

You can make the chord changes stand out by setting
@internalsref{ChordNames}.@code{chordChanges} to true.  This will only
display chord names when there is a change in the chords scheme and at
the start of a new line

@lilypond[quote,verbatim,ragged-right]
harmonies = \chordmode {
  c1:m c:m \break c:m c:m d
}
<<
  \new ChordNames {
    \set chordChanges = ##t
    \harmonies }
  \new Staff \transpose c c' \harmonies
>>
@end lilypond

The previous examples all show chords over a staff.  This is not
necessary.  Chords may also be printed separately.  It may be necessary
to add @internalsref{Volta_engraver} and @internalsref{Bar_engraver}
for showing repeats.

@lilypond[ragged-right,verbatim]
\new ChordNames \with {
  \override BarLine #'bar-size = #4
  voltaOnThisStaff = ##t
  \consists Bar_engraver
  \consists "Volta_engraver"
}
\chordmode { \repeat volta 2 {
  f1:maj7 f:7 bes:7
  c:maj7
} \alternative {
  es e
}
}
@end lilypond


The default chord name layout is a system for Jazz music, proposed by
Klaus Ignatzek (see @ref{Literature list}).  It can be tuned through the
following properties

@table @code
@funindex chordNameExceptions
@item chordNameExceptions
This is a list that contains the chords that have special formatting.

The exceptions list should be encoded as
@example
@{ <c f g bes>1 \markup @{ \super "7" "wahh" @} @}
@end example

To get this information into @code{chordNameExceptions} takes a little
manoeuvring.  The following code transforms @code{chExceptionMusic}
(which is a sequential music) into a list of exceptions.
@example
(sequential-music-to-chord-exceptions chExceptionMusic #t)
@end example
Then,
@example
(append
 (sequential-music-to-chord-exceptions chExceptionMusic #t)
 ignatzekExceptions)
@end example
adds the new exceptions to the default ones, which are defined in
@file{ly/@/chord@/-modifier@/-init@/.ly}.

For an example of tuning this property, see also
@lsr{chords/,chord@/-name@/-exceptions@/.ly}
@cindex exceptions, chord names.


@funindex majorSevenSymbol
@item majorSevenSymbol
This property contains the markup object used for the 7th step, when
it is major.  Predefined options are @code{whiteTriangleMarkup} and
@code{blackTriangleMarkup}.  See
@lsr{chords,chord@/-name@/-major7@/.ly} for an example.

@funindex chordNameSeparator
@item chordNameSeparator
Different parts of a chord name are normally separated by a
slash.  By setting @code{chordNameSeparator}, you can specify other
separators, e.g.,
@lilypond[quote,ragged-right,fragment,verbatim]
\new ChordNames \chordmode {
  c:7sus4
  \set chordNameSeparator
    = \markup { \typewriter "|" }
  c:7sus4
}
@end lilypond

@funindex chordRootNamer
@item chordRootNamer
The root of a chord is usually printed as a letter with an optional
alteration.  The transformation from pitch to letter is done by this
function.  Special note names (for example, the German @q{H} for a
B-chord) can be produced by storing a new function in this property.

@funindex chordNoteNamer
@item chordNoteNamer
The default is to print single pitch, e.g., the bass note, using the
@code{chordRootNamer}.  The @code{chordNoteNamer} property can be set
to a specialized function to change this behavior.  For example, the
base can be printed in lower case.

@funindex chordPrefixSpacer
@item chordPrefixSpacer
The @q{m} for minor chords is usually printed right after the root of
the chord. By setting @code{chordPrefixSpacer}, you can fix a spacer
between the root and @q{m}. The spacer is not used when the root
is altered.

@end table

The predefined variables @code{\germanChords},
@code{\semiGermanChords}, @code{\italianChords} and @code{\frenchChords}
set these variables.  The effect is
demonstrated here,

@lilypondfile[ragged-right]{chord-names-languages.ly}

There are also two other chord name schemes implemented: an alternate
Jazz chord notation, and a systematic scheme called Banter chords.  The
alternate Jazz notation is also shown on the chart in @ref{Chord name
chart}.  Turning on these styles is described in the input file
@inputfileref{input/@/test,chord@/-names@/-jazz@/.ly}.

@cindex Banter
@cindex jazz chords
@cindex chords, jazz


@refcommands

@funindex \germanChords
@code{\germanChords},
@funindex \semiGermanChords
@code{\semiGermanChords}.
@funindex \italianChords
@code{\italianChords}.
@funindex \frenchChords
@code{\frenchChords}.




@seealso

Examples:
@lsr{chords/,chord@/-name@/-exceptions@/.ly},
@lsr{chords,chord@/-name@/-major7@/.ly}, and
@inputfileref{input/@/test,chord@/-names@/-jazz@/.ly}.


Init files: @file{scm/@/chords@/-ignatzek@/.scm}, and
@file{scm/@/chord@/-entry@/.scm}.


@refbugs

Chord names are determined solely from the list of pitches.  Chord
inversions are not identified, and neither are added bass notes.  This
may result in strange chord names when chords are entered with the
@code{< .. >} syntax.



@node Vocal music
@section Vocal music

Since LilyPond input files are text, there are two issues to
consider when working with vocal music:

@itemize @bullet
@item
Song texts must be entered as text, not notes.  For example, the
input@tie{}@code{d} should be interpreted as a one letter syllable, not the
note@tie{}D.

@item
Song texts must be aligned with the notes of their melody.
@end itemize

There are a few different ways to define lyrics; the simplest
way is to use the @code{\addlyrics} function.

@menu
* Setting simple songs::        
* Entering lyrics::             
* Hyphens and extenders::       
* The Lyrics context::          
* Melismata::                   
* Another way of entering lyrics::  
* Flexibility in placement::    
* Spacing lyrics::              
* More about stanzas::          
* Ambitus::                     
* Other vocal issues::          
@end menu


@commonprop

Checking to make sure that text scripts and lyrics are within the margins is
a relatively large computational task.  To speed up processing, lilypond does
not perform such calculations by default; to enable it, use

@example
\override Score.PaperColumn #'keep-inside-line = ##t
@end example

To make lyrics avoid barlines as well, use
@example
\layout @{
  \context @{
    \Lyrics
      \consists "Bar_engraver"
      \consists "Separating_line_group_engraver"
      \override BarLine #'transparent = ##t
  @}
@}
@end example


@node Setting simple songs
@subsection Setting simple songs

The easiest way to add lyrics to a melody is to append
@cindex \addlyrics
@example
\addlyrics @{ @var{the lyrics} @}
@end example

@noindent
to a melody.  Here is an example,

@lilypond[ragged-right,verbatim,fragment,quote]
\time 3/4
\relative { c2 e4 g2. }
\addlyrics { play the game }
@end lilypond

More stanzas can be added by adding more
@code{\addlyrics} sections

@lilypond[ragged-right,verbatim,fragment,quote]
\time 3/4
\relative { c2 e4 g2. }
\addlyrics { play the game }
\addlyrics { speel het spel }
\addlyrics { joue le jeu }
@end lilypond

The command @code{\addlyrics} cannot handle polyphony settings.  For these
cases you should use @code{\lyricsto} and @code{\lyricmode}.



@node Entering lyrics
@subsection Entering lyrics

@cindex lyrics
@funindex \lyricmode
@cindex punctuation

Lyrics are entered in a special input mode.  This mode is introduced
by the keyword @code{\lyricmode}, or by using @code{\addlyrics} or
@code{\lyricsto}.  In this mode you can enter lyrics,
with punctuation and accents, and the input @code{d} is not parsed as
a pitch, but rather as a one letter syllable.  Syllables are entered
like notes, but with pitches replaced by text.  For example,
@example
\lyricmode @{ Twin-4 kle4 twin- kle litt- le star2 @}
@end example

There are two main methods to specify the horizontal placement
of the syllables, either by specifying the duration of each syllable
explicitly, like in the example above, or by automatically aligning
the lyrics to a melody or other voice of music, using @code{\addlyrics}
or @code{\lyricsto}.  For more details see @ref{The Lyrics context}.

A word or syllable of lyrics begins with an alphabetic character, and ends
with
any space or digit.  The following characters can be any character
that is not a digit or white space.  One important consequence of this
is that a word can end with @code{@}}.  The following example is
usually a mistake in the input file.  The syllable includes a @code{@}}, so
the
opening brace is not balanced
@example
\lyricmode @{ twinkle@}
@end example

@funindex \property in \lyricmode

@noindent
Similarly, a period which follows an alphabetic sequence is included in
the resulting string.  As a consequence, spaces must be inserted around
property commands
@example
\override Score . LyricText #'font-shape = #'italic
@end example

@funindex _
@cindex spaces, in lyrics
@cindex quotes, in lyrics
@cindex ties, in lyrics

In order to assign more than one syllable to a single note, you can
surround them with quotes or use a @code{_} character, to get spaces
between syllables, or use tilde  symbol (@code{~}) to get a lyric tie.

@lilypond[quote,relative=2,ragged-right,fragment,verbatim]
\time 3/4
\relative { c2 e4 g2 e4 }
\addlyrics { gran- de_a- mi- go }
\addlyrics { pu- "ro y ho-" nes- to }
\addlyrics { pu- ro~y~ho- nes- to }
@end lilypond

The lyric ties is implemented with the Unicode character U+203F, so be
sure to have a font (Like DejaVuLGC) installed that includes this
glyph.


To enter lyrics with characters from non-English languages, or with
accented and special characters (such as the heart symbol or slanted quotes),
simply insert the characters directly into the input file and save
it with utf-8 encoding.  See @ref{Text encoding} for more info.

@lilypond[quote,ragged-right,fragment,verbatim]
\relative { e4 f e d e f e2 }
\addlyrics { He said: “Let my peo ple go”. }
@end lilypond

To use normal quotes in lyrics, add a backslash before the
quotes.  For example,

@lilypond[quote,ragged-right,fragment,verbatim]
\relative c' { \time 3/4 e4 e4. e8 d4 e d c2. }
\addlyrics { "\"I" am so lone- "ly\"" said she }
@end lilypond

The full definition of a word start in Lyrics mode is somewhat more
complex.

A word in Lyrics mode begins with: an alphabetic character, @code{_},
@code{?}, @code{!}, @code{:}, @code{'}, the control characters @code{^A}
through @code{^F}, @code{^Q} through @code{^W}, @code{^Y}, @code{^^},
any 8-bit character with ASCII code over 127, or a two-character
combination of a backslash followed by one of @code{`}, @code{'},
@code{"}, or @code{^}.

To define indentifiers containing lyrics, the function @code{lyricmode}
must be used.

@example
verseOne = \lyricmode @{ Joy to the world the Lord is come @}
\score @{
  <<
    \new Voice = "one" \relative c'' @{
      \autoBeamOff
      \time 2/4
      c4 b8. a16 g4. f8 e4 d c2
    @}
    \addlyrics @{ \verseOne @}
  >>
@}
@end example


@seealso

Program reference: @internalsref{LyricText}, @internalsref{LyricSpace}.



@node Hyphens and extenders
@subsection Hyphens and extenders

@cindex hyphens

Centered hyphens are entered as @samp{--} between syllables.
The hyphen will have variable length depending on the space between
the syllables and it will be centered between the syllables.

@cindex melisma
@cindex extender

When a lyric is sung over many notes (this is called a melisma), this is
indicated with a horizontal line centered between a syllable and the
next one.  Such a line is called an extender line, and it is entered as
@samp{__}.

In tighly engraved music, hyphens can be removed.  Whether this
happens can be controlled with the @code{minimum-distance} (minimum
distance between two syllables) and the @code{minimum-length}
(threshold below which hyphens are removed).

@seealso

Program reference: @internalsref{LyricHyphen}, @internalsref{LyricExtender}.



@node The Lyrics context
@subsection The Lyrics context

Lyrics are printed by interpreting them in the context called
@internalsref{Lyrics}.

@example
\new Lyrics \lyricmode @dots{}
@end example

@cindex automatic syllable durations
@funindex \lyricsto
@cindex lyrics and melodies

This will place the lyrics according to the durations that were
entered.  The lyrics can also be aligned under a given melody
automatically.  In this case, it is no longer necessary to enter the
correct duration for each syllable.  This is achieved by combining the
melody and the lyrics with the @code{\lyricsto} expression

@example
\new Lyrics \lyricsto @var{name} @dots{}
@end example

This aligns the lyrics to the
notes of the @internalsref{Voice} context called @var{name}, which must
already exist.  Therefore normally the @code{Voice} is specified first, and
then the lyrics are specified with @code{\lyricsto}.  The command
@code{\lyricsto} switches to @code{\lyricmode} mode automatically, so the
@code{\lyricmode} keyword may be omitted.

The following example uses different commands for entering lyrics.

@lilypond[quote,fragment,ragged-right,verbatim]
<<
  \new Voice = "one" \relative c'' {
    \autoBeamOff
    \time 2/4
    c4 b8. a16 g4. f8 e4 d c2
  }
  \new Lyrics \lyricmode { Joy4 to8. the16 world!4. the8 Lord4 is come.2 }
  \new Lyrics \lyricmode { Joy to the earth! the Sa -- viour reigns. }
  \new Lyrics \lyricsto "one" { No more let sins and sor -- rows grow. }
>>
@end lilypond

The second stanza is not properly aligned because the durations
were not specified.  A solution for that would be to use @code{\lyricsto}.

The @code{\addlyrics} command is actually just a convenient way
to write a more complicated LilyPond structure that sets up the
lyrics.

@example
@{ MUSIC @}
\addlyrics @{ LYRICS @}
@end example

@noindent
is the same as

@example
\new Voice = "blah" @{ music @}
\new Lyrics \lyricsto "blah" @{ LYRICS @}
@end example

For different or more complex orderings, the best way is to setup the
hierarchy of staves and lyrics first, e.g.,
@example
\new ChoirStaff <<
  \new Voice = "soprano" @{ @emph{music} @}
  \new Lyrics = "sopranoLyrics" @{ s1 @}
  \new Lyrics = "tenorLyrics" @{ s1 @}
  \new Voice = "tenor" @{ @emph{music} @}
>>
@end example

and then combine the appropriate melodies and lyric lines

@example
\context Lyrics = sopranoLyrics \lyricsto "soprano"
  @emph{the lyrics}
@end example

@noindent
The final input would resemble

@example
<<\new ChoirStaff << @emph{setup the music} >>
  \lyricsto "soprano" @emph{etc}
  \lyricsto "alto" @emph{etc}
  @emph{etc}
>>
@end example

@seealso

Program reference: @internalsref{LyricCombineMusic},
@internalsref{Lyrics}.


@node Melismata
@subsection Melismata

The @code{\lyricsto} command detects melismata: it only puts one
syllable under a tied or slurred group of notes.  If you want to force
an unslurred group of notes to be a melisma, insert @code{\melisma}
after the first note of the group, and @code{\melismaEnd} after the
last one, e.g.,

@lilypond[quote,relative=2,ragged-right,fragment,verbatim]
<<
  \new Voice = "lala" {
    \time 3/4
    f4 g8
    \melisma
    f e f
    \melismaEnd
    e2
  }
  \new Lyrics \lyricsto "lala" {
    la di __ daah
  }
>>
@end lilypond

In addition, notes are considered a melisma if they are manually
beamed, and automatic beaming (see @ref{Setting automatic beam
behavior}) is switched off.

@cindex SATB
@cindex choral score

A complete example of a SATB score setup is in section
@ref{Vocal ensembles}.


@refcommands

@code{\melisma}, @code{\melismaEnd}
@funindex \melismaEnd
@funindex \melisma

@seealso

Program reference: @internalsref{Melisma_translator}.

@lsr{vocal,lyric@/-combine.ly}.

@refbugs

Melismata are not detected automatically, and extender lines must be
inserted by hand.


@node Another way of entering lyrics
@subsection Another way of entering lyrics

Lyrics can also be entered without @code{\lyricsto}.  In this case the
duration of each syllable must be entered explicitly, for example,

@example
play2 the4 game2.
sink2 or4 swim2.
@end example

The alignment to a melody can be specified with the
@code{associatedVoice} property,

@example
\set associatedVoice = #"lala"
@end example

@noindent
The value of the property (here: @code{"lala"}) should be the name of
a @internalsref{Voice} context.  Without this setting, extender lines
will not be formatted properly.

Here is an example demonstrating manual lyric durations,

@lilypond[relative=1,ragged-right,verbatim,fragment,quote]
<< \new Voice = "melody" {
     \time 3/4
     c2 e4 g2.
  }
  \new Lyrics \lyricmode {
    \set associatedVoice = #"melody"
    play2 the4 game2.
  } >>
@end lilypond


@c TODO: document \new Staff << Voice \lyricsto >> bug

@node Flexibility in placement
@subsection Flexibility in placement

Often, different stanzas of one song are put to one melody in slightly
differing ways.  Such variations can still be captured with
@code{\lyricsto}.

@menu
* Lyrics to multiple notes of a melisma::  
* Divisi lyrics::               
* Switching the melody associated with a lyrics line::  
* Specifying melismata within the lyrics::  
* Lyrics independent of notes::  
@end menu

@node Lyrics to multiple notes of a melisma
@subsubsection Lyrics to multiple notes of a melisma


One possibility is that the text has a melisma in one stanza, but
multiple syllables in another one.  One solution is to make the faster
voice ignore the melisma.  This is done by setting
@code{ignoreMelismata} in the Lyrics context.

There is one tricky aspect: the setting for @code{ignoreMelismata}
must be set one syllable @emph{before} the non-melismatic syllable
in the text, as shown here,

@c  FIXME: breaks compile
@lilypond[verbatim,ragged-right,quote]
%{
<<
  \relative \new Voice = "lahlah" {
    \set Staff.autoBeaming = ##f
    c4
    \slurDotted
    f8.[( g16])
    a4
  }
  \new Lyrics \lyricsto "lahlah" {
    more slow -- ly
  }
  \new Lyrics \lyricsto "lahlah" {
    \set ignoreMelismata = ##t % applies to "fas"
    go fas -- ter
    \unset ignoreMelismata
    still
  }
>>
%}
@end lilypond


The @code{ignoreMelismata} applies to the syllable @q{fas}, so it
should be entered before @q{go}.

The reverse is also possible: making a lyric line slower than the
standard.  This can be achieved by insert @code{\skip}s into the
lyrics.  For every @code{\skip}, the text will be delayed another note.
For example,

@lilypond[verbatim,ragged-right,quote]
\relative { c c g' }
\addlyrics {
  twin -- \skip 4
  kle
}
@end lilypond


@node Divisi lyrics
@subsubsection Divisi lyrics

You can display alternate (or divisi) lyrics by naming voice
contexts and attaching lyrics to those specific contexts.

@lilypond[verbatim,ragged-right,quote]
\score{ <<
  \new Voice = "melody" {
    \relative c' {
      c4
      <<
        { \voiceOne c8 e }
        \new Voice = "splitpart" { \voiceTwo c4 }
      >>
      \oneVoice c4 c | c
    }
  }
  \new Lyrics \lyricsto "melody" { we shall not o- ver- come }
  \new Lyrics \lyricsto "splitpart" { will }
>> }
@end lilypond


You can use this trick to display different lyrics for a repeated
section.

@lilypond[verbatim,ragged-right,quote]
\score{ <<
  \new Voice = "melody" \relative c' {
    c2 e | g e | c1 |
    \new Voice = "verse" \repeat volta 2 {c4 d e f | g1 | }
    a2 b | c1}
  \new Lyrics = "mainlyrics" \lyricsto melody \lyricmode {
    do mi sol mi do
    la si do }
  \context Lyrics = "mainlyrics" \lyricsto verse \lyricmode {
   do re mi fa sol }
  \new Lyrics = "repeatlyrics" \lyricsto verse \lyricmode {
   dodo rere mimi fafa solsol }
>>
}
@end lilypond



@node Switching the melody associated with a lyrics line
@subsubsection Switching the melody associated with a lyrics line

More complex variations in text underlay are possible.  It is possible
to switch the melody for a line of lyrics during the text.  This is
done by setting the @code{associatedVoice} property.  In the example

@lilypond[ragged-right,quote]
<<
  \relative \new Voice = "lahlah" {
    \set Staff.autoBeaming = ##f
    c4
    <<
      \new Voice = "alternative" {
        \voiceOne
        \times 2/3 {
          % show associations clearly.
          \override NoteColumn #'force-hshift = #-3
          f8 f g
        }
      }
      {
        \voiceTwo
        f8.[ g16]
        \oneVoice
      } >>
    a8( b) c
  }
  \new Lyrics \lyricsto "lahlah" {
    Ju -- ras -- sic Park
  }
  \new Lyrics \lyricsto "lahlah" {
    % Tricky: need to set associatedVoice
    % one syllable too soon!
    \set associatedVoice = alternative % applies to "ran"
    Ty --
    ran --
    no --
    \set associatedVoice = lahlah % applies to "rus"
    sau -- rus Rex
  } >>
@end lilypond

@noindent
the text for the first stanza is set to a melody called @q{lahlah},

@example
\new Lyrics \lyricsto "lahlah" @{
  Ju -- ras -- sic Park
@}
@end example


The second stanza initially is set to the @code{lahlah} context, but
for the syllable @q{ran}, it switches to a different melody.
This is achieved with
@example
\set associatedVoice = alternative
@end example

@noindent
Here, @code{alternative} is the name of the @code{Voice} context
containing the triplet.

Again, the command must be one syllable too early, before @q{Ty} in
this case.

@example
\new Lyrics \lyricsto "lahlah" @{
  \set associatedVoice = alternative % applies to "ran"
  Ty --
  ran --
  no --
  \set associatedVoice = lahlah % applies to "rus"
  sau -- rus Rex
@}
@end example

@noindent
The underlay is switched back to the starting situation by assigning
@code{lahlah} to @code{associatedVoice}.


@node Specifying melismata within the lyrics
@subsubsection Specifying melismata within the lyrics

It is also possible to define melismata entirely in the lyrics. This
can be done by entering @code{_} for every note that is part of the
melisma.

@lilypond[relative=1,verbatim,fragment,quote]
{ \set melismaBusyProperties = #'()
  c d( e) f f( e) e e  }
\addlyrics
 { Ky -- _ _ ri __ _ _ _  e }
@end lilypond

In this case, you can also have ties and slurs in the melody if you
set @code{melismaBusyProperties}, as is done in the example above.


@node Lyrics independent of notes
@subsubsection Lyrics independent of notes

In some complex vocal music, it may be desirable to place
lyrics completely independently of notes.  Music defined
inside @code{lyricrhythm} disappears into the
@code{Devnull} context, but the rhythms can still be used
to place the lyrics.

@lilypond[quote,verbatim,ragged-right]
voice = {
  c''2
  \tag #'music { c''2 }
  \tag #'lyricrhythm { c''4. c''8 }
  d''1
}

lyr = \lyricmode { I like my cat! }

<<
  \new Staff \keepWithTag #'music \voice
  \new Devnull="nowhere" \keepWithTag #'lyricrhythm \voice
  \new Lyrics \lyricsto "nowhere" \lyr
  \new Staff { c'8 c' c' c' c' c' c' c'
  c' c' c' c' c' c' c' c' }
>>
@end lilypond


@node Spacing lyrics
@subsection Spacing lyrics

@cindex Spacing lyrics
@cindex Lyrics, increasing space between

To increase the spacing between lyrics, set the minimum-distance property of
LyricSpace.

@lilypond[relative,verbatim,fragment,quote,ragged-right]
{
  c c c c
  \override Lyrics.LyricSpace #'minimum-distance = #1.0
  c c c c
}
\addlyrics {
  longtext longtext longtext longtext
  longtext longtext longtext longtext
}
@end lilypond

To make this change for all lyrics in the score, set the property in the
layout.

@lilypond[relative,verbatim,quote,ragged-right]
\score {
  {
  c c c c
  c c c c
  }
  \addlyrics {
  longtext longtext longtext longtext
  longtext longtext longtext longtext
  }
  \layout {
    \context {
      \Lyrics
      \override LyricSpace #'minimum-distance = #1.0
    }
  }
}
@end lilypond


@node More about stanzas
@subsection More about stanzas

@c what's this doing here?
@cindex phrasing, in lyrics

@cindex stanza number
@subsubsection Adding stanza numbers 

Stanza numbers can be added by setting @code{stanza}, e.g.,

@lilypond[quote,ragged-right,verbatim,relative=2,fragment]
\new Voice {
  \time 3/4 g2 e4 a2 f4 g2.
} \addlyrics {
  \set stanza = "1. "
  Hi, my name is Bert.
} \addlyrics {
  \set stanza = "2. "
  Oh, che -- ri, je t'aime
}
@end lilypond

@noindent
These numbers are put just before the start of the first syllable.


@subsubsection Adding dynamics marks

Stanzas differing in loudness may be indicated by putting a
dynamics mark before each stanza.  In Lilypond, everthing coming in
front of a stanza goes into the @code{StanzaNumber} object; dynamics marks
are no different.  For technical reasons, you have to set the stanza
outside @code{\lyricmode}:

@lilypond[quote,ragged-right,verbatim]
text = {
  \set stanza = \markup { \dynamic "ff" "1. " }
  \lyricmode {
    Big bang
  }
}

<<
  \new Voice = "tune" {
    \time 3/4
    g'4 c'2
  }
\new Lyrics \lyricsto "tune" \text
>>
@end lilypond

@cindex singer name
@cindex name of singer
@subsubsection Adding singer names

Names of singers can also be added.  They are printed at the start of
the line, just like instrument names.  They are created by setting
@code{vocalName}.  A short version may be entered as @code{shortVocalName}.

@lilypond[fragment,ragged-right,quote,verbatim,relative=2]
\new Voice {
  \time 3/4 g2 e4 a2 f4 g2.
} \addlyrics {
  \set vocalName = "Bert "
  Hi, my name is Bert.
} \addlyrics {
  \set vocalName = "Ernie "
  Oh, che -- ri, je t'aime
}
@end lilypond


@subsubsection Printing stanzas at the end 

Sometimes it is appropriate to have one stanza set
to the music, and the rest added in verse form at
the end of the piece.  This can be accomplished by adding
the extra verses into a @code{\markup} section outside
of the main score block.  Notice that there are two
different ways to force linebreaks when using
@code{\markup}.

@lilypond[ragged-right,verbatim,quote]
melody = \relative c' {
e d c d | e e e e |
d d e d | c1 |
}

text = \lyricmode {
\set stanza = "1." Ma- ry had a lit- tle lamb,
its fleece was white as snow.
}

\book{
  \score{ <<
    \new Voice = "one" { \melody }
    \new Lyrics \lyricsto "one" \text
	>>
    \layout { }
  }
  \markup { \column{
    \line{ Verse 2. }
    \line{ All the children laughed and played }
    \line{ To see a lamb at school. }
    }
  }
  \markup{
    \wordwrap-string #"
    Verse 3.

    Mary took it home again,

    It was against the rule."
  }
}
@end lilypond


@subsubsection Printing stanzas at the end in multiple columns 

When a piece of music has many verses, they are often printed in
multiple columns across the page. An outdented verse number often
introduces each verse. The following example shows how to produce such
output in Lilypond.

@lilypond[ragged-right,quote,verbatim]
melody = \relative c' {
  c c c c | d d d d
}
 
text = \lyricmode {
  \set stanza = "1." This is verse one.
  It has two lines.
}

\score{ <<
    \new Voice = "one" { \melody }
    \new Lyrics \lyricsto "one" \text
   >>
  \layout { }
}

\markup {
  \fill-line {
    \hspace #0.1 % moves the column off the left margin; can be removed if
        % space on the page is tight
     \column {
      \line { \bold "2."
        \column {
          "This is verse two."
          "It has two lines."
        }
      }
      \hspace #0.1 % adds vertical spacing between verses
      \line { \bold "3."
        \column {
          "This is verse three."
          "It has two lines."
        }
      }
    }
    \hspace #0.1  % adds horizontal spacing between columns; if they are
        % still too close, add more " " pairs until the result 
        % looks good
     \column {
      \line { \bold "4."
        \column {
          "This is verse four."
          "It has two lines."
        }
      }
      \hspace #0.1 % adds vertical spacing between verses
      \line { \bold "5."
        \column {
          "This is verse five."
          "It has two lines."
        }
      }
    }
  \hspace #0.1 % gives some extra space on the right margin; can
      % be removed if page space is tight
  }
}
@end lilypond


@seealso

Program reference: @internalsref{LyricText}, @internalsref{StanzaNumber},
@internalsref{VocalName}.



@node Ambitus
@subsection Ambitus
@cindex ambitus

The term @emph{ambitus} denotes a range of pitches for a given voice
in a part of music.  It may also denote the pitch range that a musical
instrument is capable of playing.  Ambits are printed on vocal parts,
so performers can easily determine it meets their capabilities.

Ambits are denoted at the beginning of a piece near the initial clef.
The range is graphically specified by two note heads that represent the
minimum and maximum pitch.  To print such ambits, add the
@internalsref{Ambitus_engraver} to the @internalsref{Voice} context,
for example,

@example
\layout @{
  \context @{
    \Voice
    \consists Ambitus_engraver
  @}
@}
@end example

This results in the following output

@lilypond[quote,ragged-right]
\layout {
  \context {
    \Staff
    \consists Ambitus_engraver
  }
}

\relative \new Staff {
  as'' c e2 cis,2
}
@end lilypond

If you have multiple voices in a single staff and you want a single
ambitus per staff rather than per each voice, add the
@internalsref{Ambitus_engraver} to the @internalsref{Staff} context
rather than to the @internalsref{Voice} context.  Here is an example,

@lilypond[verbatim,ragged-right,quote]
\new Staff \with {
  \consists "Ambitus_engraver"
}
<<
  \new Voice \with {
    \remove "Ambitus_engraver"
  } \relative c'' {
    \override Ambitus #'X-offset = #-1.0
    \voiceOne
    c4 a d e f2
  }
  \new Voice \with {
    \remove "Ambitus_engraver"
  } \relative c' {
    \voiceTwo
    es4 f g as b2
  }
>>
@end lilypond

@noindent
This example uses one advanced feature,

@example
\override Ambitus #'X-offset = #-1.0
@end example

@noindent
This code moves the ambitus to the left.  The same effect could have
been achieved with @code{extra-offset}, but then the formatting system
would not reserve space for the moved object.

@seealso

Program reference: @internalsref{Ambitus},
@internalsref{AmbitusLine}, @internalsref{AmbitusNoteHead},
@internalsref{AmbitusAccidental}.

Examples:
@lsr{vocal,ambitus@/.ly}.

@refbugs

There is no collision handling in the case of multiple per-voice
ambitus.


@node Other vocal issues
@subsection Other vocal issues

@ignore
yeah, I'm giving up somewhat by stuffing a bunch of things in
here.  But at least they're in the manual now; it's easier to
move them around in the manual once they're already here.

Besides, if users complain about everything stuffed in here, I
can ask them for specific instructions about where to move these
examples, and that might get them more involved in the docs.  -gp
@end ignore

@q{Parlato} is spoken without pitch but still with rhythm; it is
notated by cross noteheads.  This is demonstrated in
@ref{Special noteheads}.





@node Rhythmic music
@section Rhythmic music

Rhythmic music is primarily used for percussion and drum notation, but it can
also be used to show the rhythms of melodies.

@menu
* Showing melody rhythms::      
* Entering percussion::         
* Percussion staves::           
* Ghost notes::                 
@end menu


@node Showing melody rhythms
@subsection Showing melody rhythms

Sometimes you might want to show only the rhythm of a melody.  This
can be done with the rhythmic staff.  All pitches of notes on such a
staff are squashed, and the staff itself has a single line

@lilypond[quote,ragged-right,fragment,relative=1,verbatim]
\new RhythmicStaff {
  \time 4/4
  c4 e8 f g2 | r4 g r2 | g1:32 | r1 |
}
@end lilypond

@seealso

Program reference: @internalsref{RhythmicStaff}.


@node Entering percussion
@subsection Entering percussion

@cindex percussion
@cindex drums


Percussion notes may be entered in @code{\drummode} mode, which is
similar to the standard mode for entering notes.  Each piece of
percussion has a full name and an abbreviated name, and both can be used
in input files

@lilypond[quote,ragged-right,verbatim]
\drums {
  hihat hh bassdrum bd
}
@end lilypond

The complete list of drum names is in the init file
@file{ly/@/drumpitch@/-init@/.ly}.
@c TODO: properly document this.

@seealso

Program reference: @internalsref{note-event}.

@node Percussion staves
@subsection Percussion staves
@cindex percussion
@cindex drums

A percussion part for more than one instrument typically uses a
multiline staff where each position in the staff refers to one piece
of percussion.


To typeset the music, the notes must be interpreted in a
@internalsref{DrumStaff} and @internalsref{DrumVoice} contexts

@lilypond[quote,ragged-right,verbatim]
up = \drummode { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
down = \drummode { bassdrum4 snare8 bd r bd sn4 }
  \new DrumStaff <<
    \new DrumVoice { \voiceOne \up }
    \new DrumVoice { \voiceTwo \down }
  >>
@end lilypond

The above example shows verbose polyphonic notation.  The short
polyphonic notation, described in @ref{Basic polyphony}, can also be used if
the @internalsref{DrumVoice}s are instantiated by hand first.  For example,

@lilypond[quote,ragged-right,fragment,verbatim]
\new DrumStaff <<
  \new DrumVoice = "1" { s1 *2 }
  \new DrumVoice = "2" { s1 *2 }
  \drummode {
    bd4 sn4 bd4 sn4
    <<
      { \repeat unfold 16 hh16 }
      \\
      { bd4 sn4 bd4 sn4 }
    >>
  }
>>
@end lilypond


There are also other layout possibilities.  To use these, set the
property @code{drumStyleTable} in context @internalsref{DrumVoice}.
The following variables have been predefined

@table @code
@item drums-style
This is the default.  It typesets a typical drum kit on a five-line staff

@lilypond[quote,line-width=10.0\cm]
nam = \lyricmode {
  cymc cyms cymr hh hhc hho hhho hhp
  cb hc bd sn ss tomh tommh tomml toml tomfh tomfl }
mus = \drummode {
  cymc cyms cymr hh hhc hho hhho hhp \break
  cb hc bd sn ss tomh tommh tomml toml tomfh tomfl s16 }
\score {
  << \new DrumStaff \with {
       \remove Bar_engraver
       \remove Time_signature_engraver
       \override Stem #'transparent = ##t
       \override Stem #'Y-extent-callback = ##f
       \override VerticalAxisGroup #'minimum-Y-extent = #'(-4.0 . 5.0)
     } \mus
     \new Lyrics \nam
  >>
  \layout {
    \context {
      \Score
      \override LyricText #'font-family = #'typewriter
      \override BarNumber #'transparent =##T
    }
  }
}
@end lilypond

The drum scheme supports six different toms.  When there are fewer toms,
simply select the toms that produce the desired result, i.e., to get toms
on the three middle lines you use @code{tommh}, @code{tomml}, and
@code{tomfh}.

@item timbales-style
This typesets timbales on a two line staff

@lilypond[quote,ragged-right]
nam = \lyricmode { timh ssh timl ssl cb }
mus = \drummode { timh ssh timl ssl cb s16 }

<<
  \new DrumStaff \with {
    \remove Bar_engraver
    \remove Time_signature_engraver
    \override Stem #'transparent = ##t
    \override Stem #'Y-extent-callback = ##f
    \override StaffSymbol #'line-count = #2
    \override StaffSymbol #'staff-space = #2
    \override VerticalAxisGroup #'minimum-Y-extent = #'(-3.0 . 4.0)
    drumStyleTable = #timbales-style
  } \mus
  \new Lyrics {
    \override LyricText #'font-family = #'typewriter
    \nam
  }
>>
@end lilypond

@item congas-style
This typesets congas on a two line staff

@lilypond[quote,ragged-right]
nam = \lyricmode { cgh cgho cghm ssh cgl cglo cglm ssl }
mus = \drummode { cgh cgho cghm ssh cgl cglo cglm ssl s16 }

<<
  \new DrumStaff \with {
    \remove Bar_engraver
    \remove Time_signature_engraver
    drumStyleTable = #congas-style
    \override StaffSymbol #'line-count = #2

    %% this sucks; it will lengthen stems.
    \override StaffSymbol #'staff-space = #2
    \override Stem #'transparent = ##t
    \override Stem #'Y-extent-callback = ##f
  } \mus
  \new Lyrics {
    \override LyricText #'font-family = #'typewriter
    \nam
  }
>>
@end lilypond

@item bongos-style
This typesets bongos on a two line staff

@lilypond[quote,ragged-right]
nam = \lyricmode { boh boho bohm ssh bol bolo bolm ssl }
mus = \drummode { boh boho bohm ssh bol bolo bolm ssl s16 }

<<
  \new DrumStaff \with {
    \remove Bar_engraver
    \remove Time_signature_engraver
    \override StaffSymbol #'line-count = #2
    drumStyleTable = #bongos-style

    %% this sucks; it will lengthen stems.
    \override StaffSymbol #'staff-space = #2
    \override Stem #'transparent = ##t
    \override Stem #'Y-extent-callback = ##f
  } \mus
  \new Lyrics {
    \override LyricText #'font-family = #'typewriter
    \nam
  }
>>
@end lilypond

@item percussion-style
To typeset all kinds of simple percussion on one line staves.

@lilypond[quote,ragged-right]
nam = \lyricmode { tri trio trim gui guis guil cb cl tamb cab mar hc }
mus = \drummode { tri trio trim gui guis guil cb cl tamb cab mar hc s16 }

<<
  \new DrumStaff \with{
    \remove Bar_engraver
    drumStyleTable = #percussion-style
    \override StaffSymbol #'line-count = #1
    \remove Time_signature_engraver
    \override Stem #'transparent = ##t
    \override Stem #'Y-extent-callback = ##f
  } \mus
  \new Lyrics {
    \override LyricText #'font-family = #'typewriter
    \nam
  }
>>
@end lilypond
@end table

If you do not like any of the predefined lists you can define your own
list at the top of your file

@lilypond[quote,ragged-right,verbatim]
#(define mydrums '(
         (bassdrum     default   #f         -1)
         (snare        default   #f         0)
         (hihat        cross     #f         1)
         (pedalhihat   xcircle   "stopped"  2)
         (lowtom       diamond   #f         3)))
up = \drummode { hh8 hh hh hh hhp4 hhp }
down = \drummode { bd4 sn bd toml8 toml }

\new DrumStaff <<
  \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
  \new DrumVoice { \voiceOne \up }
  \new DrumVoice { \voiceTwo \down }
>>
@end lilypond


@seealso

Init files: @file{ly/@/drumpitch@/-init@/.ly}.

Program reference: @internalsref{DrumStaff}, @internalsref{DrumVoice}.

@refbugs

Because general MIDI does not contain rim shots, the sidestick is used
for this purpose instead.


@c FIXME: check name -gp
@node Ghost notes
@subsection Ghost notes

Ghost notes for drums and percussion may be created using the
@code{\parenthesize} command detailed in @ref{Parentheses}.  However,
the default @code{\drummode} does
not include the @code{Parenthesis_engraver} plugin which allows
this.  You
must add the plugin explicitly in the context definition as
detailed in @ref{Changing context properties on the fly}.

@lilypond[quote,ragged-right,verbatim,fragment]
\new DrumStaff \with {
  \consists "Parenthesis_engraver"
} <<
  \context DrumVoice  = "1"  { s1 *2 }
  \context DrumVoice  = "2" { s1 *2 }
  \drummode {
    <<
      {
        hh8[ hh] <hh sn> hh16
        < \parenthesize sn > hh < \parenthesize
        sn > hh8 <hh sn> hh
      } \\ {
        bd4 r4 bd8 bd r8 bd
      }
    >>
  }
>>
@end lilypond

@noindent
Also note that you must add chords (@code{< >} brackets)
around each @code{\parenthesize} statement.


@node Guitar
@section Guitar

@cindex tablature
@cindex guitar tablature

@menu
* String number indications::   
* Tablatures basic::            
* Non-guitar tablatures::       
* Banjo tablatures::            
* Fret diagrams::               
* Right hand fingerings::       
* Other guitar issues::         
@end menu

@node String number indications
@subsection String number indications

@cindex String numbers

String numbers can be added to chords, by indicating the string number
with @code{\}@var{number},

@lilypond[relative,relative=1,ragged-right,fragment]
<c\1 e\2 g\3>
@end lilypond


@seealso

Program reference: @internalsref{StringNumber},
@lsr{guitar/,string-number.ly}.


@node Tablatures basic
@subsection Tablatures basic
@cindex Tablatures basic

Tablature notation is used for notating music for plucked string
instruments.  Pitches are not denoted with note heads, but by
numbers indicating on which string and fret a note must be played.  LilyPond
offers limited support for tablature.

The string number associated to a note is given as a backslash
followed by a number, e.g., @code{c4\3} for a C quarter on the third
string.  By default, string 1 is the highest one, and the tuning
defaults to the standard guitar tuning (with 6 strings).  The notes
are printed as tablature, by using @internalsref{TabStaff} and
@internalsref{TabVoice} contexts

@lilypond[quote,ragged-right,fragment,verbatim]
\new TabStaff {
  a,4\5 c'\2 a\3 e'\1
  e\4 c'\2 a\3 e'\1
}
@end lilypond

@funindex minimumFret
@cindex fret

When no string is specified, the first string that does not give a
fret number less than @code{minimumFret} is selected.  The default
value for @code{minimumFret} is 0


@example
e16 fis gis a b4
\set TabStaff.minimumFret = #8
e16 fis gis a b4
@end example
@lilypond[quote,ragged-right]
frag = {
  \key e \major
  e16 fis gis a b4
  \set TabStaff.minimumFret = #8
  e16 fis gis a b4
}
  \new StaffGroup <<
    \new Staff { \clef "G_8" \frag }
    \new TabStaff { \frag }
  >>
@end lilypond


@commonprop

To print tablatures with stems down and horizontal beams,
initialize the @code{TabStaff} with this code:

@example
\stemDown
\override Beam #'damping = #100000
@end example

@seealso

Program reference: @internalsref{TabStaff}, @internalsref{TabVoice}.

@refbugs

Chords are not handled in a special way, and hence the automatic
string selector may easily select the same string to two notes in a
chord.


@node Non-guitar tablatures
@subsection Non-guitar tablatures
@cindex Non-guitar tablatures

You can change the tuning of the strings.  A string tuning is given as
a Scheme list with one integer number for each string, the number
being the pitch (measured in semitones relative to middle C) of an
open string.  The numbers specified for @code{stringTuning} are the
numbers of semitones to subtract or add, starting the specified pitch
by default middle C, in string order.  LilyPond automatically calculates
the number of strings by looking at @code{stringTuning}.

In the next example,
@code{stringTunings} is set for the pitches e, a, d, and g

@lilypond[quote,ragged-right,fragment,verbatim]
\new TabStaff <<
  \set TabStaff.stringTunings = #'(-5 -10 -15 -20)
  {
    a,4 c' a e' e c' a e'
  }
>>
@end lilypond

LilyPond comes with predefined string tunings for banjo, mandolin, guitar
and bass guitar.

@example
\set TabStaff.stringTunings = #bass-tuning
@end example

The default string tuning is @code{guitar-tuning} (the standard EADGBE
tuning).
Some other predefined tunings are @code{guitar-open-g-tuning},
@code{mandolin-tuning} and @code{banjo-open-g-tuning}.

@seealso

The file @file{scm/@/output@/-lib@/.scm} contains the predefined string
tunings.
Program reference: @internalsref{Tab_note_heads_engraver}.

@refbugs

No guitar special effects have been implemented.



@node Banjo tablatures
@subsection Banjo tablatures
@cindex Banjo tablatures

LilyPond has basic support for five stringed banjo.  When making tablatures
for five stringed banjo, use the banjo tablature format function to get
correct
fret numbers for the fifth string:

@lilypond[quote,ragged-right,fragment,verbatim]
\new TabStaff <<
  \set TabStaff.tablatureFormat = #fret-number-tablature-format-banjo
  \set TabStaff.stringTunings = #banjo-open-g-tuning
  {
    \stemDown
    g8 d' g'\5 a b g e d' |
    g4 d''8\5 b' a'\2 g'\5 e'\2 d' |
    g4
  }
>>
@end lilypond

A number of common tunings for banjo are predefined in LilyPond:
@code{banjo-c-tuning} (gCGBD), @code{banjo-modal-tuning} (gDGCD),
@code{banjo-open-d-tuning} (aDF#AD) and @code{banjo-open-dm-tuning}
(aDFAD).

These tunings may be converted to four string banjo tunings using the
@code{four-string-banjo} function:

@example
\set TabStaff.stringTunings = #(four-string-banjo banjo-c-tuning)
@end example

@seealso

The file @file{scm/@/output@/-lib@/.scm} contains predefined banjo tunings.


@node Fret diagrams
@subsection Fret diagrams
@cindex fret diagrams
@cindex chord diagrams

Fret diagrams can be added to music as a markup to the desired note.  The
markup contains information about the desired fret diagram, as shown in the
following example

@lilypond[verbatim, ragged-right, quote]
\new Voice {
  d'^\markup \fret-diagram #"6-x;5-x;4-o;3-2;2-3;1-2;"
  d' d' d'
  fis'^\markup \override #'(size . 0.75) {
    \override #'(finger-code . below-string) {
      \fret-diagram-verbose #'((place-fret 6 2 1) (barre 6 1 2)
                               (place-fret 5 4 3) (place-fret 4 4 4)
                               (place-fret 3 3 2) (place-fret 2 2 1)
                               (place-fret 1 2 1))
    }
  }
  fis' fis' fis'
  c'^\markup \override #'(dot-radius . 0.35) {
    \override #'(finger-code . in-dot) {
      \override #'(dot-color . white) {
        \fret-diagram-terse #"x;3-1-(;5-2;5-3;5-4;3-1-);"
      }
    }
  }
  c' c' c'
}
@end lilypond


There are three different fret-diagram markup interfaces: standard, terse,
and verbose.  The three interfaces produce equivalent markups, but have
varying amounts of information in the markup string.  Details about the
markup interfaces are found at @ref{Overview of text markup commands}.

You can set a number of graphical properties according to your preference.
Details about the property interface to fret diagrams are found at
@internalsref{fret-diagram-interface}.


@seealso

Examples: @inputfileref{input/@/test,fret@/-diagram@/.ly}


@node Right hand fingerings
@subsection Right hand fingerings

Right hand fingerings in chords can be entered using
@code{@var{note}-\rightHandFinger @var{finger}}

@lilypond[verbatim,fragment,relative=2]
  <c-\rightHandFinger #1 e-\rightHandFinger #2 >
@end lilypond

for brevity, you can abbreviate @code{\rightHandFinger} to something
short, for example @code{RH},

@example
#(define RH rightHandFinger)
@end example

@cindex fingerings, right hand, for guitar 
@cindex right hand fingerings for guitar
 
@commonprop

You may exercise greater control over right handing fingerings by
setting @code{strokeFingerOrientations},

@lilypond[quote,verbatim,ragged-right,fragment,relative=1]
#(define RH rightHandFinger)
{
  \set strokeFingerOrientations = #'(up down)
  <c-\RH #1 es-\RH #2 g-\RH #4 > 4
  \set strokeFingerOrientations = #'(up right down)
  <c-\RH #1 es-\RH #2 g-\RH #4 > 4
}
@end lilypond

The letters used for the fingerings are contained in the property
@code{digit-names}, but they can also be set individually by supplying
@code{\rightHandFinger} with a string argument, as in the following example


@lilypond[quote,verbatim,ragged-right,fragment,relative=1]
#(define RH rightHandFinger)
{
  \set strokeFingerOrientations = #'(right)
  \override StrokeFinger #'digit-names = ##("x" "y" "z" "!" "@") 
  <c-\RH #5 >4
  <c-\RH "@">4  
}
@end lilypond

@seealso

Internalls: @internalsref{StrokeFinger}



@node Other guitar issues
@subsection Other guitar issues

This example demonstrates how to include guitar position and
barring indications.

@lilypond[quote,ragged-right,fragment,verbatim,relative=0]
\clef "G_8"
b16 d16 g16 b16 e16
\textSpannerDown
\override TextSpanner #'bound-details #'left #'text = "XII "
  g16\startTextSpan
  b16 e16 g16 e16 b16 g16\stopTextSpan
e16 b16 g16 d16
@end lilypond


Stopped (X) note heads are used in guitar music to signal a place where the
guitarist must play a certain note or chord, with its fingers just
touching the strings instead of fully pressing them.  This gives the sound a
percussive noise-like sound that still maintains part of the original
pitch.  It is notated with cross noteheads; this is
demonstrated in @ref{Special noteheads}.


@node Bagpipe
@section Bagpipe

@cindex Bagpipe

@menu
* Bagpipe definitions::         
* Bagpipe example::             
@end menu


@node Bagpipe definitions
@subsection Bagpipe definitions

LilyPond contains special definitions for music for the Scottish
highland bagpipe; to use them, add

@example
\include "bagpipe.ly"
@end example

@noindent
at the top of your input file.  This lets you add the special gracenotes
common to bagpipe music with short commands.  For example, you could
write @code{\taor} instead of

@example
\grace @{ \small G32[ d G e] @}
@end example

@code{bagpipe.ly} also contains pitch definitions for the bagpipe
notes in the appropiate octaves, so you do not need to worry about
@code{\relative} or @code{\transpose}.

@lilypond[ragged-right,verbatim,quote,notime]
\include "bagpipe.ly"
{ \grg G4 \grg a \grg b \grg c \grg d \grg e \grg f \grA g A }
@end lilypond

Bagpipe music nominally uses the key of D Major (even though that
isn't really true). However, since that is the only key that can be used,
the key signature is normally not written out. To set this up correctly,
always start your music with @code{\hideKeySignature}. If you for some
reason want to show the key signature, you can use @code{\showKeySignature}
instead.

Some modern music use cross fingering on c and f to flatten those notes.
This can be indicated by @code{cflat} or @code{fflat}. Similarly, the
piobaireachd high g can be written @code{gflat} when it occurs in light
music.


@node Bagpipe example
@subsection Bagpipe example

This is what the well known tune Amazing Grace looks like in bagpipe
notation.

@lilypond[verbatim,quote]
\include "bagpipe.ly"
\layout {
  indent = 0.0\cm
  \context { \Score \remove "Bar_number_engraver" }
}

\header {
  title = "Amazing Grace"
  meter = "Hymn"
  arranger = "Trad. arr."
}

{
  \hideKeySignature
  \time 3/4
  \grg \partial 4 a8. d16
  \slurd d2 \grg f8[ e32 d16.]
  \grg f2 \grg f8 e
  \thrwd d2 \grg b4
  \grG a2 \grg a8. d16
  \slurd d2 \grg f8[ e32 d16.]
  \grg f2 \grg e8. f16
  \dblA A2 \grg A4
  \grg A2 f8. A16
  \grg A2 \hdblf f8[ e32 d16.]
  \grg f2 \grg f8 e
  \thrwd d2 \grg b4
  \grG a2 \grg a8. d16
  \slurd d2 \grg f8[ e32 d16.]
  \grg f2 e4
  \thrwd d2.
  \slurd d2
  \bar "|."
}
@end lilypond


@node Ancient notation
@section Ancient notation

@cindex Vaticana, Editio
@cindex Medicaea, Editio
@cindex hufnagel
@cindex Petrucci
@cindex mensural

Support for ancient notation includes features for mensural notation
and Gregorian Chant notation.  There is also limited support for
figured bass notation.

Many graphical objects provide a @code{style} property, see
@itemize @bullet
@item
@ref{Ancient note heads},
@item
@ref{Ancient accidentals},
@item
@ref{Ancient rests},
@item
@ref{Ancient clefs},
@item
@ref{Ancient flags},
@item
@ref{Ancient time signatures}.
@end itemize

By manipulating such a grob property, the typographical appearance of
the affected graphical objects can be accommodated for a specific
notation flavor without the need for introducing any new notational
concept.

In addition to the standard articulation signs described in section
@ref{Articulations}, specific articulation signs for ancient notation
are provided.

@itemize @bullet
@item
@ref{Ancient articulations}
@end itemize

Other aspects of ancient notation can not that easily be expressed
in terms of just changing a style property of a graphical object or
adding articulation signs.  Some notational concepts are introduced
specifically for ancient notation,

@itemize @bullet
@item
@ref{Custodes},
@item
@ref{Divisiones},
@item
@ref{Ligatures}.
@end itemize

If this all is too much of documentation for you, and you just want to
dive into typesetting without worrying too much about the details on
how to customize a context, you may have a look at the predefined
contexts.  Use them to set up predefined style-specific voice and
staff contexts, and directly go ahead with the note entry,

@itemize @bullet
@item
@ref{Gregorian Chant contexts},
@item
@ref{Mensural contexts}.
@end itemize

There is limited support for figured bass notation which came
up during the baroque period.

@itemize @bullet
@item
@ref{Figured bass}
@end itemize

Here are all suptopics at a glance:

@menu
* Ancient note heads::          
* Ancient accidentals::         
* Ancient rests::               
* Ancient clefs::               
* Ancient flags::               
* Ancient time signatures::     
* Ancient articulations::       
* Custodes::                    
* Divisiones::                  
* Ligatures::                   
* Gregorian Chant contexts::    
* Mensural contexts::           
* Musica ficta accidentals::    
* Figured bass::                
@end menu



@node Ancient note heads
@subsection Ancient note heads

@cindex note heads, ancient

For ancient notation, a note head style other than the @code{default}
style may be chosen.  This is accomplished by setting the @code{style}
property of the @internalsref{NoteHead} object to @code{baroque},
@code{neomensural}, @code{mensural} or @code{petrucci}.  The
@code{baroque} style differs from the @code{default} style only in
using a square shape for @code{\breve} note heads.  The
@code{neomensural} style differs from the @code{baroque} style in that
it uses rhomboidal heads for whole notes and all smaller durations.
Stems are centered on the note heads.  This style is particularly
useful when transcribing mensural music, e.g., for the incipit.  The
@code{mensural} style produces note heads that mimic the look of note
heads in historic printings of the 16th century.  Finally, the
@code{petrucci} style also mimicks historic printings, but uses bigger
note heads.

The following example demonstrates the @code{neomensural} style

@lilypond[quote,fragment,ragged-right,verbatim]
\set Score.skipBars = ##t
\override NoteHead #'style = #'neomensural
a'\longa a'\breve a'1 a'2 a'4 a'8 a'16
@end lilypond

When typesetting a piece in Gregorian Chant notation, the
@internalsref{Gregorian_ligature_engraver} will automatically select
the proper note heads, so there is no need to explicitly set the
note head style.  Still, the note head style can be set, e.g., to
@code{vaticana_punctum} to produce punctum neumes.  Similarly, a
@internalsref{Mensural_ligature_engraver} is used to automatically
assemble mensural ligatures.  See @ref{Ligatures} for how ligature
engravers work.

@seealso

@ref{Note head styles} gives an overview over all available note head styles.


@node Ancient accidentals
@subsection Ancient accidentals

@cindex accidentals


Use the @code{glyph-name-alist} property of grob
@internalsref{Accidental} and @internalsref{KeySignature} to select
ancient accidentals. 

@lilypond[quote,ragged-right,staffsize=26]
\score {
{
  \fatText
  s^\markup {
    \column {
      "vaticana"
      \line { " " \musicglyph #"accidentals.vaticana-1"
        " " \musicglyph #"accidentals.vaticana0" }
    }
    \column {
      "medicaea"
      \line { " " \musicglyph #"accidentals.medicaea-1" }
    }
    \column {
      "hufnagel"
      \line { " " \musicglyph #"accidentals.hufnagel-1" }
    }
    \column {
      "mensural"
      \line { " " \musicglyph #"accidentals.mensural-1"
        " " \musicglyph #"accidentals.mensural1" }
    }
  }
}
\layout {
  interscoreline = 1
  \context { \Score \remove "Bar_number_engraver" }
  \context { \Staff
      \remove "Clef_engraver"
      \remove "Key_engraver"
      \remove "Time_signature_engraver"
      \remove "Staff_symbol_engraver"
      \override VerticalAxisGroup #'minimum-Y-extent = ##f
    }
  }
}
@end lilypond

As shown, not all accidentals are supported by each style.  When
trying to access an unsupported accidental, LilyPond will switch to a
different style, as demonstrated in
@inputfileref{input/@/test,ancient@/-accidentals@/.ly}.

Similarly to local accidentals, the style of the key signature can be
controlled by the @code{glyph-name-alist} property of the
@internalsref{KeySignature} grob.

@seealso

In this manual: @ref{Pitches}, @ref{Cautionary accidentals} and
@ref{Automatic accidentals} give a general introduction of the use of
accidentals.  @ref{Key signature} gives a general introduction of
the use of key signatures.

Program reference: @internalsref{KeySignature}.

Examples: @inputfileref{input/@/test,ancient@/-accidentals@/.ly}.

@node Ancient rests
@subsection Ancient rests

@cindex rests, ancient


Use the @code{style} property of grob @internalsref{Rest} to select
ancient rests.   Supported styles are @code{classical},
@code{neomensural}, and @code{mensural}.  @code{classical} differs
from the @code{default} style only in that the quarter rest looks like
a horizontally mirrored 8th rest.  The @code{neomensural} style suits
well for, e.g., the incipit of a transcribed mensural piece of music.
The @code{mensural} style finally mimics the appearance of rests as
in historic prints of the 16th century.

The following example demonstrates the @code{neomensural} style

@lilypond[quote,fragment,ragged-right,verbatim]
\set Score.skipBars = ##t
\override Rest #'style = #'neomensural
r\longa r\breve r1 r2 r4 r8 r16
@end lilypond

There are no 32th and 64th rests specifically for the mensural or
neo-mensural style.  Instead, the rests from the default style will be
taken.  See @inputfileref{input/@/test,rests@/.ly} for a chart of all
rests.

There are no rests in Gregorian Chant notation; instead, it uses
@ref{Divisiones}.

@seealso

In this manual: @ref{Rests} gives a general introduction into the use of
rests.


@node Ancient clefs
@subsection Ancient clefs

@cindex clefs


LilyPond supports a variety of clefs, many of them ancient.

The following table shows all ancient clefs that are supported via the
@code{\clef} command.  Some of the clefs use the same glyph, but
differ only with respect to the line they are printed on.  In such
cases, a trailing number in the name is used to enumerate these clefs.
Still, you can manually force a clef glyph to be typeset on an
arbitrary line, as described in @ref{Clef}.  The note printed to the
right side of each clef in the example column denotes the @code{c'}
with respect to that clef.

@multitable @columnfractions .4 .4 .2
@item
@b{Description}
@tab
@b{Supported Clefs}
@tab
@b{Example}

@item
modern style mensural C clef
@tab
@code{neomensural-c1}, @code{neomensural-c2},@*
@code{neomensural-c3}, @code{neomensural-c4}
@tab
@lilypond[fragment,relative=1,notime]
  \clef "neomensural-c2" c
@end lilypond

@item
petrucci style mensural C clefs, for use on different staff lines
(the examples show the 2nd staff line C clef)
@tab
@code{petrucci-c1}, @code{petrucci-c2},@*
@code{petrucci-c3}, @code{petrucci-c4},@*
@code{petrucci-c5}
@tab
@lilypond[fragment,relative=1,notime]
  \clef "petrucci-c2"
  \override NoteHead #'style = #'mensural
  c
@end lilypond

@item
petrucci style mensural F clef
@tab
@code{petrucci-f}
@tab
@lilypond[fragment,relative=1,notime]
  \clef "petrucci-f"
  \override NoteHead #'style = #'mensural
  c
@end lilypond

@item
petrucci style mensural G clef
@tab
@code{petrucci-g}
@tab
@lilypond[fragment,relative=1,notime]
  \clef "petrucci-g"
  \override NoteHead #'style = #'mensural
  c
@end lilypond

@item
historic style mensural C clef
@tab
@code{mensural-c1}, @code{mensural-c2},@*
@code{mensural-c3}, @code{mensural-c4}
@tab
@lilypond[fragment,relative=1,notime]
  \clef "mensural-c2"
  \override NoteHead #'style = #'mensural
  c
@end lilypond

@item
historic style mensural F clef
@tab
@code{mensural-f}
@tab
@lilypond[fragment,relative=1,notime]
  \clef "mensural-f"
  \override NoteHead #'style = #'mensural
  c
@end lilypond

@item
historic style mensural G clef
@tab
@code{mensural-g}
@tab
@lilypond[fragment,relative=1,notime]
  \clef "mensural-g"
  \override NoteHead #'style = #'mensural
  c
@end lilypond

@item
Editio Vaticana style do clef
@tab
@code{vaticana-do1}, @code{vaticana-do2},@*
@code{vaticana-do3}
@tab
@lilypond[fragment,relative=1,notime]
  \override Staff.StaffSymbol #'line-count = #4
  \override Staff.StaffSymbol #'color = #red
  \override Staff.LedgerLineSpanner #'color = #red
  \override Voice.Stem #'transparent = ##t
  \override NoteHead #'style = #'vaticana.punctum
  \clef "vaticana-do2"
  c
@end lilypond

@item
Editio Vaticana style fa clef
@tab
@code{vaticana-fa1}, @code{vaticana-fa2}
@tab
@lilypond[fragment,relative=1,notime]
  \override Staff.StaffSymbol #'line-count = #4
  \override Staff.StaffSymbol #'color = #red
  \override Staff.LedgerLineSpanner #'color = #red
  \override Voice.Stem #'transparent = ##t
  \override NoteHead #'style = #'vaticana.punctum
  \clef "vaticana-fa2"
  c
@end lilypond

@item
Editio Medicaea style do clef
@tab
@code{medicaea-do1}, @code{medicaea-do2},@*
@code{medicaea-do3}
@tab
@lilypond[fragment,relative=1,notime]
  \override Staff.StaffSymbol #'line-count = #4
  \override Staff.StaffSymbol #'color = #red
  \override Staff.LedgerLineSpanner #'color = #red
  \override Voice.Stem #'transparent = ##t
  \override NoteHead #'style = #'medicaea.punctum
  \clef "medicaea-do2"
  c
@end lilypond

@item
Editio Medicaea style fa clef
@tab
@code{medicaea-fa1}, @code{medicaea-fa2}
@tab
@lilypond[fragment,relative=1,notime]
  \override Staff.StaffSymbol #'line-count = #4
  \override Staff.StaffSymbol #'color = #red
  \override Staff.LedgerLineSpanner #'color = #red
  \override Voice.Stem #'transparent = ##t
  \override NoteHead #'style = #'medicaea.punctum
  \clef "medicaea-fa2"
  c
@end lilypond

@item
historic style hufnagel do clef
@tab
@code{hufnagel-do1}, @code{hufnagel-do2},@*
@code{hufnagel-do3}
@tab
@lilypond[fragment,relative=1,notime]
  \override Staff.StaffSymbol #'line-count = #4
  \override Staff.StaffSymbol #'color = #red
  \override Staff.LedgerLineSpanner #'color = #red
  \override Voice.Stem #'transparent = ##t
  \override NoteHead #'style = #'hufnagel.punctum
  \clef "hufnagel-do2"
  c
@end lilypond

@item
historic style hufnagel fa clef
@tab
@code{hufnagel-fa1}, @code{hufnagel-fa2}
@tab
@lilypond[fragment,relative=1,notime]
  \override Staff.StaffSymbol #'line-count = #4
  \override Staff.StaffSymbol #'color = #red
  \override Staff.LedgerLineSpanner #'color = #red
  \override Voice.Stem #'transparent = ##t
  \override NoteHead #'style = #'hufnagel.punctum
  \clef "hufnagel-fa2"
  c
@end lilypond

@item
historic style hufnagel combined do/fa clef
@tab
@code{hufnagel-do-fa}
@tab
@lilypond[fragment,relative=1,notime]
  \override Staff.StaffSymbol #'color = #red
  \override Staff.LedgerLineSpanner #'color = #red
  \override Voice.Stem #'transparent = ##t
  \override NoteHead #'style = #'hufnagel.punctum
  \clef "hufnagel-do-fa"
  c
@end lilypond
@end multitable



@emph{Modern style} means @qq{as is typeset in contemporary editions of
transcribed mensural music.}

@emph{Petrucci style} means @qq{inspired by printings published by the
famous engraver Petrucci (1466-1539).}

@emph{Historic style} means @qq{as was typeset or written in historic
editions (other than those of Petrucci).}

@emph{Editio XXX style} means @qq{as is/was printed in Editio XXX.}

Petrucci used C clefs with differently balanced left-side vertical
beams, depending on which staff line it is printed.

@seealso

In this manual: see @ref{Clef}.

@refbugs

The mensural g clef is mapped to the Petrucci g clef.



@node Ancient flags
@subsection Ancient flags

@cindex flags


Use the @code{flag-style} property of grob @internalsref{Stem} to
select ancient flags.  Besides the @code{default} flag style,
only the @code{mensural} style is supported

@lilypond[quote,fragment,ragged-right,verbatim]
\override Stem #'flag-style = #'mensural
\override Stem #'thickness = #1.0
\override NoteHead #'style = #'mensural
\autoBeamOff
c'8 d'8 e'8 f'8 c'16 d'16 e'16 f'16 c'32 d'32 e'32 f'32 s8
c''8 d''8 e''8 f''8 c''16 d''16 e''16 f''16 c''32 d''32 e''32 f''32
@end lilypond

Note that the innermost flare of each mensural flag always is
vertically aligned with a staff line.

There is no particular flag style for neo-mensural notation.  Hence,
when typesetting the incipit of a transcribed piece of mensural
music, the default flag style should be used.  There are no flags in
Gregorian Chant notation.

@refbugs

The attachment of ancient flags to stems is slightly off due to a
change in early 2.3.x.

Vertically aligning each flag with a staff line assumes that stems
always end either exactly on or exactly in the middle between two
staff lines.  This may not always be true when using advanced layout
features of classical notation (which however are typically out of
scope for mensural notation).

@node Ancient time signatures
@subsection Ancient time signatures

@cindex time signatures


There is limited support for mensural time signatures.   The
glyphs are hard-wired to particular time fractions.  In other words,
to get a particular mensural signature glyph with the @code{\time n/m}
command, @code{n} and @code{m} have to be chosen according to the
following table

@lilypond[quote,ragged-right]
\layout {
  indent = 0.0
  \context {
    \Staff
    \remove Staff_symbol_engraver
    \remove Clef_engraver
    \remove Time_signature_engraver
  }
}
{
  \set Score.timing = ##f
  \set Score.barAlways = ##t
  s_\markup { "\\time 4/4" }^\markup { "       " \musicglyph
#"timesig.neomensural44" }
  s
  s_\markup { "\\time 2/2" }^\markup { "       " \musicglyph
#"timesig.neomensural22" }
  s
  s_\markup { "\\time 6/4" }^\markup { "       " \musicglyph
#"timesig.neomensural64" }
  s
  s_\markup { "\\time 6/8" }^\markup { "       " \musicglyph
#"timesig.neomensural68" }
  \break
  s_\markup { "\\time 3/2" }^\markup { "       " \musicglyph
#"timesig.neomensural32" }
  s
  s_\markup { "\\time 3/4" }^\markup { "       " \musicglyph
#"timesig.neomensural34" }
  s
  s_\markup { "\\time 9/4" }^\markup { "       " \musicglyph
#"timesig.neomensural94" }
  s
  s_\markup { "\\time 9/8" }^\markup { "       " \musicglyph
#"timesig.neomensural98" }
  \break
  s_\markup { "\\time 4/8" }^\markup { "       " \musicglyph
#"timesig.neomensural48" }
  s
  s_\markup { "\\time 2/4" }^\markup { "       " \musicglyph
#"timesig.neomensural24" }
}
@end lilypond

Use the @code{style} property of grob @internalsref{TimeSignature} to
select ancient time signatures.  Supported styles are
@code{neomensural} and @code{mensural}.  The above table uses the
@code{neomensural} style.  This style is appropriate for the
incipit of transcriptions of mensural pieces.  The @code{mensural}
style mimics the look of historical printings of the 16th century.

The following examples show the differences in style,

@lilypond[ragged-right,fragment,relative=1,quote]
{
  \fatText

  \time 2/2
  c1^\markup { \hspace #-2.0 \typewriter default }

  \override Staff.TimeSignature #'style = #'numbered
  \time 2/2
  c1^\markup { \hspace #-2.0 \typewriter numbered }

  \override Staff.TimeSignature #'style = #'mensural
  \time 2/2
  c1^\markup { \hspace #-2.0 \typewriter mensural }

  \override Staff.TimeSignature #'style = #'neomensural
  \time 2/2
  c1^\markup { \hspace #-2.0 \typewriter neomensural }
  \override Staff.TimeSignature #'style = #'single-digit
  \time 2/2
  c1^\markup { \hspace #-2.0 \typewriter single-digit }
}
@end lilypond

@seealso

This manual: @ref{Time signature} gives a general introduction to
the use of time signatures.

@refbugs

Ratios of note durations do not change with the time signature.  For
example, the ratio of 1 brevis = 3 semibrevis (tempus perfectum) must
be made by hand, by setting

@example
breveTP = #(ly:make-duration -1 0 3 2)
@dots{}
@{ c\breveTP f1 @}
@end example

@noindent
This sets @code{breveTP} to 3/2 times 2 = 3 times a whole note.

The @code{old6/8alt} symbol (an alternate symbol for 6/8) is not
addressable with @code{\time}.  Use a @code{\markup} instead

@node Ancient articulations
@subsection Ancient articulations

@cindex articulations

In addition to the standard articulation signs described in section
@ref{Articulations}, articulation signs for ancient notation are
provided.  These are specifically designed for use with notation in
Editio Vaticana style.

@lilypond[quote,ragged-right,verbatim]
\include "gregorian-init.ly"
\score {
  \new VaticanaVoice {
    \override TextScript #'font-family = #'typewriter
    \override TextScript #'font-shape = #'upright
    \override Script #'padding = #-0.1
    a\ictus_"ictus" \break
    a\circulus_"circulus" \break
    a\semicirculus_"semicirculus" \break
    a\accentus_"accentus" \break
    \[ a_"episem" \episemInitium \pes b \flexa a b \episemFinis \flexa a \]
  }
}
@end lilypond

@refbugs

Some articulations are vertically placed too closely to the
correpsonding note heads.

The episem line is not displayed in many cases.  If it is displayed,
the right end of the episem line is often too far to the right.

@node Custodes
@subsection Custodes

@cindex custos
@cindex custodes

A @emph{custos} (plural: @emph{custodes}; Latin word for @q{guard}) is a
symbol that appears at the end of a staff.  It anticipates the pitch
of the first note(s) of the following line thus helping the performer
to manage line breaks during performance.

Custodes were frequently used in music notation until the 17th
century.  Nowadays, they have survived only in a few particular forms
of musical notation such as contemporary editions of Gregorian chant
like the @emph{editio vaticana}.  There are different custos glyphs
used in different flavors of notational style.

For typesetting custodes, just put a @internalsref{Custos_engraver} into the
@internalsref{Staff} context when declaring the @code{\layout} block,
as shown in the following example

@example
\layout @{
  \context @{
    \Staff
    \consists Custos_engraver
    Custos \override #'style = #'mensural
  @}
@}
@end example

The result looks like this

@lilypond[quote,ragged-right]
\score {
{
  a'1
  \override Staff.Custos #'style = #'mensural
  \break
  g'
}
\layout {
  \context { \Staff \consists Custos_engraver }
  }
}
@end lilypond

The custos glyph is selected by the @code{style} property.  The styles
supported are @code{vaticana}, @code{medicaea}, @code{hufnagel}, and
@code{mensural}.  They are demonstrated in the following fragment

@lilypond[quote,ragged-right,fragment]
\new Lyrics \lyricmode {
  \markup { \column {
    \typewriter "vaticana"
    \line { " " \musicglyph #"custodes.vaticana.u0" }
  } }
  \markup { \column {
    \typewriter "medicaea"
    \line { " " \musicglyph #"custodes.medicaea.u0" }
  }}
  \markup { \column {
    \typewriter "hufnagel"
    \line { " " \musicglyph #"custodes.hufnagel.u0" }
  }}
  \markup { \column {
    \typewriter "mensural"
    \line { " " \musicglyph #"custodes.mensural.u0" }
  }}
}
@end lilypond

@seealso

Program reference: @internalsref{Custos}.

Examples:
@lsr{ancient,custodes@/.ly}.


@node Divisiones
@subsection Divisiones

@cindex divisio
@cindex divisiones
@cindex finalis

A @emph{divisio} (plural: @emph{divisiones}; Latin word for
@q{division}) is a staff context symbol that is used to structure
Gregorian music into phrases and sections.  The musical meaning of
@emph{divisio minima}, @emph{divisio maior}, and @emph{divisio maxima}
can be characterized as short, medium, and long pause, somewhat like
the breathmarks from @ref{Breath marks}.  The @emph{finalis} sign not
only marks the end of a chant, but is also frequently used within a
single antiphonal/responsorial chant to mark the end of each section.


To use divisiones, include the file @file{gregorian@/-init@/.ly}.  It
contains definitions that you can apply by just inserting
@code{\divisioMinima}, @code{\divisioMaior}, @code{\divisioMaxima},
and @code{\finalis} at proper places in the input.  Some editions use
@emph{virgula} or @emph{caesura} instead of divisio minima.
Therefore, @file{gregorian@/-init@/.ly} also defines @code{\virgula} and
@code{\caesura}

@lilypondfile[quote,ragged-right]{divisiones.ly}

@refcommands

@funindex \virgula
@code{\virgula},
@funindex \caesura
@code{\caesura},
@funindex \divisioMinima
@code{\divisioMinima},
@funindex \divisioMaior
@code{\divisioMaior},
@funindex \divisioMaxima
@code{\divisioMaxima},
@funindex \finalis
@code{\finalis}.

@seealso

In this manual: @ref{Breath marks}.

Program reference: @internalsref{BreathingSign}.

Examples: @inputfileref{input/@/test,divisiones@/.ly}.

@node Ligatures
@subsection Ligatures

@cindex Ligatures

@c TODO: Should double check if I recalled things correctly when I wrote
@c down the following paragraph by heart.

A ligature is a graphical symbol that represents at least two distinct
notes.  Ligatures originally appeared in the manuscripts of Gregorian
chant notation to denote ascending or descending sequences of notes.

Ligatures are entered by enclosing them in @code{\[} and @code{\]}.
Some ligature styles may need additional input syntax specific for
this particular type of ligature.  By default, the
@internalsref{LigatureBracket} engraver just puts a square bracket
above the ligature

@lilypond[quote,ragged-right,verbatim]
\transpose c c' {
  \[ g c a f d' \]
  a g f
  \[ e f a g \]
}
@end lilypond

To select a specific style of ligatures, a proper ligature engraver
has to be added to the @internalsref{Voice} context, as explained in
the following subsections.   Only white mensural ligatures
are supported with certain limitations.



@refbugs

Ligatures need special spacing that has not yet been implemented.  As
a result, there is too much space between ligatures most of the time,
and line breaking often is unsatisfactory.  Also, lyrics do not
correctly align with ligatures.

Accidentals must not be printed within a ligature, but instead need to
be collected and printed in front of it.

The syntax still uses the deprecated infix style @code{\[ music expr
\]}.  For consistency reasons, it will eventually be changed to
postfix style @code{note\[ ... note\]}.  Alternatively, the file
@file{gregorian@/-init@/.ly} can be included; it provides a scheme
function
@example
\ligature @var{music expr}
@end example
with the same effect and is believed to be stable.

@menu
* White mensural ligatures::    
* Gregorian square neumes ligatures::  
@end menu

@node White mensural ligatures
@subsubsection White mensural ligatures

@cindex Mensural ligatures
@cindex White mensural ligatures

There is limited support for white mensural ligatures.

To engrave white mensural ligatures, in the layout block put the
@internalsref{Mensural_ligature_engraver} into the
@internalsref{Voice} context, and remove the
@internalsref{Ligature_bracket_engraver}, like this

@example
\layout @{
  \context @{
    \Voice
    \remove Ligature_bracket_engraver
    \consists Mensural_ligature_engraver
  @}
@}
@end example

There is no additional input language to describe the shape of a
white mensural ligature.  The shape is rather determined solely from
the pitch and duration of the enclosed notes.  While this approach may
take a new user a while to get accustomed to, it has the great advantage
that the full musical information of the ligature is known internally.
This is not only required for correct MIDI output, but also allows for
automatic transcription of the ligatures.

For example,

@example
\set Score.timing = ##f
\set Score.defaultBarType = "empty"
\override NoteHead #'style = #'neomensural
\override Staff.TimeSignature #'style = #'neomensural
\clef "petrucci-g"
\[ c'\maxima g \]
\[ d\longa c\breve f e d \]
\[ c'\maxima d'\longa \]
\[ e'1 a g\breve \]
@end example
@lilypond[quote,ragged-right]
\score {
  \transpose c c' {
    \set Score.timing = ##f
    \set Score.defaultBarType = "empty"
    \override NoteHead #'style = #'neomensural
    \override Staff.TimeSignature #'style = #'neomensural
    \clef "petrucci-g"
    \[ c'\maxima g \]
    \[ d\longa c\breve f e d \]
    \[ c'\maxima d'\longa \]
    \[ e'1 a g\breve \]
  }
  \layout {
    \context {
      \Voice
      \remove Ligature_bracket_engraver
      \consists Mensural_ligature_engraver
    }
  }
}
@end lilypond

Without replacing @internalsref{Ligature_bracket_engraver} with
@internalsref{Mensural_ligature_engraver}, the same music transcribes
to the following

@lilypond[quote,ragged-right]
\transpose c c' {
  \set Score.timing = ##f
  \set Score.defaultBarType = "empty"
  \override NoteHead #'style = #'neomensural
  \override Staff.TimeSignature #'style = #'neomensural
  \clef "petrucci-g"
  \[ c'\maxima g \]
  \[ d\longa c\breve f e d \]
  \[ c'\maxima d'\longa \]
  \[ e'1 a g\breve \]
}
@end lilypond

@refbugs

Horizontal spacing is poor.

@node Gregorian square neumes ligatures
@subsubsection Gregorian square neumes ligatures

@cindex Square neumes ligatures
@cindex Gregorian square neumes ligatures

There is limited support for Gregorian square neumes notation
(following the style of the Editio Vaticana).  Core ligatures can
already be typeset, but essential issues for serious typesetting are
still lacking, such as (among others) horizontal alignment of multiple
ligatures, lyrics alignment and proper handling of accidentals.


The following table contains the extended neumes table of the 2nd
volume of the Antiphonale Romanum (@emph{Liber Hymnarius}), published
1983 by the monks of Solesmes.

@multitable @columnfractions .4 .2 .2 .2

@item
@b{Neuma aut@*
Neumarum Elementa}
@tab
@b{Figurae@*
Rectae}
@tab
@b{Figurae@*
Liquescentes@*
Auctae}
@tab
@b{Figurae@*
Liquescentes@*
Deminutae}

@c TODO: \layout block is identical in all of the below examples.
@c Therefore, it should somehow be included rather than duplicated all
@c the time. --jr

@c why not make identifiers in ly/engraver-init.ly? --hwn

@c Because it's just used to typeset plain notes without
@c a staff for demonstration purposes rather than something
@c special of Gregorian chant notation. --jr

@item
@code{1. Punctum}
@tab
@lilypond[staffsize=26,line-width=1.5\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Punctum
    \[ b \]
    \noBreak s^\markup {"a"} \noBreak

    % Punctum Inclinatum
    \[ \inclinatum b \]
    \noBreak s^\markup {"b"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=2.5\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Punctum Auctum Ascendens
    \[ \auctum \ascendens b \]
    \noBreak s^\markup {"c"} \noBreak

    % Punctum Auctum Descendens
    \[ \auctum \descendens b \]
    \noBreak s^\markup {"d"} \noBreak

    % Punctum Inclinatum Auctum
    \[ \inclinatum \auctum b \]
    \noBreak s^\markup {"e"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Punctum Inclinatum Parvum
    \[ \inclinatum \deminutum b \]
    \noBreak s^\markup {"f"}
  }
\layout { \neumeDemoLayout }}
@end lilypond

@item
@code{2. Virga}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Virga
    \[ \virga b \]
    \noBreak s^\markup {"g"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@tab

@item
@code{3. Apostropha vel Stropha}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Stropha
    \[ \stropha b \]
    \noBreak s^\markup {"h"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Stropha Aucta
    \[ \stropha \auctum b \]
    \noBreak s^\markup {"i"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab

@item
@code{4. Oriscus}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Oriscus
    \[ \oriscus b \]
    \noBreak s^\markup {"j"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@tab

@item
@code{5. Clivis vel Flexa}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Clivis vel Flexa
    \[ b \flexa g \]
    s^\markup {"k"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=2.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Clivis Aucta Descendens
    \[ b \flexa \auctum \descendens g \]
    \noBreak s^\markup {"l"} \noBreak

    % Clivis Aucta Ascendens
    \[ b \flexa \auctum \ascendens g \]
    \noBreak s^\markup {"m"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Cephalicus
    \[ b \flexa \deminutum g \]
    s^\markup {"n"}
  }
\layout { \neumeDemoLayout }}
@end lilypond

@item
@code{6. Podatus vel Pes}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Podatus vel Pes
    \[ g \pes b \]
    s^\markup {"o"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=2.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Pes Auctus Descendens
    \[ g \pes \auctum \descendens b \]
    \noBreak s^\markup {"p"} \noBreak

    % Pes Auctus Ascendens
    \[ g \pes \auctum \ascendens b \]
    \noBreak s^\markup {"q"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Epiphonus
    \[ g \pes \deminutum b \]
    s^\markup {"r"}
  }
\layout { \neumeDemoLayout }}
@end lilypond

@item
@code{7. Pes Quassus}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Pes Quassus
    \[ \oriscus g \pes \virga b \]
    s^\markup {"s"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Pes Quassus Auctus Descendens
    \[ \oriscus g \pes \auctum \descendens b \]
    s^\markup {"t"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab

@item
@code{8. Quilisma Pes}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Quilisma Pes
    \[ \quilisma g \pes b \]
    s^\markup {"u"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Quilisma Pes Auctus Descendens
    \[ \quilisma g \pes \auctum \descendens b \]
    s^\markup {"v"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab

@item
@code{9. Podatus Initio Debilis}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Pes Initio Debilis
    \[ \deminutum g \pes b \]
    s^\markup {"w"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Pes Auctus Descendens Initio Debilis
    \[ \deminutum g \pes \auctum \descendens b \]
    s^\markup {"x"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab

@item
@code{10. Torculus}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Torculus
    \[ a \pes b \flexa g \]
    s^\markup {"y"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Torculus Auctus Descendens
    \[ a \pes b \flexa \auctum \descendens g \]
    s^\markup {"z"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Torculus Deminutus
    \[ a \pes b \flexa \deminutum g \]
    s^\markup {"A"}
  }
\layout { \neumeDemoLayout }}
@end lilypond

@item
@code{11. Torculus Initio Debilis}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Torculus Initio Debilis
    \[ \deminutum a \pes b \flexa g \]
    s^\markup {"B"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Torculus Auctus Descendens Initio Debilis
    \[ \deminutum a \pes b \flexa \auctum \descendens g \]
    s^\markup {"C"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Torculus Deminutus Initio Debilis
    \[ \deminutum a \pes b \flexa \deminutum g \]
    s^\markup {"D"}
  }
\layout { \neumeDemoLayout }}
@end lilypond

@item
@code{12. Porrectus}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Porrectus
    \[ a \flexa g \pes b \]
    s^\markup {"E"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Porrectus Auctus Descendens
    \[ a \flexa g \pes \auctum \descendens b \]
    s^\markup {"F"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Porrectus Deminutus
    \[ a \flexa g \pes \deminutum b \]
    s^\markup {"G"}
  }
\layout { \neumeDemoLayout }}
@end lilypond

@item
@code{13. Climacus}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Climacus
    \[ \virga b \inclinatum a \inclinatum g \]
    s^\markup {"H"}
  }
  \layout { \neumeDemoLayout }
}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Climacus Auctus
    \[ \virga b \inclinatum a \inclinatum \auctum g \]
    s^\markup {"I"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Climacus Deminutus
    \[ \virga b \inclinatum a \inclinatum \deminutum g \]
    s^\markup {"J"}
  }
\layout { \neumeDemoLayout }}
@end lilypond

@item
@code{14. Scandicus}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Scandicus
    \[ g \pes a \virga b \]
    s^\markup {"K"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Scandicus Auctus Descendens
    \[ g \pes a \pes \auctum \descendens b \]
    s^\markup {"L"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Scandicus Deminutus
    \[ g \pes a \pes \deminutum b \]
    s^\markup {"M"}
  }
\layout { \neumeDemoLayout }}
@end lilypond

@item
@code{15. Salicus}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Salicus
    \[ g \oriscus a \pes \virga b \]
    s^\markup {"N"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Salicus Auctus Descendens
    \[ g \oriscus a \pes \auctum \descendens b \]
    s^\markup {"O"}
  }
\layout { \neumeDemoLayout }}
@end lilypond
@tab

@item
@code{16. Trigonus}
@tab
@lilypond[staffsize=26,line-width=1.0\cm]
\include "gregorian-init.ly"
\score {
  \transpose c c' {
    % Trigonus
    \[ \stropha b \stropha b \stropha a \]
    s^\markup {"P"}
  }
  \layout { \neumeDemoLayout }
}
@end lilypond
@tab
@tab

@end multitable


Unlike most other neumes notation systems, the input language for
neumes does not reflect the typographical appearance, but is designed
to focus on musical meaning.  For example, @code{\[ a \pes b
\flexa g \]} produces a Torculus consisting of three Punctum heads,
while @code{\[ a \flexa g \pes b \]} produces a Porrectus with a
curved flexa shape and only a single Punctum head.  There is no
command to explicitly typeset the curved flexa shape; the decision of
when to typeset a curved flexa shape is based on the musical
input.  The idea of this approach is to separate the musical aspects
of the input from the notation style of the output.  This way, the
same input can be reused to typeset the same music in a different
style of Gregorian chant notation.

The following table shows the code fragments that produce the
ligatures in the above neumes table.  The letter in the first column
in each line of the below table indicates to which ligature in the
above table it refers.  The second column gives the name of the
ligature.  The third column shows the code fragment that produces this
ligature, using @code{g}, @code{a}, and @code{b} as example pitches.

@multitable @columnfractions .02 .31 .67
@item
@b{#}
@tab
@b{Name}
@tab
@b{Input Language}

@item
a
@tab
Punctum
@tab
@code{\[ b \]}

@item
b
@tab
Punctum Inclinatum
@tab
@code{\[ \inclinatum b \]}

@item
c
@tab
Punctum Auctum@*
Ascendens
@tab
@code{\[ \auctum \ascendens b \]}

@item
d
@tab
Punctum Auctum@*
Descendens
@tab
@code{\[ \auctum \descendens b \]}

@item
e
@tab
Punctum Inclinatum@*
Auctum
@tab
@code{\[ \inclinatum \auctum b \]}

@item
f
@tab
Punctum Inclinatum@*
Parvum @tab
@code{\[ \inclinatum \deminutum b \]}

@item
g
@tab
Virga
@tab
@code{\[ \virga b \]}

@item
h
@tab
Stropha
@tab
@code{\[ \stropha b \]}

@item
i
@tab
Stropha Aucta
@tab
@code{\[ \stropha \auctum b \]}

@item
j
@tab
Oriscus
@tab
@code{\[ \oriscus b \]}

@item
k
@tab
Clivis vel Flexa
@tab
@code{\[ b \flexa g \]}

@item
l
@tab
Clivis Aucta@*
Descendens
@tab
@code{\[ b \flexa \auctum \descendens g \]}

@item
m
@tab
Clivis Aucta@*
Ascendens
@tab
@code{\[ b \flexa \auctum \ascendens g \]}

@item
n
@tab
Cephalicus
@tab
@code{\[ b \flexa \deminutum g \]}

@item
o
@tab
Podatus vel Pes
@tab
@code{\[ g \pes b \]}

@item
p
@tab
Pes Auctus@*
Descendens
@tab
@code{\[ g \pes \auctum \descendens b \]}

@item
q
@tab
Pes Auctus@*
Ascendens
@tab
@code{\[ g \pes \auctum \ascendens b \]}

@item
r
@tab
Epiphonus
@tab
@code{\[ g \pes \deminutum b \]}

@item
s
@tab
Pes Quassus
@tab
@code{\[ \oriscus g \pes \virga b \]}

@item
t
@tab
Pes Quassus@*
Auctus Descendens @tab
@code{\[ \oriscus g \pes \auctum \descendens b \]}

@item
u
@tab
Quilisma Pes
@tab
@code{\[ \quilisma g \pes b \]}

@item
v
@tab
Quilisma Pes@*
Auctus Descendens
@tab
@code{\[ \quilisma g \pes \auctum \descendens b \]}

@item
w
@tab
Pes Initio Debilis
@tab
@code{\[ \deminutum g \pes b \]}

@item
x
@tab
Pes Auctus Descendens@*
Initio Debilis
@tab
@code{\[ \deminutum g \pes \auctum \descendens b \]}

@item
y
@tab
Torculus
@tab
@code{\[ a \pes b \flexa g \]}

@item
z
@tab
Torculus Auctus@*
Descendens
@tab
@code{\[ a \pes b \flexa \auctum \descendens g \]}

@item
A
@tab
Torculus Deminutus
@tab
@code{\[ a \pes b \flexa \deminutum g \]}

@item
B
@tab
Torculus Initio Debilis
@tab
@code{\[ \deminutum a \pes b \flexa g \]}

@item
C
@tab
Torculus Auctus@*
Descendens Initio Debilis
@tab
@code{\[ \deminutum a \pes b \flexa \auctum \descendens g \]}

@item
D
@tab
Torculus Deminutus@*
Initio Debilis
@tab
@code{\[ \deminutum a \pes b \flexa \deminutum g \]}

@item
E
@tab
Porrectus
@tab
@code{\[ a \flexa g \pes b \]}

@item
F
@tab
Porrectus Auctus@*
Descendens
@tab
@code{\[ a \flexa g \pes \auctum \descendens b \]}

@item
G
@tab
Porrectus Deminutus
@tab
@code{\[ a \flexa g \pes \deminutum b \]}

@item
H
@tab
Climacus
@tab
@code{\[ \virga b \inclinatum a \inclinatum g \]}

@item
I
@tab
Climacus Auctus
@tab
@code{\[ \virga b \inclinatum a \inclinatum \auctum g \]}

@item
J
@tab
Climacus Deminutus
@tab
@code{\[ \virga b \inclinatum a \inclinatum \deminutum g \]}

@item
K
@tab
Scandicus
@tab
@code{\[ g \pes a \virga b \]}

@item
L
@tab
Scandicus Auctus@*
Descendens
@tab
@code{\[ g \pes a \pes \auctum \descendens b \]}

@item
M
@tab
Scandicus Deminutus
@tab
@code{\[ g \pes a \pes \deminutum b \]}

@item
N
@tab
Salicus
@tab
@code{\[ g \oriscus a \pes \virga b \]}

@item
O
@tab
Salicus Auctus Descendens
@tab
@code{\[ g \oriscus a \pes \auctum \descendens b \]}

@item
P
@tab
Trigonus
@tab
@code{\[ \stropha b \stropha b \stropha a \]}
@end multitable

The ligatures listed above mainly serve as a limited, but still
representative pool of Gregorian ligature examples.  Virtually, within
the ligature delimiters @code{\[} and @code{\]}, any number of heads
may be accumulated to form a single ligature, and head prefixes like
@code{\pes}, @code{\flexa}, @code{\virga}, @code{\inclinatum},
etc. may be mixed in as desired.  The use of the set of rules that
underlies the construction of the ligatures in the above table is
accordingly extrapolated.  This way, infinitely many different
ligatures can be created.

Augmentum dots, also called @emph{morae}, are added with the music
function @code{\augmentum}.  Note that @code{\augmentum} is
implemented as a unary music function rather than as head prefix.  It
applies to the immediately following music expression only.  That is,
@code{\augmentum \virga c} will have no visible effect.  Instead, say
@code{\virga \augmentum c} or @code{\augmentum @{\virga c@}}.  Also
note that you can say @code{\augmentum @{a g@}} as a shortcut for
@code{\augmentum a \augmentum g}.

@lilypond[quote,ragged-right,verbatim]
\include "gregorian-init.ly"
\score {
  \new VaticanaVoice {
    \[ \augmentum a \flexa \augmentum g \]
    \augmentum g
  }
}
@end lilypond

@refcommands

The following head prefixes are supported

@funindex \virga
@code{\virga},
@funindex \stropha
@code{\stropha},
@funindex \inclinatum
@code{\inclinatum},
@funindex \auctum
@code{\auctum},
@funindex \descendens
@code{\descendens},
@funindex \ascendens
@code{\ascendens},
@funindex \oriscus
@code{\oriscus},
@funindex \quilisma
@code{\quilisma},
@funindex \deminutum
@code{\deminutum},
@funindex \cavum
@code{\cavum},
@funindex \linea
@code{\linea}.

Head prefixes can be accumulated, though restrictions apply.  For
example, either @code{\descendens} or @code{\ascendens} can be applied
to a head, but not both to the same head.

@funindex \pes
@funindex \flexa
Two adjacent heads can be tied together with the @code{\pes} and
@code{\flexa} infix commands for a rising and falling line of melody,
respectively.

@funindex \augmentum
Use the unary music function @code{\augmentum} to add augmentum dots.

@refbugs

When an @code{\augmentum} dot appears at the end of the last staff
within a ligature, it is sometimes vertically placed wrong.  As a
workaround, add an additional skip note (e.g. @code{s8}) as last note
of the staff.

@code{\augmentum} should be implemented as a head prefix rather than a
unary music function, such that @code{\augmentum} can be intermixed
with head prefixes in arbitrary order.

@node Gregorian Chant contexts
@subsection Gregorian Chant contexts

@cindex VaticanaVoiceContext
@cindex VaticanaStaffContext

The predefined @code{VaticanaVoiceContext} and
@code{VaticanaStaffContext} can be used to engrave a piece of
Gregorian Chant in the style of the Editio Vaticana.  These contexts
initialize all relevant context properties and grob properties to
proper values, so you can immediately go ahead entering the chant, as
the following excerpt demonstrates

@lilypond[quote,ragged-right,packed,verbatim]
\include "gregorian-init.ly"
\score {
  <<
    \new VaticanaVoice = "cantus" {
      \[ c'\melisma c' \flexa a \]
      \[ a \flexa \deminutum g\melismaEnd \]
      f \divisioMinima
      \[ f\melisma \pes a c' c' \pes d'\melismaEnd \]
      c' \divisioMinima \break
      \[ c'\melisma c' \flexa a \]
      \[ a \flexa \deminutum g\melismaEnd \] f \divisioMinima
    }
    \new Lyrics \lyricsto "cantus" {
      San- ctus, San- ctus, San- ctus
    }
  >>
}
@end lilypond


@node Mensural contexts
@subsection Mensural contexts

@cindex MensuralVoiceContext
@cindex MensuralStaffContext

The predefined @code{MensuralVoiceContext} and
@code{MensuralStaffContext} can be used to engrave a piece in mensural
style.  These contexts initialize all relevant context properties and
grob properties to proper values, so you can immediately go ahead
entering the chant, as the following excerpt demonstrates

@lilypond[quote,ragged-right,verbatim]
\score {
  <<
    \new MensuralVoice = "discantus" \transpose c c' {
      \override Score.BarNumber #'transparent = ##t {
        c'1\melisma bes a g\melismaEnd
        f\breve
        \[ f1\melisma a c'\breve d'\melismaEnd \]
        c'\longa
        c'\breve\melisma a1 g1\melismaEnd
        fis\longa^\signumcongruentiae
      }
    }
    \new Lyrics \lyricsto "discantus" {
      San -- ctus, San -- ctus, San -- ctus
    }
  >>
}
@end lilypond

@node Musica ficta accidentals
@subsection Musica ficta accidentals

In European music from before about 1600, singers were often expected
to chromatically alter notes at their own initiative. This is called
@q{Musica Ficta}. In modern transcriptions, these accidentals are
usually printed over the note.

@cindex Accidental, musica ficta
@cindex Musica ficta

Support for such suggested accidentals is included, and can be
switched on by setting @code{suggestAccidentals} to true.

@funindex suggestAccidentals

@lilypond[verbatim,fragment,relative=1]
fis gis
\set suggestAccidentals = ##t
ais bis
@end lilypond

@seealso

Program reference: @internalsref{Accidental_engraver} engraver and the
@internalsref{AccidentalSuggestion} object.

@node Figured bass
@subsection Figured bass

@cindex Basso continuo

@c TODO: musicological blurb about FB


LilyPond has support for figured bass

@lilypond[quote,ragged-right,verbatim,fragment]
<<
  \new Voice { \clef bass dis4 c d ais g fis}
  \new FiguredBass \figuremode {
    < 6 >4 < 7\+ >8 < 6+ [_!] >
    < 6 >4 <6 5 [3+] >
    < _ >4 < 6 5/>4
  }
>>
@end lilypond

The support for figured bass consists of two parts: there is an input
mode, introduced by @code{\figuremode}, where you can enter bass figures
as numbers, and there is a context called @internalsref{FiguredBass} that
takes care of making @internalsref{BassFigure} objects.

In figures input mode, a group of bass figures is delimited by
@code{<} and @code{>}.  The duration is entered after the @code{>}
@example
<4 6>
@end example
@lilypond[quote,ragged-right,fragment]
\new FiguredBass
\figuremode { <4 6> }
@end lilypond

Accidentals are added when you append @code{-}, @code{!}, and @code{+}
to the numbers.  A plus sign is added when you append @code{\+}, and
diminished fifths and sevenths can be obtained with @code{5/} and @code{7/}.

@example
<4- 6+ 7!> <5++> <3--> <7/> r <6\+ 5/>
@end example
@lilypond[quote,ragged-right,fragment]
\figures { <4- 6+ 7!> <5++> <3--> <7/> r <6\+ 5/> }
@end lilypond

Spaces may be inserted by using @code{_}.  Brackets are
introduced with @code{[} and @code{]}. You can also include text
strings and text markups, see @ref{Overview of text markup commands}.

@example
< [4 6] 8 [_! 12] > < 5 \markup @{ \number 6 \super (1) @} >
@end example
@lilypond[quote,ragged-right,fragment]
\new FiguredBass
\figuremode { < [4 6] 8 [_! 12] > < 5 \markup{ \tiny \number 6 \super (1)} > }
@end lilypond


It is also possible to use continuation lines for repeated figures,

@lilypond[verbatim,relative=1]
<<
  \new Staff {
    \clef bass
    c4 c c
  }
  \figures {
    \set useBassFigureExtenders = ##t
    <4 6> <3 6> <3 7>
  }
>>
@end lilypond

@noindent
In this case, the extender lines always replace existing figures.

The @code{FiguredBass} context doesn't pay attention to the actual
bass line. As a consequence, you may have to insert extra figures to
get extender lines below all notes, and you may have to add @code{\!}
to avoid getting an extender line, e.g.

@lilypond[relative=1]
<<
  \new Voice
  \figures {
    \set useBassFigureExtenders = ##t
    <6 4->4. <6 4->16. <6 4->32 <5>8. r16 <6>8 <6\! 5->
  }
  {
    \clef bass
    f16. g32 f16. g32 f16. g32 f16. g32 f8. es16 d8 es
  }
>>
@end lilypond

When using continuation lines, common figures are always put in the
same vertical position. When this is unwanted, you can insert a rest
with @code{r}. The rest will clear any previous alignment.  For
example, you can write

@example
  <4 6>8 r8
@end example

@noindent
instead of
@example
  <4 6>4
@end example

Accidentals and plus signs can appear before or after the numbers,
depending on the @code{figuredBassAlterationDirection} and
@code{figuredBassPlusDirection}
properties

@lilypond
  \figures {
    <6\+> <5+> <6 4-> r
    \set figuredBassAlterationDirection = #1
    <6\+> <5+> <6 4-> r
    \set figuredBassPlusDirection = #1
    <6\+> <5+> <6 4-> r
    \set figuredBassAlterationDirection = #-1
    <6\+> <5+> <6 4-> r
  }
@end lilypond


Although the support for figured bass may superficially resemble chord
support, it is much simpler.  The @code{\figuremode} mode simply
stores the numbers and @internalsref{FiguredBass} context prints them
as entered.  There is no conversion to pitches and no realizations of
the bass are played in the MIDI file.

Internally, the code produces markup texts.  You can use any of the
markup text properties to override formatting.  For example, the
vertical spacing of the figures may be set with @code{baseline-skip}.


Figured bass can also be added to @code{Staff} contexts
directly.  In this case, their vertical position is adjusted
automatically.

@lilypond[ragged-right,fragment,quote]
<<
  \new Staff = someUniqueName
  \relative c'' {
    c4 c'8 r8 c,4 c'
  }

  %% send to existing Staff.
  \context Staff = someUniqueName 
  \figuremode {
    <4>4 <6 10>8 s8
    
    \set Staff.useBassFigureExtenders = ##t
    <4 6>4 <4 6>
  }
>>
@end lilypond


@refbugs

When using figured bass above the staff with extender lines and
@code{implicitBassFigures} the lines may become swapped around.
Maintaining order consistently will be impossible when multiple figures
have overlapping extender lines.  To avoid this problem, plese
use @code{stacking-dir} on @code{BassFigureAlignment}.


@seealso

Program reference: @internalsref{NewBassFigure},
@internalsref{BassFigureAlignment}, @internalsref{BassFigureLine},
@internalsref{BassFigureBracket}, and
@internalsref{BassFigureContinuation} objects and
@internalsref{FiguredBass} context.



@node Other instrument specific notation
@section Other instrument specific notation

This section includes extra information for writing for instruments.

@menu
* Artificial harmonics (strings)::  
@end menu

@node Artificial harmonics (strings)
@subsection Artificial harmonics (strings)

@cindex artificial harmonics

Artificial harmonics are notated with a different notehead style.  They
are entered by marking the harmonic pitch with @code{\harmonic}.

@lilypond[ragged-right,verbatim,quote,fragment,relative=1]
<c g'\harmonic>4
@end lilypond

