### 2.4.1 Common notation for fretted strings

This section discusses common notation that is unique to fretted string instruments.

#### References for fretted strings

Music for fretted string instruments is normally notated on a single staff, either in traditional music notation or in tablature. Sometimes the two types are combined, and it is especially common in popular music to use chord diagrams above a staff of traditional notation. The guitar and the banjo are transposing instruments, sounding an octave lower than written. Scores for these instruments should use the `"treble_8"` clef (or `\transposition c` to get correct MIDI output). Some other elements pertinent to fretted string instruments are covered elsewhere:

- Fingerings are indicated as shown in Fingering instructions.
- Instructions for Laissez vibrer ties as well as ties on arpeggios and tremolos can be found in Ties.
- Instructions for handling multiple voices can be found in Collision resolution.
- Instructions for indicating harmonics can be found in Harmonics.

#### See also

Notation Reference: Fingering instructions, Ties, Collision resolution, Instrument names, Writing music in parallel, Arpeggio, List of articulations, Clef, Instrument transpositions.

#### String number indications

The string on which a note should be played may be indicated by appending `\number` to a note.

>     \clef "treble_8"
>     c4\5 e\4 g2\3
>     <c,\5 e\4 g\3>1

When fingerings and string indications are used together, their placement can be controlled by the order in which the two items appear in the code only if they appear inside of an explicit chord: applied to whole chords or single notes outside of chords, fingerings are placed using a different mechanism.

>     \clef "treble_8"
>     g4\3-0
>     g-0\3
>     <g\3-0>
>     <g-0\3>

#### Selected Snippets

Controlling the placement of chord fingerings

The placement of fingering numbers can be controlled precisely. For fingering orientation to apply, you must use a chord construct <> even if it is a single note.

>     \relative c' {
>       \set fingeringOrientations = #'(left)
>       <c-1 e-3 a-5>4
>       \set fingeringOrientations = #'(down)
>       <c-1 e-3 a-5>4
>       \set fingeringOrientations = #'(down right up)
>       <c-1 e-3 a-5>4
>       \set fingeringOrientations = #'(up)
>       <c-1 e-3 a-5>4
>       \set fingeringOrientations = #'(left)
>       <c-1>2
>       \set fingeringOrientations = #'(down)
>       <e-3>2
>     }

Allowing fingerings to be printed inside the staff

By default, vertically oriented fingerings are positioned outside the staff. However, this behavior can be canceled. Note: you must use a chord construct <>, even if it is only a single note.

>     \relative c' {
>       <c-1 e-2 g-3 b-5>2
>       \override Fingering.staff-padding = #'()
>       <c-1 e-2 g-3 b-5>4 <g'-0>
>     }

#### See also

Notation Reference: Fingering instructions.

Snippets: Fretted strings.

Internals Reference: StringNumber, Fingering.

#### Default tablatures

Music for plucked string instruments is frequently notated using a finger/touch notation or tablature. In contrast to traditional notation pitches are not denoted with note heads, but by numbers (or letter-like symbols in historical intavolatura). The staff lines in tablature indicate the string on which the note is to be played, and a number placed on a staff line indicated the fret at which the corresponding string is to be pressed. Notes that are to be played simultaneously are vertically aligned.

By default, string 1 is the highest string, and corresponds to the top line on the `TabStaff`. The tuning of the `TabStaff` strings defaults to the standard guitar tuning (with 6 strings). The notes are printed as tablature, by using `TabStaff` and `TabVoice` contexts. A calligraphic tablature clef is added automatically.

>     \new TabStaff \relative c' {
>       a,8 a' <c e> a
>       d,8 a' <d f> a
>     }

Default tablatures do not contain any symbols for tone duration nor any other musical symbols such as e.g. expressive marks.

>     symbols = {
>       \time 3/4
>       c4-.^"Allegro" d( e)
>       f4-.\f g a^\fermata
>       \mark \default
>       c8_.\<\( c16 c~ c2\!
>       c'2.\prall\)
>     }

>     \score {
>       <<
>         \new Staff { \clef "G_8" \symbols }
>         \new TabStaff { \symbols }
>       >>
>     }

If all musical symbols used in traditional notation should also show up in tablature one has to apply the command `\tabFullNotation` in a `TabStaff`-context. Please bear in mind that half notes are double-stemmed in tablature in order to distinguish them from quarter notes.

>     symbols = {
>       \time 3/4
>       c4-.^"Allegro" d( e)
>       f4-.\f g a^\fermata
>       \mark \default
>       c8_.\<\( c16 c~ c2\!
>       c'2.\prall\)
>     }

>     \score {
>       \new TabStaff {
>         \tabFullNotation
>         \symbols
>       }
>     }

By default pitches are assigned to the lowest playing position on the fret-board (first position). Open strings are automatically preferred. If you would like a certain pitch to be played on a specific string you can add a string number indication to the pitch name. If you don’t want to have string number indications appear in traditional notation, you can override the respective stencil. Usually it will be more comfortable to define the playing position by using the value of `minimumFret`. The default value for minimumFret is 0.

Even when `minimumFret` is set, open strings are used whenever possible. This behaviour can be changed by setting `restrainOpenStrings` to `#t`.

>     \layout { \omit Voice.StringNumber }
>     \new StaffGroup <<
>        \new Staff \relative c {
>          \clef "treble_8"
>          \time 2/4
>          c16 d e f g4
>          c,16\5 d\5 e\4 f\4 g4\4
>          c,16 d e f g4
>        }
>        \new TabStaff \relative c {
>          c16 d e f g4
>          c,16\5 d\5 e\4 f\4 g4\4
>          \set TabStaff.minimumFret = #5
>          \set TabStaff.restrainOpenStrings = ##t
>          c,16 d e f g4
>        }
>     >>

Chord constructs can be repeated by the chord repetition symbol `q`. In combination with tabulatures, its behavior of removing string and finger numbers alongside with other events is cumbersome, so you’ll want to run

>     \chordRepeats #'(string-number-event fingering-event)

explicitly on music expressions in tabulature using Chord repetition. This particular command is so common that it is available as `\tabChordRepeats`.

>     guitar = \relative c' {
>       r8 <gis-2 cis-3 b-0>~ q4 q8~ q q4
>     }

>     \new StaffGroup <<
>       \new Staff {
>         \clef "treble_8"
>         \guitar
>       }
>       \new TabStaff {
>         \tabChordRepeats \guitar
>       }
>     >>

Ties over a line break are parenthesized by default. The same holds for the second alternative of a repeat.

>     ties = \relative c' {
>       \repeat volta 2 {
>         e2. f4~
>         f2 g2~
>       }
>       \alternative {
>          { g4 f2. }
>          { g4\repeatTie c,2. }
>       }
>       b1~
>       \break
>       b1
>       \bar "|."
>     }

