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