@c -*- coding: utf-8; mode: texinfo; -*-
@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.  For details, see the Contributors'
    Guide, node Updating translation committishes..
@end ignore

@c \version "2.19.28"


@node Chord notation
@section Chord notation

@lilypondfile[quote]{snippets/chords-headword.ly}

Chords can be entered either as normal notes or in chord mode and displayed
using a variety of traditional European chord naming conventions.  Chord
names and figured bass notation can also be displayed.

@menu
* Chord mode::
* Displaying chords::
* Figured bass::
@end menu


@node Chord mode
@subsection Chord mode

@cindex chord

Chord mode is used to enter chords using an indicator of the chord
structure, rather than the chord pitches.

@menu
* Chord mode overview::
* Common chords::
* Extended and altered chords::
* Chord inversions and specific voicings::
@end menu

@node Chord mode overview
@unnumberedsubsubsec Chord mode overview

@cindex chord name
@cindex chord mode

Chords can be entered as simultaneous music, as discussed in
@ref{Chorded notes}.

Chords can also be entered in @qq{chord mode}, which is an input
mode that focuses on the structures of chords in traditional
European music, rather than on specific pitches.  This is
convenient for those who are familiar with using chord names to
describe chords.  More information on different input modes can be
found at @ref{Input modes}.

@lilypond[verbatim,quote,ragged-right]
\chordmode { c1 g a g c }
@end lilypond

Chords entered using chord mode are music elements, and can be
transposed just like chords entered using simultaneous music.
@code{\chordmode} is absolute, as @code{\relative} has no effect
on @code{chordmode} blocks.  However, in @code{\chordmode} the
absolute pitches are one octave higher than in note mode.

Chord mode and note mode can be mixed in sequential music:

@lilypond[verbatim,quote,ragged-right]
\relative {
  <c' e g>2 <g b d>
  \chordmode { c2 f }
  <c e g>2 <g' b d>
  \chordmode { f2 g }
}
@end lilypond

@morerefs
Music Glossary:
@rglos{chord}.

Notation Reference:
@ref{Chorded notes},
@ref{Input modes}.

Snippets:
@rlsr{Chords}.
@endmorerefs

@knownissues
Predefined shorthands for articulations and ornaments cannot be used
on notes in chord mode, see @ref{Articulations and ornamentations}.


@node Common chords
@unnumberedsubsubsec Common chords

@cindex triad
@cindex seventh chord
@cindex root of chord
@cindex modifier, in chord
@cindex chord quality

Major triads are entered by including the root and an
optional duration:

@lilypond[verbatim,quote,ragged-right]
\chordmode { c2 f4 g }
@end lilypond

Minor, augmented, and diminished triads are entered by placing
@code{:} and a quality modifier string after the duration:

@lilypond[verbatim,quote,ragged-right]
\chordmode { c2:m f4:aug g:dim }
@end lilypond

Seventh chords can be created:

@lilypond[quote,ragged-right,verbatim]
\chordmode { c1:7 c:m7 c:maj7 c:dim7 c:aug7 }
@end lilypond

@funindex aug
@funindex dim
@funindex maj
@funindex m

The table below shows the actions of the quality modifiers on
triads and seventh chords.  The default seventh step added to
chords is a minor or flatted seventh, which makes the dominant
seventh the basic seventh chord.  All alterations are relative to
the dominant seventh.  A more complete table of modifier usage
is found at @ref{Common chord modifiers}.

@c @table @code
@multitable @columnfractions .2 .4 .3

@item
@b{Modifier}
@tab
@b{Action}
@tab
@b{Example}

@item
None
@tab
The default action; produces a major triad.
@tab
@lilypond[inline,line-width=4\cm, noragged-right]
\chordmode {
  \omit Staff.TimeSignature
  c1
}
@end lilypond

@item
m, m7
@tab
The minor chord.  This modifier lowers the 3rd.
@tab
@lilypond[inline,line-width=4\cm, noragged-right]
\chordmode {
  \omit Staff.TimeSignature
  c1:m c:m7
}
@end lilypond


@item
dim, dim7
@tab
The diminished chord.  This modifier lowers the 3rd, 5th and (if
present) the 7th step.
@tab
@lilypond[inline,line-width=4\cm, noragged-right]
\chordmode {
  \omit Staff.TimeSignature
  c1:dim c:dim7
}
@end lilypond

@item
aug
@tab
The augmented chord.  This modifier raises the 5th step.
@tab
@lilypond[inline,line-width=4\cm, noragged-right]
\chordmode {
  \omit Staff.TimeSignature
  c1:aug
}
@end lilypond