>     \score {
>       <<
>         \new StaffGroup  <<
>           \new Staff {
>             \clef "treble_8"
>             \ties
>           }
>           \new TabStaff {
>             \ties
>           }
>         >>
>       >>
>       \layout {
>       indent = #0
>       ragged-right = ##t
>       }
>     }

The command `\hideSplitTiedTabNotes` cancels the behavior of engraving fret numbers in parentheses:

>     ties = \relative c' {
>       \repeat volta 2 {
>         e2. f4~
>         f2 g2~ }
>       \alternative {
>         { g4 f2. }
>         { g4\repeatTie c,2. }
>       }
>       b1~
>       \break
>       b1
>       \bar "|."
>     }

>     \score {
>       <<
>         \new StaffGroup  <<
>           \new Staff {
>             \clef "treble_8"
>             \ties
>           }
>           \new TabStaff {
>           \hideSplitTiedTabNotes
>             \ties
>           }
>         >>
>       >>
>       \layout {
>       indent = #0
>       ragged-right = ##t
>       }
>     }

Harmonic indications can be added to tablature notation as sounding pitches:

>     \layout { \omit Voice.StringNumber }
>     firstHarmonic = {
>       d'4\4\harmonic
>       g'4\3\harmonic
>       b'2\2\harmonic
>     }
>     \score {
>       <<
>         \new Staff {
>           \clef "treble_8"
>           \firstHarmonic
>         }
>         \new TabStaff { \firstHarmonic }
>       >>
>     }

Note that the command `\harmonic` must always be attached to single notes (possibly inside of a chord) instead of whole chords. It only makes sense for open-string harmonics in the 12th fret. All other harmonics should be calculated by LilyPond. This can be achieved by indicating the fret where a finger of the fretting hand should touch a string.

>     fretHarmonics = {
>       \harmonicByFret #5 d16\4
>       \harmonicByFret #4 d16\4
>       \harmonicByFret #3 d8\4
>       \harmonicByFret #5 <g\3 b\2>2.
>     }
>     \score {
>       <<
>         \new Staff {
>           \clef "treble_8"
>           \fretHarmonics
>         }
>         \new TabStaff { \fretHarmonics }
>       >>
>     }

Alternatively, harmonics can be computed by defining the ratio of string lengths above and below the harmonic fingering.

>     ratioHarmonics = {
>       \harmonicByRatio #1/2 <g\3 b\2 e'\1>4
>       \harmonicByRatio #1/3 <g\3 b\2 e'\1>4
>       \harmonicByRatio #1/4 { g8\3 b8\2 e'4\1 }
>     }
>     \score {
>       <<
>         \new Staff {
>           \clef "treble_8"
>           \ratioHarmonics
>         }
>         \new TabStaff { \ratioHarmonics }
>       >>
>     }

#### Selected Snippets

Stem and beam behavior in tablature

The direction of stems is controlled the same way in tablature as in traditional notation. Beams can be made horizontal, as shown in this example.

>     \new TabStaff {
>       \relative c {
>         \tabFullNotation
>         g16 b d g b d g b
>         \stemDown
>         \override Beam.concaveness = #10000
>         g,,16 b d g b d g b
>       }
>     }

Polyphony in tablature

Polyphony is created the same way in a `TabStaff` as in a regular staff.

>     upper = \relative c' {
>       \time 12/8
>       \key e \minor
>       \voiceOne
>       r4. r8 e, fis g16 b g e e' b c b a g fis e
>     }

>     lower = \relative c {
>       \key e \minor
>       \voiceTwo
>       r16 e d c b a g4 fis8 e fis g a b c
>     }

>     \score {
>       <<
>         \new StaffGroup = "tab with traditional" <<
>           \new Staff = "guitar traditional" <<
>             \clef "treble_8"
>             \context Voice = "upper" \upper
>             \context Voice = "lower" \lower
>           >>
>           \new TabStaff = "guitar tab" <<
>             \context TabVoice = "upper" \upper
>             \context TabVoice = "lower" \lower
>           >>
>         >>
>       >>
>     }

Open string harmonics in tablature

This snippet demonstrates open-string harmonics

>     openStringHarmonics = {
>       %first harmonic
>       \harmonicByFret #12 e,2\6_\markup{"1st harm."}
>       \harmonicByRatio #1/2 e,\6
>       %second harmonic
>       \harmonicByFret #7 e,\6_\markup{"2nd harm. - - - -"}
>       \harmonicByRatio #1/3 e,\6
>       \harmonicByFret #19 e,\6
>       \harmonicByRatio #2/3 e,\6
>       %\harmonicByFret #19 < e,\6 a,\5 d\4 >
>       %\harmonicByRatio #2/3 < e,\6 a,\5 d\4 >
>       %third harmonic
>       \harmonicByFret #5 e,\6_\markup{"3rd harm. - - - -"}
>       \harmonicByRatio #1/4 e,\6
>       \harmonicByFret #24 e,\6
>       \harmonicByRatio #3/4 e,\6
>       \break
>       %fourth harmonic
>       \harmonicByFret #4 e,\6_\markup{"4th harm. - - - - - - - - - - - - -"}
>       \harmonicByRatio #1/5 e,\6
>       \harmonicByFret #9 e,\6
>       \harmonicByRatio #2/5 e,\6
>       \harmonicByFret #16 e,\6
>       \harmonicByRatio #3/5 e,\6
>       %fifth harmonic
>       \harmonicByFret #3 e,\6_\markup{"5th harm."}
>       \harmonicByRatio #1/6 e,\6
>       \break
>       %sixth harmonic
>       \harmonicByFret #2.7 e,\6_\markup{"6th harm."}
>       \harmonicByRatio #1/7 e,\6
>       %seventh harmonic
>       \harmonicByFret #2.3 e,\6_\markup{"7th harm."}
>       \harmonicByRatio #1/8 e,\6
>       %eighth harmonic
>       \harmonicByFret #2 e,\6_\markup{"8th harm."}
>       \harmonicByRatio #1/9 e,\6
>     }

>     \score {
>       <<
>         \new Staff {
>           \new Voice {
>             \clef "treble_8"
>             \openStringHarmonics
>           }
>         }
>         \new TabStaff {
>           \new TabVoice {
>             \openStringHarmonics
>           }
>         }
>       >>
>     }

Fretted-string harmonics in tablature

Demonstrates fretted-string harmonics in tablature

