15.2 Displaying chords

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


15.2.1 Printing chord names

Chord names are printed in the ChordNames context:

\new ChordNames {
  \chordmode {
    c2 f4. g8
  }
}
[image of music]

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:

chordmusic = \relative {
  <c' e g>2 <f bes c>
  <f c' e g>1
  \chordmode {
    c2 f:sus4 c1:/f
  }
}
<<
  \new ChordNames {
    \chordmusic
  }
  {
    \chordmusic
  }
>>
[image of music]

When passed to a ChordNames context, rests (including multi-measure rests) cause the text “N.C.” (No Chord) to be displayed.

myChords = \chordmode {
  c1
  r1
  g1
  R1
  c1
}

<<
  \new ChordNames \myChords
  \new Staff \myChords
>>
[image of music]

\chords { … } is a shortcut notation for \new ChordNames \chordmode { … }.

\chords {
  c2 f4.:m g8:maj7
}
[image of music]
\new ChordNames {
  \chordmode {
    c2 f4.:m g8:maj7
  }
}
[image of music]

Selected snippets

Showing chords at changes

By default, every chord entered is printed. This behavior can be modified so that chord names are printed only at the start of lines or when the chord changes.

harmonies = \chordmode {
  c'1:m c:m \break
  c'1:m c:m d
}

<<
  \new ChordNames {
    \set chordChanges = ##t
    \harmonies
  }
  \new Staff {
    \harmonies
  }
>>
[image of music]

Simple lead sheet

When put together, chord names, a melody, and lyrics form a lead sheet.

<<
  \chords { c2 g:sus4 f e }
  \new Staff \relative c'' {
    a4 e c8 e r4
    b2 c4( d)
  }
  \addlyrics { One day this shall be free __ }
>>
[image of music]

Customizing the no-chord symbol

By default, rests in a ChordNames context cause the text “N.C.” to be printed. This markup can be customized by setting the noChordSymbol context property.

<<
  \chords {
    R1
    \set noChordSymbol = "—"
    R1
    \set noChordSymbol = \markup \italic "Ssh!"
    R1
  }
  {
    R1*3
  }
>>
[image of music]

See also

Music Glossary: chord.

Notation Reference: Writing music in parallel.

Snippets: Chord notation.

Internals Reference: ChordNames, ChordName, Chord_name_engraver, Volta_engraver, Bar_engraver.

Known issues and warnings

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


15.2.2 Customizing chord names

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.

The basic chord name layout is a system for Jazz music proposed by Klaus Ignatzek (see Literature list). (Other chord naming systems may be implemented through Scheme functions, see Chord names alternative for an example.) A list of common jazz chords notations can be found in Chord name chart.

The default naming system may be tweaked easily in a number of ways. To begin with, predefined commands allow the display of different languages for the root pitch. These include \germanChords, \norwegianChords, \italianChords, \frenchChords, and \englishChords.

[image of music]

German songbooks may indicate minor chords as lowercase letters, without any ‘m’ suffix. This can be obtained by setting the chordNameLowercaseMinor property:

\chords {
  \set chordNameLowercaseMinor = ##t
  c2 d:m e:m f
}
[image of music]

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

chordRootNamer

The default setup is to print the chord name 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 ‘H’ for a B-chord) can be produced by storing a different function in this property.

majorSevenSymbol

This property holds the markup object that identifies a major 7 chord, to be printed right after the chord root. Predefined values are whiteTriangleMarkup (the default) and blackTriangleMarkup.

additionalPitchPrefix

If the chord name contains additional pitches, they normally have the prefix ‘add’, which is LilyPond’s default. This prefix can be changed or suppressed.

\new ChordNames {
  <c e g d'>    % add9
  \set additionalPitchPrefix = ""
  <c e g d'>    % add9
}
[image of music]
chordNoteNamer

If a chord name contains additional pitches other than the root (e.g., an added bass note), the function assigned to this property is used to print them. If not set or set to '(), use the function assigned to chordRootNamer instead.

As an example, the function chord-name:german-lowercase-name-markup is used by \germanChords to print bass notes in lower case.

chordNameSeparator

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

\chords {
  c4:7.9- c:7.9-/g
  \set chordNameSeparator = \markup { "/" }
  \break
  c4:7.9- c:7.9-/g
}
[image of music]
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 slashChordSeparator defaults to a forward slash, but you can change it to other markup.

\chords {
  c4:7.9- c:7.9-/g
  \set slashChordSeparator = \markup { " over " }
  \break
  c4:7.9- c:7.9-/g
}
[image of music]
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 follows the chordRootNamer output to create the chord name.

minorChordModifier

Minor chords are often denoted via an ‘m’ suffix to the right of the root of the chord (this is LilyPond’s default). However, some idioms prefer other suffixes, such as a minus sign.

\chords {
  c4:min f:min7
  \set minorChordModifier = \markup { "-" }
  \break
  c4:min f:min7
}
[image of music]
chordPrefixSpacer

The modifier for minor chords as determined by minorChordModifier is by default printed immediately to the right of the chord root. Some whitespace can be placed between the root and the modifier by setting chordPrefixSpacer (used, for example, in \italianChords). No whitespace is inserted if the root is altered.

Predefined commands

\whiteTriangleMarkup, \blackTriangleMarkup, \germanChords, \norwegianChords, \italianChords, \frenchChords, \englishChords.

Selected snippets

Chord name exceptions

The property chordNameExceptions stores a list of chord name exceptions to handle cases either not covered or handled incorrectly.

