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