>     pinchedHarmonics = {
>        \textSpannerDown
>        \override TextSpanner.bound-details.left.text =
>           \markup {\halign #-0.5 \teeny "PH" }
>           \override TextSpanner.style =
>              #'dashed-line
>        \override TextSpanner.dash-period = #0.6
>        \override TextSpanner.bound-details.right.attach-dir = #1
>        \override TextSpanner.bound-details.right.text =
>           \markup { \draw-line #'(0 . 1) }
>        \override TextSpanner.bound-details.right.padding = #-0.5
>     }

>     harmonics = {
>       %artificial harmonics (AH)
>       \textLengthOn
>       <\parenthesize b b'\harmonic>4_\markup{ \teeny "AH 16" }
>       <\parenthesize g g'\harmonic>4_\markup{ \teeny "AH 17" }
>       <\parenthesize d' d''\harmonic>2_\markup{ \teeny "AH 19" }
>       %pinched harmonics (PH)
>       \pinchedHarmonics
>       <a'\harmonic>2\startTextSpan
>       <d''\harmonic>4
>       <e'\harmonic>4\stopTextSpan
>       %tapped harmonics (TH)
>       <\parenthesize g\4 g'\harmonic>4_\markup{ \teeny "TH 17" }
>       <\parenthesize a\4 a'\harmonic>4_\markup{ \teeny "TH 19" }
>       <\parenthesize c'\3 c''\harmonic>2_\markup{ \teeny "TH 17" }
>       %touch harmonics (TCH)
>       a4( <e''\harmonic>2. )_\markup{ \teeny "TCH" }
>     }

>     frettedStrings = {
>       %artificial harmonics (AH)
>       \harmonicByFret #4 g4\3
>       \harmonicByFret #5 d4\4
>       \harmonicByFret #7 g2\3
>       %pinched harmonics (PH)
>       \harmonicByFret #7 d2\4
>       \harmonicByFret #5 d4\4
>       \harmonicByFret #7 a4\5
>       %tapped harmonics (TH)
>       \harmonicByFret #5 d4\4
>       \harmonicByFret #7 d4\4
>       \harmonicByFret #5 g2\3
>       %touch harmonics (TCH)
>       a4 \harmonicByFret #9 g2.\3
>     }

>     \score {
>       <<
>         \new Staff {
>           \new Voice {
>             \clef "treble_8"
>             \harmonics
>           }
>         }
>         \new TabStaff {
>           \new TabVoice {
>             \frettedStrings
>           }
>         }
>       >>
>     }

Slides in tablature

Slides can be typeset in both `Staff` and `TabStaff` contexts:

>     slides = {
>       c'8\3(\glissando d'8\3)
>       c'8\3\glissando d'8\3
>       \hideNotes
>       \grace { g16\glissando }
>       \unHideNotes
>       c'4\3
>       \afterGrace d'4\3\glissando {
>       \stemDown \hideNotes
>       g16 }
>       \unHideNotes
>     }

>     \score {
>       <<
>         \new Staff { \clef "treble_8" \slides }
>         \new TabStaff { \slides }
>       >>
>       \layout {
>         \context {
>           \Score
>           \override Glissando.minimum-length = #4
>           \override Glissando.springs-and-rods =
>                               #ly:spanner::set-spacing-rods
>           \override Glissando.thickness = #2
>         }
>       }
>     }

Chord glissando in tablature

Slides for chords can be indicated in both `Staff` and `TabStaff`. String numbers are necessary for `TabStaff` because automatic string calculations are different for chords and for single notes.

>     myMusic = \relative c' {
>       <c\3 e\2 g\1>1 \glissando <f\3 a\2 c\1>
>     }

>     \score {
>       <<
>         \new Staff {
>           \clef "treble_8"
>           \myMusic
>         }
>         \new TabStaff {
>           \myMusic
>         }
>       >>
>     }

Hammer on and pull off

Hammer-on and pull-off can be obtained using slurs.

>     \new TabStaff {
>       \relative c' {
>         d4( e\2)
>         a( g)
>       }
>     }

Hammer on and pull off using voices

The arc of hammer-on and pull-off is upwards in voices one and three and downwards in voices two and four:

>     \new TabStaff {
>       \relative c' {
>         << { \voiceOne g2( a) }
>         \\ { \voiceTwo a,( b) }
>         >> \oneVoice
>       }
>     }

Hammer on and pull off using chords

When using hammer-on or pull-off with chorded notes, only a single arc is drawn. However ‘double arcs’ are possible by setting the `doubleSlurs` property to `#t`.

>     \new TabStaff {
>       \relative c' {
>         % chord hammer-on and pull-off
>         \set doubleSlurs = ##t
>         <g' b>8( <a c> <g b>)
>       }
>     }

#### See also

Notation Reference: Chord repetition, Glissando, Harmonics, Stems, Written-out repeats.

Snippets: Fretted strings.

Internals Reference: TabNoteHead, TabStaff, TabVoice, Beam.

#### Known issues and warnings

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

In order to handle `\partcombine`, a `TabStaff` must use specially-created voices:

>     melodia = \partcombine { e4 g g g } { e4 e e e }
>     <<
>       \new TabStaff <<
>         \new TabVoice = "one" s1
>         \new TabVoice = "two" s1
>         \new TabVoice = "shared" s1
>         \new TabVoice = "solo" s1
>         { \melodia }
>       >>
>     >>

Guitar special effects are limited to harmonics and slides.

#### Custom tablatures

LilyPond tablature automatically calculates the fret for a note based on the string to which the note is assigned. In order to do this, the tuning of the strings must be specified. The tuning of the strings is given in the `stringTunings` property.

LilyPond comes with predefined string tunings for banjo, mandolin, guitar, bass guitar, ukulele, violin, viola, cello, and double bass. LilyPond automatically sets the correct transposition for predefined tunings. The following example is for bass guitar, which sounds an octave lower than written.

>     <<
>       \new Voice \with {
>         \omit StringNumber
>       } {
>         \clef "bass_8"
>         \relative c, {
>           c4 d e f
>         }
>       }
>       \new TabStaff \with {
>         stringTunings = #bass-tuning
>       } {
>         \relative c, {
>           c4 d e f
>         }
>       }
>     >>

The default string tuning is `guitar-tuning`, which is the standard EADGBE tuning. Some other predefined tunings are `guitar-open-g-tuning`, `mandolin-tuning` and `banjo-open-g-tuning`. The predefined string tunings are found in ‘`ly/string-tunings-init.ly`’.

Any desired string tuning can be created. The `\stringTuning` function can be used to define a string tuning which can be used to set `stringTunings` for the current context.

Its argument is a chord construct defining the pitches of each string in the tuning. The chord construct must be in absolute octave mode, see Absolute octave entry. The string with the highest number (generally the lowest string) must come first in the chord. For example, we can define a string tuning for a four-string instrument with pitches of `a''`, `d''`, `g'`, and `c'`:

