]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/fretted-strings.itely
Updates to chords.itely, fretted-strings.itely
[lilypond.git] / Documentation / user / 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.  See TRANSLATION for details.
7 @end ignore
8
9 @c \version "2.11.53"
10
11 @node Fretted string instruments
12 @section Fretted string instruments
13
14 @lilypondfile[quote]{fretted-headword.ly}
15
16 This section discusses several aspects of music notation that are unique
17 to fretted string instruments.
18
19 @cindex tablature
20 @cindex guitar tablature
21
22 @menu
23 * Common notation for fretted strings::  
24 * Guitar::                      
25 * Banjo::                       
26 @end menu
27
28 @node Common notation for fretted strings
29 @subsection Common notation for fretted strings
30
31 This section discusses common notation that is unique
32 to fretted string instruments.
33
34 @menu
35 * References for fretted strings::  
36 * String number indications::   
37 * Default tablatures::          
38 * Custom tablatures::           
39 * Fret diagram markups::
40 * Predefined fret diagrams::
41 * Automatic fret diagrams::               
42 * Right-hand fingerings::       
43 @end menu
44
45 @node References for fretted strings
46 @unnumberedsubsubsec References for fretted strings
47
48 Music for fretted string instruments is normally notated on
49 a single staff, either in traditional music notation or in
50 tablature.  Sometimes the two types are combined, and it is
51 especially common in popular music to use chord diagrams above
52 a staff of traditional notation.  The guitar and the banjo are
53 transposing instruments, sounding an octave lower than written. 
54 Scores for these instruments should use the @code{"treble_8"} clef. 
55 Some other elements pertinent to fretted string instruments 
56 are covered elsewhere:
57
58 @itemize
59 @item Fingerings are indicated with @ref{Fingering instructions}.
60
61 @item Instructions for @notation{Laissez vibrer} ties
62 as well as ties on arpeggios and tremolos is described in
63 @ref{Ties}.
64
65 @item Instructions on handling multiple voices is described 
66 in @ref{Collision resolution}. 
67
68 @end itemize
69
70 @seealso
71
72 Notation Reference:
73 @ref{Fingering instructions},
74 @ref{Ties},
75 @ref{Collision resolution},
76 @ref{Instrument names},
77 @ref{Writing music in parallel},
78 @ref{Arpeggio},
79 @ref{List of articulations},
80 @ref{Clef}.
81
82 @node String number indications
83 @unnumberedsubsubsec String number indications
84
85 @cindex String numbers
86
87 The string on which a note should be played may be indicated by
88 appending @code{\@var{number}} to a note inside a chord construct
89 @code{<>}.
90
91 @warning{String numbers @strong{must} be defined inside a chord
92 construct even if there is only a single note.}
93
94 @lilypond[verbatim,quote,relative=0]
95 \clef "treble_8"
96 <c\5>4 <e\4> <g\3>2
97 <c,\5 e\4 g\3>1
98 @end lilypond
99
100 When fingerings and string indications are used together, their
101 placement is controlled by the order in which the two items appear
102 in the code:
103
104 @lilypond[verbatim,quote,relative=1]
105 \clef "treble_8"
106 <g\3-0>2
107 <g-0\3>
108 @end lilypond
109
110 @snippets
111
112 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
113 {controlling-the-placement-of-chord-fingerings.ly}
114
115 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
116 {allowing-fingerings-to-be-printed-inside-the-staff.ly}
117
118 @seealso
119
120 Notation Reference:
121 @ref{Fingering instructions}.
122
123 Snippets:
124 @rlsr{Fretted strings}.
125
126 Internals Reference:
127 @rinternals{StringNumber},
128 @rinternals{Fingering}.
129
130
131 @node Default tablatures
132 @unnumberedsubsubsec Default tablatures
133 @cindex Tablatures, basic
134 @cindex Tablatures, default
135
136 Tablature notation is used for notating music for plucked string
137 instruments.  Pitches are not denoted with note heads, but by
138 numbers indicating on which string and fret a note must be played.  
139 LilyPond offers limited support for tablature.
140
141 The string number associated with a note is given as a backslash
142 followed by a number.  By default, string 1 is the highest, 
143 and the tuning defaults to the standard guitar tuning (with 6 strings).  
144 The notes are printed as tablature, by using @code{TabStaff} and
145 @code{TabVoice} contexts
146
147 @lilypond[quote,ragged-right,fragment,verbatim]
148 \new TabStaff {
149   a,4\5 c'\2 a\3 e'\1
150   e\4 c'\2 a\3 e'\1
151 }
152 @end lilypond
153
154 @funindex minimumFret
155 @cindex fret
156
157
158 When no string is specified for a note, the note is assigned to
159 the lowest string that can generate the note with a fret number
160 greater than or equal to the value of @code{minimumFret}.
161 The default value for @code{minimumFret} is 0.
162
163
164 @lilypond[quote,ragged-right,verbatim]
165 \new StaffGroup <<
166    \new Staff \relative c {
167      \clef "treble_8"
168      c16 d e f g4
169      c,16 d e f g4
170    }
171    \new TabStaff \relative c {
172      c16 d e f g4
173      \set TabStaff.minimumFret = #5
174      c,16 d e f g4
175    }
176 >>
177 @end lilypond
178
179 @snippets
180
181 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
182 {stem-and-beam-behavior-in-tablature.ly}
183
184 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
185 {polyphony-in-tablature.ly}
186
187 @seealso
188
189 Notation Reference:
190 @ref{Stems}.
191
192 Snippets:
193 @rlsr{Fretted strings}.
194
195 Internals Reference: 
196 @rinternals{TabNoteHead},
197 @rinternals{TabStaff},
198 @rinternals{TabVoice},
199 @rinternals{Beam}.
200
201 @knownissues
202
203 Chords are not handled in a special way, and hence the automatic
204 string selector may easily select the same string for two notes in
205 a chord.
206
207 In order to handle @code{\partcombine}, a @code{TabStaff} must use
208 specially-created voices:
209
210 @lilypond[quote,ragged-right,verbatim]
211 melodia = \partcombine { e4 g g g }{ e4 e e e }
212 <<
213   \new TabStaff <<
214     \new TabVoice = "one" s1
215     \new TabVoice = "two" s1
216     \new TabVoice = "shared" s1
217     \new TabVoice = "solo" s1
218     { \melodia }
219   >>
220 >>
221 @end lilypond
222
223
224 @node Custom tablatures
225 @unnumberedsubsubsec Custom tablatures
226 @cindex Tablatures, custom
227
228 LilyPond tabulature automatically calculates the fret for 
229 a note based on the string to which the note is assigned.
230 In order to do this, the tuning of the strings must be
231 specified.  The tuning of the strings is given in the
232 @code{StringTunings} property.
233
234 LilyPond comes with predefined string tunings for banjo, mandolin,
235 guitar and bass guitar.  Lilypond automatically sets the correct 
236 transposition for predefined tunings.  The following example is
237 for bass guitar, which sounds an octave lower than written.
238
239 @lilypond[quote,ragged-right,verbatim]
240 <<
241   \new Staff {
242     \clef "bass_8"
243     \relative c, {
244       c4 d e f
245     }
246   }
247   \new TabStaff {
248     \set TabStaff.stringTunings = #bass-tuning
249     \relative c, {
250       c4 d e f
251     }
252   }
253 >>
254 @end lilypond
255
256 The default string tuning is @code{guitar-tuning}, which
257 is the standard EADGBE tuning.  Some other predefined tunings are
258 @code{guitar-open-g-tuning}, @code{mandolin-tuning} and
259 @code{banjo-open-g-tuning}.  The predefined string tunings 
260 are found in @code{scm/output-lib.scm}.
261
262 A string tuning is a Scheme list of string pitches, 
263 one for each string, ordered by string number from 1 to N,
264 where string 1 is at the top of the tablature staff and
265 string N is at the bottom.  This ordinarily results in ordering 
266 from highest pitch to lowest pitch, but some instruments 
267 (e.g. ukulele) do not have strings ordered by pitch.
268
269 A string pitch in a string tuning list is the pitch difference  
270 of the open string from middle C measured in semitones.  The 
271 string pitch must be an integer.  Lilypond calculates the actual 
272 pitch of the string by adding the string tuning pitch to the 
273 actual pitch for middle C.
274
275 LilyPond automatically calculates the number of strings in the
276 @code{TabStaff} as the number of elements in @code{stringTunings}.
277
278 Any desired string tuning can be created.  For example, we can
279 define a string tuning for a four-string instrument with pitches
280 of @code{a''},  @code{d''},  @code{g'}, and @code{c'}:
281
282
283 @lilypond[quote,verbatim]
284 mynotes = {
285     c'4 e' g' c'' |
286     e'' g'' b'' c'''
287 }
288
289 <<
290   \new Staff {
291     \clef treble
292     \mynotes
293   }
294   \new TabStaff {
295     \set TabStaff.stringTunings = #'(21 14 7 0)
296     \mynotes
297   }
298 >>
299 @end lilypond
300
301 @seealso
302
303 Installed Files:
304 @file{scm/output-lib.scm}.
305
306 Snippets:
307 @rlsr{Fretted strings}.
308
309 Internals Reference: 
310 @rinternals{Tab_note_heads_engraver}.
311
312 @knownissues
313
314 No guitar special effects have been implemented.
315
316
317 @node Fret diagram markups
318 @unnumberedsubsubsec Fret diagram markups
319 @cindex fret diagrams
320 @cindex chord diagrams
321
322 Fret diagrams can be added to music as a markup to the desired
323 note.  The markup contains information about the desired fret
324 diagram.  There are three different fret-diagram markup
325 interfaces: standard, terse, and verbose.  The three interfaces
326 produce equivalent markups, but have varying amounts of
327 information in the markup string.  Details about the markup
328 interfaces are found at @ref{Text markup commands}.
329
330 The standard fret diagram markup string indicates the string
331 number and the fret number for each dot to be placed on the string.
332 In addition, open and unplayed (muted) strings can be indicated.
333
334 @lilypond[quote, verbatim]
335 <<
336   \context ChordNames {
337      \chordmode { 
338        c1 d:m          
339      }
340   }
341   \context Staff {
342     \clef "treble_8"
343     < c e g c' e' > 1 ^\markup 
344       \fret-diagram #"6-x;5-3;4-2;3-o;2-1;1-o;"
345     < d a d' f'> ^\markup
346       \fret-diagram #"6-x;5-x;4-o;3-2;2-3;1-1;"
347   }  
348 >>
349 @end lilypond
350
351 Barre indications can be added to the diagram from
352 the fret-diagram markup string.
353
354 @lilypond[quote, verbatim]
355 <<
356   \context ChordNames {
357      \chordmode {
358        f1 g
359      }
360   }
361   \context Staff {
362     \clef "treble_8"
363     < f, c f a c' f'>1 ^\markup
364       \fret-diagram #"c:6-1-1;6-1;5-3;4-3;3-2;2-1;1-1;"
365     < g, b, d g b' g'> ^\markup
366       \fret-diagram #"c:6-1-3;6-3;5-5;4-5;3-4;2-3;1-3;"
367   }
368 >>
369 @end lilypond
370
371 The size of the fret diagram, and the number of frets in the diagram
372 can be changed in the fret-diagram markup string.
373
374 @lilypond[quote, verbatim]
375 <<
376   \context ChordNames {
377      \chordmode {
378        f1 g
379      }
380   }
381   \context Staff {
382     \clef "treble_8"
383     < f, c f a c' f'>1 ^\markup
384       \fret-diagram #"s:1.5;c:6-1-1;6-1;5-3;4-3;3-2;2-1;1-1;"
385     < g, b, d g b' g'> ^\markup
386       \fret-diagram #"h:6;6-3;5-2;4-o;3-o;2-o;1-3;"
387   }
388 >>
389 @end lilypond
390
391 The number of strings in a fret diagram can be changed to accomodate
392 different instruments such as banjos and ukeleles with the fret-diagram
393 markup string.
394
395 @lilypond[quote, verbatim]
396 <<
397   \context ChordNames {
398      \chordmode {
399        a1
400      }
401   }
402   \context Staff {
403         %% A chord for ukelele
404     a'1 ^\markup \fret-diagram #"w:4;4-2-2;3-1-1;2-o;1-o;"
405   }
406 >>
407 @end lilypond
408
409 Fingering indications can be added, and the location of fingering labels
410 can be controlled by the fret-diagram markup string.
411
412 @lilypond[quote, verbatim]
413 <<
414   \context ChordNames {
415      \chordmode { 
416        c1 d:m          
417      }
418   }
419   \context Staff {
420     \clef "treble_8"
421     < c e g c' e' > 1 ^\markup 
422       \fret-diagram #"f:1;6-x;5-3-3;4-2-2;3-o;2-1-1;1-o;"
423     < d a d' f'> ^\markup
424       \fret-diagram #"f:2;6-x;5-x;4-o;3-2-2;2-3-3;1-1-1;"
425   }  
426 >>
427 @end lilypond
428
429 Dot radius and dot position can be controlled with the fret-diagram
430 markup string.
431
432 @lilypond[quote, verbatim]
433 <<
434   \context ChordNames {
435      \chordmode { 
436        c1 d:m          
437      }
438   }
439   \context Staff {
440     \clef "treble_8"
441     < c e g c' e' > 1 ^\markup 
442       \fret-diagram #"d:0.35;6-x;5-3;4-2;3-o;2-1;1-o;"
443     < d a d' f'> ^\markup
444       \fret-diagram #"p:0.2;6-x;5-x;4-o;3-2;2-3;1-1;"
445   }  
446 >>
447 @end lilypond
448
449 The fret-diagram-terse markup string omits string numbers; the string
450 number is implied by the presence of semicolons.  There is one semicolon 
451 for each string in the diagram.  The first semicolon corresponds to the
452 highest string number and the last semicolon corresponds to the first string.
453 Mute strings, open strings, and fret numbers can be indicated.
454
455 @lilypond[quote, verbatim]
456 <<
457   \context ChordNames {
458      \chordmode {
459        c1 d:m
460      }
461   }
462   \context Staff {
463     \clef "treble_8"
464     < c e g c' e' > 1 ^\markup
465       \fret-diagram-terse #"x;3;2;o;1;o;"
466     < d a d' f'> ^\markup
467       \fret-diagram-terse #"x;x;o;2;3;1;"
468   }
469 >>
470 @end lilypond
471
472 Barre indicators can be included in the fret-diagram-terse markup string.
473
474 @lilypond[quote, verbatim]
475 <<
476   \context ChordNames {
477      \chordmode {
478        f1 g
479      }
480   }
481   \context Staff {
482     \clef "treble_8"
483     < f, c f a c' f'>1 ^\markup
484       \fret-diagram-terse #"1-(;3;3;2;1;1-);"
485     < g, b, d g b' g'> ^\markup
486       \fret-diagram-terse #"3-(;5;5;4;3;3-);"
487   }
488 >>
489 @end lilypond      
490
491 Fingering indications can be included in the fret-diagram-terse markup string.
492
493 @c Need to use override to enable fingerings to show this -- can we do so?
494 @lilypond[quote, verbatim]
495 <<    
496   \context ChordNames {
497      \chordmode {
498        c1 d:m
499      }
500   }
501   \context Staff {
502     \override Voice.TextScript 
503       #'fret-diagram-details #'finger-code = #'below-string
504     \clef "treble_8"
505     < c e g c' e' > 1 ^\markup
506       \fret-diagram-terse #"x;3-3;2-2;o;1-1;o;"
507     < d a d' f'> ^\markup
508       \fret-diagram-terse #"x;x;o;2-2;3-3;1-1;"
509   }
510 >>
511 @end lilypond
512
513 Other fret diagram properties must be adjusted using @code{\override} when using
514 the fret-diagram-terse markup.
515
516 The fret-diagram-verbose markup string is in the format of a Scheme list.  Each
517 element of the list indicates an item to be placed on the fret diagram.
518
519 @lilypond[quote, verbatim]
520 <<  \context ChordNames {
521      \chordmode {
522        c1 d:m
523      }
524   }
525   \context Staff {
526     \clef "treble_8"
527     < c e g c' e' > 1 ^\markup
528       \fret-diagram-verbose #'(
529         (mute 6)
530         (place-fret 5 3)
531         (place-fret 4 2)
532         (open 3)
533         (place-fret 2 1)
534         (open 1)
535       )
536     < d a d' f'> ^\markup
537       \fret-diagram-verbose #'(
538         (mute 6)
539         (mute 5)
540         (open 4)
541         (place-fret 3 2)
542         (place-fret 2 3)
543         (place-fret 1 1)
544       )
545   }
546 >>
547 @end lilypond
548
549 Fingering indications and barres can be included in a 
550 fret-diagram-verbose markup string.
551
552 @c \override is necessary to make fingering visible
553 @lilypond[quote, verbatim]
554 <<
555   \context ChordNames {
556      \chordmode {
557        f1 g
558      }
559   }
560   \context Staff {
561     \clef "treble_8"
562     \override Voice.TextScript
563       #'fret-diagram-details #'finger-code = #'below-string
564
565     < f, c f a c' f'>1 ^\markup
566       \fret-diagram-verbose #'(
567         (place-fret 6 1)
568         (place-fret 5 3)
569         (place-fret 4 3)
570         (place-fret 3 2)
571         (place-fret 2 1)
572         (place-fret 1 1)
573         (barre 6 1 1)
574       )
575     < g, b, d g b' g'> ^\markup
576       \fret-diagram-verbose #'(
577         (place-fret 6 3 2)
578         (place-fret 5 2 1)
579         (open 4)
580         (open 3)
581         (open 2)
582         (place-fret 1 3 3)
583       )
584   }
585 >>
586 @end lilypond
587
588 All other fret diagram properties must be adjusted using @code{\override} 
589 when using the fret-diagram-verbose markup.
590
591 @ignore
592 The following example shows the three fret-diagram markup
593 interfaces, along with examples of common tweaks.  For example,
594 the size of the verbose fret diagram is reduced to 0.75, and the
595 finger indications are specified to appear below the diagram.  The
596 terse diagram includes tweaks to specify placement of finger code
597 and color of dots.
598
599 @lilypond[verbatim,ragged-right,quote]
600 \new Voice {
601   \clef "treble_8"
602   d^\markup \fret-diagram #"6-x;5-x;4-o;3-2;2-3;1-2;"
603   d d d
604   fis^\markup \override #'(size . 0.75) {
605     \override #'(finger-code . below-string) {
606       \fret-diagram-verbose #'((place-fret 6 2 1) (barre 6 1 2)
607                                (place-fret 5 4 3) 
608                                (place-fret 4 4 4)
609                                (place-fret 3 3 2) 
610                                (place-fret 2 2 1)
611                                (place-fret 1 2 1))
612     }
613   }
614   fis fis fis
615   c^\markup \override #'(dot-radius . 0.35) {
616     \override #'(finger-code . in-dot) {
617       \override #'(dot-color . white) {
618         \fret-diagram-terse #"x;3-1-(;5-2;5-3;5-4;3-1-);"
619       }
620     }
621   }
622   c c c
623 }
624 @end lilypond
625 @end ignore
626
627 The graphical layout of a fret diagram can be customized according to
628 user preference through the properties of the @code{fret-diagram-interface}.
629 Details are found at @rinternals{fret-diagram-interface}.  For a fret diagram
630 markup , the interface properties belong to @code{Voice.TextScript}.
631
632 @snippets
633
634 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
635 {customizing-markup-fret-diagrams.ly}
636
637
638 @seealso
639
640 Notation Reference:
641 @ref{Text markup commands}.
642
643 Snippets:
644 @rlsr{Fretted strings}.
645
646 Internals Reference:
647 @rinternals{fret-diagram-interface}.
648
649 @node Predefined fret diagrams
650 @unnumberedsubsubsec Predefined fret diagrams
651 @cindex fret diagrams
652 @cindex chord diagrams
653
654 Fret diagrams can be displayed using the @code{FretBoards} context.  By
655 default, the @code{FretBoards} context will display fret diagrams that
656 are stored in a lookup table:
657
658 @lilypond[verbatim, ragged-right, quote]
659 \include "predefined-guitar-fretboards.ly"
660 \context FretBoards {
661   \chordmode {
662     c1 d
663   }
664 }
665 @end lilypond
666
667 The default predefined fret diagrams are contained in the file
668 @code{predefined-guitar-fretboards.ly}.  Fret diagrams are 
669 stored based on the pitches of a chord and the value of
670 @code{stringTunings} that is currently in use.  
671 @code{predefined-guitar-fretboards.ly} contains predefined 
672 fret diagrams only for @code{guitar-tuning}.  Predefined fret
673 diagrams can be added for other instruments or other tunings
674 by following the examples found in 
675 @code{predefined-guitar-fretboards.ly}.  
676
677 Chord pitches can be entered
678 either as simultaneous music or using chord mode (see
679 @ref{Chord mode overview}).
680
681 @lilypond[verbatim, ragged-right,quote]
682 \include "predefined-guitar-fretboards.ly"
683 \context FretBoards {
684   \chordmode {c1}
685   <c' e' g'>1
686 }
687 @end lilypond
688
689 It is common that both chord names and fret diagrams are displayed together.
690 This is achieved by putting a @code{ChordNames} context in parallel with
691 a @code{FretBoards} context and giving both contexts the same music.
692
693 @lilypond[verbatim, ragged-right, quote]
694 \include "predefined-guitar-fretboards.ly"
695 mychords = \chordmode{
696   c1 f g
697 }
698
699 <<
700   \context ChordNames {
701     \mychords
702   }
703   \context FretBoards {
704     \mychords
705   }
706 >>
707 @end lilypond
708
709 Predefined fret diagrams are transposable, as long as a diagram for the
710 transposed chord is stored in the fret diagram table.
711
712 @lilypond[verbatim, ragged-right, quote]
713 \include "predefined-guitar-fretboards.ly"
714 mychords = \chordmode{
715   c1 f g
716 }
717
718 mychordlist = {
719   \mychords
720   \transpose c e { \mychords}
721 }
722 <<
723   \context ChordNames {
724     \mychordlist
725   }
726   \context FretBoards {
727     \mychordlist
728   }
729 >>
730 @end lilypond
731
732
733 The predefined fret diagram table contains seven chords (major, minor,
734 augmented, diminished, dominant seventh, major seventh, minor seventh)
735 for each of 17 keys.  A complete list of the predefined fret diagrams is
736 shown in @ref{Predefined fretboard diagrams}.  If there is no entry in
737 the table for a chord, the FretBoards engraver will calculate a
738 fret-diagram using the automatic fret diagram functionality described in
739 @ref{Automatic fret diagrams}.
740
741 @lilypond[verbatim, ragged-right, quote]
742 \include "predefined-guitar-fretboards.ly"
743 mychords = \chordmode{
744   c1 c:9
745 }
746
747 <<
748   \context ChordNames {
749     \mychords
750   }
751   \context FretBoards {
752     \mychords
753   }
754 >>
755 @end lilypond
756
757 Fret diagrams can be added to the fret diagram table.  To add a diagram,
758 you must specify the chord for the diagram, the tuning to be used, and the
759 fret-diagram-terse definition string for the diagram.
760
761 @lilypond[verbatim, ragged-right, quote]
762 \include "predefined-guitar-fretboards.ly"
763
764 \storePredefinedDiagram \chordmode {c:9} 
765                         #guitar-tuning
766                         #"x;3-2;2-1;3-3;3-4;x;"
767
768 mychords = \chordmode{
769   c1 c:9
770 }
771
772 <<
773   \context ChordNames {
774     \mychords
775   }
776   \context FretBoards {
777     \mychords
778   }
779 >>
780 @end lilypond
781
782 Different fret diagrams for the same chord name can be stored using different
783 octaves of pitches.
784
785 @lilypond[verbatim, ragged-right, quote]
786 \include "predefined-guitar-fretboards.ly"
787
788 \storePredefinedDiagram \chordmode {c'} 
789                         #guitar-tuning
790                         #(offset-fret 2 (chord-shape 'bes))
791
792 mychords = \chordmode{
793   c1 c'
794 }
795
796 <<
797   \context ChordNames {
798     \mychords
799   }
800   \context FretBoards {
801     \mychords
802   }
803 >>
804 @end lilypond
805
806 In addition to fret diagrams, LilyPond stores an internal list of chord
807 shapes.  The chord shapes are fret diagrams that can be shifted along
808 the neck to different posistions to provide different chords.  Chord
809 shapes can be added to the internal list and then used to define
810 predefined fret diagrams.
811
812 @lilypond[verbatim, ragged-right, quote]
813 \include "predefined-guitar-fretboards.ly"
814
815 % add a new chord shape
816
817 \addChordShape #'powerf #"1-1;3-3;3-4;x;x;x;"
818
819 % add some new chords based on the power chord shape
820
821 \storePredefinedDiagram \chordmode {f'} 
822                         #guitar-tuning 
823                         #(chord-shape 'powerf)
824 \storePredefinedDiagram \chordmode {g'} 
825                         #guitar-tuning
826                         #(offset-fret 2 (chord-shape 'powerf))
827
828 mychords = \chordmode{
829   f1 f' g g' 
830 }
831
832 <<
833   \context ChordNames {
834     \mychords
835   }
836   \context FretBoards {
837     \mychords
838   }
839 >>
840 @end lilypond
841
842 The graphical layout of a fret diagram can be customized according to
843 user preference through the properties of the @code{fret-diagram-interface}.
844 Details are found at @rinternals{fret-diagram-interface}.  For a 
845 predefined fret diagram, the interface properties belong to 
846 @code{FretBoards.FretBoard}.
847
848 @snippets
849
850 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
851 {customizing-fretboard-fret-diagrams.ly}
852
853
854 @seealso
855
856 Notation Reference:
857 @ref{Custom tablatures},
858 @ref{Automatic fret diagrams},
859 @ref{Chord mode overview},
860 @ref{Predefined fretboard diagrams}.
861
862 Installed Files:
863 @file{ly/predefined-guitar-fretboards.ly}.
864
865 Snippets:
866 @rlsr{Fretted strings}.
867
868 Internals Reference:
869 @rinternals {fret-diagram-interface}.
870
871
872 @node Automatic fret diagrams
873 @unnumberedsubsubsec Automatic fret diagrams
874 @cindex fret diagrams
875 @cindex chord diagrams
876
877 Fret diagrams can be automatically created from entered notes using the 
878 @code{FretBoards} context.  If no predefined diagram is available for
879 the entered notes in the active @code{stringTunings}, this context
880 calculates strings and frets that can be used to play the notes.
881
882 @lilypond[quote,ragged-right,verbatim]
883 <<
884   \context ChordNames {
885      \chordmode { 
886        f1 g  
887      }
888   }
889   \context FretBoards {
890     < f, c f a c' f'>1
891     < g,\6 b, d g b g'>
892   }
893   \context Staff {
894     \clef "treble_8"
895     < f, c f a c' f'>1
896     < g, b, d g b' g'>
897   }  
898 >>
899 @end lilypond
900
901 As no predefined diagrams are loaded by default, automatic calculation 
902 of fret diagrams is the default behavior.  Once default diagrams are
903 loaded, automatic calculation can be enabled and disabled with predefined
904 commands:
905
906 @lilypond[quote,ragged-right,verbatim]
907
908 \storePredefinedDiagram <c e g c' e'>
909                         #guitar-tuning
910                         #"x;3-1-(;5-2;5-3;5-4;3-1-1);"
911 <<
912   \context ChordNames {
913      \chordmode { 
914        c1 c c 
915      }
916   }
917   \context FretBoards {
918     <c e g c' e'>1
919     \predefinedFretboardsOff
920     <c e g c' e'>
921     \predefinedFretboardsOn
922     <c e g c' e'>
923   }
924   \context Staff {
925     \clef "treble_8"
926     <c e g c' e'>1
927     <c e g c' e'>
928     <c e g c' e'>
929   }  
930 >>
931 @end lilypond
932
933   
934
935 Sometimes the fretboard calculator will be unable to find
936 an accceptable diagram.  This can often be remedied by
937 manually assigning a note to a string.  In many cases, only one
938 note need be manually placed on a string; the rest of 
939 the notes will then be placed appropriately by the @code{FretBoards}
940 context.
941
942 @lilypond[quote,ragged-right,verbatim]
943 <<
944   \context ChordNames {
945      \chordmode { 
946        c1 c 
947      }
948   }
949   \context FretBoards {
950     < c g c' e' g'> 1
951     < c g\4 c' e' g'> 1
952   }
953   \context Staff {
954     \clef "treble_8"
955     < c g c' e' g'> 1
956     < c g c' e' g'> 1
957   }  
958 >>
959 @end lilypond
960
961 Fingerings can be added to FretBoard fret diagrams.
962
963 @lilypond[quote, verbatim]
964 <<
965   \context ChordNames {
966      \chordmode { 
967        c1 d:m          
968      }
969   }
970   \context FretBoards {
971     < c-3 e-2 g c'-1 e' > 1
972     < d a-2 d'-3 f'-1>
973   }
974   \context Staff {
975     \clef "treble_8"
976     < c e g c' e' > 1
977     < d a d' f'>
978   }  
979 >>
980 @end lilypond
981
982 The minimum fret to be used in calculating strings and frets for
983 the FretBoard context can be set with the @code{minimumFret}
984 property.
985
986 @lilypond[quote, verbatim]
987 <<
988   \context ChordNames {
989      \chordmode {
990        d1:m d:m
991      }
992   }
993   \context FretBoards {
994     < d a d' f'>
995     \set FretBoards.minimumFret = #5
996     < d a d' f'>
997   }
998   \context Staff {
999     \clef "treble_8"
1000     < d a d' f'>
1001     < d a d' f'>
1002   }
1003 >>
1004 @end lilypond
1005
1006 The strings and frets for the @code{FretBoards} context depend
1007 on the @code{stringTunings} property, which has the same meaning
1008 as in the TabStaff context.  See @ref{Custom tablatures} for 
1009 information on the @code{stringTunings} property. 
1010
1011 The graphical layout of a fret diagram can be customized according to
1012 user preference through the properties of the @code{fret-diagram-interface}.
1013 Details are found at @rinternals{fret-diagram-interface}.  For a 
1014 @code{FretBoards} fret diagram, the interface properties belong to 
1015 @code{FretBoards.FretBoard}.
1016
1017 @predefined
1018 @code{\predefinedFretboardsOff},
1019 @code{\predefinedFretboardsOn}.
1020
1021 @seealso
1022
1023 Notation Reference:
1024 @ref{Custom tablatures}.
1025
1026 Snippets:
1027 @rlsr{Fretted strings}.
1028
1029 Internals Reference:
1030 @rinternals {fret-diagram-interface}.
1031
1032
1033 @node Right-hand fingerings
1034 @unnumberedsubsubsec Right-hand fingerings
1035
1036 Right-hand fingerings @var{p-i-m-a} must be entered within a  
1037 chord construct @code{<>} for them to be printed in the score, 
1038 even when applied to a single note. 
1039
1040 @warning{There @strong{must} be a hyphen after the note and a space 
1041 before the closing @code{>}.}
1042
1043 @lilypond[quote,verbatim,relative=0]
1044 \clef "treble_8"
1045 <c-\rightHandFinger #1 >4 
1046 <e-\rightHandFinger #2 > 
1047 <g-\rightHandFinger #3 > 
1048 <c-\rightHandFinger #4 >
1049 <c,-\rightHandFinger #1 e-\rightHandFinger #2 g-\rightHandFinger #3 c-\rightHandFinger #4 >1
1050 @end lilypond
1051
1052 For convenience, you can abbreviate @code{\rightHandFinger} to something
1053 short, for example @code{RH},
1054
1055 @example
1056 #(define RH rightHandFinger)
1057 @end example
1058
1059 @cindex fingerings, right hand, for guitar
1060 @cindex right hand fingerings for guitar
1061
1062 @snippets
1063
1064 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1065 {placement-of-right-hand-fingerings.ly}
1066
1067 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1068 {fingerings,-string-indications,-and-right-hand-fingerings.ly}
1069
1070 @seealso
1071
1072 Snippets:
1073 @rlsr{Fretted strings}.
1074
1075 Internals Reference: 
1076 @rinternals{StrokeFinger}.
1077
1078
1079 @node Guitar
1080 @subsection Guitar
1081
1082 Most of the notational issues associated with guitar music are
1083 covered sufficiently in the general fretted strings section, but there
1084 are a few more worth covering here.  Occasionally users want to 
1085 create songbook-type documents having only lyrics with chord
1086 indications above them.  Since Lilypond is a music typesetter,
1087 it is not recommended for documents that have no music notation
1088 in them.  A better alternative is a word processor, text editor, 
1089 or, for experienced users, a typesetter like GuitarTeX.
1090
1091 @menu
1092 * Indicating position and barring::  
1093 * Indicating harmonics and dampened notes::  
1094 @end menu
1095
1096 @node Indicating position and barring
1097 @unnumberedsubsubsec Indicating position and barring
1098
1099 This example demonstrates how to include guitar position and
1100 barring indications.
1101
1102 @lilypond[quote,ragged-right,fragment,verbatim,relative=0]
1103 \clef "treble_8"
1104 b16 d g b e
1105 \textSpannerDown
1106 \override TextSpanner #'bound-details #'left #'text = #"XII "
1107   g16\startTextSpan
1108   b16 e g e b g\stopTextSpan
1109 e16 b g d
1110 @end lilypond
1111
1112 @seealso
1113
1114 Notation Reference:
1115 @ref{Text spanners}.
1116
1117 Snippets:
1118 @rlsr{Fretted strings},
1119 @rlsr{Expressive marks}.
1120
1121 @node Indicating harmonics and dampened notes
1122 @unnumberedsubsubsec Indicating harmonics and dampened notes
1123
1124 Special note heads can be used to indicate dampened notes or 
1125 harmonics.  Harmonics are normally further explained with a 
1126 text markup.
1127
1128 @lilypond[quote,ragged-right,fragment,verbatim]
1129 \relative c' {
1130   \clef "treble_8"
1131   \override Staff.NoteHead #'style = #'cross
1132   g8 a b c b4
1133   \override Staff.NoteHead #'style = #'harmonic-mixed
1134   d^\markup { \italic { \fontsize #-2 { "harm. 12" }}} <g b>1
1135 }
1136 @end lilypond
1137
1138 @seealso
1139
1140 Snippets:
1141 @rlsr{Fretted strings}.
1142
1143 Notation Reference:
1144 @ref{Special note heads},
1145 @ref{Note head styles}.
1146
1147 @node Banjo
1148 @subsection Banjo
1149
1150 @menu
1151 * Banjo tablatures::            
1152 @end menu
1153
1154 @node Banjo tablatures
1155 @unnumberedsubsubsec Banjo tablatures
1156 @cindex Banjo tablatures
1157
1158 LilyPond has basic support for the five-string banjo.  When making tablatures
1159 for five-string banjo, use the banjo tablature format function to get
1160 correct fret numbers for the fifth string:
1161
1162 @c due to crazy intervals of banjo music, absolute pitch is recommended
1163
1164 @lilypond[quote,ragged-right,fragment,verbatim]
1165 \new TabStaff <<
1166   \set TabStaff.tablatureFormat = #fret-number-tablature-format-banjo
1167   \set TabStaff.stringTunings = #banjo-open-g-tuning
1168   {
1169     \stemDown
1170     g8 d' g'\5 a b g e d' |
1171     g4 d''8\5 b' a'\2 g'\5 e'\2 d' |
1172     g4
1173   }
1174 >>
1175 @end lilypond
1176
1177 A number of common tunings for banjo are predefined in LilyPond:
1178 @code{banjo-c-tuning} (gCGBD), @code{banjo-modal-tuning} (gDGCD),
1179 @code{banjo-open-d-tuning} (aDF#AD) and @code{banjo-open-dm-tuning}
1180 (aDFAD).
1181
1182 These tunings may be converted to four-string banjo tunings using the
1183 @code{four-string-banjo} function:
1184
1185 @example
1186 \set TabStaff.stringTunings = #(four-string-banjo banjo-c-tuning)
1187 @end example
1188
1189 @seealso
1190
1191 Snippets:
1192 @rlsr{Fretted strings}.
1193
1194 The file @file{scm/@/output@/-lib@/.scm} contains predefined banjo tunings.
1195
1196
1197
1198
1199