@item
maj, maj7
@tab
The major 7th chord.  This modifier adds a raised 7th step.  The
@code{7} following @code{maj} is optional.  Do NOT use this modifier
to create a major triad.
@tab
@lilypond[inline,line-width=4\cm, noragged-right]
\chordmode {
  \omit Staff.TimeSignature
  c1:maj c:maj7
}
@end lilypond

@end multitable

@morerefs
Notation Reference:
@ref{Common chord modifiers},
@ref{Extended and altered chords}.

Snippets:
@rlsr{Chords}.
@endmorerefs

@knownissues
Only one quality modifier should be used per chord, typically on the
highest step present in the chord.  Chords with more than quality
modifier will be parsed without an error or warning, but the results
are unpredictable.  Chords that cannot be achieved with a single
quality modifier should be altered by individual pitches, as described
in @ref{Extended and altered chords}.


@node Extended and altered chords
@unnumberedsubsubsec Extended and altered chords

@cindex extended chord
@cindex altered chord

Chord structures of arbitrary complexity can be created in chord
mode.  The modifier string can be used to extend a chord, add or
remove chord steps, raise or lower chord steps, and add a bass note
or create an inversion.

The first number following the @code{:} is taken to be the extent
of the chord.  The chord is constructed by sequentially adding
thirds to the root until the specified number has been reached.
Note that the seventh step added as part of an extended chord will be the
minor or flatted seventh, not the major seventh.
If the extent is not a third (e.g., 6), thirds are added up to the
highest third below the extent, and then the step of the extent is
added.  The largest possible value for the extent is 13.  Any
larger value is interpreted as 13.

@lilypond[quote,ragged-right,verbatim]
\chordmode {
  c1:2 c:3 c:4 c:5
  c1:6 c:7 c:8 c:9
  c1:10 c:11 c:12 c:13
  c1:14
}
@end lilypond

@noindent
As a special exception, @code{c:5} produces a @q{power chord} only
consisting of root and fifth.

Since an unaltered 11 does not sound good when combined with an
unaltered 13, the 11 is removed from a @code{:13} chord (unless it
is added explicitly).

@lilypond[quote,ragged-right,verbatim]
\chordmode {
  c1:13 c:13.11 c:m13
}
@end lilypond

@cindex addition, in chords

Individual steps can be added to a chord.  Additions follow the
extent and are prefixed by a dot (@code{.}).  The basic seventh
step added to a chord is the minor or flatted seventh, rather than
the major seventh.

@lilypond[quote,verbatim]
\chordmode {
  c1:3.5.6 c:3.7.8 c:3.6.13
}
@end lilypond

Added steps can be as high as desired.

@lilypond[quote,verbatim]
\chordmode {
  c4:3.5.15 c:3.5.20 c:3.5.25 c:3.5.30
}
@end lilypond

@cindex chord step, altering

Added chord steps can be altered by suffixing a @code{-} or @code{+}
sign to the number.  To alter a step that is automatically included
as part of the basic chord structure, add it as an altered step.

@lilypond[quote,verbatim]
\chordmode {
  c1:7+ c:5+.3- c:3-.5-.7-
}
@end lilypond

@cindex removal, in chord

@funindex ^

Following any steps to be added, a series of steps to be removed
is introduced in a modifier string with a prefix of @code{^}.
If more than one step is to be removed, the steps to be
removed are separated by @code{.} following the
initial @code{^}.

@lilypond[quote,verbatim]
\chordmode {
  c1^3 c:7^5 c:9^3 c:9^3.5 c:13.11^3.7
}
@end lilypond

@funindex sus

The modifier @code{sus} can be added to the modifier string to
create suspended chords.  This removes the 3rd step from the
chord.  Append either @code{2} or @code{4} to add the 2nd or 4th
step to the chord.  When @code{sus} is followed by either a 2nd or
4th step, it is equivalent to @code{^3}, otherwise to @code{sus4},
namely @code{5.4}.

@lilypond[quote,ragged-right,verbatim]
\chordmode {
  c1:sus c:sus2 c:sus4 c:5.4
}
@end lilypond

@funindex /
@cindex bass note, for chords

Added bass notes (putting a pitch other than the root
on the bottom of the chord) can be specified by appending
@code{/}@var{pitch} to the chord.

@lilypond[quote,ragged-right,verbatim]
\chordmode {
  c'1 c'/e c'/f
}
@end lilypond

@funindex /+

If the added pitch is already part of the chord, this may be
used to print chord inversions, in which case the pitch is
not added but merely moved to the bottom of the chord.
It may however be treated as an added note (and thus printed
twice), by using the syntax @code{/+}@var{pitch}.

@lilypond[quote,ragged-right,verbatim]
\chordmode {
  c'1 c'/g c'/+e
}
@end lilypond

Automatic chord inversions and voicings are demonstrated in
@ref{Chord inversions and specific voicings}.