>     mynotes = {
>       c'4 e' g' c'' |
>       e''4 g'' b'' c'''
>     }

>     <<
>       \new Staff {
>         \clef treble
>         \mynotes
>       }
>       \new TabStaff {
>         \set Staff.stringTunings = \stringTuning <c' g' d'' a''>
>         \mynotes
>       }
>     >>

The `stringTunings` property is also used by `FretBoards` to calculate automatic fret diagrams.

String tunings are used as part of the hash key for predefined fret diagrams (see Predefined fret diagrams).

The previous example could also be written as follows:

>     custom-tuning = \stringTuning <c' g' d'' a''>

>     mynotes = {
>       c'4 e' g' c'' |
>       e''4 g'' b'' c'''
>     }

>     <<
>       \new Staff {
>         \clef treble
>         \mynotes
>       }
>       \new TabStaff {
>         \set TabStaff.stringTunings = #custom-tuning
>         \mynotes
>       }
>     >>

Internally, a string tuning is a Scheme list of string pitches, one for each string, ordered by string number from 1 to N, where string 1 is at the top of the tablature staff and string N is at the bottom. This ordinarily results in ordering from highest pitch to lowest pitch, but some instruments (e.g. ukulele) do not have strings ordered by pitch.

A string pitch in a string tuning list is a LilyPond pitch object. Pitch objects are created with the Scheme function `ly:make-pitch` (see Scheme functions).

`\stringTuning` creates such an object from chord input.

LilyPond automatically calculates the number of lines in the `TabStaff` and the number of strings in an automatically calculated `FretBoard` as the number of elements in `stringTunings`.

To let all TabStaff contexts use the same custom tuning by default, you can use

>     \layout {
>       \context {
>         \TabStaff
>         stringTunings = \stringTuning <c' g' d'' a''>
>       }
>     }

A modern tab clef can also be used.

>     \new TabStaff {
>       \clef moderntab
>       <a, e a>1
>       \break
>       \clef tab
>       <a, e a>1
>     }

The modern tab clef supports tablatures from 4 to 7 strings.

#### See also

Notation Reference: Absolute octave entry, Predefined fret diagrams, Scheme functions.

Installed Files: ‘`ly/string-tunings-init.ly`’, ‘`scm/tablature.scm`’.

Snippets: Fretted strings.

Internals Reference: Tab_note_heads_engraver.

#### Known issues and warnings

Automatic tablature calculations do not work properly in most cases for instruments where string pitches do not vary monotonically with string number, such as ukuleles.

#### Fret diagram markups

Fret diagrams can be added to music as a markup to the desired note. The markup contains information about the desired fret diagram. 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 syntax of the different markup strings used to define fret diagrams are found at Instrument Specific Markup.

The standard fret diagram markup string indicates the string number and the fret number for each dot to be placed on the string. In addition, open and unplayed (muted) strings can be indicated.

>     <<
>       \new ChordNames {
>         \chordmode {
>           c1 d:m
>         }
>       }
>       \new Staff {
>         \clef "treble_8"
>         <c e g c' e'>1^\markup {
>           \fret-diagram #"6-x;5-3;4-2;3-o;2-1;1-o;"
>         }
>         <d a d' f'>1^\markup {
>           \fret-diagram #"6-x;5-x;4-o;3-2;2-3;1-1;"
>         }
>       }
>     >>

Barre indications can be added to the diagram from the fret-diagram markup string.

>     <<
>       \new ChordNames {
>          \chordmode {
>            f1 g
>          }
>       }
>       \new Staff {
>         \clef "treble_8"
>         <f, c f a c' f'>1^\markup {
>           \fret-diagram #"c:6-1-1;6-1;5-3;4-3;3-2;2-1;1-1;"
>         }
>         <g, d g b d' g'>1^\markup {
>           \fret-diagram #"c:6-1-3;6-3;5-5;4-5;3-4;2-3;1-3;"
>         }
>       }
>     >>

The size of the fret diagram, and the number of frets in the diagram can be changed in the fret-diagram markup string.

>     <<
>       \new ChordNames {
>          \chordmode {
>            f1 g
>          }
>       }
>       \new Staff {
>         \clef "treble_8"
>         <f, c f a c' f'>1^\markup {
>           \fret-diagram #"s:1.5;c:6-1-1;6-1;5-3;4-3;3-2;2-1;1-1;"
>         }
>         <g, b, d g b g'>1^\markup {
>           \fret-diagram #"h:6;6-3;5-2;4-o;3-o;2-o;1-3;"
>         }
>       }
>     >>

The number of strings in a fret diagram can be changed to accommodate different instruments such as banjos and ukuleles with the fret-diagram markup string.

>     <<
>       \new ChordNames {
>         \chordmode {
>           a1
>         }
>       }
>       \new Staff {
>         % An 'A' chord for ukulele
>         a'1^\markup {
>           \fret-diagram #"w:4;4-2-2;3-1-1;2-o;1-o;"
>         }
>       }
>     >>

Fingering indications can be added, and the location of fingering labels can be controlled by the fret-diagram markup string.

>     <<
>       \new ChordNames {
>         \chordmode {
>           c1 d:m
>         }
>       }
>       \new Staff {
>         \clef "treble_8"
>         <c e g c' e'>1^\markup {
>           \fret-diagram #"f:1;6-x;5-3-3;4-2-2;3-o;2-1-1;1-o;"
>         }
>         <d a d' f'>1^\markup {
>           \fret-diagram #"f:2;6-x;5-x;4-o;3-2-2;2-3-3;1-1-1;"
>         }
>       }
>     >>

Dot radius and dot position can be controlled with the fret-diagram markup string.

>     <<
>       \new ChordNames {
>         \chordmode {
>           c1 d:m
>         }
>       }
>       \new Staff {
>         \clef "treble_8"
>         <c e g c' e'>1^\markup {
>           \fret-diagram #"d:0.35;6-x;5-3;4-2;3-o;2-1;1-o;"
>         }
>         <d a d' f'>1^\markup {
>           \fret-diagram #"p:0.2;6-x;5-x;4-o;3-2;2-3;1-1;"
>         }
>       }
>     >>

The fret-diagram-terse markup string omits string numbers; the string number is implied by the presence of semicolons. There is one semicolon for each string in the diagram. The first semicolon corresponds to the highest string number and the last semicolon corresponds to the first string. Mute strings, open strings, and fret numbers can be indicated.

>     <<
>       \new ChordNames {
>         \chordmode {
>           c1 d:m
>         }
>       }
>       \new Staff {
>         \clef "treble_8"
>         <c e g c' e'>1^\markup {
>           \fret-diagram-terse #"x;3;2;o;1;o;"
>         }
>         <d a d' f'>1^\markup {
>           \fret-diagram-terse #"x;x;o;2;3;1;"
>         }
>       }
>     >>

Barre indicators can be included in the fret-diagram-terse markup string.

