This page is about what a chord shows over the music: its name, and the fret diagram a guitarist reads. Writing the notes a chord plays is on Writing chords.
01
One word says what is seen
chord shows the name (with the diagram of a shape written with it);
diagram shows the diagram alone. With @ it marks the note it
is on; without, it is a chord that sounds. Every combination is one word, but one: on a
<…> chord, @chord@diagram reads the name and the fingering both off its
notes.
| Written | Looks | Name | Diagram |
|---|---|---|---|
| On a note — the note sounds; the mark only shows | |||
f1@chord(F) | ✓ | ||
f1@chord(F 133211) | ✓ | ✓ | |
f1@chord(x32010) | ✓ read off the shape | ✓ | |
f1@diagram(133211) | ✓ | ||
f1@diagram | ✓ where the note is held | ||
On a <…> chord — read off its own notes, with nothing written | |||
<f a c>1@chord | ✓ read off the notes | ||
<f a c>1@diagram | ✓ the notes, fretted | ||
<f a c>1@chord@diagram | ✓ read off the notes | ✓ the notes, fretted | |
Alone, with no @ — a chord that sounds | |||
chord(F)1 | ✓ | ||
chord(F 133211)1 | ✓ | ✓ | |
chord(x32010)1 | ✓ read off the shape | ✓ | |
diagram(133211)1 | ✓ | ||
Repeated at new lengths — a length alone repeats the note or chord before it; q the chord before it | |||
chord(F 133211)4 4 2 | ✓ the first only | ✓ the first only | |
chord(F 133211)4 e2 4 | ✓ the first only | ✓ the first only | |
chord(F 133211)4 e2 q4 | ✓ the first only | ✓ the first only | |
chord(F 133211)4 chord(F 133211)2 chord(F xx3211)4 | ✓ where the chord changes | ✓ where the chord changes | |
Show the whole file
// The table's spellings, one score for each group of rows.
// Switch between them with the preview's Score: list. The bars follow the table's rows.
// On a chord name, Ctrl+Shift+Down adds the diagram of its usual shape.
// On a diagram, Ctrl+Shift+Down shows another way to hold the same chord.
// On a chord(…), Ctrl+. → Convert to Chord Notes rewrites it as its notes, <…>.
time 4/4
part gt { instrument guitar }
section onNote {
gt {
f1@chord(F) | // a name
f1@chord(F 133211) | // a name over its diagram
f1@chord(x32010) | // the name read off the shape, over its diagram
f1@diagram(133211) | // a diagram alone
f1@diagram | // where the note is held
}
}
section onChord {
gt {
<f a c>1@chord | // the name read off the notes
<f a c>1@diagram | // the diagram of the notes, fretted
<f a c>1@chord@diagram | // the name and the diagram, both read off the notes
}
}
section alone {
gt {
chord(F)1 | // a name; F A C sound
chord(F 133211)1 | // a name over its diagram; the shape sounds
chord(x32010)1 | // the name read off the shape, over its diagram
diagram(133211)1 | // a diagram alone; the shape sounds
}
}
section repeated {
gt {
chord(F 133211)4 4 2 | // a length alone repeats the note or chord before it
chord(F 133211)4 e2 4 | // here it repeats the single note e
chord(F 133211)4 e2 q4 | // q repeats the chord before it (never a single note)
chord(F 133211)4 chord(F 133211)2 chord(F xx3211)4 | // the same name and diagram written again show only where the chord changes
}
}
score onNote { form { onNote } staff gt }
score onChord { form { onChord } staff gt }
score alone { form { alone } staff gt }
score repeated { form { repeated } staff gt }Everything written on a note can be written on a <…> chord too
(<f a c>1@chord(F)).
A chords row follows the same rule: F is a name,
F(133211) a name over its diagram. A name alone draws no diagram — a
diagram appears where you ask for one, or where the score's layout asks for every chord
(below). The sounding items, chord(…) and
diagram(…), are on Writing chords.
02
Chord names
A chord name is typed the way it prints — C, Am,
Dm7, G7, Bb7/D, F#m7-5 (an altered
tension takes + or -, because # and b
belong to the root). There are two places to write one:
- A
chordsrow holds a progression. Placed directly above a staff in thescore, it aligns over that staff; entries carry no durations — one entry takes the bar, two in 4/4 take half each. @chord(NAME)puts a name on one note — or on a rest or a spacer, since a chord name belongs to the beat:s1@chord(C)is an intro bar over silence.
Every printed spelling is read, so a chart can be copied as it stands:
CΔ7, CM7 and Cmaj7 are one chord, as are
Cø7 and Cm7-5, C°7 and Cdim7,
C-7 and Cm7, and B♭7 and Bb7; the page
prints the canonical name. Alterations can also go in parentheses, glued to the symbol —
C7(b9, #11), Cm7(b5), C(add9), C7(sus4).
A b or # glued inside the quality (C7b9) is not
read — it belongs to the root and the bass alone, which keeps Bb9
unambiguous: write C7(b9) or C7-9. A symbol that is no chord is
warned with its fix; in a chords row it still prints as written, and plays only
its root.
Show the whole file
// Chord names alone. A `chords` row placed directly above a staff aligns over it;
// `@chord(NAME)` puts a name on one note. Neither draws a diagram: a name is only a name.
time 4/4
part melody { clef treble }
section A {
melody { e''4 d c d | e e e2 | d4 d e d | c1@chord(C) | }
chords prog { C | Am | Dm7 G7 | | }
}
form { ~A }
score { chords prog staff melody }Spelling, the registered qualities, Roman degrees (Imaj7) and
as roman are in the manual's Chords and chord
rows.
03
Names from the notes
A bare @chord on a <…> chord names it from its own notes, so
the name can never disagree with what sounds. Sevenths, inversions and slash basses are all
named: <e g c> prints C/E. On a single note there is nothing to name,
and it says so (LYS1020): write the name.
Show the whole file
// A bare @chord names a chord from its own notes - a seventh, an inversion, the bass.
time 4/4
part piano { clef treble }
section A {
piano { <c' e g>2@chord <a c e g>2@chord | <f a c e>2@chord <g b d f>2@chord | <e g c>1@chord | }
}
form { ~A }
score { staff piano }A name you write yourself on a chord is checked against its notes, gently (LYS1054,
information — a voicing may hold a tension its name leaves out): a note that is not a tone of
the name is noted, with the chord the notes spell and a quick fix that writes it. A single
note's @chord is not checked — a melody note is as often a passing tone.
| Chord | The compiler notes |
|---|---|
<c' f' g'>1@chord(C) | f is not a tone of C: the chord's notes spell Csus4 — write @chord(Csus4), or keep C if f is meant as a tension. |
To name a whole song at once, Add Chord Track reads
the chords the score plays and writes them as a chords row
(from the command line, lysc harmonize suggests a chord track for a melody).
04
Shapes and diagrams
A shape is one character per string, from the low string up. Written after a name it
draws a diagram under the name, between the name and the staff — C(x32010) in a
row, @chord(C x32010) on a note — and the bars widen to make room.
| In a shape | Means |
|---|---|
| one character per string | from the low string up: x32010 is low E muted, A at the 3rd fret, D at the 2nd, G open, B at the 1st, high E open |
x | a muted string — drawn as an X above the grid, as LilyPond draws it |
0 or o | an open string — drawn as an O above the grid |
| a digit | the fret. A shape that reaches past the 4th fret is drawn from its lowest fret, labelled 3fr, 8fr … as LilyPond draws it |
-10- … -15- | a two-digit fret, with a - on each side: 8xx88-11, xx-10-12-13-11. A - between every string reads the same (x-x-10-12-13-11), so a chord chart's spelling can be pasted in |
Show the whole file
// A shape in parentheses after a row's chord draws its diagram under the name. One
// character per string from the low string: x mutes the string, 0 (or o) leaves it open,
// a digit is the fret. Frets 10-15 take a '-' on each side: 8xx88-11, xx-10-12-13-11.
time 4/4
part melody { clef treble }
section A {
melody { e''2 c2 | c2 b2 | c'2 g2 | }
chords prog { C(x32010) Am(x02210) | F(133211) G7(320001) | Cm(8xx88-11) Cm(xx-10-12-13-11) | }
}
form { ~A }
score { chords prog staff melody }Between dashes, exactly two digits are one fret, so frets 10, 9, 9 are written
10-9-9 (10-99 would be fret 99, and warns). Shapes are lower
case, like every value word. A shape of the wrong length, a doubled or dangling
-, or a fret above 15 warns (LYS1038), naming the fix; the name still draws.
On a note
The shape follows the name inside the parentheses — which is why @chord(C 7)
is C with a (too short) shape, not C7: write @chord(C7).
| Written | Draws |
|---|---|
@chord(C) | the name only |
@chord(C x32010) | the name and its diagram |
@chord(x32010) | the name the shape spells (C) and its diagram |
@diagram(x24442) | a diagram with no name at all — not a chord symbol, so it draws in every score but a chordDiagrams none one. .down puts it under the staff |
<g b d' f'>1@diagram | the chord's own notes, fretted on the part's strings (xx5431) — see On a fretted instrument |
Show the whole file
// On a note, the shape follows the name inside @chord( ): the name over its diagram.
// @diagram draws a diagram with no name at all; .down puts it under the staff.
time 4/4
part melody { clef treble }
section A {
melody { e''1@chord(C x32010) | c1@chord(Am7 x02010) | a'1@diagram(x02210) | b1@diagram(x24442).down | }
}
form { ~A }
score { staff melody }A bare @chord beside an @diagram(x32010) asks in two words what
@chord(C x32010) says in one: both draw, and it is warned (LYS1056) with that
spelling.
One chord, several instruments
A shape is routed by its string count, so one chord can carry a shape for each
instrument that might draw it — F(133211 2010) is the guitar's six strings
and the ukulele's four. When two tunings have the same count, a tuning word names which
shape is whose: F(guitar 133211 guitarDropD 333211). A shape that no score of
the file can draw warns (LYS1038): G(xx543) is a five-string shape, and in a
file whose scores draw guitar diagrams it would draw nothing, so the warning names the strings
the scores draw.
A symbol in a chords row takes an
@todo like a note — Am7@todo("or C?") —
and the preview rings it.
05
Which instrument, and every chord
A diagram is drawn for one tuning, strongest first:
- The part's instrument, when it is fretted: for an
@chordor achord(…)item, the part it is written in; for a row, the staff the row stands directly above. A guitar part's chords draw guitar diagrams in every score — the shape drawn is the one played. - Else the score's layout:
layout { chordTuning ukulele }— any word a tab'stuningtakes (guitar,ukulele,mandolin,guitarDropD,bass, …) — for the chords no fretted part owns: a piano's, a voice's, a lead-sheet row's. - Else the guitar (a violin or cello part too: bowed strings have no diagrams of their own).
Which chords draw at all is the layout's chordDiagrams: written
(the default) — a chord with a shape, written at it or listed in the file's shape table
(below); all — every chord; none — no diagram at all, written shapes
included, whatever the parts.
So one source prints a guitar book, a ukulele book and a piano score, each from its own
score:
layout uke { chordTuning ukulele }
layout piano { chordDiagrams none }
part melody { clef treble }
section A {
melody { c''1@chord(C x32010) | }
chords prog { F(guitar 133211 ukulele 2010) | }
}
form { A }
score { chords prog staff melody } // guitar: C and F
score uke { layout uke chords prog staff melody } // ukulele: F only
score piano { layout piano chords prog staff melody } // no diagrams
A shape the diagram's tuning cannot take (the guitar's six characters on a ukulele) is simply not used there.
chordDiagrams all — a diagram for every chord
Writing a shape on every chord of a song is tedious when the shapes are the usual ones.
layout { chordDiagrams all } makes every chord name in that score draw a
diagram: the shape written for its tuning, else its usual shape. The usual shape is LilyPond's
predefined one for that tuning (C x32010, F 133211; ukulele C
0003), else the first shape of Lily#'s own order. A chord with no shape at
all on the tuning warns once, asking you to write one.
Show the whole file
// `chordDiagrams all` draws a diagram for EVERY chord name: the shape written for the
// tuning, else its usual shape. The row stands above a ukulele staff, so the diagrams
// are the ukulele's - no chordTuning word needed for that.
layout { chordDiagrams all }
time 4/4
part uke { instrument ukulele "Ukulele" }
section A {
uke { g''4 e c e | a2 c | a4 f c f | g1 | }
chords prog { C | Am | F | G7(0212) | }
}
form { ~A }
score { chords prog staff uke }G7 above carries a written shape, 0212, and draws it; the other
three draw the ukulele's usual shapes. Without all, only G7 would have a
diagram.
Lily#'s own order reaches the ukulele too. Its rules are the guitar's — chord tones only,
the required tones present, four frets, four fingers — less one: on a re-entrant tuning
(the ukulele's high G, a banjo's drone) the lowest string is not the lowest note, so "the
root is lowest" is not asked. With that, the order opens on LilyPond's own ukulele shape for
every chord tried, and a chord LilyPond's table lacks still has a usual shape
(Cmaj9 is 4203). A chord no rule can voice on four strings
(C13) has none, and warns.
Listed chords — the shape table
Between "only what is written" and "everything" sits a list. The top-level block
chordShapes { … } — written once, beside time and key:
which shape a chord takes belongs to the piece, not to one edition of it — names the chords
that draw a diagram wherever they are named — in a row, in an @chord, in
a bare @chord by the name it derives — and the shape each draws, written as a
row writes its shapes (F 133211 2010, F guitar 133211 ukulele 2010);
a name alone draws the usual shape. A section NAME { … } block inside the table
applies to the chords written in that section, the rest to the whole song.
Show the whole file
// The shape table lists the chords that draw, wherever they are named - the piece's own
// data, written once at the top level. C draws its usual shape and F the listed xx3211 -
// except in the Chorus, where F is the barre and G draws too.
chordShapes { C F xx3211 section Chorus { F 133211 G } }
time 4/4
part melody { clef treble }
section Verse { melody { e''2 c2 | f2 d2 | } chords prog { C | F G | } }
section Chorus { melody { e''2 c2 | f2 d2 | } chords prog { C | F G | } }
form { ~Verse ~Chorus }
score { chords prog staff melody }Strongest first: the shape written at the chord, the section's entry, the song's, then
— under chordDiagrams all — the usual shape. A symbol that is no chord, a bad
shape and a chord listed twice (the last wins) are warnings and the rest of the table
stands; a section nothing declares warns. Inside the block, Ctrl+Space offers
the chords the file names that the table does not list yet.
06
A capo
The top-level line capo 3 puts a capo on the third fret, for the whole
piece (every shape in the music is a pressed shape, and a chord(…) item's sound
must not change from one score to another — so the capo is the piece's data, like
time, not a layout switch). The music still writes the sounding chords —
a row's Eb, @chord(Eb) — and everything a player reads follows the
capo:
- Every shape is the shape pressed above the capo.
Eb(x32010)is the C shape, and it is checked against the pressed chord (LYS1039); the usual shape of a chord is its pressed chord's, and the table's shapes are pressed shapes. - The printed name is the pressed chord's —
CforEb,GforBb— spelled in the key that many semitones below the key at the bar (in E major at capo 3 a soundingG#mprintsFm). A Roman degree is the sounding key's and is not moved. - "Capo 3" stands at the score's head, on the header's instrument line — in every score that prints diagrams or pressed names.
- A
chord(Eb x32010)item sounds three semitones higher — on the staff, in the MIDI and in the.lytwin, in every score.
What a name shows under the capo is layout { chordNames … }:
| Value | Prints, for a sounding E♭m7 at capo 3 |
|---|---|
shape (the default) | Cm7 — the chord the player presses |
sounding | E♭m7 — the chord that sounds |
both | E♭m7 (Cm7) — the sounding name, then the pressed one in parentheses, each with its own raised quality |
Show the whole file
// A capo on the third fret - the piece's own line. The music writes the SOUNDING chords
// (Eb, Ab, Bb7); the page prints what the player presses (C, F, G7), draws the pressed
// shapes, and says "Capo 3" at the head. `chordNames both` prints both: the sounding
// name, then the pressed one.
capo 3
layout { chordDiagrams all chordNames both }
title "Capo"
time 4/4
key ees major
part melody { clef treble }
section A {
melody { g''2 ees2 | aes2 f2 | bes2 d,2 | ees1 | }
chords prog { Eb | Ab | Bb7 | Eb | }
}
form { ~A }
score { chords prog staff melody }A fret is 1 to 11, and capo 0 is refused — leave the line out. Without a
capo the three chordNames values print the same name. The .ly twin
writes the pressed chords and
instrument = "Capo 3", so LilyPond prints the same page (it cannot spell
both, and warns); MusicXML keeps the sounding chord in its
<harmony> and the pressed shape in its <frame>.
Which fret? In VS Code, on a new line after capo the completion
ranks the frets 0 to 7 by how many of the file's chords would need a barre there, fewest
first (capo 3: 0 barre chords of 3); hovering the capo line shows the
same ranking, and Ctrl+Shift+Up / Down step the fret. You pick the
fret and write it — there is no capo auto.
07
The chord list
A songbook page opens with the chords it uses. layout { chordList true }
draws that row at the score's head, under the title and above the first system: every chord
the score names — its chords rows and every @chord — once, in
order of first appearance, as the name the score prints (a capo's pressed name) over the
diagram it draws there.
Show the whole file
// `chordList true` puts every chord the score names at its head, once each in order of
// first appearance, over the diagram it draws there - the songbook's "chords used" row.
layout { chordList true }
title "Chord list"
time 4/4
part melody { clef treble }
section A {
melody { e''2 c2 | f2 d2 | g2 b,2 | c1 | }
chords prog { C | F(xx3211) | G | C | }
}
form { ~A }
score { chords prog staff melody }A chord that draws no diagram in the score still shows its usual shape in the list — the
list is where a shape is looked up — on the layout's chordTuning, else the guitar; under
chordDiagrams none the names stand alone. The cells fill the fewest rows that
fit the line, with as nearly equal counts as those rows allow (16 chords where 12 would fit
make two rows of 8), and each row is centred on the page. The .ly twin writes
the rows as \markup lines before the score.
08
When a shape is not the chord
A written shape is checked against the name it is written for (LYS1039, a warning — the shape still draws). Two things are asked: every note it sounds is a tone of the chord, and every tone the chord needs is there. The root and the perfect fifth may be left out; the 3rd, the 7th, an altered fifth and the tensions may not. The bass is not checked — an inversion is an ordinary shape.
c'2@chord(C x02210) c'2@chord(C7 x3201x) |
| Shape | The compiler says |
|---|---|
@chord(C x02210) | 'x02210' sounds A C E, which is Am, not C (A is not a tone of C) - write @chord(Am x02210) or another shape. |
@chord(C7 x3201x) | 'x3201x' for C7 lacks B♭ (the 7th) - fret B♭ or write another shape. |
A shape with no name (diagram(x32010)), a lone @diagram and a
Roman degree in a row are not checked against a name. An @diagram(SHAPE) on a
<…> chord is checked against the chord's notes instead (LYS1057, on
Writing chords). Nine of LilyPond's predefined shapes
would fail this check (guitar D♯m xx4341, Faug and Baug among them), so Lily#
does not use them as usual shapes.
09
Let the editor write the shapes
You rarely need to type a shape. In VS Code, put the caret on a chord — an
@chord(Cm7) or a row's Cm7 — and press Ctrl+Shift+Down:
its usual shape is written and the diagram appears. Press it again to walk through the
other playable shapes, each one sounded as you go; Ctrl+Shift+Up walks back,
and at the usual shape removes it again. Hovering a chord shows what it would draw — for
a listed chord, the table's shape (guitar: xx3211 (layout)) — and which of the order
it is (shape 2 of 39). It works on a ukulele part too. Hard stretch shapes — fretted
frets five apart — are left out; with the caret on a written shape, Ctrl+Shift+PageUp /
PageDown walk the same shapes with the stretch ones stepped in among them, and the status bar marks one
(8xx546, stretch). On the chord's name that pair walks the key's seventh chords instead.
@chord(Cm7) writes its usual shape, then steps
through the others; Up at the usual shape removes it.With shapes for two instruments written (@chord(C x32010 0003)), the one under
the caret steps on its own instrument: C (ukulele): shape 2 of 39 (0403). On a
<…> chord, right-click → Add Guitar Diagram writes the shape its
notes are held by (On a fretted instrument).
The keys and the stepping order are on the editor page.