The default chord names used by LilyPond follow the rules as given in Klaus Ignatzek’s book “Die Jazzmethode für Klavier 1”; the algorithm to convert chords to chord names can be found in file scm/chord-ignatzek-names.scm. Additional rules are given as chord exceptions and stored in the variable ignatzekExceptions, as set up in file ly/chord-modifiers-init.ly.

This snippet modifies these exceptions in three steps.

  1. Set up some music with chords and associated markup. By convention, the root (i.e., the lowest note) of each chord should have pitch c.
  2. Call Scheme function sequential-music-to-chord-exceptions to create a new list of exceptions, then concatenate it with the existing ones. Since ignatzekExceptions is set up with this function’s second parameter set to #t (to ignore the root of the chords), we have to do the same.
  3. Register the new exception list.
% Step 1: Define music with chords and markup for maj9 and 6(add9).
chExceptionMusic = {
  <c e g b d'>-\markup { \super "maj9" }
  <c e g a d'>-\markup { \super "6(add9)" }
}

% Step 2: Create extended exception list.
chExceptions =
#(append (sequential-music-to-chord-exceptions chExceptionMusic #t)
         ignatzekExceptions)

theMusic = \chordmode {
  g1:maj9 g1:6.9
  % Step 3: Register extended exception list.
  \set chordNameExceptions = #chExceptions
  g1:maj9 g1:6.9
}

<<
  \new ChordNames \theMusic
  \new Voice \theMusic
>>

\layout {
  line-width = 10\cm
  ragged-right = ##f
}
[image of music]

Chord name major7

The layout of the major 7 can be tuned with the majorSevenSymbol context property.

\chords {
  c:7+
  \set majorSevenSymbol = \markup { j7 }
  c:7+
}
[image of music]

Adding bar lines to ChordNames context

To add bar line indications in the ChordNames context, add the Bar_engraver.

\new ChordNames \with {
  \override BarLine.bar-extent = #'(-1 . 3)
  \consists "Bar_engraver"
}

\chordmode {
  f1:maj7 f:7 bes:7
}
[image of music]

Volta below chords

By adding the Volta_engraver to the relevant staff, volte can be put below chords.

\score {
  <<
    \chords { c1 c1 }
    \new Staff \with { \consists "Volta_engraver" }
    {
      \repeat volta 2 { c'1 \alternative { c' } }
    }
  >>
  \layout {
    \context {
      \Score
      \remove "Volta_engraver"
    }
  }
}
[image of music]

Changing chord separator

The separator between different parts of a chord name can be set to any markup.

\chords {
  c:7sus4
  \set chordNameSeparator = \markup { \typewriter | }
  c:7sus4
}
[image of music]

See also

Notation Reference: Chord name chart, Common chord modifiers.

Essay on automated music engraving: Literature list.

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

Snippets: Chord notation.

Known issues and warnings

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 \chordmode. If the simultaneous pitches method of entering chords is used, undesired names result from inversions or bass notes.

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 }
>>
[image of music]

15.2.3 Chord grids

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

[image of music]

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

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

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

In order to create a chord grid, instantiate a ChordGrid context.

\new ChordGrid \chordmode { c1 d1:m e1:7 f1:7+ }
[image of music]

Each square is automatically subdivided.

\new ChordGrid \chordmode {
  c1
  d2 c2
  e2. c4
}
[image of music]

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:

[image of music]

The \medianChordGridStyle changes the default display of squares with particular measure divisions to use the style recommended by Philippe Baudoin in his book Jazz, mode d’emploi (“Jazz, user instructions”).

\layout {
  \context {
    \ChordGrid
    \medianChordGridStyle
  }
}
[image of music]

In chord grids, rests cause the noChordSymbol to be printed, just like in a regular ChordNames context (see Printing chord names).

\new ChordGrid \chordmode { c1 r2 c2 R1 }
[image of music]

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

\new ChordGrid \chordmode { c1 s2 c2 s1 }
[image of music]

Selected snippets

Customizing the chord grid style

Custom divisions of chord squares can be defined through the measure-division-lines-alist and measure-division-chord-placement-alist properties of ChordSquare. These are both alists. Their keys are measure divisions, namely lists which give the fraction of the measure that each chord (or rest, or skip) represents. More precisely, a measure division alist is made of positive, exact numbers adding up to 1, for example: '(1/2 1/4 1/4). The exactness requirement means that, e.g., 1/2 is valid but not 0.5.

The values in measure-division-lines-alist are lists of lines, which are represented as (x1 y1 x2 y2). The line starts at the point (x1 . y1) and ends at (x2 . y2). Coordinates are expressed in the [-1, 1] scale relative to the extent of the square.

The values in measure-division-chord-placement-alist are lists of (xy) pairs giving the placement of the respective chords.

This example defines a peculiar chord grid style that has a rule for measures divided in three equal parts.

\paper {
  line-width = 10\cm
  ragged-right = ##f
}

\new ChordGrid \with {
  \override ChordSquare.measure-division-lines-alist =
    #'(((1) . ())
       ((1/3 1/3 1/3) . ((-1 -0.4 0 1) (0 -1 1 0.4))))
  \override ChordSquare.measure-division-chord-placement-alist =
    #'(((1) . ((0 . 0)))
       ((1/3 1/3 1/3) . ((-0.7 . 0.5) (0 . 0) (0.7 . -0.5))))
}
\chordmode {
  \time 3/4
  c2.
  c4 c4 c4
}
[image of music]

See also

Music Glossary: chord grid.

Internals Reference: ChordGrid, ChordGridScore, GridChordName, ChordSquare, Grid_chord_name_engraver, Chord_square_engraver.


LilyPond Notation Reference v2.25.35 (development-branch).