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