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