Chord modifiers that can be used to produce a variety of
standard chords are shown in
@ref{Common chord modifiers}.

@morerefs
Notation Reference:
@ref{Chord inversions and specific voicings},
@ref{Common chord modifiers}.

Snippets:
@rlsr{Chords}.
@endmorerefs

@knownissues
Each step can only be present in a chord once.  The following
simply produces the augmented chord, since @code{5+} is
interpreted last.

@lilypond[quote,ragged-right,verbatim]
\chordmode { c1:3.5.5-.5+ }
@end lilypond


@node Chord inversions and specific voicings
@unnumberedsubsubsec Chord inversions and specific voicings

@cindex chord, rotating
@cindex chord inversion
@cindex chord voicing
@funindex \invertChords
@funindex \dropNote
@funindex \raiseNote

In addition to chord modifiers and added bass notes, various
functions may be used to automatically print chords in a
specific inversion or voicing -- for example the so-called
@q{drop@tie{}2} voicing commonly used in jazz music.

@lilypond[quote,verbatim]
\chordmode {
  \dropNote 2 {
    c2:maj7 d:m7
  }
  \invertChords 1 d1:maj7
}
@end lilypond

Unlike added bass notes shown in @ref{Extended and altered chords}
this only affects the way chords are printed on a staff,
and not chord names written with letters.  Furthermore, these
functions may be used not only in chord mode but also
with @code{<...>} chords constructs explained in
@ref{Chorded notes}.

@morerefs
Notation Reference:
@ref{Extended and altered chords},
@ref{Chorded notes}.

Snippets:
@rlsr{Chords}.
@endmorerefs


@node Displaying chords
@subsection Displaying chords

Chords can be displayed by name, in addition to the standard display
as notes on a staff.

@menu
* Printing chord names::
* Customizing chord names::
* Chord grids::
@end menu

@node Printing chord names
@unnumberedsubsubsec Printing chord names

@cindex printing chord name
@cindex chord name
@cindex chord

Chord names are printed in the @code{ChordNames} context:

@lilypond[verbatim,quote,ragged-right]
\new ChordNames {
  \chordmode {
    c2 f4. g8
  }
}
@end lilypond

Chords can be entered as simultaneous notes or through the use of
chord mode.  The displayed chord name will be the same, regardless
of the mode of entry, unless there are inversions or added bass notes:

@lilypond[verbatim,quote]
chordmusic = \relative {
  <c' e g>2 <f bes c>
  <f c' e g>1
  \chordmode {
    c2 f:sus4 c1:/f
  }
}
<<
  \new ChordNames {
    \chordmusic
  }
  {
    \chordmusic
  }
>>
@end lilypond

@cindex no-chord symbol
@cindex N.C. symbol
@cindex indicating No Chord in @code{ChordNames}

When passed to a @code{ChordNames} context, rests (including
multi-measure rests) cause the text @qq{N.C.} (@emph{No Chord}) to
be displayed.

@lilypond[verbatim,quote]
myChords = \chordmode {
  c1
  r1
  g1
  R1
  c1
}

<<
  \new ChordNames \myChords
  \new Staff \myChords
>>
@end lilypond

@funindex \chords

@code{\chords @{ @dots{} @}} is a shortcut notation for
@code{\new ChordNames \chordmode @{ @dots{} @}}.

@lilypond[verbatim,quote,ragged-right]
\chords {
  c2 f4.:m g8:maj7
}
@end lilypond

@lilypond[verbatim,quote,ragged-right]
\new ChordNames {
  \chordmode {
    c2 f4.:m g8:maj7
  }
}
@end lilypond


@snippets

@cindex chord, suppressing repeated
@cindex repeated chords, suppressing
@cindex suppressing repeated chords
@funindex chordChanges
@lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
{snippets/showing-chords-at-changes.ly}

@c @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
@c {snippets/adding-bar-lines-to-chordnames-context.ly}

@cindex lead sheet
@lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
{snippets/simple-lead-sheet.ly}

@funindex noChordSymbol
@cindex no-chord symbol, customizing
@cindex N.C. symbol, customizing
@lilypondfile[verbatim,quote,ragged-right,texidoc, doctitle]
{snippets/customizing-the-no-chord-symbol.ly}

@morerefs
Music Glossary:
@rglos{chord}.

Notation Reference:
@ref{Writing music in parallel}.

Snippets:
@rlsr{Chords}.

Internals Reference:
@rinternals{ChordNames},
@rinternals{ChordName},
@rinternals{Chord_name_engraver},
@rinternals{Volta_engraver},
@rinternals{Bar_engraver}.
@endmorerefs

@knownissues
Chords containing inversions or altered bass notes are not named
properly if entered using simultaneous music.


