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