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