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