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