>     <<
>       \new ChordNames {
>         \chordmode {
>           f1 g
>         }
>       }
>       \new Staff {
>         \clef "treble_8"
>         <f, c f a c' f'>1^\markup {
>           \fret-diagram-terse #"1-(;3;3;2;1;1-);"
>         }
>         <g, d g b d' g'>1^\markup {
>           \fret-diagram-terse #"3-(;5;5;4;3;3-);"
>         }
>       }
>     >>

Fingering indications can be included in the fret-diagram-terse markup string.

>     <<
>       \new ChordNames {
>         \chordmode {
>           c1 d:m
>         }
>       }
>       \new Staff {
>         \override Voice.TextScript.fret-diagram-details.finger-code = #'below-string
>         \clef "treble_8"
>         <c e g c' e'>1^\markup {
>           \fret-diagram-terse #"x;3-3;2-2;o;1-1;o;"
>         }
>         <d a d' f'>1^\markup {
>           \fret-diagram-terse #"x;x;o;2-2;3-3;1-1;"
>         }
>       }
>     >>

Other fret diagram properties must be adjusted using `\override` when using the fret-diagram-terse markup.

The fret-diagram-verbose markup string is in the format of a Scheme list. Each element of the list indicates an item to be placed on the fret diagram.

>     <<
>         \new ChordNames {
>           \chordmode {
>             c1 d:m
>           }
>         }
>       \new Staff {
>         \clef "treble_8"
>         <c e g c' e'>1^\markup {
>           \fret-diagram-verbose #'(
>             (mute 6)
>             (place-fret 5 3)
>             (place-fret 4 2)
>             (open 3)
>             (place-fret 2 1)
>             (open 1)
>           )
>         }
>         <d a d' f'>1^\markup {
>           \fret-diagram-verbose #'(
>             (mute 6)
>             (mute 5)
>             (open 4)
>             (place-fret 3 2)
>             (place-fret 2 3)
>             (place-fret 1 1)
>           )
>         }
>       }
>     >>

Fingering indications and barres can be included in a fret-diagram-verbose markup string. Unique to the fret-diagram-verbose interface is a capo indication that can be placed on the fret diagram. The capo indication is a thick bar that covers all strings. The fret with the capo will be the lowest fret in the fret diagram.

>     <<
>         \new ChordNames {
>           \chordmode {
>             f1 g c
>           }
>         }
>       \new Staff {
>         \clef "treble_8"
>         \override Voice.TextScript.fret-diagram-details.finger-code = #'below-string
>         <f, c f a c' f'>1^\markup {
>           \fret-diagram-verbose #'(
>             (place-fret 6 1)
>             (place-fret 5 3)
>             (place-fret 4 3)
>             (place-fret 3 2)
>             (place-fret 2 1)
>             (place-fret 1 1)
>             (barre 6 1 1)
>           )
>         }
>         <g, b, d g b g'>1^\markup {
>           \fret-diagram-verbose #'(
>             (place-fret 6 3 2)
>             (place-fret 5 2 1)
>             (open 4)
>             (open 3)
>             (open 2)
>             (place-fret 1 3 3)
>           )
>         }
>         <c g c' e' g'>1^\markup {
>           \fret-diagram-verbose #'(
>             (capo 3)
>             (mute 6)
>             (place-fret 4 5 1)
>             (place-fret 3 5 2)
>             (place-fret 2 5 3)
>           )
>         }
>       }
>     >>

All other fret diagram properties must be adjusted using `\override` when using the fret-diagram-verbose markup.

The graphical layout of a fret diagram can be customized according to user preference through the properties of the `fret-diagram-interface`. Details are found at fret-diagram-interface. For a fret diagram markup, the interface properties belong to `Voice.TextScript`.

#### Selected Snippets

Changing fret orientations

Fret diagrams can be oriented in three ways. By default the top string or fret in the different orientations will be aligned.

>     \include "predefined-guitar-fretboards.ly"

>     <<
>       \chords {
>         c1
>         c1
>         c1
>       }
>       \new FretBoards {
>         \chordmode {
>           c1
>           \override FretBoard.fret-diagram-details.orientation =
>             #'landscape
>           c1
>           \override FretBoard.fret-diagram-details.orientation =
>             #'opposing-landscape
>           c1
>         }
>       }
>       \new Voice {
>         c'1
>         c'1
>         c'
>       }
>     >>

Customizing markup fret diagrams

Fret diagram properties can be set through `'fret-diagram-details`. For markup fret diagrams, overrides can be applied to the `Voice.TextScript` object or directly to the markup.

>     <<
>       \chords { c1 | c | c | d }

>       \new Voice = "mel" {
>         \textLengthOn
>         % Set global properties of fret diagram
>         \override TextScript.size = #'1.2
>         \override TextScript.fret-diagram-details.finger-code = #'in-dot
>         \override TextScript.fret-diagram-details.dot-color = #'white

>         %% C major for guitar, no barre, using defaults
>            % terse style
>         c'1^\markup { \fret-diagram-terse #"x;3-3;2-2;o;1-1;o;" }

>         %% C major for guitar, barred on third fret
>            % verbose style
>            % size 1.0
>            % roman fret label, finger labels below string, straight barre
>         c'1^\markup {
>           % standard size
>           \override #'(size . 1.0) {
>             \override #'(fret-diagram-details . (
>                          (number-type . roman-lower)
>                          (finger-code . in-dot)
>                          (barre-type . straight))) {
>               \fret-diagram-verbose #'((mute 6)
>                                        (place-fret 5 3 1)
>                                        (place-fret 4 5 2)
>                                        (place-fret 3 5 3)
>                                        (place-fret 2 5 4)
>                                        (place-fret 1 3 1)
>                                        (barre 5 1 3))
>             }
>           }
>         }

>         %% C major for guitar, barred on third fret
>            % verbose style
>            % landscape orientation, arabic numbers, M for mute string
>            % no barre, fret label down or left, small mute label font
>         c'1^\markup {
>           \override #'(fret-diagram-details . (
>                        (finger-code . below-string)
>                        (number-type . arabic)
>                        (label-dir . -1)
>                        (mute-string . "M")
>                        (orientation . landscape)
>                        (barre-type . none)
>                        (xo-font-magnification . 0.4)
>                        (xo-padding . 0.3))) {
>             \fret-diagram-verbose #'((mute 6)
>                                      (place-fret 5 3 1)
>                                      (place-fret 4 5 2)
>                                      (place-fret 3 5 3)
>                                      (place-fret 2 5 4)
>                                      (place-fret 1 3 1)
>                                      (barre 5 1 3))
>           }
>         }

