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