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