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