@node Customizing chord names
@unnumberedsubsubsec Customizing chord names

@cindex customizing chord name

There is no unique system for naming chords.  Different musical
traditions use different names for the same set of chords.  There
are also different symbols displayed for a given chord name.  The
names and symbols displayed for chord names are customizable.

@cindex jazz chord
@cindex chord, jazz
@cindex chord, alternative name
@cindex alternative chord name

The basic chord name layout is a system for Jazz music, proposed
by Klaus Ignatzek (see @ressay{Literature list}).  (Other chord
naming systems may be implemented through Scheme functions, as
demonstrated by the @qq{Chord names alternative} snippet in @rlsr{Chords}.)
A list of common jazz chords notations may be found on the chart in
@ref{Chord name chart}.
@c FIXME: move the chord-names-alternative snippet to a new section. -vv

@funindex \germanChords
@funindex \semiGermanChords
@funindex \italianChords
@funindex \frenchChords

The default naming system may be tweaked easily in a number
of ways.  To begin with, predefined commands allow to use
different languages for the root pitch.  These include
@code{\germanChords}, @code{\semiGermanChords},
@code{\italianChords} and @code{\frenchChords}:

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


@funindex chordNameLowercaseMinor

German songbooks may indicate minor chords as lowercase letters,
without any @var{m} suffix.  This can be obtained by setting the
@code{chordNameLowercaseMinor} property:

@lilypond[verbatim,quote,ragged-right]
\chords {
  \set chordNameLowercaseMinor = ##t
  c2 d:m e:m f
}
@end lilypond

The chord name display can also be tuned through the following properties.

@table @code

@funindex chordRootNamer

@item chordRootNamer

The chord name is usually printed as a letter for the root 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 majorSevenSymbol

@item majorSevenSymbol

@funindex \blackTriangleMarkup
@funindex \whiteTriangleMarkup

This property contains the markup object used to follow the output
of @code{chordRootNamer} to identify a major 7 chord.  Predefined
options are @code{whiteTriangleMarkup} and
@code{blackTriangleMarkup}.

@funindex additionalPitchPrefix

@item additionalPitchPrefix

When the chord name contains additional pitches, they can optionally
be prefixed with some text.  The default is no prefix, in order to
avoid too much visual clutter, but for small numbers of additional
pitches this can be visually effective.

@lilypond[verbatim,quote,ragged-right]
\new ChordNames {
  <c e g d'>    % add9
  \set additionalPitchPrefix = "add"
  <c e g d'>    % add9
}
@end lilypond

@funindex chordNoteNamer

@item chordNoteNamer

When the chord name contains additional pitches other than the root
(e.g., an added bass note), this function is used to print the
additional pitch.  By default the pitch is printed using
@code{chordRootNamer}.  The @code{chordNoteNamer} property can be set
to a specialized function to change this behavior.  For example, the
bass note can be printed in lower case.

@funindex chordNameSeparator

@item chordNameSeparator

Different parts of a chord name are normally separated by a small
amount of horizontal space.  By setting @code{chordNameSeparator}, you
can use any desired markup for a separator.  This does not affect the
separator between a chord and its bass note; to customize that, use
@code{slashChordSeparator}.

@lilypond[verbatim,quote,ragged-right]
\chords {
  c4:7.9- c:7.9-/g
  \set chordNameSeparator = \markup { "/" }
  \break
  c4:7.9- c:7.9-/g
}
@end lilypond

@funindex slashChordSeparator

@item slashChordSeparator

Chords can be played over a bass note other than the conventional root
of the chord.  These are known as ``inversions'' or ``slash chords'',
because the default way of notating them is with a forward slash
between the main chord and the bass note.  Therefore the value of
@code{slashChordSeparator} defaults to a forward slash, but you can
change it to any markup you choose.

@lilypond[verbatim,quote,ragged-right]
\chords {
  c4:7.9- c:7.9-/g
  \set slashChordSeparator = \markup { " over " }
  \break
  c4:7.9- c:7.9-/g
}
@end lilypond

@funindex chordNameExceptions

@item chordNameExceptions

This property is a list of pairs.  The first item in each pair
is a set of pitches used to identify the steps present in the chord.
The second item is a markup that will follow the @code{chordRootNamer}
output to create the chord name.

@funindex minorChordModifier

@item minorChordModifier

Minor chords are often denoted via a @q{m} suffix to the right of the
root of the chord.  However some idioms prefer other suffices, such as
a minus sign.

@lilypond[verbatim,quote,ragged-right]
\chords {
  c4:min f:min7
  \set minorChordModifier = \markup { "-" }
  \break
  c4:min f:min7
}
@end lilypond

@funindex chordPrefixSpacer

@item chordPrefixSpacer