>         %% simple D chord
>            % terse style
>            % larger dots, centered dots, fewer frets
>            % label below string
>         d'1^\markup {
>           \override #'(fret-diagram-details . (
>                        (finger-code . below-string)
>                        (dot-radius . 0.35)
>                        (dot-position . 0.5)
>                        (fret-count . 3))) {
>             \fret-diagram-terse #"x;x;o;2-1;3-2;2-3;"
>           }
>         }
>       }
>     >>

#### See also

Notation Reference: Instrument Specific Markup.

Snippets: Fretted strings.

Internals Reference: fret-diagram-interface.

#### Predefined fret diagrams

Fret diagrams can be displayed using the `FretBoards` context. By default, the `FretBoards` context will display fret diagrams that are stored in a lookup table:

>     \include "predefined-guitar-fretboards.ly"
>     \new FretBoards {
>       \chordmode {
>         c1 d
>       }
>     }

The default predefined fret diagrams are contained in the file ‘`predefined-guitar-fretboards.ly`’. Fret diagrams are stored based on the pitches of a chord and the value of `stringTunings` that is currently in use. ‘`predefined-guitar-fretboards.ly`’ contains predefined fret diagrams only for `guitar-tuning`. Predefined fret diagrams can be added for other instruments or other tunings by following the examples found in ‘`predefined-guitar-fretboards.ly`’.

Fret diagrams for the ukulele are contained in the file
‘`predefined-ukulele-fretboards.ly`’.

>     \include "predefined-ukulele-fretboards.ly"

>     myChords = \chordmode { a1 a:m a:aug }

>     \new ChordNames {
>       \myChords
>     }

>     \new FretBoards {
>       \set Staff.stringTunings = #ukulele-tuning
>       \myChords
>     }

Fret diagrams for the mandolin are contained in the file
‘`predefined-mandolin-fretboards.ly`’.

>     \include "predefined-mandolin-fretboards.ly"

>     myChords = \chordmode { c1 c:m7.5- c:aug }

>     \new ChordNames {
>       \myChords
>     }

>     \new FretBoards {
>       \set Staff.stringTunings = #mandolin-tuning
>       \myChords
>     }

Chord pitches can be entered either as simultaneous music or using chord mode (see Chord mode overview).

>     \include "predefined-guitar-fretboards.ly"
>     \new FretBoards {
>       \chordmode { c1 }
>       <c' e' g'>1
>     }

It is common that both chord names and fret diagrams are displayed together. This is achieved by putting a `ChordNames` context in parallel with a `FretBoards` context and giving both contexts the same music.

>     \include "predefined-guitar-fretboards.ly"
>     mychords = \chordmode{
>       c1 f g
>     }

>     <<
>       \new ChordNames {
>         \mychords
>       }
>       \new FretBoards {
>         \mychords
>       }
>     >>

Predefined fret diagrams are transposable, as long as a diagram for the transposed chord is stored in the fret diagram table.

>     \include "predefined-guitar-fretboards.ly"
>     mychords = \chordmode{
>       c1 f g
>     }

>     mychordlist = {
>       \mychords
>       \transpose c e { \mychords }
>     }
>     <<
>       \new ChordNames {
>         \mychordlist
>       }
>       \new FretBoards {
>         \mychordlist
>       }
>     >>

The predefined fret diagram table for guitar contains eight chords (major, minor, augmented, diminished, dominant seventh, major seventh, minor seventh, dominant ninth) for each of 17 keys. The predefined fret diagram table for ukulele contains these chords plus an additional three chords (major sixth, suspended second, and suspended fourth). A complete list of the predefined fret diagrams is shown in Predefined fretboard diagrams. If there is no entry in the table for a chord, the FretBoards engraver will calculate a fret-diagram using the automatic fret diagram functionality described in Automatic fret diagrams.

>     \include "predefined-guitar-fretboards.ly"
>     mychords = \chordmode{
>       c1 c:maj9
>     }

>     <<
>       \new ChordNames {
>         \mychords
>       }
>       \new FretBoards {
>         \mychords
>       }
>     >>

Fret diagrams can be added to the fret diagram table. To add a diagram, you must specify the hash table for the diagram, the chord for the diagram, the tuning to be used, and a definition for the diagram. Normally, the hash table will be default-fret-table. The diagram definition can be either a fret-diagram-terse definition string or a fret-diagram-verbose marking list.

>     \include "predefined-guitar-fretboards.ly"

>     \storePredefinedDiagram #default-fret-table
>                             \chordmode { c:maj9 }
>                             #guitar-tuning
>                             #"x;3-2;o;o;o;o;"

>     mychords = \chordmode {
>       c1 c:maj9
>     }

>     <<
>       \new ChordNames {
>         \mychords
>       }
>       \new FretBoards {
>         \mychords
>       }
>     >>

Different fret diagrams for the same chord name can be stored using different octaves of pitches. The different octave should be at least two octaves above or below the default octave, because the octaves above and below the default octave are used for transposing fretboards.

>     \include "predefined-guitar-fretboards.ly"

>     \storePredefinedDiagram #default-fret-table
>                             \chordmode { c'' }
>                             #guitar-tuning
>                             #(offset-fret 2 (chord-shape 'bes guitar-tuning))

>     mychords = \chordmode {
>       c1 c''
>     }

>     <<
>       \new ChordNames {
>         \mychords
>       }
>       \new FretBoards {
>         \mychords
>       }
>     >>

In addition to fret diagrams, LilyPond stores an internal list of chord shapes. The chord shapes are fret diagrams that can be shifted along the neck to different positions to provide different chords. Chord shapes can be added to the internal list and then used to define predefined fret diagrams. Because they can be moved to various positions on the neck, chord shapes will normally not contain any open strings. Like fret diagrams, chord shapes can be entered as either fret-diagram-terse strings or fret-diagram-verbose marking lists.

>     \include "predefined-guitar-fretboards.ly"

>     % Add a new chord shape

>     \addChordShape #'powerf #guitar-tuning #"1-1;3-3;3-4;x;x;x;"

>     % add some new chords based on the power chord shape

>     \storePredefinedDiagram #default-fret-table
>                             \chordmode { f'' }
>                             #guitar-tuning
>                             #(chord-shape 'powerf guitar-tuning)
>     \storePredefinedDiagram #default-fret-table
>                             \chordmode { g'' }
>                             #guitar-tuning
>                             #(offset-fret 2 (chord-shape 'powerf guitar-tuning))

>     mychords = \chordmode{
>       f1 f'' g g''
>     }

>     <<
>       \new ChordNames {
>         \mychords
>       }
>       \new FretBoards {
>         \mychords
>       }
>     >>

The graphical layout of a fret diagram can be customized according to user preference through the properties of the `fret-diagram-interface`. Details are found at fret-diagram-interface. For a predefined fret diagram, the interface properties belong to `FretBoards.FretBoard`.

#### Selected Snippets

Customizing fretboard fret diagrams

