]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/fretted-strings.itely
Merge master into nested-bookparts
[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
954 Snippets:
955 @rlsr{Fretted strings}.
956
957 Internals Reference:
958 @rinternals {fret-diagram-interface}.
959
960
961 @node Automatic fret diagrams
962 @unnumberedsubsubsec Automatic fret diagrams
963
964 @cindex fret diagrams, automatic
965 @cindex chord diagrams, automatic
966 @cindex automatic fret diagrams
967 @cindex automatic chord diagrams
968
969 Fret diagrams can be automatically created from entered notes using the 
970 @code{FretBoards} context.  If no predefined diagram is available for
971 the entered notes in the active @code{stringTunings}, this context
972 calculates strings and frets that can be used to play the notes.
973
974 @lilypond[quote,ragged-right,verbatim]
975 <<
976   \context ChordNames {
977      \chordmode { 
978        f1 g  
979      }
980   }
981   \context FretBoards {
982     < f, c f a c' f'>1
983     < g,\6 b, d g b g'>
984   }
985   \context Staff {
986     \clef "treble_8"
987     < f, c f a c' f'>1
988     < g, b, d g b' g'>
989   }  
990 >>
991 @end lilypond
992
993 @funindex predefinedFretboardsOff
994 @funindex \predefinedFretboardsOff
995 @funindex predefinedFretboardsOn
996 @funindex \predefinedFretboardsOn
997
998 As no predefined diagrams are loaded by default, automatic calculation 
999 of fret diagrams is the default behavior.  Once default diagrams are
1000 loaded, automatic calculation can be enabled and disabled with predefined
1001 commands:
1002
1003 @lilypond[quote,ragged-right,verbatim]
1004
1005 \storePredefinedDiagram <c e g c' e'>
1006                         #guitar-tuning
1007                         #"x;3-1-(;5-2;5-3;5-4;3-1-1);"
1008 <<
1009   \context ChordNames {
1010      \chordmode { 
1011        c1 c c 
1012      }
1013   }
1014   \context FretBoards {
1015     <c e g c' e'>1
1016     \predefinedFretboardsOff
1017     <c e g c' e'>
1018     \predefinedFretboardsOn
1019     <c e g c' e'>
1020   }
1021   \context Staff {
1022     \clef "treble_8"
1023     <c e g c' e'>1
1024     <c e g c' e'>
1025     <c e g c' e'>
1026   }  
1027 >>
1028 @end lilypond
1029
1030   
1031
1032 Sometimes the fretboard calculator will be unable to find
1033 an accceptable diagram.  This can often be remedied by
1034 manually assigning a note to a string.  In many cases, only one
1035 note need be manually placed on a string; the rest of 
1036 the notes will then be placed appropriately by the @code{FretBoards}
1037 context.
1038
1039 @lilypond[quote,ragged-right,verbatim]
1040 <<
1041   \context ChordNames {
1042      \chordmode { 
1043        c1 c 
1044      }
1045   }
1046   \context FretBoards {
1047     < c g c' e' g'> 1
1048     < c g\4 c' e' g'> 1
1049   }
1050   \context Staff {
1051     \clef "treble_8"
1052     < c g c' e' g'> 1
1053     < c g c' e' g'> 1
1054   }  
1055 >>
1056 @end lilypond
1057
1058 @cindex fret diagrams, adding fingerings
1059 @cindex fingerings, adding to fret diagrams
1060
1061 Fingerings can be added to FretBoard fret diagrams.
1062
1063 @lilypond[quote, verbatim]
1064 <<
1065   \context ChordNames {
1066      \chordmode { 
1067        c1 d:m          
1068      }
1069   }
1070   \context FretBoards {
1071     < c-3 e-2 g c'-1 e' > 1
1072     < d a-2 d'-3 f'-1>
1073   }
1074   \context Staff {
1075     \clef "treble_8"
1076     < c e g c' e' > 1
1077     < d a d' f'>
1078   }  
1079 >>
1080 @end lilypond
1081
1082 The minimum fret to be used in calculating strings and frets for
1083 the FretBoard context can be set with the @code{minimumFret}
1084 property.
1085
1086 @lilypond[quote, verbatim]
1087 <<
1088   \context ChordNames {
1089      \chordmode {
1090        d1:m d:m
1091      }
1092   }
1093   \context FretBoards {
1094     < d a d' f'>
1095     \set FretBoards.minimumFret = #5
1096     < d a d' f'>
1097   }
1098   \context Staff {
1099     \clef "treble_8"
1100     < d a d' f'>
1101     < d a d' f'>
1102   }
1103 >>
1104 @end lilypond
1105
1106 The strings and frets for the @code{FretBoards} context depend
1107 on the @code{stringTunings} property, which has the same meaning
1108 as in the TabStaff context.  See @ref{Custom tablatures} for 
1109 information on the @code{stringTunings} property. 
1110
1111 The graphical layout of a fret diagram can be customized according to
1112 user preference through the properties of the @code{fret-diagram-interface}.
1113 Details are found at @rinternals{fret-diagram-interface}.  For a 
1114 @code{FretBoards} fret diagram, the interface properties belong to 
1115 @code{FretBoards.FretBoard}.
1116
1117 @predefined
1118 @code{\predefinedFretboardsOff},
1119 @code{\predefinedFretboardsOn}.
1120
1121 @seealso
1122
1123 Notation Reference:
1124 @ref{Custom tablatures}.
1125
1126 Snippets:
1127 @rlsr{Fretted strings}.
1128
1129 Internals Reference:
1130 @rinternals {fret-diagram-interface}.
1131
1132
1133 @node Right-hand fingerings
1134 @unnumberedsubsubsec Right-hand fingerings
1135
1136 @cindex fretted instruments, right hand fingerings
1137 @cindex fingerings, right hand for fretted instruments
1138 @cindex right hand fingerings for fretted instruments
1139
1140 @funindex rightHandFinger
1141 @funindex \rightHandFinger
1142
1143 Right-hand fingerings @var{p-i-m-a} must be entered within a  
1144 chord construct @code{<>} for them to be printed in the score, 
1145 even when applied to a single note. 
1146
1147 @warning{There @strong{must} be a hyphen after the note and a space 
1148 before the closing @code{>}.}
1149
1150 @lilypond[quote,verbatim,relative=0]
1151 \clef "treble_8"
1152 <c-\rightHandFinger #1 >4 
1153 <e-\rightHandFinger #2 > 
1154 <g-\rightHandFinger #3 > 
1155 <c-\rightHandFinger #4 >
1156 <c,-\rightHandFinger #1 e-\rightHandFinger #2 g-\rightHandFinger #3 c-\rightHandFinger #4 >1
1157 @end lilypond
1158
1159 For convenience, you can abbreviate @code{\rightHandFinger} to something
1160 short, for example @code{RH},
1161
1162 @example
1163 #(define RH rightHandFinger)
1164 @end example
1165
1166
1167 @snippets
1168
1169 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1170 {placement-of-right-hand-fingerings.ly}
1171
1172 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1173 {fingerings,-string-indications,-and-right-hand-fingerings.ly}
1174
1175 @seealso
1176
1177 Snippets:
1178 @rlsr{Fretted strings}.
1179
1180 Internals Reference: 
1181 @rinternals{StrokeFinger}.
1182
1183
1184 @node Guitar
1185 @subsection Guitar
1186
1187 Most of the notational issues associated with guitar music are
1188 covered sufficiently in the general fretted strings section, but there
1189 are a few more worth covering here.  Occasionally users want to 
1190 create songbook-type documents having only lyrics with chord
1191 indications above them.  Since Lilypond is a music typesetter,
1192 it is not recommended for documents that have no music notation
1193 in them.  A better alternative is a word processor, text editor, 
1194 or, for experienced users, a typesetter like GuitarTeX.
1195
1196 @menu
1197 * Indicating position and barring::  
1198 * Indicating harmonics and dampened notes::  
1199 @end menu
1200
1201 @node Indicating position and barring
1202 @unnumberedsubsubsec Indicating position and barring
1203
1204 @cindex indicating position and barring for fretted instruments
1205 @cindex fretted instruments, indicating position and barring
1206
1207 This example demonstrates how to include guitar position and
1208 barring indications.
1209
1210 @lilypond[quote,ragged-right,fragment,verbatim,relative=0]
1211 \clef "treble_8"
1212 b16 d g b e
1213 \textSpannerDown
1214 \override TextSpanner #'bound-details #'left #'text = #"XII "
1215   g16\startTextSpan
1216   b16 e g e b g\stopTextSpan
1217 e16 b g d
1218 @end lilypond
1219
1220 @seealso
1221
1222 Notation Reference:
1223 @ref{Text spanners}.
1224
1225 Snippets:
1226 @rlsr{Fretted strings},
1227 @rlsr{Expressive marks}.
1228
1229 @node Indicating harmonics and dampened notes
1230 @unnumberedsubsubsec Indicating harmonics and dampened notes
1231
1232 @cindex fretted instruments, dampened notes
1233 @cindex fretted instruments, harmonics
1234 @cindex dampened notes on fretted instruments
1235 @cindex harmonics on fretted instruments
1236
1237 Special note heads can be used to indicate dampened notes or 
1238 harmonics.  Harmonics are normally further explained with a 
1239 text markup.
1240
1241 @lilypond[quote,ragged-right,fragment,verbatim]
1242 \relative c' {
1243   \clef "treble_8"
1244   \override Staff.NoteHead #'style = #'cross
1245   g8 a b c b4
1246   \override Staff.NoteHead #'style = #'harmonic-mixed
1247   d^\markup { \italic { \fontsize #-2 { "harm. 12" }}} <g b>1
1248 }
1249 @end lilypond
1250
1251 @seealso
1252
1253 Snippets:
1254 @rlsr{Fretted strings}.
1255
1256 Notation Reference:
1257 @ref{Special note heads},
1258 @ref{Note head styles}.
1259
1260 @node Banjo
1261 @subsection Banjo
1262
1263 @menu
1264 * Banjo tablatures::            
1265 @end menu
1266
1267 @node Banjo tablatures
1268 @unnumberedsubsubsec Banjo tablatures
1269
1270 @cindex banjo tablatures
1271 @cindex tablature, banjo
1272
1273 LilyPond has basic support for the five-string banjo.  When making tablatures
1274 for five-string banjo, use the banjo tablature format function to get
1275 correct fret numbers for the fifth string:
1276
1277 @c due to crazy intervals of banjo music, absolute pitch is recommended
1278
1279 @lilypond[quote,ragged-right,fragment,verbatim]
1280 \new TabStaff <<
1281   \set TabStaff.tablatureFormat = #fret-number-tablature-format-banjo
1282   \set TabStaff.stringTunings = #banjo-open-g-tuning
1283   {
1284     \stemDown
1285     g8 d' g'\5 a b g e d' |
1286     g4 d''8\5 b' a'\2 g'\5 e'\2 d' |
1287     g4
1288   }
1289 >>
1290 @end lilypond
1291
1292 @cindex banjo tunings
1293 @cindex tunings, banjo
1294
1295 @funindex banjo-c-tuning
1296 @funindex banjo-modal-tuning
1297 @funindex banjo-open-d-tuning
1298 @funindex banjo-open-dm-tuning
1299 @funindex four-string-banjo
1300
1301 A number of common tunings for banjo are predefined in LilyPond:
1302 @code{banjo-c-tuning} (gCGBD), @code{banjo-modal-tuning} (gDGCD),
1303 @code{banjo-open-d-tuning} (aDF#AD) and @code{banjo-open-dm-tuning}
1304 (aDFAD).
1305
1306 These tunings may be converted to four-string banjo tunings using the
1307 @code{four-string-banjo} function:
1308
1309 @example
1310 \set TabStaff.stringTunings = #(four-string-banjo banjo-c-tuning)
1311 @end example
1312
1313 @seealso
1314
1315 Snippets:
1316 @rlsr{Fretted strings}.
1317
1318 The file @file{scm/@/output@/-lib@/.scm} contains predefined banjo tunings.
1319
1320
1321
1322
1323