@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.  See TRANSLATION for details.
@end ignore

@node Guitar
@section Guitar

@cindex tablature
@cindex guitar tablature

@menu
* Guitar sections::             
@end menu

@node Guitar sections
@subsection Guitar sections

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

@node String number indications
@subsubsection String number indications

@cindex String numbers

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

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


@seealso

Internals Reference: @internalsref{StringNumber},
@c @lsr{guitar/,string-number.ly}.


@node Tablatures basic
@subsubsection Tablatures basic
@cindex Tablatures basic

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

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

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

@funindex minimumFret
@cindex fret

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


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


@snippets

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

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

@seealso

Internals Reference: @internalsref{TabNoteHead}, @internalsref{TabStaff}, @internalsref{TabVoice}.

@knownissues

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

In order to handle @code{\partcombine}, a @code{TabStaff} must use
specially-created voices:

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


@node Non-guitar tablatures
@subsubsection Non-guitar tablatures
@cindex Non-guitar tablatures

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

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

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

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

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

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

@seealso

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

@knownissues

No guitar special effects have been implemented.



@node Banjo tablatures
@subsubsection Banjo tablatures
@cindex Banjo tablatures

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

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

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

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

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

@seealso

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


@node Fret diagrams
@subsubsection Fret diagrams
@cindex fret diagrams
@cindex chord diagrams

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

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


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

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


@seealso

Examples: @c @lsrdir{guitar}


@node Right hand fingerings
@subsubsection Right hand fingerings

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

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

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

@example
#(define RH rightHandFinger)
@end example

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

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

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

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


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

@seealso

Internals Reference: @internalsref{StrokeFinger}



@node Other guitar issues
@subsubsection Other guitar issues

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

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


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