The modifier for minor chords as determined by
@code{minorChordModifier} is usually printed immediately to the right
of the root of the chord.  A spacer can be placed between the root and
the modifier by setting @code{chordPrefixSpacer}.  The spacer is not
used when the root is altered.

@end table


@predefined
@cindex major seven symbol
@cindex symbol, major seven
@code{\whiteTriangleMarkup},
@code{\blackTriangleMarkup},
@code{\germanChords},
@code{\semiGermanChords},
@code{\italianChords},
@code{\frenchChords}.
@endpredefined


@snippets

@cindex exception, chord names
@cindex chord names, exceptions
@funindex chordNameExceptions
@lilypondfile[verbatim,quote,texidoc,doctitle]
{snippets/chord-name-exceptions.ly}

@c TODO - tweak snippet to use \blackTriangleMarkup as well
@cindex major 7 chord, layout
@cindex layout, major 7 chord
@cindex chord, major 7, layout
@funindex majorSevenSymbol
@lilypondfile[verbatim,quote,texidoc,doctitle]
{snippets/chord-name-major7.ly}

@cindex @code{ChordNames}, with bar lines
@cindex bar line, in @code{ChordNames}
@lilypondfile[verbatim,quote,texidoc,doctitle]
{snippets/adding-bar-lines-to-chordnames-context.ly}

@cindex volta repeat, below chords
@cindex chords, volta repeat, below
@lilypondfile[verbatim,quote,texidoc,doctitle]
{snippets/volta-below-chords.ly}

@cindex chord separator, changing
@cindex changing chord separator
@funindex chordNameSeparator
@lilypondfile[verbatim,quote,texidoc,doctitle]
{snippets/changing-chord-separator.ly}

@morerefs
Notation Reference:
@ref{Chord name chart},
@ref{Common chord modifiers}.

Essay on automated music engraving:
@ressay{Literature list}.

Installed Files:
@file{scm/chords-ignatzek-names.scm},
@file{scm/chord-entry.scm},
@file{ly/chord-modifiers-init.ly}.

Snippets:
@rlsr{Chords}.
@endmorerefs

@knownissues
Chord names are determined from both the pitches that are present
in the chord and the information on the chord structure that may
have been entered in @code{\chordmode}.  If the simultaneous pitches
method of entering chords is used, undesired names result from
inversions or bass notes.

@lilypond[quote,ragged-right,verbatim]
myChords = \relative c' {
  \chordmode { c1 c/g c/f }
  <c e g>1 <g c e> <f c' e g>
}
<<
  \new ChordNames { \myChords }
  \new Staff { \myChords }
>>
@end lilypond


@node Chord grids
@unnumberedsubsubsec Chord grids

@cindex chord grid
@funindex ChordGrid

In some European countries, particularly France, jazz musicians
use so-called @q{chord grids}, which notate chords visually by
placing them in squares.

@lilypond[quote,indent=0\cm,noragged-right]
\new ChordGrid \chordmode {
  g2:7+ bes4:m7 ees:7
  \repeat percent 2 {
    a2:m7 b2:7.11+
  }
  e4:m7 e4:m7/d a4:7/cis c4:m7
}
@end lilypond

Although they are omitted in the rest of this section for brevity,
it is recommended to use the following @code{\paper} settings for
chord grids:

@example
\paper @{
  indent = 0
  ragged-right = ##f
@}
@end example

