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