Fret diagram properties can be set through `'fret-diagram-details`. For FretBoard fret diagrams, overrides are applied to the `FretBoards.FretBoard` object. Like `Voice`, `FretBoards` is a bottom level context, therefore can be omitted in property overrides.

>     \include "predefined-guitar-fretboards.ly"
>     \storePredefinedDiagram #default-fret-table \chordmode { c' }
>                             #guitar-tuning
>                             #"x;1-1-(;3-2;3-3;3-4;1-1-);"
>     <<
>       \new ChordNames {
>         \chordmode { c1 | c | c | d }
>       }
>       \new FretBoards {
>         % Set global properties of fret diagram
>         \override FretBoards.FretBoard.size = #'1.2
>         \override FretBoard.fret-diagram-details.finger-code = #'in-dot
>         \override FretBoard.fret-diagram-details.dot-color = #'white
>         \chordmode {
>           c
>           \once \override FretBoard.size = #'1.0
>           \once \override FretBoard.fret-diagram-details.barre-type = #'straight
>           \once \override FretBoard.fret-diagram-details.dot-color = #'black
>           \once \override FretBoard.fret-diagram-details.finger-code = #'below-string
>           c'
>           \once \override FretBoard.fret-diagram-details.barre-type = #'none
>           \once \override FretBoard.fret-diagram-details.number-type = #'arabic
>           \once \override FretBoard.fret-diagram-details.orientation = #'landscape
>           \once \override FretBoard.fret-diagram-details.mute-string = #"M"
>           \once \override FretBoard.fret-diagram-details.label-dir = #LEFT
>           \once \override FretBoard.fret-diagram-details.dot-color = #'black
>           c'
>           \once \override FretBoard.fret-diagram-details.finger-code = #'below-string
>           \once \override FretBoard.fret-diagram-details.dot-radius = #0.35
>           \once \override FretBoard.fret-diagram-details.dot-position = #0.5
>           \once \override FretBoard.fret-diagram-details.fret-count = #3
>           d
>         }
>       }
>       \new Voice {
>         c'1 | c' | c' | d'
>       }
>     >>

Defining predefined fretboards for other instruments

Predefined fret diagrams can be added for new instruments in addition to the standards used for guitar. This file shows how this is done by defining a new string-tuning and a few predefined fretboards for the Venezuelan cuatro.

This file also shows how fingerings can be included in the chords used as reference points for the chord lookup, and displayed in the fret diagram and the `TabStaff`, but not the music.

These fretboards are not transposable because they contain string information. This is planned to be corrected in the future.

>     % add FretBoards for the Cuatro
>     %   Note: This section could be put into a separate file
>     %      predefined-cuatro-fretboards.ly
>     %      and \included into each of your compositions

>     cuatroTuning = #`(,(ly:make-pitch 0 6 0)
>                       ,(ly:make-pitch 1 3 SHARP)
>     		  ,(ly:make-pitch 1 1 0)
>     		  ,(ly:make-pitch 0 5 0))

>     dSix = { <a\4 b\1 d\3 fis\2> }
>     dMajor = { <a\4 d\1 d\3 fis \2> }
>     aMajSeven = { <a\4 cis\1 e\3 g\2> }
>     dMajSeven = { <a\4 c\1 d\3 fis\2> }
>     gMajor = { <b\4 b\1 d\3 g\2> }

>     \storePredefinedDiagram #default-fret-table \dSix
>                             #cuatroTuning
>                             #"o;o;o;o;"
>     \storePredefinedDiagram #default-fret-table \dMajor
>                             #cuatroTuning
>                             #"o;o;o;3-3;"
>     \storePredefinedDiagram #default-fret-table \aMajSeven
>                             #cuatroTuning
>                             #"o;2-2;1-1;2-3;"
>     \storePredefinedDiagram #default-fret-table \dMajSeven
>                             #cuatroTuning
>                             #"o;o;o;1-1;"
>     \storePredefinedDiagram #default-fret-table \gMajor
>                             #cuatroTuning
>                             #"2-2;o;1-1;o;"

>     % end of potential include file /predefined-cuatro-fretboards.ly

>     #(set-global-staff-size 16)

>     primerosNames = \chordmode {
>       d:6 d a:maj7 d:maj7
>       g
>     }
>     primeros = {
>       \dSix \dMajor \aMajSeven \dMajSeven
>       \gMajor
>     }

>     \score {
>       <<
>         \new ChordNames {
>           \set chordChanges = ##t
>           \primerosNames
>         }

>         \new Staff {
>           \new Voice \with {
>             \remove "New_fingering_engraver"
>           }
>           \relative c'' {
>             \primeros
>           }
>         }

>         \new FretBoards {
>           \set Staff.stringTunings = #cuatroTuning
>     %      \override FretBoard
>     %        #'(fret-diagram-details string-count) = #'4
>           \override FretBoard.fret-diagram-details.finger-code = #'in-dot
>           \primeros
>         }

>         \new TabStaff \relative c'' {
>           \set TabStaff.stringTunings = #cuatroTuning
>           \primeros
>         }

>       >>

>       \layout {
>         \context {
>           \Score
>           \override SpacingSpanner.base-shortest-duration = #(ly:make-moment 1/16)
>         }
>       }
>       \midi { }
>     }

ChordChanges for FretBoards

FretBoards can be set to display only when the chord changes or at the beginning of a new line.

>     \include "predefined-guitar-fretboards.ly"

>     myChords = \chordmode {
>       c1 c1 \break
>       \set chordChanges = ##t
>       c1 c1 \break
>       c1 c1
>     }

>     <<
>       \new ChordNames { \myChords }
>       \new FretBoards { \myChords }
>       \new Staff { \myChords }
>     >>

Fretboards alternate tables

Alternate fretboard tables can be created. These would be used in order to have alternate fretboards for a given chord.

In order to use an alternate fretboard table, the table must first be created. Fretboards are then added to the table.

The created fretboard table can be blank, or it can be copied from an existing table.

The table to be used in displaying predefined fretboards is selected by the property `\predefinedDiagramTable`.

>     \include "predefined-guitar-fretboards.ly"

>     % Make a blank new fretboard table
>     #(define custom-fretboard-table-one (make-fretboard-table))

>     % Make a new fretboard table as a copy of default-fret-table
>     #(define custom-fretboard-table-two (make-fretboard-table default-fret-table))

>     % Add a chord to custom-fretboard-table-one
>     \storePredefinedDiagram #custom-fretboard-table-one
>                             \chordmode{c}
>                             #guitar-tuning
>                             "3-(;3;5;5;5;3-);"

>     % Add a chord to custom-fretboard-table-two
>     \storePredefinedDiagram #custom-fretboard-table-two
>                             \chordmode{c}
>                             #guitar-tuning
>                             "x;3;5;5;5;o;"

