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