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