>     <<
>       \chords {
>         c1 | d1 |
>         c1 | d1 |
>         c1 | d1 |
>       }
>       \new FretBoards {
>         \chordmode {
>           \set predefinedDiagramTable = #default-fret-table
>           c1 | d1 |
>           \set predefinedDiagramTable = #custom-fretboard-table-one
>           c1 | d1 |
>           \set predefinedDiagramTable = #custom-fretboard-table-two
>           c1 | d1 |
>         }
>       }
>       \new Staff {
>         \clef "treble_8"
>         <<
>           \chordmode {
>             c1 | d1 |
>             c1 | d1 |
>             c1 | d1 |
>           }
>           {
>             s1_\markup "Default table" | s1 |
>             s1_\markup \column {"New table" "from empty"} | s1 |
>             s1_\markup \column {"New table" "from default"} | s1 |
>           }
>         >>
>       }
>     >>

#### See also

Notation Reference: Custom tablatures, Automatic fret diagrams, Chord mode overview, Predefined fretboard diagrams.

Installed Files: ‘`ly/predefined-guitar-fretboards.ly`’,
‘`ly/predefined-guitar-ninth-fretboards.ly`’,
‘`ly/predefined-ukulele-fretboards.ly`’,
‘`ly/predefined-mandolin-fretboards.ly`’.

Snippets: Fretted strings.

Internals Reference: fret-diagram-interface.

#### Automatic fret diagrams

Fret diagrams can be automatically created from entered notes using the `FretBoards` context. If no predefined diagram is available for the entered notes in the active `stringTunings`, this context calculates strings and frets that can be used to play the notes.

>     <<
>       \new ChordNames {
>         \chordmode {
>           f1 g
>         }
>       }
>       \new FretBoards {
>         <f, c f a c' f'>1
>         <g,\6 b, d g b g'>1
>       }
>       \new Staff {
>         \clef "treble_8"
>         <f, c f a c' f'>1
>         <g, b, d g b' g'>1
>       }
>     >>

As no predefined diagrams are loaded by default, automatic calculation of fret diagrams is the default behavior. Once default diagrams are loaded, automatic calculation can be enabled and disabled with predefined commands:

>     \storePredefinedDiagram #default-fret-table
>                             <c e g c' e'>
>                             #guitar-tuning
>                             #"x;3-1-(;5-2;5-3;5-4;3-1-1-);"
>     <<
>       \new ChordNames {
>         \chordmode {
>           c1 c c
>         }
>       }
>       \new FretBoards {
>         <c e g c' e'>1
>         \predefinedFretboardsOff
>         <c e g c' e'>1
>         \predefinedFretboardsOn
>         <c e g c' e'>1
>       }
>       \new Staff {
>         \clef "treble_8"
>         <c e g c' e'>1
>         <c e g c' e'>1
>         <c e g c' e'>1
>       }
>     >>

Sometimes the fretboard calculator will be unable to find an acceptable diagram. This can often be remedied by manually assigning a note to a string. In many cases, only one note need be manually placed on a string; the rest of the notes will then be placed appropriately by the `FretBoards` context.

Fingerings can be added to FretBoard fret diagrams.

>     <<
>       \new ChordNames {
>         \chordmode {
>           c1 d:m
>         }
>       }
>       \new FretBoards {
>         <c-3 e-2 g c'-1 e'>1
>         <d a-2 d'-3 f'-1>1
>       }
>       \new Staff {
>         \clef "treble_8"
>         <c e g c' e'>1
>         <d a d' f'>1
>       }
>     >>

The minimum fret to be used in calculating strings and frets for the FretBoard context can be set with the `minimumFret` property.

>     <<
>       \new ChordNames {
>         \chordmode {
>           d1:m d:m
>         }
>       }
>       \new FretBoards {
>         <d a d' f'>1
>         \set FretBoards.minimumFret = #5
>         <d a d' f'>1
>       }
>       \new Staff {
>         \clef "treble_8"
>         <d a d' f'>1
>         <d a d' f'>1
>       }
>     >>

The strings and frets for the `FretBoards` context depend on the `stringTunings` property, which has the same meaning as in the TabStaff context. See Custom tablatures for information on the `stringTunings` property.

The graphical layout of a fret diagram can be customized according to user preference through the properties of the `fret-diagram-interface`. Details are found at fret-diagram-interface. For a `FretBoards` fret diagram, the interface properties belong to `FretBoards.FretBoard`.

#### Predefined commands

`\predefinedFretboardsOff`, `\predefinedFretboardsOn`.

#### See also

Notation Reference: Custom tablatures.

Snippets: Fretted strings.

Internals Reference: fret-diagram-interface.

#### Known issues and warnings

Automatic fretboard calculations do not work properly for instruments with non-monotonic tunings.

#### Right-hand fingerings

Right-hand fingerings p-i-m-a must be entered using `\rightHandFinger` followed by a number.

Note: If the number is entered in Scheme notation, remember to append a space before following it with a closing `>` or similar.

>     \clef "treble_8"
>     c4\rightHandFinger #1
>     e\rightHandFinger #2
>     g\rightHandFinger #3
>     c\rightHandFinger #4
>     <c,\rightHandFinger #1 e\rightHandFinger #2
>      g\rightHandFinger #3 c\rightHandFinger #4 >1

For convenience, you can abbreviate `\rightHandFinger` to something short, for example `RH`,

>     RH=#rightHandFinger

#### Selected Snippets

Placement of right-hand fingerings

It is possible to exercise greater control over the placement of right-hand fingerings by setting a specific property, as demonstrated in the following example. Note: you must use a chord construct

>     #(define RH rightHandFinger)

>     \relative c {
>       \clef "treble_8"

>       \set strokeFingerOrientations = #'(up down)
>       <c-\RH #1 e-\RH #2 g-\RH #3 c-\RH #4 >4

>       \set strokeFingerOrientations = #'(up right down)
>       <c-\RH #1 e-\RH #2 g-\RH #3 c-\RH #4 >4

>       \set strokeFingerOrientations = #'(left)
>       <c-\RH #1 e-\RH #2 g-\RH #3 c-\RH #4 >2
>     }

Fingerings string indications and right-hand fingerings

This example combines left-hand fingering, string indications, and right-hand fingering.

>     #(define RH rightHandFinger)

>     \relative c {
>       \clef "treble_8"
>       <c-3\5-\RH #1 >4
>       <e-2\4-\RH #2 >4
>       <g-0\3-\RH #3 >4
>       <c-1\2-\RH #4 >4
>     }

#### See also

Snippets: Fretted strings.

Internals Reference: StrokeFinger.

其他语言：deutsch, español, français, italiano, 日本語。
About automatic language selection.

#### LilyPond — Notation Reference v2.18.2 (稳定分支).