@code{indent = 0} ensures that the first line is not indented as
it would normally be (@pxref{paper variables for shifts and
indents}).  @code{ragged-right = ##f} is necessary for single-line
grids to ensure they span the whole page; @pxref{paper variables
for widths and margins}.

In order to create a chord grid, instantiate a @code{ChordGrid} context.

@lilypond[verbatim,quote,indent=0\cm,noragged-right]
\new ChordGrid \chordmode { c1 d1:m e1:7 f1:7+ }
@end lilypond

Each square is automatically subdivided.

@lilypond[verbatim,quote,indent=0\cm,noragged-right]
\new ChordGrid \chordmode {
  c1
  d2 c2
  e2. c4
}
@end lilypond

Chords spanning a complete measure are centered within their
square.  Chords lasting half a measure take half the square, and
those lasting a quarter of a measure take a quarter of the square.
This summary picture shows the default rules for subdividing the
square:

@lilypond[quote,indent=0\cm,noragged-right]
\new ChordGrid \chordmode {
  \override GridChordName.stencil =
    #(lambda (grob)
       (let* ((ev (event-cause grob))
              (mus (ly:event-property ev 'music-cause))
              (dur (ly:music-property mus 'duration))
              (num (number->string (1+ (ly:grob-property grob 'index)))))
       (grob-interpret-markup
        grob
        #{ \markup { \note #dur #UP \hspace #0.7 \circle #num } #})))
  r1
  r2 r2
  r4 r4 r2
  r2 r4 r4
  \break
  r4 r4 r4 r4
  r2. r4
  r4 r2.
  \stopStaff
  s1
}
@end lilypond

The @code{\medianChordGridStyle} changes the default display of
squares with four chords of equal length to use the style
recommended by Philippe Baudoin in his book @emph{Jazz, mode
d'emploi} (@qq{Jazz, user instructions}).

@example
\layout @{
  \context @{
    \ChordGrid
    \medianChordGridStyle
  @}
@}
@end example

@lilypond[quote,indent=0\cm,noragged-right]
\new ChordGrid \chordmode {
  \override GridChordName.stencil =
    #(lambda (grob)
       (let* ((ev (event-cause grob))
              (mus (ly:event-property ev 'music-cause))
              (dur (ly:music-property mus 'duration))
              (num (number->string (1+ (ly:grob-property grob 'index)))))
       (grob-interpret-markup
        grob
        #{ \markup { \note #dur #UP \hspace #0.7 \circle #num } #})))
  \override Score.RehearsalMark.self-alignment-X = #LEFT
  \textMark "default"
  r4 r4 r4 r4
  \stopStaff
  s1
  \startStaff
  \textMark \markup \typewriter "\\medianChordGridStyle"
  \medianChordGridStyle
  r4 r4 r4 r4
  \stopStaff
  s1*2
}
@end lilypond

In chord grids, rests cause the @code{noChordSymbol} to be
printed, just like in a regular @code{ChordNames} context
(@pxref{Printing chord names}).

@lilypond[verbatim,quote,indent=0\cm,noragged-right]
\new ChordGrid \chordmode { c1 r2 c2 R1 }
@end lilypond

Skips cause blank space.  They can occupy part of a square.

@lilypond[verbatim,quote,indent=0\cm,noragged-right]
\new ChordGrid \chordmode { c1 s2 c2 s1 }
@end lilypond

@snippets

@lilypondfile[verbatim,quote,texidoc,doctitle]
{snippets/customizing-the-chord-grid-style.ly}


@morerefs
Music Glossary:
@rglos{chord grid}.

Internals Reference:
@rinternals{ChordGrid},
@rinternals{ChordGridScore},
@rinternals{GridChordName},
@rinternals{ChordSquare},
@rinternals{Grid_chord_name_engraver},
@rinternals{Chord_square_engraver}.
@endmorerefs


@node Figured bass
@subsection Figured bass

@c Indent hack because of instrument names
@lilypondfile[quote,staffsize=18,indent=2\cm]{snippets/figured-bass-headword.ly}

Figured bass notation can be displayed.

@menu
* Introduction to figured bass::
* Entering figured bass::
* Displaying figured bass::
@end menu

@node Introduction to figured bass
@unnumberedsubsubsec Introduction to figured bass

@cindex basso continuo
@cindex thorough bass
@cindex figured bass
@cindex bass, thorough
@cindex bass, figured

@c TODO: musicological blurb about FB


LilyPond has support for figured bass, also called @dfn{thorough
bass} or @dfn{basso continuo}.

@lilypond[quote,ragged-right,verbatim]
<<
  \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

@funindex \figuremode
@funindex \figures

The support for figured bass consists of two parts: there is an
input mode, introduced by @code{\figuremode}, that accepts
entry of bass figures, and there is a context named
@code{FiguredBass} that takes care of displaying
@code{BassFigure} objects.  Figured bass can also be displayed
in @code{Staff} contexts.

@code{\figures @{ @dots{} @}} is a shortcut notation for
@code{\new FiguredBass \figuremode @{ @dots{} @}}.

Although the support for figured bass may superficially resemble chord
support, it is much simpler.  @code{\figuremode} mode simply
stores the figures and the @code{FiguredBass} context prints them
as entered.  There is no conversion to pitches.

@ignore
Figures are created as markup texts.  Any of the standard markup
properties can be used to modify the display of figures.  For
example, the vertical spacing of the figures may be set with
@code{baseline-skip}.
@end ignore

@morerefs
Music Glossary:
@rglos{figured bass}.

Snippets:
@rlsr{Chords}.
@endmorerefs


@node Entering figured bass
@unnumberedsubsubsec Entering figured bass

@code{\figuremode} is used to switch the input mode to figure
mode.  @xref{Input modes} for more information on different input
modes.

In figure mode, a group of bass figures is delimited by @samp{<}
and @samp{>}.  The duration is entered after the @samp{>}.

@lilypond[verbatim,quote,ragged-right]
\new FiguredBass {
  \figuremode {
    <6 4>2
  }
}
@end lilypond


Accidentals (including naturals) may be used for modifying scale
steps.  These are entered by appending @samp{+} (for sharps),
@samp{-} (for flats) or @samp{!} (for naturals) after the number.
For double accidentals the modifier is applied twice.  For the
modification of the third step the number is often omitted, which
can be achieved by using @samp{_} instead of a number.

@lilypond[verbatim,quote,ragged-right]
\figures {
  <7! 6+ 4-> <5++> <3--> <_+> <7 _!>
}
@end lilypond

If used without accidental, @samp{_} creates an empty figure which
nevertheless takes up space.  This can be used for controlling the
stacking of bass figures.

@lilypond[verbatim,quote,ragged-right]
<<
  {
    \clef bass
    g2 c4
  }
  \figures {
    <_ 5 4>4 <8 _ 3>8 <7>
  }
>>
@end lilypond

Augmented and diminished steps can be indicated.

@lilypond[verbatim,quote,ragged-right]
\figures {
  <6\+ 5/> <7/> <7 _\+>
}
@end lilypond

A backward slash through a figure is also available.

@lilypond[verbatim,quote,ragged-right]
\figures {
  <5> <5\\>
}
@end lilypond

For some figures, special backward slash glyphs are provided.

@lilypond[verbatim,quote,ragged-right]
\figures {
  <8 6\\> <9 7\\> <9\\ 7>
}
@end lilypond

Brackets can be added around accidentals, figures, and consecutive
groups of figures.

@lilypond[verbatim,quote,ragged-right]
\figures {
  <9[-] 8 [7-] 5 [4[!] 2+]>
}
@end lilypond

Any text markup can be inserted as a figure.

@lilypond[verbatim,quote,ragged-right]
\figures {
  <\markup { \fontsize #-5 \number 6 \teeny \super (1) } 5>
}
@end lilypond

@c NOTE: We need to include notes any time we use extenders to
@c avoid extraneous staff creation due to Staff.use... in
@c \bassFigureExtendersOn

@funindex \bassFigureExtendersOn
@funindex \bassFigureExtendersOff

Continuation lines can be used to indicate repeated figures.

@lilypond[verbatim,quote,ragged-right]
<<
  {
    \clef bass
    e4 d c b,
    e4 d c b,
  }
  \figures {
    \bassFigureExtendersOn
    <6 4>4 <6 3> <7 3> <7 3>
    \bassFigureExtendersOff
    <6 4>4 <6 3> <7 3> <7 3>
  }
>>
@end lilypond

@noindent
In this case, the extender lines replace existing figures, unless
the continuation lines have been explicitly terminated with
@code{\!}.

@lilypond[verbatim,quote,ragged-right]
<<
  \figures {
    \bassFigureExtendersOn
    <6 4>4 <6 4> <6\! 4\!> <6 4>
  }
  {
    \clef bass
    d4 d c c
  }
>>
@end lilypond

The table below summarizes the figure modifiers available.

@indentedBlock
@multitable @columnfractions .1 .5 .4

@headitem
modifier
@tab
purpose
@tab
example

@item
@code{+}, @code{-}, @code{!}
@tab
accidentals
@tab
@lilypond[inline,line-width=4\cm]
\figures {
  <7! 6+ 4-> <5++> <3-->
}
@end lilypond

@item
@code{\+}, @code{/}
@tab
augmented and diminished steps
@tab
@lilypond[inline,line-width=4\cm]
\figures {
  <6\+ 5/> <7/>
}
@end lilypond

@item
@code{\\}
@tab
raised by a semitone
@tab
@lilypond[inline,line-width=4\cm]
\figures {
  <6\\> <7\\> <9\\>
}
@end lilypond

@item
@code{\!}
@tab
end of continuation line
@tab
@lilypond[inline,line-width=4\cm]
<<
  \figures {
    \bassFigureExtendersOn
    <6 4> <6 4> <6\! 4\!> <6 4>
  }
  {
    \clef bass
    d d c c
  }
>>
@end lilypond

@end multitable
@endIndentedBlock


@predefined
@cindex figured bass, extender lines
@code{\bassFigureExtendersOn},
@code{\bassFigureExtendersOff}.
@endpredefined


@snippets

@cindex figured bass, alteration, position
@cindex position, figured bass alteration
@cindex alteration, figured bass, position
@funindex figuredBassAlterationDirection
@funindex figuredBassPlusDirection
@lilypondfile[verbatim,quote,texidoc,doctitle]
{snippets/changing-the-positions-of-figured-bass-alterations.ly}

@cindex figured bass, alteration, glyphs
@cindex alteration, figured bass, glyphs
@cindex glyph, for figured bass alteration
@funindex figuredBassPlusStrokedAlist
@lilypondfile[verbatim,quote,texidoc,doctitle]
{snippets/adjusting-figured-bass-alteration-glyphs.ly}


@morerefs
Snippets:
@rlsr{Chords}.

Internals Reference:
@rinternals{BassFigure},
@rinternals{BassFigureAlignment},
@rinternals{BassFigureLine},
@rinternals{BassFigureBracket},
@rinternals{BassFigureContinuation},
@rinternals{FiguredBass}.
@endmorerefs


@node Displaying figured bass
@unnumberedsubsubsec Displaying figured bass

Figured bass can be displayed using the @code{FiguredBass} context,
or in most staff contexts.

When displayed in a @code{FiguredBass} context, the vertical location
of the figures is independent of the notes on the staff.

@lilypond[verbatim,ragged-right,quote]
<<
  \relative {
    c''4 c'8 r8 c,4 c'
  }
  \new FiguredBass {
    \figuremode {
      <4>4 <10 6>8 s8
      <6 4>4 <6 4>
    }
  }
>>
@end lilypond

@noindent
In the example above, the @code{FiguredBass} context must be
explicitly instantiated to avoid creating a second (empty) staff.


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

@lilypond[verbatim,ragged-right,quote]
<<
  \new Staff = "myStaff"
  \figuremode {
    <4>4 <10 6>8 s8
    <6 4>4 <6 4>
  }
  %% Put notes on same Staff as figures
  \context Staff = "myStaff" {
    \clef bass
    c4 c'8 r8 c4 c'
  }
>>
@end lilypond


@funindex \bassFigureStaffAlignmentDown
@funindex \bassFigureStaffAlignmentUp
@funindex \bassFigureStaffAlignmentNeutral

When added in a @code{Staff} context, figured bass can be displayed above
or below the staff.

@lilypond[verbatim,ragged-right,quote]
<<
  \new Staff = "myStaff"
  \figuremode {
    <4>4 <10 6>8 s8
    \bassFigureStaffAlignmentDown
    <6 4>4 <6 4>
  }
  %% Put notes on same Staff as figures
  \context Staff = "myStaff" {
    \clef bass
    c4 c'8 r8 c4 c'
  }
>>
@end lilypond

The horizontal alignment of numbers in a figured bass stack that
have more than a single digit can be controlled with the context
property @code{figuredBassLargeNumberAlignment}.

@lilypond[verbatim, ragged-right, quote]
<<
  \new Voice {
    \clef bass
    r2 d | d d | a2
  }
  \new FiguredBass \figuremode {
    s2 <10+ 8> |
    \set figuredBassLargeNumberAlignment = #RIGHT
    <11 9>2
    \set figuredBassLargeNumberAlignment = #LEFT
    <10+ 9>2 |
    <_+>2
  }
>>
@end lilypond

@cindex figured bass, vertical distance of elements
@cindex vertical distance, figured bass elements

The vertical distance of figured bass elements can be controlled
with subproperties @code{minimum-@/distance} and @code{padding} of
@code{staff-@/staff-@/spacing}.

@lilypond[verbatim, ragged-right, quote]
<<
  { \clef bass g,2 c, }
  \figures {
    \once \override BassFigureLine
                    .staff-staff-spacing.minimum-distance = 3
    <7 _-> <7- _->
  }
>>
@end lilypond

@predefined
@cindex figured bass, alignment
@code{\bassFigureStaffAlignmentDown},
@code{\bassFigureStaffAlignmentUp},
@code{\bassFigureStaffAlignmentNeutral}.
@endpredefined

@morerefs
Snippets:
@rlsr{Chords}.

Internals Reference:
@rinternals{BassFigure},
@rinternals{BassFigureAlignment},
@rinternals{BassFigureLine},
@rinternals{BassFigureBracket},
@rinternals{BassFigureContinuation},
@rinternals{FiguredBass}.
@endmorerefs

@knownissues
To ensure that continuation lines work properly, it is
safest to use the same rhythm in the figure line as in
the bass line.

@lilypond[verbatim,ragged-right,quote]
<<
  {
    \clef bass
    \repeat unfold 4 { f16. g32 } f8. es16 d8 es
  }
  \figures {
    \bassFigureExtendersOn
    % The extenders are correct here,
    % with the same rhythm as the bass.
    \repeat unfold 4 { <6 4->16. <6 4->32 }
    <5>8. r16 <6>8 <6\! 5->
  }
>>
<<
  {
    \clef bass
    \repeat unfold 4 { f16. g32 } f8. es16 d8 es
  }
  \figures {
    \bassFigureExtendersOn
    % The extenders are incorrect here,
    % even though the timing is the same.
    <6 4->4 <6 4->4
    <5>8. r16 <6>8 <6\! 5->
  }
>>
@end lilypond
