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