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