]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/fretted-strings.itely
Make the length of beamlets configurable.
[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.
608
609 @c \override is necessary to make fingering visible
610 @lilypond[quote, verbatim]
611 <<
612   \context ChordNames {
613      \chordmode {
614        f1 g
615      }
616   }
617   \context Staff {
618     \clef "treble_8"
619     \override Voice.TextScript
620       #'(fret-diagram-details finger-code) = #'below-string
621
622     < f, c f a c' f'>1 ^\markup
623       \fret-diagram-verbose #'(
624         (place-fret 6 1)
625         (place-fret 5 3)
626         (place-fret 4 3)
627         (place-fret 3 2)
628         (place-fret 2 1)
629         (place-fret 1 1)
630         (barre 6 1 1)
631       )
632     < g, b, d g b g'> ^\markup
633       \fret-diagram-verbose #'(
634         (place-fret 6 3 2)
635         (place-fret 5 2 1)
636         (open 4)
637         (open 3)
638         (open 2)
639         (place-fret 1 3 3)
640       )
641   }
642 >>
643 @end lilypond
644
645 All other fret diagram properties must be adjusted using @code{\override}
646 when using the fret-diagram-verbose markup.
647
648 @ignore
649 The following example shows the three fret-diagram markup
650 interfaces, along with examples of common tweaks.  For example,
651 the size of the verbose fret diagram is reduced to 0.75, and the
652 finger indications are specified to appear below the diagram.  The
653 terse diagram includes tweaks to specify placement of finger code
654 and color of dots.
655
656 @lilypond[verbatim,ragged-right,quote]
657 \new Voice {
658   \clef "treble_8"
659   d^\markup \fret-diagram #"6-x;5-x;4-o;3-2;2-3;1-2;"
660   d d d
661   fis^\markup \override #'(size . 0.75) {
662     \override #'(finger-code . below-string) {
663       \fret-diagram-verbose #'((place-fret 6 2 1) (barre 6 1 2)
664                                (place-fret 5 4 3)
665                                (place-fret 4 4 4)
666                                (place-fret 3 3 2)
667                                (place-fret 2 2 1)
668                                (place-fret 1 2 1))
669     }
670   }
671   fis fis fis
672   c^\markup \override #'(dot-radius . 0.35) {
673     \override #'(finger-code . in-dot) {
674       \override #'(dot-color . white) {
675         \fret-diagram-terse #"x;3-1-(;5-2;5-3;5-4;3-1-);"
676       }
677     }
678   }
679   c c c
680 }
681 @end lilypond
682 @end ignore
683
684 @cindex customized fret diagram
685 @cindex fret diagram, customized
686 @cindex diagram, fret, customized
687
688 @funindex fret-diagram-interface
689
690 The graphical layout of a fret diagram can be customized according to
691 user preference through the properties of the @code{fret-diagram-interface}.
692 Details are found at @rinternals{fret-diagram-interface}.  For a fret diagram
693 markup, the interface properties belong to @code{Voice.TextScript}.
694
695 @snippets
696
697 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
698 {customizing-markup-fret-diagrams.ly}
699
700
701 @seealso
702 Notation Reference:
703 @ref{Text markup commands}.
704
705 Snippets:
706 @rlsr{Fretted strings}.
707
708 Internals Reference:
709 @rinternals{fret-diagram-interface}.
710
711
712 @node Predefined fret diagrams
713 @unnumberedsubsubsec Predefined fret diagrams
714
715
716 @cindex fret diagrams
717 @cindex chord diagrams
718
719 @funindex FretBoards
720 @funindex stringTunings
721
722 Fret diagrams can be displayed using the @code{FretBoards} context.  By
723 default, the @code{FretBoards} context will display fret diagrams that
724 are stored in a lookup table:
725
726 @lilypond[verbatim, ragged-right, quote]
727 \include "predefined-guitar-fretboards.ly"
728 \context FretBoards {
729   \chordmode {
730     c1 d
731   }
732 }
733 @end lilypond
734
735 The default predefined fret diagrams are contained in the file
736 @code{predefined-guitar-fretboards.ly}.  Fret diagrams are
737 stored based on the pitches of a chord and the value of
738 @code{stringTunings} that is currently in use.
739 @code{predefined-guitar-fretboards.ly} contains predefined
740 fret diagrams only for @code{guitar-tuning}.  Predefined fret
741 diagrams can be added for other instruments or other tunings
742 by following the examples found in
743 @code{predefined-guitar-fretboards.ly}.
744
745 Chord pitches can be entered
746 either as simultaneous music or using chord mode (see
747 @ref{Chord mode overview}).
748
749 @lilypond[verbatim, ragged-right,quote]
750 \include "predefined-guitar-fretboards.ly"
751 \context FretBoards {
752   \chordmode {c1}
753   <c' e' g'>1
754 }
755 @end lilypond
756
757 @cindex chord names with fret diagrams
758 @cindex fret diagrams with chord names
759
760 @funindex ChordNames
761 @funindex chordmode
762 @funindex \chordmode
763
764 It is common that both chord names and fret diagrams are displayed together.
765 This is achieved by putting a @code{ChordNames} context in parallel with
766 a @code{FretBoards} context and giving both contexts the same music.
767
768 @lilypond[verbatim, ragged-right, quote]
769 \include "predefined-guitar-fretboards.ly"
770 mychords = \chordmode{
771   c1 f g
772 }
773
774 <<
775   \context ChordNames {
776     \mychords
777   }
778   \context FretBoards {
779     \mychords
780   }
781 >>
782 @end lilypond
783
784 @cindex transposing fret diagrams
785 @cindex fret diagrams, transposing
786 @cindex diagrams, fret, transposing
787
788 Predefined fret diagrams are transposable, as long as a diagram for the
789 transposed chord is stored in the fret diagram table.
790
791 @lilypond[verbatim, ragged-right, quote]
792 \include "predefined-guitar-fretboards.ly"
793 mychords = \chordmode{
794   c1 f g
795 }
796
797 mychordlist = {
798   \mychords
799   \transpose c e { \mychords}
800 }
801 <<
802   \context ChordNames {
803     \mychordlist
804   }
805   \context FretBoards {
806     \mychordlist
807   }
808 >>
809 @end lilypond
810
811
812 The predefined fret diagram table contains seven chords (major, minor,
813 augmented, diminished, dominant seventh, major seventh, minor seventh)
814 for each of 17 keys.  A complete list of the predefined fret diagrams is
815 shown in @ref{Predefined fretboard diagrams}.  If there is no entry in
816 the table for a chord, the FretBoards engraver will calculate a
817 fret-diagram using the automatic fret diagram functionality described in
818 @ref{Automatic fret diagrams}.
819
820 @lilypond[verbatim, ragged-right, quote]
821 \include "predefined-guitar-fretboards.ly"
822 mychords = \chordmode{
823   c1 c:9
824 }
825
826 <<
827   \context ChordNames {
828     \mychords
829   }
830   \context FretBoards {
831     \mychords
832   }
833 >>
834 @end lilypond
835
836 @cindex fret diagrams, adding custom
837 @cindex custom fret diagrams, adding
838 @cindex adding custom fret diagrams
839
840 Fret diagrams can be added to the fret diagram table.  To add a diagram,
841 you must specify the chord for the diagram, the tuning to be used, and the
842 fret-diagram-terse definition string for the diagram.
843
844 @lilypond[verbatim, ragged-right, quote]
845 \include "predefined-guitar-fretboards.ly"
846
847 \storePredefinedDiagram \chordmode {c:9}
848                         #guitar-tuning
849                         #"x;3-2;2-1;3-3;3-4;x;"
850
851 mychords = \chordmode{
852   c1 c:9
853 }
854
855 <<
856   \context ChordNames {
857     \mychords
858   }
859   \context FretBoards {
860     \mychords
861   }
862 >>
863 @end lilypond
864
865 Different fret diagrams for the same chord name can be stored using different
866 octaves of pitches.
867
868 @lilypond[verbatim, ragged-right, quote]
869 \include "predefined-guitar-fretboards.ly"
870
871 \storePredefinedDiagram \chordmode {c'}
872                         #guitar-tuning
873                         #(offset-fret 2 (chord-shape 'bes))
874
875 mychords = \chordmode{
876   c1 c'
877 }
878
879 <<
880   \context ChordNames {
881     \mychords
882   }
883   \context FretBoards {
884     \mychords
885   }
886 >>
887 @end lilypond
888
889 @cindex fretted instruments, chord shapes
890 @cindex chord shapes for fretted instruments
891
892 @funindex \addChordShape
893 @funindex add ChordShape
894 @funindex storePredefinedDiagram
895 @funindex \storePredefinedDiagram
896
897 In addition to fret diagrams, LilyPond stores an internal list of chord
898 shapes.  The chord shapes are fret diagrams that can be shifted along
899 the neck to different posistions to provide different chords.  Chord
900 shapes can be added to the internal list and then used to define
901 predefined fret diagrams.
902
903 @lilypond[verbatim, ragged-right, quote]
904 \include "predefined-guitar-fretboards.ly"
905
906 % add a new chord shape
907
908 \addChordShape #'powerf #"1-1;3-3;3-4;x;x;x;"
909
910 % add some new chords based on the power chord shape
911
912 \storePredefinedDiagram \chordmode {f'}
913                         #guitar-tuning
914                         #(chord-shape 'powerf)
915 \storePredefinedDiagram \chordmode {g'}
916                         #guitar-tuning
917                         #(offset-fret 2 (chord-shape 'powerf))
918
919 mychords = \chordmode{
920   f1 f' g g'
921 }
922
923 <<
924   \context ChordNames {
925     \mychords
926   }
927   \context FretBoards {
928     \mychords
929   }
930 >>
931 @end lilypond
932
933 The graphical layout of a fret diagram can be customized according to
934 user preference through the properties of the @code{fret-diagram-interface}.
935 Details are found at @rinternals{fret-diagram-interface}.  For a
936 predefined fret diagram, the interface properties belong to
937 @code{FretBoards.FretBoard}.
938
939 @snippets
940
941 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
942 {customizing-fretboard-fret-diagrams.ly}
943
944 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
945 {defining-predefined-fretboards-for-other-instruments.ly}
946
947
948 @seealso
949 Notation Reference:
950 @ref{Custom tablatures},
951 @ref{Automatic fret diagrams},
952 @ref{Chord mode overview},
953 @ref{Predefined fretboard diagrams}.
954
955 Installed Files:
956 @file{ly/predefined-guitar-fretboards.ly},
957 @file{ly/predefined-guitar-ninth-fretboards.ly}.
958
959 Snippets:
960 @rlsr{Fretted strings}.
961
962 Internals Reference:
963 @rinternals {fret-diagram-interface}.
964
965
966 @node Automatic fret diagrams
967 @unnumberedsubsubsec Automatic fret diagrams
968
969 @cindex fret diagrams, automatic
970 @cindex chord diagrams, automatic
971 @cindex automatic fret diagrams
972 @cindex automatic chord diagrams
973
974 Fret diagrams can be automatically created from entered notes using the
975 @code{FretBoards} context.  If no predefined diagram is available for
976 the entered notes in the active @code{stringTunings}, this context
977 calculates strings and frets that can be used to play the notes.
978
979 @lilypond[quote,ragged-right,verbatim]
980 <<
981   \context ChordNames {
982      \chordmode {
983        f1 g
984      }
985   }
986   \context FretBoards {
987     < f, c f a c' f'>1
988     < g,\6 b, d g b g'>
989   }
990   \context Staff {
991     \clef "treble_8"
992     < f, c f a c' f'>1
993     < g, b, d g b' g'>
994   }
995 >>
996 @end lilypond
997
998 @funindex predefinedFretboardsOff
999 @funindex \predefinedFretboardsOff
1000 @funindex predefinedFretboardsOn
1001 @funindex \predefinedFretboardsOn
1002
1003 As no predefined diagrams are loaded by default, automatic calculation
1004 of fret diagrams is the default behavior.  Once default diagrams are
1005 loaded, automatic calculation can be enabled and disabled with predefined
1006 commands:
1007
1008 @lilypond[quote,ragged-right,verbatim]
1009
1010 \storePredefinedDiagram <c e g c' e'>
1011                         #guitar-tuning
1012                         #"x;3-1-(;5-2;5-3;5-4;3-1-1);"
1013 <<
1014   \context ChordNames {
1015      \chordmode {
1016        c1 c c
1017      }
1018   }
1019   \context FretBoards {
1020     <c e g c' e'>1
1021     \predefinedFretboardsOff
1022     <c e g c' e'>
1023     \predefinedFretboardsOn
1024     <c e g c' e'>
1025   }
1026   \context Staff {
1027     \clef "treble_8"
1028     <c e g c' e'>1
1029     <c e g c' e'>
1030     <c e g c' e'>
1031   }
1032 >>
1033 @end lilypond
1034
1035
1036
1037 Sometimes the fretboard calculator will be unable to find
1038 an accceptable diagram.  This can often be remedied by
1039 manually assigning a note to a string.  In many cases, only one
1040 note need be manually placed on a string; the rest of
1041 the notes will then be placed appropriately by the @code{FretBoards}
1042 context.
1043
1044 @cindex fret diagrams, adding fingerings
1045 @cindex fingerings, adding to fret diagrams
1046
1047 Fingerings can be added to FretBoard fret diagrams.
1048
1049 @lilypond[quote, verbatim]
1050 <<
1051   \context ChordNames {
1052      \chordmode {
1053        c1 d:m
1054      }
1055   }
1056   \context FretBoards {
1057     < c-3 e-2 g c'-1 e' > 1
1058     < d a-2 d'-3 f'-1>
1059   }
1060   \context Staff {
1061     \clef "treble_8"
1062     < c e g c' e' > 1
1063     < d a d' f'>
1064   }
1065 >>
1066 @end lilypond
1067
1068 The minimum fret to be used in calculating strings and frets for
1069 the FretBoard context can be set with the @code{minimumFret}
1070 property.
1071
1072 @lilypond[quote, verbatim]
1073 <<
1074   \context ChordNames {
1075      \chordmode {
1076        d1:m d:m
1077      }
1078   }
1079   \context FretBoards {
1080     < d a d' f'>
1081     \set FretBoards.minimumFret = #5
1082     < d a d' f'>
1083   }
1084   \context Staff {
1085     \clef "treble_8"
1086     < d a d' f'>
1087     < d a d' f'>
1088   }
1089 >>
1090 @end lilypond
1091
1092 The strings and frets for the @code{FretBoards} context depend
1093 on the @code{stringTunings} property, which has the same meaning
1094 as in the TabStaff context.  See @ref{Custom tablatures} for
1095 information on the @code{stringTunings} property.
1096
1097 The graphical layout of a fret diagram can be customized according to
1098 user preference through the properties of the @code{fret-diagram-interface}.
1099 Details are found at @rinternals{fret-diagram-interface}.  For a
1100 @code{FretBoards} fret diagram, the interface properties belong to
1101 @code{FretBoards.FretBoard}.
1102
1103
1104 @predefined
1105 @code{\predefinedFretboardsOff},
1106 @code{\predefinedFretboardsOn}.
1107 @endpredefined
1108
1109
1110 @seealso
1111 Notation Reference:
1112 @ref{Custom tablatures}.
1113
1114 Snippets:
1115 @rlsr{Fretted strings}.
1116
1117 Internals Reference:
1118 @rinternals {fret-diagram-interface}.
1119
1120
1121 @node Right-hand fingerings
1122 @unnumberedsubsubsec Right-hand fingerings
1123
1124 @cindex fretted instruments, right hand fingerings
1125 @cindex fingerings, right hand for fretted instruments
1126 @cindex right hand fingerings for fretted instruments
1127
1128 @funindex rightHandFinger
1129 @funindex \rightHandFinger
1130
1131 Right-hand fingerings @var{p-i-m-a} must be entered within a
1132 chord construct @code{<>} for them to be printed in the score,
1133 even when applied to a single note.
1134
1135 @warning{There @strong{must} be a hyphen after the note and a space
1136 before the closing @code{>}.}
1137
1138 @lilypond[quote,verbatim,relative=0]
1139 \clef "treble_8"
1140 <c-\rightHandFinger #1 >4
1141 <e-\rightHandFinger #2 >
1142 <g-\rightHandFinger #3 >
1143 <c-\rightHandFinger #4 >
1144 <c,-\rightHandFinger #1 e-\rightHandFinger #2
1145   g-\rightHandFinger #3 c-\rightHandFinger #4 >1
1146 @end lilypond
1147
1148 For convenience, you can abbreviate @code{\rightHandFinger} to something
1149 short, for example @code{RH},
1150
1151 @example
1152 #(define RH rightHandFinger)
1153 @end example
1154
1155
1156 @snippets
1157
1158 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1159 {placement-of-right-hand-fingerings.ly}
1160
1161 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1162 {fingerings,-string-indications,-and-right-hand-fingerings.ly}
1163
1164
1165 @seealso
1166 Snippets:
1167 @rlsr{Fretted strings}.
1168
1169 Internals Reference:
1170 @rinternals{StrokeFinger}.
1171
1172
1173 @node Guitar
1174 @subsection Guitar
1175
1176 Most of the notational issues associated with guitar music are
1177 covered sufficiently in the general fretted strings section, but there
1178 are a few more worth covering here.  Occasionally users want to
1179 create songbook-type documents having only lyrics with chord
1180 indications above them.  Since Lilypond is a music typesetter,
1181 it is not recommended for documents that have no music notation
1182 in them.  A better alternative is a word processor, text editor,
1183 or, for experienced users, a typesetter like GuitarTeX.
1184
1185 @menu
1186 * Indicating position and barring::
1187 * Indicating harmonics and dampened notes::
1188 @end menu
1189
1190 @node Indicating position and barring
1191 @unnumberedsubsubsec Indicating position and barring
1192
1193 @cindex indicating position and barring for fretted instruments
1194 @cindex fretted instruments, indicating position and barring
1195
1196 This example demonstrates how to include guitar position and
1197 barring indications.
1198
1199 @lilypond[quote,ragged-right,fragment,verbatim,relative=0]
1200 \clef "treble_8"
1201 b16 d g b e
1202 \textSpannerDown
1203 \override TextSpanner #'(bound-details left text) = #"XII "
1204   g16\startTextSpan
1205   b16 e g e b g\stopTextSpan
1206 e16 b g d
1207 @end lilypond
1208
1209
1210 @seealso
1211 Notation Reference:
1212 @ref{Text spanners}.
1213
1214 Snippets:
1215 @rlsr{Fretted strings},
1216 @rlsr{Expressive marks}.
1217
1218
1219 @node Indicating harmonics and dampened notes
1220 @unnumberedsubsubsec Indicating harmonics and dampened notes
1221
1222 @cindex fretted instruments, dampened notes
1223 @cindex fretted instruments, harmonics
1224 @cindex dampened notes on fretted instruments
1225 @cindex harmonics on fretted instruments
1226
1227 Special note heads can be used to indicate dampened notes or
1228 harmonics.  Harmonics are normally further explained with a
1229 text markup.
1230
1231 @lilypond[quote,ragged-right,fragment,verbatim]
1232 \relative c' {
1233   \clef "treble_8"
1234   \override Staff.NoteHead #'style = #'cross
1235   g8 a b c b4
1236   \override Staff.NoteHead #'style = #'harmonic-mixed
1237   d^\markup { \italic { \fontsize #-2 { "harm. 12" }}} <g b>1
1238 }
1239 @end lilypond
1240
1241
1242 @seealso
1243 Snippets:
1244 @rlsr{Fretted strings}.
1245
1246 Notation Reference:
1247 @ref{Special note heads},
1248 @ref{Note head styles}.
1249
1250
1251 @node Banjo
1252 @subsection Banjo
1253
1254 @menu
1255 * Banjo tablatures::
1256 @end menu
1257
1258 @node Banjo tablatures
1259 @unnumberedsubsubsec Banjo tablatures
1260
1261 @cindex banjo tablatures
1262 @cindex tablature, banjo
1263
1264 LilyPond has basic support for the five-string banjo.  When making tablatures
1265 for five-string banjo, use the banjo tablature format function to get
1266 correct fret numbers for the fifth string:
1267
1268 @c due to crazy intervals of banjo music, absolute pitch is recommended
1269
1270 @lilypond[quote,ragged-right,fragment,verbatim]
1271 \new TabStaff <<
1272   \set TabStaff.tablatureFormat = #fret-number-tablature-format-banjo
1273   \set TabStaff.stringTunings = #banjo-open-g-tuning
1274   {
1275     \stemDown
1276     g8 d' g'\5 a b g e d' |
1277     g4 d''8\5 b' a'\2 g'\5 e'\2 d' |
1278     g4
1279   }
1280 >>
1281 @end lilypond
1282
1283 @cindex banjo tunings
1284 @cindex tunings, banjo
1285
1286 @funindex banjo-c-tuning
1287 @funindex banjo-modal-tuning
1288 @funindex banjo-open-d-tuning
1289 @funindex banjo-open-dm-tuning
1290 @funindex four-string-banjo
1291
1292 A number of common tunings for banjo are predefined in LilyPond:
1293 @code{banjo-c-tuning} (gCGBD), @code{banjo-modal-tuning} (gDGCD),
1294 @code{banjo-open-d-tuning} (aDF#AD) and @code{banjo-open-dm-tuning}
1295 (aDFAD).
1296
1297 These tunings may be converted to four-string banjo tunings using the
1298 @code{four-string-banjo} function:
1299
1300 @example
1301 \set TabStaff.stringTunings = #(four-string-banjo banjo-c-tuning)
1302 @end example
1303
1304
1305 @seealso
1306 Snippets:
1307 @rlsr{Fretted strings}.
1308
1309 The file @file{scm/@/output@/-lib@/.scm} contains predefined banjo tunings.