]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/notation/fretted-strings.itely
Run scripts/auxiliar/update-with-convert-ly.sh
[lilypond.git] / Documentation / notation / fretted-strings.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @ignore
3     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
4
5     When revising a translation, copy the HEAD committish of the
6     version that you are working on.  For details, see the Contributors'
7     Guide, node Updating translation committishes..
8 @end ignore
9
10 @c \version "2.16.0"
11
12 @node Fretted string instruments
13 @section Fretted string instruments
14
15 @lilypondfile[quote]{fretted-headword.ly}
16
17 This section discusses several aspects of music notation that are unique
18 to fretted string instruments.
19
20 @cindex tablature
21 @cindex tablature, guitar
22 @cindex tablature, banjo
23 @cindex guitar tablature
24 @cindex banjo tablature
25
26 @menu
27 * Common notation for fretted strings::
28 * Guitar::
29 * Banjo::
30 @end menu
31
32 @node Common notation for fretted strings
33 @subsection Common notation for fretted strings
34
35 This section discusses common notation that is unique
36 to fretted string instruments.
37
38 @menu
39 * References for fretted strings::
40 * String number indications::
41 * Default tablatures::
42 * Custom tablatures::
43 * Fret diagram markups::
44 * Predefined fret diagrams::
45 * Automatic fret diagrams::
46 * Right-hand fingerings::
47 @end menu
48
49 @node References for fretted strings
50 @unnumberedsubsubsec References for fretted strings
51
52 Music for fretted string instruments is normally notated on
53 a single staff, either in traditional music notation or in
54 tablature.  Sometimes the two types are combined, and it is
55 especially common in popular music to use chord diagrams above
56 a staff of traditional notation.  The guitar and the banjo are
57 transposing instruments, sounding an octave lower than written.
58 Scores for these instruments should use the @code{"treble_8"} clef
59 (or @code{\transposition c} to get correct MIDI output).
60 Some other elements pertinent to fretted string instruments
61 are covered elsewhere:
62
63 @itemize
64 @item Fingerings are indicated as shown in
65 @ref{Fingering instructions}.
66
67 @item Instructions for @notation{Laissez vibrer} ties
68 as well as ties on arpeggios and tremolos can be found in
69 @ref{Ties}.
70
71 @item Instructions for handling multiple voices can be found
72 in @ref{Collision resolution}.
73
74 @item Instructions for indicating harmonics can be found in
75 @ref{Harmonics}.
76
77 @end itemize
78
79 @seealso
80 Notation Reference:
81 @ref{Fingering instructions},
82 @ref{Ties},
83 @ref{Collision resolution},
84 @ref{Instrument names},
85 @ref{Writing music in parallel},
86 @ref{Arpeggio},
87 @ref{List of articulations},
88 @ref{Clef},
89 @ref{Instrument transpositions}.
90
91
92 @node String number indications
93 @unnumberedsubsubsec String number indications
94
95 @cindex string numbers
96 @cindex string vs. fingering numbers
97 @cindex fingering vs. string numbers
98
99 The string on which a note should be played may be indicated by
100 appending @code{\@var{number}} to a note.
101
102 @lilypond[verbatim,quote,relative=0]
103 \clef "treble_8"
104 c4\5 e\4 g2\3
105 <c,\5 e\4 g\3>1
106 @end lilypond
107
108 When fingerings and string indications are used together, their
109 placement can be controlled by the order in which the two items appear
110 in the code @emph{only} if they appear inside of an explicit chord:
111 applied to whole chords or single notes @emph{outside} of chords,
112 fingerings are placed using a different mechanism.
113
114 @lilypond[verbatim,quote,relative=1]
115 \clef "treble_8"
116 g4\3-0
117 g-0\3
118 <g\3-0>
119 <g-0\3>
120 @end lilypond
121
122 @snippets
123
124 @lilypondfile[verbatim,quote,texidoc,doctitle]
125 {controlling-the-placement-of-chord-fingerings.ly}
126
127 @lilypondfile[verbatim,quote,texidoc,doctitle]
128 {allowing-fingerings-to-be-printed-inside-the-staff.ly}
129
130 @seealso
131 Notation Reference:
132 @ref{Fingering instructions}.
133
134 Snippets:
135 @rlsr{Fretted strings}.
136
137 Internals Reference:
138 @rinternals{StringNumber},
139 @rinternals{Fingering}.
140
141
142 @node Default tablatures
143 @unnumberedsubsubsec Default tablatures
144
145 @cindex tablatures, basic
146 @cindex tablatures, default
147
148 @funindex TabStaff
149 @funindex TabVoice
150
151 Music for plucked string instruments is frequently notated using a
152 finger/touch notation or tablature.  In contrast to traditional
153 notation pitches are not denoted with note heads, but by numbers (or
154 letter-like symbols in historical intavolatura).  The staff lines
155 in tablature indicate the string on which the note is to be played,
156 and a number placed on a staff line indicated the fret at which
157 the corresponding string is to be pressed.
158 Notes that are to be played simultaneously are vertically aligned.
159
160 By default, string 1 is the highest string, and corresponds to the top
161 line on the @code{TabStaff}.  The tuning of the @code{TabStaff}
162 strings defaults to the
163 standard guitar tuning (with 6 strings).  The notes are printed as
164 tablature, by using @code{TabStaff} and @code{TabVoice} contexts.  A
165 calligraphic tablature clef is added automatically.
166
167 @lilypond[quote,ragged-right,verbatim]
168 \new TabStaff \relative c' {
169   a,8 a' <c e> a
170   d,8 a' <d f> a
171 }
172 @end lilypond
173
174 Default tablatures do not contain any symbols for tone duration nor any
175 other musical symbols such as e.g. expressive marks.
176
177 @lilypond[quote,ragged-right,verbatim]
178 symbols = {
179   \time 3/4
180   c4-.^"Allegro" d( e)
181   f4-.\f g a^\fermata
182   \mark \default
183   c8_.\<\( c16 c~ c2\!
184   c'2.\prall\)
185 }
186
187 \score {
188   <<
189     \new Staff { \clef "G_8" \symbols }
190     \new TabStaff { \symbols }
191   >>
192 }
193 @end lilypond
194
195 @funindex \tabFullNotation
196
197 If all musical symbols used in traditional notation should also show up
198 in tablature one has to apply the command @code{\tabFullNotation} in a
199 @code{TabStaff}-context.  Please bear in mind that half notes are
200 double-stemmed in tablature in order to distinguish them from quarter
201 notes.
202
203 @lilypond[quote,ragged-right,verbatim]
204 symbols = {
205   \time 3/4
206   c4-.^"Allegro" d( e)
207   f4-.\f g a^\fermata
208   \mark \default
209   c8_.\<\( c16 c~ c2\!
210   c'2.\prall\)
211 }
212
213 \score {
214   \new TabStaff {
215     \tabFullNotation
216     \symbols
217   }
218 }
219 @end lilypond
220
221 @cindex fret
222
223 @funindex minimumFret
224 @funindex restrainOpenStrings
225
226 By default pitches are assigned to the lowest playing position on the
227 fret-board (first position).  Open strings are automatically preferred.
228 If you would like a certain pitch to be played on a specific string you
229 can add a string number indication to the pitch name.  If you don't want
230 to have string number indications appear in traditional notation, you
231 can override the respective stencil.  Usually it will be more
232 comfortable to define the playing position by using the value of
233 @code{minimumFret}.  The default value for minimumFret is 0.
234
235 Even when @code{minimumFret} is set, open strings are used whenever
236 possible.  This behaviour can be changed by setting @code{restrainOpenStrings}
237 to @code{#t}.
238
239 @lilypond[quote,ragged-right,verbatim]
240 \layout { \override Voice.StringNumber #'stencil = ##f }
241 \new StaffGroup <<
242    \new Staff \relative c {
243      \clef "treble_8"
244      \time 2/4
245      c16 d e f g4
246      c,16\5 d\5 e\4 f\4 g4\4
247      c,16 d e f g4
248    }
249    \new TabStaff \relative c {
250      c16 d e f g4
251      c,16\5 d\5 e\4 f\4 g4\4
252      \set TabStaff.minimumFret = #5
253      \set TabStaff.restrainOpenStrings = ##t
254      c,16 d e f g4
255    }
256 >>
257 @end lilypond
258
259 @funindex \tabChordRepeats
260 @funindex \chordRepeats
261 @cindex Chord, repetition
262 @cindex repetition, using @code{q}
263
264 Chord constructs can be repeated by the chord repetition symbol
265 @code{q}.  In combination with tabulatures, its behavior of removing
266 string and finger numbers alongside with other events is cumbersome, so
267 you'll want to run
268 @example
269 \chordRepeats #'(string-number-event fingering-event)
270 @end example
271 explicitly on music expressions in tabulature using @ref{Chord
272 repetition}.  This particular command is so common that it is available
273 as @code{\tabChordRepeats}.
274
275 @lilypond[quote,verbatim]
276 guitar = \relative c' {
277   r8 <gis-2 cis-3 b-0>~ q4 q8~ q q4
278 }
279
280 \new StaffGroup <<
281   \new Staff {
282     \clef "treble_8"
283     \guitar
284   }
285   \new TabStaff {
286     \tabChordRepeats \guitar
287   }
288 >>
289 @end lilypond
290
291 Ties over a line break are parenthesized by default.  The same holds for
292 the second alternative of a repeat.
293
294 @lilypond[quote,ragged-right,verbatim]
295 ties = \relative c' {
296   \repeat volta 2 {
297     e2. f4~
298     f2 g2~
299   }
300   \alternative {
301      { g4 f2. }
302      { g4\repeatTie c,2. }
303   }
304   b1~
305   \break
306   b1
307   \bar "|."
308 }
309
310 \score {
311   <<
312     \new StaffGroup  <<
313       \context Staff {
314         \clef "treble_8"
315         \ties
316       }
317       \context TabStaff {
318         \ties
319       }
320     >>
321   >>
322   \layout {
323   indent = #0
324   ragged-right = ##t
325   }
326 }
327 @end lilypond
328
329 @funindex \hideSplitTiedTabNotes
330
331 The command @code{\hideSplitTiedTabNotes} cancels the behavior of
332 engraving fret numbers in parentheses:
333
334 @lilypond[quote,ragged-right,verbatim]
335 ties = \relative c' {
336   \repeat volta 2 {
337     e2. f4~
338     f2 g2~ }
339   \alternative {
340     { g4 f2. }
341     { g4\repeatTie c,2. }
342   }
343   b1~
344   \break
345   b1
346   \bar "|."
347 }
348
349 \score {
350   <<
351     \new StaffGroup  <<
352       \context Staff {
353         \clef "treble_8"
354         \ties
355       }
356       \context TabStaff {
357       \hideSplitTiedTabNotes
358         \ties
359       }
360     >>
361   >>
362   \layout {
363   indent = #0
364   ragged-right = ##t
365   }
366 }
367 @end lilypond
368
369 @cindex harmonic indications in tablature notation
370 @cindex tablature and harmonic indications
371 @cindex slides in tablature notation
372 @cindex tablature and slides
373 @cindex chord glissandi
374 @funindex \harmonic
375 @funindex \harmonicByFret
376 @funindex \harmonicByRatio
377
378 Harmonic indications can be added to tablature notation as sounding
379 pitches:
380
381 @lilypond[verbatim,quote]
382 \layout { \override Voice.StringNumber #'stencil = ##f }
383 firstHarmonic = {
384   d'4\4\harmonic
385   g'4\3\harmonic
386   b'2\2\harmonic
387 }
388 \score {
389   <<
390     \new Staff { \firstHarmonic }
391     \new TabStaff { \firstHarmonic }
392   >>
393 }
394 @end lilypond
395
396 Note that the command @code{\harmonic} must always be attached to single
397 notes (possibly inside of a chord) instead of whole chords.
398 It only makes sense for open-string harmonics
399 in the 12th fret. All other harmonics should be calculated by LilyPond.
400 This can be achieved by indicating the fret where a finger of the
401 fretting hand should touch a string.
402
403 @lilypond[verbatim,quote]
404 fretHarmonics = {
405   \harmonicByFret #5 d16\4
406   \harmonicByFret #4 d16\4
407   \harmonicByFret #3 d8\4
408   \harmonicByFret #5 <g\3 b\2>2.
409 }
410 \score {
411   <<
412     \new Staff { \fretHarmonics }
413     \new TabStaff { \fretHarmonics }
414   >>
415 }
416 @end lilypond
417
418 Alternatively, harmonics can be computed by defining the ratio of
419 string lengths above and below the harmonic fingering.
420
421 @lilypond[verbatim,quote]
422 ratioHarmonics = {
423   \harmonicByRatio #1/2 <g\3 b\2 e'\1>4
424   \harmonicByRatio #1/3 <g\3 b\2 e'\1>4
425   \harmonicByRatio #1/4 { g8\3 b8\2 e'4\1 }
426 }
427 \score {
428   <<
429     \new Staff { \ratioHarmonics }
430     \new TabStaff { \ratioHarmonics }
431   >>
432 }
433 @end lilypond
434
435 @snippets
436 @lilypondfile[verbatim,quote,texidoc,doctitle]
437 {stem-and-beam-behavior-in-tablature.ly}
438
439 @lilypondfile[verbatim,quote,texidoc,doctitle]
440 {polyphony-in-tablature.ly}
441
442 @lilypondfile[verbatim,quote,texidoc,doctitle]
443 {open-string-harmonics-in-tablature.ly}
444
445 @lilypondfile[verbatim,quote,texidoc,doctitle]
446 {fretted-string-harmonics-in-tablature.ly}
447
448 @lilypondfile[verbatim,quote,texidoc,doctitle]
449 {slides-in-tablature.ly}
450
451 @lilypondfile[verbatim,quote,texidoc,doctitle]
452 {chord-glissando-in-tablature.ly}
453
454 @seealso
455 Notation Reference:
456 @ref{Chord repetition},
457 @ref{Glissando},
458 @ref{Harmonics},
459 @ref{Stems},
460 @ref{Written-out repeats}.
461
462 Snippets:
463 @rlsr{Fretted strings}.
464
465 Internals Reference:
466 @rinternals{TabNoteHead},
467 @rinternals{TabStaff},
468 @rinternals{TabVoice},
469 @rinternals{Beam}.
470
471 @knownissues
472 Chords are not handled in a special way, and hence the automatic
473 string selector may easily select the same string for two notes in
474 a chord.
475
476 In order to handle @code{\partcombine}, a @code{TabStaff} must use
477 specially-created voices:
478
479 @lilypond[quote,ragged-right,verbatim]
480 melodia = \partcombine { e4 g g g } { e4 e e e }
481 <<
482   \new TabStaff <<
483     \new TabVoice = "one" s1
484     \new TabVoice = "two" s1
485     \new TabVoice = "shared" s1
486     \new TabVoice = "solo" s1
487     { \melodia }
488   >>
489 >>
490 @end lilypond
491
492 Guitar special effects are limited to harmonics and slides.
493
494
495 @node Custom tablatures
496 @unnumberedsubsubsec Custom tablatures
497
498 @cindex tablatures, custom
499 @cindex tablature, banjo
500 @cindex tablature, mandolin
501 @cindex tablature, guitar
502 @cindex tablature, bass guitar
503 @cindex tablature, ukulele
504 @cindex tablature, predefined string tunings
505 @cindex fretted instruments, predefined string tunings
506 @cindex predefined string tunings for fretted instruments
507 @cindex tablature, violin
508 @cindex tablature, viola
509 @cindex tablature, cello
510 @cindex tablature, bass
511 @cindex tablature, double bass
512
513 @funindex stringTunings
514
515 LilyPond tablature automatically calculates the fret for
516 a note based on the string to which the note is assigned.
517 In order to do this, the tuning of the strings must be
518 specified.  The tuning of the strings is given in the
519 @code{stringTunings} property.
520
521 LilyPond comes with predefined string tunings for banjo, mandolin,
522 guitar, bass guitar, ukulele, violin, viola, cello, and double bass.
523 LilyPond automatically sets
524 the correct transposition for predefined tunings.  The following
525 example is for bass guitar, which sounds an octave lower than
526 written.
527
528 @lilypond[quote,ragged-right,verbatim]
529 <<
530   \new Voice \with {
531     \override StringNumber #'stencil = ##f
532   } {
533     \clef "bass_8"
534     \relative c, {
535       c4 d e f
536     }
537   }
538   \new TabStaff \with {
539     stringTunings = #bass-tuning
540   } {
541     \relative c, {
542       c4 d e f
543     }
544   }
545 >>
546 @end lilypond
547
548 The default string tuning is @code{guitar-tuning}, which
549 is the standard EADGBE tuning.  Some other predefined tunings are
550 @code{guitar-open-g-tuning}, @code{mandolin-tuning} and
551 @code{banjo-open-g-tuning}.  The predefined string tunings
552 are found in @file{ly/string-tunings-init.ly}.
553
554 @funindex stringTuning
555 @funindex \stringTuning
556 @cindex tablature, custom string tunings
557 @cindex custom string tunings
558
559 Any desired string tuning can be created.  The
560 @code{\stringTuning} function can be
561 used to define a string tuning which can be used
562 to set @code{stringTunings} for the current context.
563
564 Its argument is a chord construct
565 defining the pitches of each string in the tuning.
566 The chord construct must be in absolute octave mode,
567 see @ref{Absolute octave entry}.  The string
568 with the highest number (generally the lowest string) must
569 come first in the chord.  For example, we can
570 define a string tuning for a four-string instrument with pitches
571 of @code{a''},  @code{d''},  @code{g'}, and @code{c'}:
572
573 @lilypond[quote,verbatim]
574
575 mynotes = {
576   c'4 e' g' c'' |
577   e''4 g'' b'' c'''
578 }
579
580 <<
581   \new Staff {
582     \clef treble
583     \mynotes
584   }
585   \new TabStaff {
586     \set Staff.stringTunings = \stringTuning <c' g' d'' a''>
587     \mynotes
588   }
589 >>
590 @end lilypond
591
592 The @code{stringTunings} property is also used by
593 @code{FretBoards} to calculate automatic fret diagrams.
594
595 String tunings are used as part of the hash key
596 for predefined fret diagrams
597 (see @ref{Predefined fret diagrams}).
598
599 The previous example could also be written as follows:
600
601 @lilypond[quote,verbatim]
602 custom-tuning = \stringTuning <c' g' d'' a''>
603
604 mynotes = {
605   c'4 e' g' c'' |
606   e''4 g'' b'' c'''
607 }
608
609 <<
610   \new Staff {
611     \clef treble
612     \mynotes
613   }
614   \new TabStaff {
615     \set TabStaff.stringTunings = #custom-tuning
616     \mynotes
617   }
618 >>
619 @end lilypond
620
621 Internally, a string tuning is a Scheme list of string pitches,
622 one for each string, ordered by string number from 1 to N,
623 where string 1 is at the top of the tablature staff and
624 string N is at the bottom.  This ordinarily results in ordering
625 from highest pitch to lowest pitch, but some instruments
626 (e.g. ukulele) do not have strings ordered by pitch.
627
628 A string pitch in a string tuning list is a LilyPond pitch
629 object.  Pitch objects are created with the Scheme function
630 @code{ly:make-pitch} (see @ref{Scheme functions}).
631
632 @code{\stringTuning} creates such an object from chord input.
633
634 LilyPond automatically calculates the number of lines in the
635 @code{TabStaff} and the number of strings in an automatically
636 calculated @code{FretBoard} as the number of elements
637 in @code{stringTunings}.
638
639 To let all TabStaff contexts use the same custom tuning by default,
640 you can use
641
642 @example
643 \layout @{
644   \context @{
645     \TabStaff
646     stringTunings = \stringTuning \notemode @{ <c' g' d'' a''> @}
647   @}
648 @}
649 @end example
650
651
652 @cindex moderntab clef
653 @cindex clef, moderntab
654 @cindex clef, tab
655 @cindex tab clef
656
657 A modern tab clef can also be used.
658
659 @lilypond[quote,ragged-right,verbatim]
660 \new TabStaff {
661   \clef moderntab
662   <a, e a>1
663   \break
664   \clef tab
665   <a, e a>1
666 }
667 @end lilypond
668
669 The modern tab clef supports tablatures from 4 to 7 strings.
670
671 @seealso
672 Notation Reference:
673 @ref{Absolute octave entry},
674 @ref{Predefined fret diagrams},
675 @ref{Scheme functions}.
676
677 Installed Files:
678 @file{ly/string-tunings-init.ly},
679 @file{scm/tablature.scm}.
680
681 Snippets:
682 @rlsr{Fretted strings}.
683
684 Internals Reference:
685 @rinternals{Tab_note_heads_engraver}.
686
687 @knownissues
688 Automatic tablature calculations do not work properly in most
689 cases for instruments where string pitches do not vary
690 monotonically with string number, such as ukuleles.
691
692
693 @node Fret diagram markups
694 @unnumberedsubsubsec Fret diagram markups
695
696 @cindex fret diagrams
697 @cindex chord diagrams
698 @cindex diagrams, fret
699 @cindex diagrams, chord for fretted instruments
700 @cindex fret diagrams, custom
701 @cindex custom fret diagrams
702
703 Fret diagrams can be added to music as a markup to the desired
704 note.  The markup contains information about the desired fret
705 diagram.  There are three different fret-diagram markup
706 interfaces: standard, terse, and verbose.  The three interfaces
707 produce equivalent markups, but have varying amounts of
708 information in the markup string.  Details about the
709 syntax of the different markup strings used to define
710 fret diagrams are found at @ref{Instrument Specific Markup}.
711
712 The standard fret diagram markup string indicates the string
713 number and the fret number for each dot to be placed on the string.
714 In addition, open and unplayed (muted) strings can be indicated.
715
716 @lilypond[quote, verbatim]
717 <<
718   \context ChordNames {
719     \chordmode {
720       c1 d:m
721     }
722   }
723   \context Staff {
724     \clef "treble_8"
725     <c e g c' e'>1^\markup {
726       \fret-diagram #"6-x;5-3;4-2;3-o;2-1;1-o;"
727     }
728     <d a d' f'>1^\markup {
729       \fret-diagram #"6-x;5-x;4-o;3-2;2-3;1-1;"
730     }
731   }
732 >>
733 @end lilypond
734
735 @cindex barre indications
736
737 Barre indications can be added to the diagram from
738 the fret-diagram markup string.
739
740 @lilypond[quote, verbatim]
741 <<
742   \context ChordNames {
743      \chordmode {
744        f1 g
745      }
746   }
747   \context Staff {
748     \clef "treble_8"
749     <f, c f a c' f'>1^\markup {
750       \fret-diagram #"c:6-1-1;6-1;5-3;4-3;3-2;2-1;1-1;"
751     }
752     <g, d g b d' g'>1^\markup {
753       \fret-diagram #"c:6-1-3;6-3;5-5;4-5;3-4;2-3;1-3;"
754     }
755   }
756 >>
757 @end lilypond
758
759 @cindex fret-diagram markup
760 @cindex ukulele
761
762 @funindex fret-diagram
763 @funindex \fret-diagram
764
765 The size of the fret diagram, and the number of frets in the diagram
766 can be changed in the fret-diagram markup string.
767
768 @lilypond[quote, verbatim]
769 <<
770   \context ChordNames {
771      \chordmode {
772        f1 g
773      }
774   }
775   \context Staff {
776     \clef "treble_8"
777     <f, c f a c' f'>1^\markup {
778       \fret-diagram #"s:1.5;c:6-1-1;6-1;5-3;4-3;3-2;2-1;1-1;"
779     }
780     <g, b, d g b g'>1^\markup {
781       \fret-diagram #"h:6;6-3;5-2;4-o;3-o;2-o;1-3;"
782     }
783   }
784 >>
785 @end lilypond
786
787 The number of strings in a fret diagram can be changed to accommodate
788 different instruments such as banjos and ukuleles with the fret-diagram
789 markup string.
790
791 @lilypond[quote, verbatim]
792 <<
793   \context ChordNames {
794     \chordmode {
795       a1
796     }
797   }
798   \context Staff {
799     % An 'A' chord for ukulele
800     a'1^\markup {
801       \fret-diagram #"w:4;4-2-2;3-1-1;2-o;1-o;"
802     }
803   }
804 >>
805 @end lilypond
806
807 Fingering indications can be added, and the location of fingering labels
808 can be controlled by the fret-diagram markup string.
809
810 @lilypond[quote, verbatim]
811 <<
812   \context ChordNames {
813     \chordmode {
814       c1 d:m
815     }
816   }
817   \context Staff {
818     \clef "treble_8"
819     <c e g c' e'>1^\markup {
820       \fret-diagram #"f:1;6-x;5-3-3;4-2-2;3-o;2-1-1;1-o;"
821     }
822     <d a d' f'>1^\markup {
823       \fret-diagram #"f:2;6-x;5-x;4-o;3-2-2;2-3-3;1-1-1;"
824     }
825   }
826 >>
827 @end lilypond
828
829 Dot radius and dot position can be controlled with the fret-diagram
830 markup string.
831
832 @lilypond[quote, verbatim]
833 <<
834   \context ChordNames {
835     \chordmode {
836       c1 d:m
837     }
838   }
839   \context Staff {
840     \clef "treble_8"
841     <c e g c' e'>1^\markup {
842       \fret-diagram #"d:0.35;6-x;5-3;4-2;3-o;2-1;1-o;"
843     }
844     <d a d' f'>1^\markup {
845       \fret-diagram #"p:0.2;6-x;5-x;4-o;3-2;2-3;1-1;"
846     }
847   }
848 >>
849 @end lilypond
850
851 @cindex fret-diagram-terse markup
852
853 @funindex fret-diagram-terse
854 @funindex \fret-diagram-terse
855
856 The fret-diagram-terse markup string omits string numbers; the string
857 number is implied by the presence of semicolons.  There is one semicolon
858 for each string in the diagram.  The first semicolon corresponds to the
859 highest string number and the last semicolon corresponds to the first string.
860 Mute strings, open strings, and fret numbers can be indicated.
861
862 @lilypond[quote, verbatim]
863 <<
864   \context ChordNames {
865     \chordmode {
866       c1 d:m
867     }
868   }
869   \context Staff {
870     \clef "treble_8"
871     <c e g c' e'>1^\markup {
872       \fret-diagram-terse #"x;3;2;o;1;o;"
873     }
874     <d a d' f'>1^\markup {
875       \fret-diagram-terse #"x;x;o;2;3;1;"
876     }
877   }
878 >>
879 @end lilypond
880
881 Barre indicators can be included in the fret-diagram-terse markup string.
882
883 @lilypond[quote, verbatim]
884 <<
885   \context ChordNames {
886     \chordmode {
887       f1 g
888     }
889   }
890   \context Staff {
891     \clef "treble_8"
892     <f, c f a c' f'>1^\markup {
893       \fret-diagram-terse #"1-(;3;3;2;1;1-);"
894     }
895     <g, d g b d' g'>1^\markup {
896       \fret-diagram-terse #"3-(;5;5;4;3;3-);"
897     }
898   }
899 >>
900 @end lilypond
901
902 Fingering indications can be included in the fret-diagram-terse markup string.
903
904 @c Need to use override to enable fingerings to show this -- can we do so?
905 @lilypond[quote, verbatim]
906 <<
907   \context ChordNames {
908     \chordmode {
909       c1 d:m
910     }
911   }
912   \context Staff {
913     \override Voice.TextScript
914       #'(fret-diagram-details finger-code) = #'below-string
915     \clef "treble_8"
916     <c e g c' e'>1^\markup {
917       \fret-diagram-terse #"x;3-3;2-2;o;1-1;o;"
918     }
919     <d a d' f'>1^\markup {
920       \fret-diagram-terse #"x;x;o;2-2;3-3;1-1;"
921     }
922   }
923 >>
924 @end lilypond
925
926 Other fret diagram properties must be adjusted using
927 @code{\override} when using the fret-diagram-terse markup.
928
929 @cindex fret-diagram-verbose markup
930 @cindex capo
931
932 @funindex fret-diagram-verbose
933 @funindex \fret-diagram-verbose
934
935 The fret-diagram-verbose markup string is in the format of a Scheme list.  Each
936 element of the list indicates an item to be placed on the fret diagram.
937
938 @lilypond[quote, verbatim]
939 <<
940     \context ChordNames {
941       \chordmode {
942         c1 d:m
943       }
944     }
945   \context Staff {
946     \clef "treble_8"
947     <c e g c' e'>1^\markup {
948       \fret-diagram-verbose #'(
949         (mute 6)
950         (place-fret 5 3)
951         (place-fret 4 2)
952         (open 3)
953         (place-fret 2 1)
954         (open 1)
955       )
956     }
957     <d a d' f'>1^\markup {
958       \fret-diagram-verbose #'(
959         (mute 6)
960         (mute 5)
961         (open 4)
962         (place-fret 3 2)
963         (place-fret 2 3)
964         (place-fret 1 1)
965       )
966     }
967   }
968 >>
969 @end lilypond
970
971 Fingering indications and barres can be included in a
972 fret-diagram-verbose markup string.  Unique to the
973 fret-diagram-verbose interface is a capo indication that
974 can be placed on the fret diagram.  The capo indication is
975 a thick bar that covers all strings.  The fret with the
976 capo will be the lowest fret in the fret diagram.
977
978 @c \override is necessary to make fingering visible
979 @lilypond[quote, verbatim]
980 <<
981     \context ChordNames {
982       \chordmode {
983         f1 g c
984       }
985     }
986   \context Staff {
987     \clef "treble_8"
988     \override Voice.TextScript
989       #'(fret-diagram-details finger-code) = #'below-string
990     <f, c f a c' f'>1^\markup {
991       \fret-diagram-verbose #'(
992         (place-fret 6 1)
993         (place-fret 5 3)
994         (place-fret 4 3)
995         (place-fret 3 2)
996         (place-fret 2 1)
997         (place-fret 1 1)
998         (barre 6 1 1)
999       )
1000     }
1001     <g, b, d g b g'>1^\markup {
1002       \fret-diagram-verbose #'(
1003         (place-fret 6 3 2)
1004         (place-fret 5 2 1)
1005         (open 4)
1006         (open 3)
1007         (open 2)
1008         (place-fret 1 3 3)
1009       )
1010     }
1011     <c e g c' e'>1^\markup {
1012       \fret-diagram-verbose #'(
1013         (capo 3)
1014         (mute 6)
1015         (place-fret 4 5 1)
1016         (place-fret 3 5 2)
1017         (place-fret 2 5 3)
1018       )
1019     }
1020   }
1021 >>
1022 @end lilypond
1023
1024 All other fret diagram properties must be adjusted using
1025 @code{\override} when using the fret-diagram-verbose markup.
1026
1027 @ignore
1028 The following example shows the three fret-diagram markup
1029 interfaces, along with examples of common tweaks.  For example,
1030 the size of the verbose fret diagram is reduced to 0.75, and the
1031 finger indications are specified to appear below the diagram.  The
1032 terse diagram includes tweaks to specify placement of finger code
1033 and color of dots.
1034
1035 @lilypond[verbatim,ragged-right,quote]
1036 \new Voice {
1037   \clef "treble_8"
1038   d4^\markup {
1039     \fret-diagram #"6-x;5-x;4-o;3-2;2-3;1-2;"
1040   }
1041   d4 d d
1042   fis^\markup {
1043     \override #'(size . 0.75) {
1044       \override #'(finger-code . below-string) {
1045         \fret-diagram-verbose #'((place-fret 6 2 1) (barre 6 1 2)
1046                                  (place-fret 5 4 3)
1047                                  (place-fret 4 4 4)
1048                                  (place-fret 3 3 2)
1049                                  (place-fret 2 2 1)
1050                                  (place-fret 1 2 1))
1051       }
1052     }
1053   }
1054   fis4 fis fis
1055   c^\markup {
1056     \override #'(dot-radius . 0.35) {
1057       \override #'(finger-code . in-dot) {
1058         \override #'(dot-color . white) {
1059           \fret-diagram-terse #"x;3-1-(;5-2;5-3;5-4;3-1-);"
1060         }
1061       }
1062     }
1063   }
1064   c4 c c
1065 }
1066 @end lilypond
1067 @end ignore
1068
1069 @cindex customized fret diagram
1070 @cindex fret diagram, customized
1071 @cindex diagram, fret, customized
1072
1073 @funindex fret-diagram-interface
1074
1075 The graphical layout of a fret diagram can be customized according to
1076 user preference through the properties of the
1077 @code{fret-diagram-interface}. Details are found at
1078 @rinternals{fret-diagram-interface}.  For a fret diagram
1079 markup, the interface properties belong to @code{Voice.TextScript}.
1080
1081 @snippets
1082
1083 @lilypondfile[verbatim,quote,texidoc,doctitle]
1084 {changing-fret-orientations.ly}
1085
1086 @lilypondfile[verbatim,quote,texidoc,doctitle]
1087 {customizing-markup-fret-diagrams.ly}
1088
1089 @seealso
1090 Notation Reference:
1091 @ref{Instrument Specific Markup}.
1092
1093 Snippets:
1094 @rlsr{Fretted strings}.
1095
1096 Internals Reference:
1097 @rinternals{fret-diagram-interface}.
1098
1099
1100 @node Predefined fret diagrams
1101 @unnumberedsubsubsec Predefined fret diagrams
1102
1103 @cindex fret diagrams
1104 @cindex fret diagrams, ukulele
1105 @cindex fret diagrams, mandolin
1106 @cindex chord diagrams
1107
1108 @funindex FretBoards
1109 @funindex stringTunings
1110
1111 Fret diagrams can be displayed using the @code{FretBoards} context.  By
1112 default, the @code{FretBoards} context will display fret diagrams that
1113 are stored in a lookup table:
1114
1115 @lilypond[verbatim, ragged-right, quote]
1116 \include "predefined-guitar-fretboards.ly"
1117 \context FretBoards {
1118   \chordmode {
1119     c1 d
1120   }
1121 }
1122 @end lilypond
1123
1124 The default predefined fret diagrams are contained in the file
1125 @file{predefined-guitar-fretboards.ly}.  Fret diagrams are
1126 stored based on the pitches of a chord and the value of
1127 @code{stringTunings} that is currently in use.
1128 @file{predefined-guitar-fretboards.ly} contains predefined
1129 fret diagrams only for @code{guitar-tuning}.  Predefined fret
1130 diagrams can be added for other instruments or other tunings
1131 by following the examples found in
1132 @file{predefined-guitar-fretboards.ly}.
1133
1134 Fret diagrams for the ukulele are contained in the file @*
1135 @file{predefined-ukulele-fretboards.ly}.
1136
1137 @lilypond[verbatim, ragged-right, quote]
1138 \include "predefined-ukulele-fretboards.ly"
1139
1140 myChords = \chordmode { a1 a:m a:aug }
1141
1142 \new ChordNames {
1143   \myChords
1144 }
1145
1146 \new FretBoards {
1147   \set Staff.stringTunings = #ukulele-tuning
1148   \myChords
1149 }
1150 @end lilypond
1151
1152 Fret diagrams for the mandolin are contained in the file @*
1153 @file{predefined-mandolin-fretboards.ly}.
1154
1155 @lilypond[verbatim, ragged-right, quote]
1156 \include "predefined-mandolin-fretboards.ly"
1157
1158 myChords = \chordmode { c1 c:m7.5- c:aug }
1159
1160 \new ChordNames {
1161   \myChords
1162 }
1163
1164 \new FretBoards {
1165   \set Staff.stringTunings = #mandolin-tuning
1166   \myChords
1167 }
1168 @end lilypond
1169
1170 Chord pitches can be entered
1171 either as simultaneous music or using chord mode (see
1172 @ref{Chord mode overview}).
1173
1174 @lilypond[verbatim, ragged-right,quote]
1175 \include "predefined-guitar-fretboards.ly"
1176 \context FretBoards {
1177   \chordmode { c1 }
1178   <c' e' g'>1
1179 }
1180 @end lilypond
1181
1182 @cindex chord names with fret diagrams
1183 @cindex fret diagrams with chord names
1184
1185 @funindex ChordNames
1186 @funindex chordmode
1187 @funindex \chordmode
1188
1189 It is common that both chord names and fret diagrams are displayed together.
1190 This is achieved by putting a @code{ChordNames} context in parallel with
1191 a @code{FretBoards} context and giving both contexts the same music.
1192
1193 @lilypond[verbatim, ragged-right, quote]
1194 \include "predefined-guitar-fretboards.ly"
1195 mychords = \chordmode{
1196   c1 f g
1197 }
1198
1199 <<
1200   \context ChordNames {
1201     \mychords
1202   }
1203   \context FretBoards {
1204     \mychords
1205   }
1206 >>
1207 @end lilypond
1208
1209 @cindex transposing fret diagrams
1210 @cindex fret diagrams, transposing
1211 @cindex diagrams, fret, transposing
1212
1213 Predefined fret diagrams are transposable, as long as a diagram for the
1214 transposed chord is stored in the fret diagram table.
1215
1216 @lilypond[verbatim, ragged-right, quote]
1217 \include "predefined-guitar-fretboards.ly"
1218 mychords = \chordmode{
1219   c1 f g
1220 }
1221
1222 mychordlist = {
1223   \mychords
1224   \transpose c e { \mychords }
1225 }
1226 <<
1227   \context ChordNames {
1228     \mychordlist
1229   }
1230   \context FretBoards {
1231     \mychordlist
1232   }
1233 >>
1234 @end lilypond
1235
1236
1237 The predefined fret diagram table for guitar contains eight chords (major, minor,
1238 augmented, diminished, dominant seventh, major seventh, minor seventh, dominant ninth)
1239 for each of 17 keys.
1240 The predefined fret diagram table for ukulele contains these chords
1241 plus an additional three chords (major sixth, suspended second, and
1242 suspended fourth).
1243 A complete list of the predefined fret diagrams is
1244 shown in @ref{Predefined fretboard diagrams}.  If there is no entry in
1245 the table for a chord, the FretBoards engraver will calculate a
1246 fret-diagram using the automatic fret diagram functionality described in
1247 @ref{Automatic fret diagrams}.
1248
1249 @lilypond[verbatim, ragged-right, quote]
1250 \include "predefined-guitar-fretboards.ly"
1251 mychords = \chordmode{
1252   c1 c:maj9
1253 }
1254
1255 <<
1256   \context ChordNames {
1257     \mychords
1258   }
1259   \context FretBoards {
1260     \mychords
1261   }
1262 >>
1263 @end lilypond
1264
1265 @cindex fret diagrams, adding custom
1266 @cindex custom fret diagrams, adding
1267 @cindex adding custom fret diagrams
1268
1269 Fret diagrams can be added to the fret diagram table.  To add a diagram,
1270 you must specify the hash table for the diagram, the chord for the
1271 diagram, the tuning to be used, and
1272 a definition for the diagram.  Normally, the hash table will be
1273 @var{default-fret-table}.  The diagram definition can be either a
1274 fret-diagram-terse definition string or a fret-diagram-verbose
1275 marking list.
1276
1277 @lilypond[verbatim, ragged-right, quote]
1278 \include "predefined-guitar-fretboards.ly"
1279
1280 \storePredefinedDiagram #default-fret-table
1281                         \chordmode { c:maj9 }
1282                         #guitar-tuning
1283                         #"x;3-2;o;o;o;o;"
1284
1285 mychords = \chordmode {
1286   c1 c:maj9
1287 }
1288
1289 <<
1290   \context ChordNames {
1291     \mychords
1292   }
1293   \context FretBoards {
1294     \mychords
1295   }
1296 >>
1297 @end lilypond
1298
1299 Different fret diagrams for the same chord name can be stored using different
1300 octaves of pitches.  The different octave should be at least two octaves
1301 above or below the default octave, because the octaves above and  below the
1302 default octave are used for transposing fretboards.
1303
1304 @lilypond[verbatim, ragged-right, quote]
1305 \include "predefined-guitar-fretboards.ly"
1306
1307 \storePredefinedDiagram #default-fret-table
1308                         \chordmode { c'' }
1309                         #guitar-tuning
1310                         #(offset-fret 2 (chord-shape 'bes guitar-tuning))
1311
1312 mychords = \chordmode {
1313   c1 c''
1314 }
1315
1316 <<
1317   \context ChordNames {
1318     \mychords
1319   }
1320   \context FretBoards {
1321     \mychords
1322   }
1323 >>
1324 @end lilypond
1325
1326 @cindex fretted instruments, chord shapes
1327 @cindex chord shapes for fretted instruments
1328
1329 @funindex \addChordShape
1330 @funindex addChordShape
1331 @funindex storePredefinedDiagram
1332 @funindex \storePredefinedDiagram
1333
1334 In addition to fret diagrams, LilyPond stores an internal list of chord
1335 shapes.  The chord shapes are fret diagrams that can be shifted along
1336 the neck to different positions to provide different chords.  Chord
1337 shapes can be added to the internal list and then used to define
1338 predefined fret diagrams.  Because they can be moved to various
1339 positions on the neck, chord shapes will normally not contain
1340 any open strings.  Like fret diagrams, chord shapes can be
1341 entered as either fret-diagram-terse strings or fret-diagram-verbose
1342 marking lists.
1343
1344 @lilypond[verbatim, ragged-right, quote]
1345 \include "predefined-guitar-fretboards.ly"
1346
1347 % Add a new chord shape
1348
1349 \addChordShape #'powerf #guitar-tuning #"1-1;3-3;3-4;x;x;x;"
1350
1351 % add some new chords based on the power chord shape
1352
1353 \storePredefinedDiagram #default-fret-table
1354                         \chordmode { f'' }
1355                         #guitar-tuning
1356                         #(chord-shape 'powerf guitar-tuning)
1357 \storePredefinedDiagram #default-fret-table
1358                         \chordmode { g'' }
1359                         #guitar-tuning
1360                         #(offset-fret 2 (chord-shape 'powerf guitar-tuning))
1361
1362 mychords = \chordmode{
1363   f1 f'' g g''
1364 }
1365
1366 <<
1367   \context ChordNames {
1368     \mychords
1369   }
1370   \context FretBoards {
1371     \mychords
1372   }
1373 >>
1374 @end lilypond
1375
1376 The graphical layout of a fret diagram can be customized according to
1377 user preference through the properties of the
1378 @code{fret-diagram-interface}. Details are found at
1379 @rinternals{fret-diagram-interface}.  For a predefined fret diagram,
1380 the interface properties belong to @code{FretBoards.FretBoard}.
1381
1382 @snippets
1383
1384 @lilypondfile[verbatim,quote,texidoc,doctitle]
1385 {customizing-fretboard-fret-diagrams.ly}
1386
1387 @lilypondfile[verbatim,quote,texidoc,doctitle]
1388 {defining-predefined-fretboards-for-other-instruments.ly}
1389
1390 @lilypondfile[verbatim,quote,texidoc,doctitle]
1391 {chordchanges-for-fretboards.ly}
1392
1393 @lilypondfile[verbatim,quote,texidoc,doctitle]
1394 {fretboards-alternate-tables.ly}
1395
1396 @seealso
1397 Notation Reference:
1398 @ref{Custom tablatures},
1399 @ref{Automatic fret diagrams},
1400 @ref{Chord mode overview},
1401 @ref{Predefined fretboard diagrams}.
1402
1403 Installed Files:
1404 @file{ly/predefined-guitar-fretboards.ly}, @*
1405 @file{ly/predefined-guitar-ninth-fretboards.ly}, @*
1406 @file{ly/predefined-ukulele-fretboards.ly}, @*
1407 @file{ly/predefined-mandolin-fretboards.ly}.
1408
1409 Snippets:
1410 @rlsr{Fretted strings}.
1411
1412 Internals Reference:
1413 @rinternals {fret-diagram-interface}.
1414
1415
1416 @node Automatic fret diagrams
1417 @unnumberedsubsubsec Automatic fret diagrams
1418
1419 @cindex fret diagrams, automatic
1420 @cindex chord diagrams, automatic
1421 @cindex automatic fret diagrams
1422 @cindex automatic chord diagrams
1423
1424 Fret diagrams can be automatically created from entered notes using the
1425 @code{FretBoards} context.  If no predefined diagram is available for
1426 the entered notes in the active @code{stringTunings}, this context
1427 calculates strings and frets that can be used to play the notes.
1428
1429 @lilypond[quote,ragged-right,verbatim]
1430 <<
1431   \context ChordNames {
1432     \chordmode {
1433       f1 g
1434     }
1435   }
1436   \context FretBoards {
1437     <f, c f a c' f'>1
1438     <g,\6 b, d g b g'>1
1439   }
1440   \context Staff {
1441     \clef "treble_8"
1442     <f, c f a c' f'>1
1443     <g, b, d g b' g'>1
1444   }
1445 >>
1446 @end lilypond
1447
1448 @funindex predefinedFretboardsOff
1449 @funindex \predefinedFretboardsOff
1450 @funindex predefinedFretboardsOn
1451 @funindex \predefinedFretboardsOn
1452
1453 As no predefined diagrams are loaded by default, automatic calculation
1454 of fret diagrams is the default behavior.  Once default diagrams are
1455 loaded, automatic calculation can be enabled and disabled with predefined
1456 commands:
1457
1458 @lilypond[quote,ragged-right,verbatim]
1459
1460 \storePredefinedDiagram #default-fret-table
1461                         <c e g c' e'>
1462                         #guitar-tuning
1463                         #"x;3-1-(;5-2;5-3;5-4;3-1-1-);"
1464 <<
1465   \context ChordNames {
1466     \chordmode {
1467       c1 c c
1468     }
1469   }
1470   \context FretBoards {
1471     <c e g c' e'>1
1472     \predefinedFretboardsOff
1473     <c e g c' e'>1
1474     \predefinedFretboardsOn
1475     <c e g c' e'>1
1476   }
1477   \context Staff {
1478     \clef "treble_8"
1479     <c e g c' e'>1
1480     <c e g c' e'>1
1481     <c e g c' e'>1
1482   }
1483 >>
1484 @end lilypond
1485
1486
1487
1488 Sometimes the fretboard calculator will be unable to find
1489 an acceptable diagram.  This can often be remedied by
1490 manually assigning a note to a string.  In many cases, only one
1491 note need be manually placed on a string; the rest of
1492 the notes will then be placed appropriately by the
1493 @code{FretBoards} context.
1494
1495 @cindex fret diagrams, adding fingerings
1496 @cindex fingerings, adding to fret diagrams
1497
1498 Fingerings can be added to FretBoard fret diagrams.
1499
1500 @lilypond[quote, verbatim]
1501 <<
1502   \context ChordNames {
1503     \chordmode {
1504       c1 d:m
1505     }
1506   }
1507   \context FretBoards {
1508     <c-3 e-2 g c'-1 e'>1
1509     <d a-2 d'-3 f'-1>1
1510   }
1511   \context Staff {
1512     \clef "treble_8"
1513     <c e g c' e'>1
1514     <d a d' f'>1
1515   }
1516 >>
1517 @end lilypond
1518
1519 @funindex minimumFret
1520
1521 The minimum fret to be used in calculating strings and frets for
1522 the FretBoard context can be set with the @code{minimumFret}
1523 property.
1524
1525 @lilypond[quote, verbatim]
1526 <<
1527   \context ChordNames {
1528     \chordmode {
1529       d1:m d:m
1530     }
1531   }
1532   \context FretBoards {
1533     <d a d' f'>1
1534     \set FretBoards.minimumFret = #5
1535     <d a d' f'>1
1536   }
1537   \context Staff {
1538     \clef "treble_8"
1539     <d a d' f'>1
1540     <d a d' f'>1
1541   }
1542 >>
1543 @end lilypond
1544
1545 The strings and frets for the @code{FretBoards} context depend
1546 on the @code{stringTunings} property, which has the same meaning
1547 as in the TabStaff context.  See @ref{Custom tablatures} for
1548 information on the @code{stringTunings} property.
1549
1550 The graphical layout of a fret diagram can be customized according to
1551 user preference through the properties of the
1552 @code{fret-diagram-interface}. Details are found at
1553 @rinternals{fret-diagram-interface}.  For a @code{FretBoards} fret
1554 diagram, the interface properties belong to
1555 @code{FretBoards.FretBoard}.
1556
1557
1558 @predefined
1559 @code{\predefinedFretboardsOff},
1560 @code{\predefinedFretboardsOn}.
1561 @endpredefined
1562
1563 @seealso
1564 Notation Reference:
1565 @ref{Custom tablatures}.
1566
1567 Snippets:
1568 @rlsr{Fretted strings}.
1569
1570 Internals Reference:
1571 @rinternals {fret-diagram-interface}.
1572
1573 @knownissues
1574 Automatic fretboard calculations do not work properly for instruments
1575 with non-monotonic tunings.
1576
1577
1578 @node Right-hand fingerings
1579 @unnumberedsubsubsec Right-hand fingerings
1580
1581 @cindex fretted instruments, right hand fingerings
1582 @cindex fingerings, right hand for fretted instruments
1583 @cindex right hand fingerings for fretted instruments
1584
1585 @funindex rightHandFinger
1586 @funindex \rightHandFinger
1587
1588 Right-hand fingerings @var{p-i-m-a} must be entered using
1589 @code{\rightHandFinger} followed by a number.
1590
1591 @warning{If the number is entered in Scheme notation, remember to append
1592 a space before following it with a closing @code{>} or similar.}
1593
1594 @lilypond[quote,verbatim,relative=0]
1595 \clef "treble_8"
1596 c4\rightHandFinger #1
1597 e\rightHandFinger #2
1598 g\rightHandFinger #3
1599 c\rightHandFinger #4
1600 <c,\rightHandFinger #1 e\rightHandFinger #2
1601  g\rightHandFinger #3 c\rightHandFinger #4 >1
1602 @end lilypond
1603
1604 For convenience, you can abbreviate @code{\rightHandFinger} to something
1605 short, for example @code{RH},
1606
1607 @example
1608 RH=#rightHandFinger
1609 @end example
1610
1611
1612 @snippets
1613
1614 @lilypondfile[verbatim,quote,texidoc,doctitle]
1615 {placement-of-right-hand-fingerings.ly}
1616
1617 @lilypondfile[verbatim,quote,texidoc,doctitle]
1618 {fingerings,-string-indications,-and-right-hand-fingerings.ly}
1619
1620 @seealso
1621 Snippets:
1622 @rlsr{Fretted strings}.
1623
1624 Internals Reference:
1625 @rinternals{StrokeFinger}.
1626
1627
1628 @node Guitar
1629 @subsection Guitar
1630
1631 Most of the notational issues associated with guitar music are
1632 covered sufficiently in the general fretted strings section, but there
1633 are a few more worth covering here.  Occasionally users want to
1634 create songbook-type documents having only lyrics with chord
1635 indications above them.  Since LilyPond is a music typesetter,
1636 it is not recommended for documents that have no music notation
1637 in them.  A better alternative is a word processor, text editor,
1638 or, for experienced users, a typesetter like GuitarTeX.
1639
1640 @menu
1641 * Indicating position and barring::
1642 * Indicating harmonics and dampened notes::
1643 * Indicating power chords::
1644 @end menu
1645
1646 @node Indicating position and barring
1647 @unnumberedsubsubsec Indicating position and barring
1648
1649 @cindex indicating position and barring for fretted instruments
1650 @cindex fretted instruments, indicating position and barring
1651
1652 This example demonstrates how to include guitar position and
1653 barring indications.
1654
1655 @lilypond[quote,ragged-right,verbatim,relative=0]
1656 \clef "treble_8"
1657 b16 d g b e
1658 \textSpannerDown
1659 \override TextSpanner #'(bound-details left text) = #"XII "
1660 g16\startTextSpan
1661 b16 e g e b g\stopTextSpan
1662 e16 b g d
1663 @end lilypond
1664
1665 @seealso
1666 Notation Reference:
1667 @ref{Text spanners}.
1668
1669 Snippets:
1670 @rlsr{Fretted strings},
1671 @rlsr{Expressive marks}.
1672
1673
1674 @node Indicating harmonics and dampened notes
1675 @unnumberedsubsubsec Indicating harmonics and dampened notes
1676
1677 @cindex fretted instruments, dampened notes
1678 @cindex fretted instruments, harmonics
1679 @cindex dampened notes on fretted instruments
1680 @cindex harmonics on fretted instruments
1681
1682 Special note heads can be used to indicate dampened notes or
1683 harmonics.  Harmonics are normally further explained with a
1684 text markup.
1685
1686 @lilypond[quote,ragged-right,verbatim]
1687 \relative c' {
1688   \clef "treble_8"
1689   \override Staff.NoteHead #'style = #'harmonic-mixed
1690   d^\markup { \italic { \fontsize #-2 { "harm. 12" }}} <g b>1
1691 }
1692 @end lilypond
1693
1694 Dampened notes (also called @notation{dead notes}) are supported
1695 within normal and tablature staves:
1696
1697 @lilypond[quote,ragged-right,verbatim]
1698 music = \relative c' {
1699   < a\3 \deadNote c\2 a'\1 >4
1700   < b\3 \deadNote d\2 b'\1 >
1701   < c\3 \deadNote e\2 c'\1 >
1702   \deadNotesOn
1703   \times 2/3 { g8 b e }
1704   \deadNotesOff
1705   < a,\3 c\2 e\1 >1
1706 }
1707 \new StaffGroup <<
1708   \new Staff {
1709     \clef "treble_8"
1710     \music
1711   }
1712   \new TabStaff {
1713     \music
1714   }
1715 >>
1716 @end lilypond
1717
1718 Another playing technique (especially used on electric guitars) is
1719 called @notation{palm mute}.  The string is hereby partly muted by the
1720 palm of the striking hand (hence the name).  Lilypond supports
1721 the notation of palm mute-style notes by changing the note head to a
1722 triangle shape.
1723
1724 @lilypond[quote,ragged-right,verbatim]
1725 \new Voice { % Warning: explicit Voice instantiation is
1726              %    required to have palmMuteOff work properly
1727              %    when palmMuteOn comes at the beginning of
1728              %    the piece.
1729   \relative c, {
1730     \clef "G_8"
1731     \palmMuteOn
1732     e8^\markup { \musicglyph #"noteheads.u2do"  = palm mute }
1733     < e b' e > e
1734     \palmMuteOff
1735     e e  \palmMute e e e |
1736     e8 \palmMute { e e e } e e e e |
1737     < \palmMute e b' e >8 \palmMute { e e e } < \palmMute e b' e >2
1738   }
1739 }
1740 @end lilypond
1741
1742 @seealso
1743 Snippets:
1744 @rlsr{Fretted strings}.
1745
1746 Notation Reference:
1747 @ref{Special note heads},
1748 @ref{Note head styles}.
1749
1750
1751 @node Indicating power chords
1752 @unnumberedsubsubsec Indicating power chords
1753
1754 @funindex powerChords
1755 @funindex \powerChords
1756
1757 @cindex power chords
1758 @cindex chords, power
1759
1760 Power chords and their symbols can be engraved in chord mode or as chord
1761 constructs:
1762
1763 @lilypond[quote,ragged-right,verbatim]
1764 ChordsAndSymbols = {
1765   \chordmode {
1766     \powerChords
1767     e,,1:1.5
1768     a,,1:1.5.8
1769     \set minimumFret = #8
1770     c,1:1.5
1771     f,1:1.5.8
1772   }
1773   \set minimumFret = #5
1774   <a, e>1
1775   <g d' g'>1
1776 }
1777 \score {
1778   <<
1779     \new ChordNames {
1780     \ChordsAndSymbols
1781     }
1782     \new Staff {
1783       \clef "treble_8"
1784       \ChordsAndSymbols
1785     }
1786     \new TabStaff {
1787       \ChordsAndSymbols
1788     }
1789   >>
1790 }
1791 @end lilypond
1792
1793 Power chord symbols are automatically switched off as soon as one of the
1794 other common chord modifier is used:
1795
1796 @lilypond[quote,ragged-right,verbatim]
1797 mixedChords = \chordmode {
1798   c,1
1799   \powerChords
1800   b,,1:1.5
1801   fis,,1:1.5.8
1802   g,,1:m
1803 }
1804 \score {
1805   <<
1806     \new ChordNames {
1807       \mixedChords
1808     }
1809     \new Staff {
1810       \clef "treble_8"
1811       \mixedChords
1812     }
1813     \new TabStaff {
1814       \mixedChords
1815     }
1816   >>
1817 }
1818 @end lilypond
1819
1820 @seealso
1821 Music Glossary:
1822 @rglos{power chord}.
1823
1824 Notation Reference:
1825 @ref{Extended and altered chords},
1826 @ref{Printing chord names}.
1827
1828 Snippets:
1829 @rlsr{Fretted strings}.
1830
1831
1832 @node Banjo
1833 @subsection Banjo
1834
1835 @menu
1836 * Banjo tablatures::
1837 @end menu
1838
1839 @node Banjo tablatures
1840 @unnumberedsubsubsec Banjo tablatures
1841
1842 @cindex banjo tablatures
1843 @cindex tablature, banjo
1844
1845 LilyPond has basic support for the five-string banjo.  When making tablatures
1846 for five-string banjo, use the banjo tablature format function to get
1847 correct fret numbers for the fifth string:
1848
1849 @c due to crazy intervals of banjo music, absolute pitch is recommended
1850
1851 @lilypond[quote,ragged-right,verbatim]
1852 \new TabStaff <<
1853   \set TabStaff.tablatureFormat = #fret-number-tablature-format-banjo
1854   \set TabStaff.stringTunings = #banjo-open-g-tuning
1855   {
1856     \stemDown
1857     g8 d' g'\5 a b g e d' |
1858     g4 d''8\5 b' a'\2 g'\5 e'\2 d' |
1859     g4
1860   }
1861 >>
1862 @end lilypond
1863
1864 @cindex banjo tunings
1865 @cindex tunings, banjo
1866
1867 @funindex banjo-c-tuning
1868 @funindex banjo-modal-tuning
1869 @funindex banjo-open-d-tuning
1870 @funindex banjo-open-dm-tuning
1871 @funindex four-string-banjo
1872
1873 A number of common tunings for the five-string banjo are predefined:
1874 @code{banjo-c-tuning} (gCGBD), @code{banjo-modal-tuning} (gDGCD),
1875 @code{banjo-open-d-tuning} (aDF#AD) and @code{banjo-open-dm-tuning}
1876 (aDFAD).
1877
1878 These may be converted to four-string tunings using the
1879 @code{four-string-banjo} function:
1880
1881 @example
1882 \set TabStaff.stringTunings = #(four-string-banjo banjo-c-tuning)
1883 @end example
1884
1885 @seealso
1886 Installed Files:
1887 @file{ly/string-tunings-init.ly}.
1888
1889 Snippets:
1890 @rlsr{Fretted strings}.