]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/notation/fretted-strings.itely
Add functionality to string numbers
[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.19.2"
11
12 @node Fretted string instruments
13 @section Fretted string instruments
14
15 @lilypondfile[quote]{fretted-headword.ly}
16
17 This section discusses several aspects of music notation that are unique
18 to fretted string instruments.
19
20 @cindex tablature
21 @cindex tablature, guitar
22 @cindex tablature, banjo
23 @cindex guitar tablature
24 @cindex banjo tablature
25
26 @menu
27 * Common notation for fretted strings::
28 * Guitar::
29 * Banjo::
30 @end menu
31
32 @node Common notation for fretted strings
33 @subsection Common notation for fretted strings
34
35 This section discusses common notation that is unique
36 to fretted string instruments.
37
38 @menu
39 * References for fretted strings::
40 * String number indications::
41 * Default tablatures::
42 * Custom tablatures::
43 * Fret diagram markups::
44 * Predefined fret diagrams::
45 * Automatic fret diagrams::
46 * Right-hand fingerings::
47 @end menu
48
49 @node References for fretted strings
50 @unnumberedsubsubsec References for fretted strings
51
52 Music for fretted string instruments is normally notated on
53 a single staff, either in traditional music notation or in
54 tablature.  Sometimes the two types are combined, and it is
55 especially common in popular music to use chord diagrams above
56 a staff of traditional notation.  The guitar and the banjo are
57 transposing instruments, sounding an octave lower than written.
58 Scores for these instruments should use the @code{"treble_8"} clef
59 (or @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
65 @ref{Fingering instructions}.
66
67 @item Instructions for @notation{Laissez vibrer} ties
68 as well as ties on arpeggios and tremolos can be found in
69 @ref{Ties}.
70
71 @item Instructions for handling multiple voices can be found
72 in @ref{Collision resolution}.
73
74 @item Instructions for indicating harmonics can be found in
75 @ref{Harmonics}.
76
77 @end itemize
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.
101
102 @lilypond[verbatim,quote,relative=0]
103 \clef "treble_8"
104 c4\5 e\4 g2\3
105 <c,\5 e\4 g\3>1
106 @end lilypond
107
108 When fingerings and string indications are used together, their
109 placement can be controlled by the order in which the two items appear
110 in the code @emph{only} if they appear inside of an explicit chord:
111 applied to whole chords or single notes @emph{outside} of chords,
112 fingerings are placed using a different mechanism.
113
114 @lilypond[verbatim,quote,relative=1]
115 \clef "treble_8"
116 g4\3-0
117 g-0\3
118 <g\3-0>
119 <g-0\3>
120 @end lilypond
121
122 String numbers may also, as is customary with unfretted strings,
123 be printed in Roman numerals and placed below the staff rather
124 than above.
125
126 @lilypond[verbatim,quote,relative=2]
127 c2\2
128 a\3
129 \romanStringNumbers
130 c\2
131 \set stringNumberOrientations = #'(down)
132 a\3
133 \arabicStringNumbers
134 g1\4
135 @end lilypond
136
137 @snippets
138
139 @lilypondfile[verbatim,quote,texidoc,doctitle]
140 {controlling-the-placement-of-chord-fingerings.ly}
141
142 @lilypondfile[verbatim,quote,texidoc,doctitle]
143 {allowing-fingerings-to-be-printed-inside-the-staff.ly}
144
145 @predefined
146 @code{\arabicStringNumbers},
147 @code{\romanStringNumbers}.
148 @endpredefined
149
150 @seealso
151 Notation Reference:
152 @ref{Fingering instructions}.
153
154 Snippets:
155 @rlsr{Fretted strings}.
156
157 Internals Reference:
158 @rinternals{StringNumber},
159 @rinternals{Fingering}.
160
161
162 @node Default tablatures
163 @unnumberedsubsubsec Default tablatures
164
165 @cindex tablatures, basic
166 @cindex tablatures, default
167
168 @funindex TabStaff
169 @funindex TabVoice
170
171 Music for plucked string instruments is frequently notated using a
172 finger/touch notation or tablature.  In contrast to traditional
173 notation pitches are not denoted with note heads, but by numbers (or
174 letter-like symbols in historical intavolatura).  The staff lines
175 in tablature indicate the string on which the note is to be played,
176 and a number placed on a staff line indicated the fret at which
177 the corresponding string is to be pressed.
178 Notes that are to be played simultaneously are vertically aligned.
179
180 By default, string 1 is the highest string, and corresponds to the top
181 line on the @code{TabStaff}.  The tuning of the @code{TabStaff}
182 strings defaults to the
183 standard guitar tuning (with 6 strings).  The notes are printed as
184 tablature, by using @code{TabStaff} and @code{TabVoice} contexts.  A
185 calligraphic tablature clef is added automatically.
186
187 @lilypond[quote,ragged-right,verbatim]
188 \new TabStaff \relative c' {
189   a,8 a' <c e> a
190   d,8 a' <d f> a
191 }
192 @end lilypond
193
194 Default tablatures do not contain any symbols for tone duration nor any
195 other musical symbols such as e.g. expressive marks.
196
197 @lilypond[quote,ragged-right,verbatim]
198 symbols = {
199   \time 3/4
200   c4-.^"Allegro" d( e)
201   f4-.\f g a^\fermata
202   \mark \default
203   c8_.\<\( c16 c~ 2\!
204   c'2.\prall\)
205 }
206
207 \score {
208   <<
209     \new Staff { \clef "G_8" \symbols }
210     \new TabStaff { \symbols }
211   >>
212 }
213 @end lilypond
214
215 @funindex \tabFullNotation
216
217 If all musical symbols used in traditional notation should also show up
218 in tablature one has to apply the command @code{\tabFullNotation} in a
219 @code{TabStaff}-context.  Please bear in mind that half notes are
220 double-stemmed in tablature in order to distinguish them from quarter
221 notes.
222
223 @lilypond[quote,ragged-right,verbatim]
224 symbols = {
225   \time 3/4
226   c4-.^"Allegro" d( e)
227   f4-.\f g a^\fermata
228   \mark \default
229   c8_.\<\( c16 c~ 2\!
230   c'2.\prall\)
231 }
232
233 \score {
234   \new TabStaff {
235     \tabFullNotation
236     \symbols
237   }
238 }
239 @end lilypond
240
241 @cindex fret
242
243 @funindex minimumFret
244 @funindex restrainOpenStrings
245
246 By default pitches are assigned to the lowest playing position on the
247 fret-board (first position).  Open strings are automatically preferred.
248 If you would like a certain pitch to be played on a specific string you
249 can add a string number indication to the pitch name.  If you don't want
250 to have string number indications appear in traditional notation, you
251 can override the respective stencil.  Usually it will be more
252 comfortable to define the playing position by using the value of
253 @code{minimumFret}.  The default value for minimumFret is 0.
254
255 Even when @code{minimumFret} is set, open strings are used whenever
256 possible.  This behaviour can be changed by setting @code{restrainOpenStrings}
257 to @code{#t}.
258
259 @lilypond[quote,ragged-right,verbatim]
260 \layout { \omit Voice.StringNumber }
261 \new StaffGroup <<
262    \new Staff \relative c {
263      \clef "treble_8"
264      \time 2/4
265      c16 d e f g4
266      c,16\5 d\5 e\4 f\4 g4\4
267      c,16 d e f g4
268    }
269    \new TabStaff \relative c {
270      c16 d e f g4
271      c,16\5 d\5 e\4 f\4 g4\4
272      \set TabStaff.minimumFret = #5
273      \set TabStaff.restrainOpenStrings = ##t
274      c,16 d e f g4
275    }
276 >>
277 @end lilypond
278
279 @funindex \tabChordRepeats
280 @funindex \chordRepeats
281 @cindex chord, repetition
282 @cindex repetition, using @code{q}
283 @cindex @code{q}, chord repetition
284
285 Chord constructs can be repeated by the chord repetition symbol
286 @code{q}.  In combination with tabulatures, its behavior of removing
287 string and finger numbers alongside with other events is cumbersome, so
288 you'll want to run
289 @example
290 \chordRepeats #'(string-number-event fingering-event)
291 @end example
292 explicitly on music expressions in tabulature using @ref{Chord
293 repetition}.  This particular command is so common that it is available
294 as @code{\tabChordRepeats}.
295
296 @lilypond[quote,verbatim]
297 guitar = \relative c' {
298   r8 <gis-2 cis-3 b-0>~ q4 q8~ 8 q4
299 }
300
301 \new StaffGroup <<
302   \new Staff {
303     \clef "treble_8"
304     \guitar
305   }
306   \new TabStaff {
307     \tabChordRepeats \guitar
308   }
309 >>
310 @end lilypond
311
312 Ties over a line break are parenthesized by default.  The same holds for
313 the second alternative of a repeat.
314
315 @lilypond[quote,ragged-right,verbatim]
316 ties = \relative c' {
317   \repeat volta 2 {
318     e2. f4~
319     2 g2~
320   }
321   \alternative {
322      { g4 f2. }
323      { g4\repeatTie c,2. }
324   }
325   b1~
326   \break
327   b1
328   \bar "|."
329 }
330
331 \score {
332   <<
333     \new StaffGroup  <<
334       \new Staff {
335         \clef "treble_8"
336         \ties
337       }
338       \new TabStaff {
339         \ties
340       }
341     >>
342   >>
343   \layout {
344   indent = #0
345   ragged-right = ##t
346   }
347 }
348 @end lilypond
349
350 @funindex \hideSplitTiedTabNotes
351
352 The command @code{\hideSplitTiedTabNotes} cancels the behavior of
353 engraving fret numbers in parentheses:
354
355 @lilypond[quote,ragged-right,verbatim]
356 ties = \relative c' {
357   \repeat volta 2 {
358     e2. f4~
359     2 g2~ }
360   \alternative {
361     { g4 f2. }
362     { g4\repeatTie c,2. }
363   }
364   b1~
365   \break
366   b1
367   \bar "|."
368 }
369
370 \score {
371   <<
372     \new StaffGroup  <<
373       \new Staff {
374         \clef "treble_8"
375         \ties
376       }
377       \new TabStaff {
378       \hideSplitTiedTabNotes
379         \ties
380       }
381     >>
382   >>
383   \layout {
384   indent = #0
385   ragged-right = ##t
386   }
387 }
388 @end lilypond
389
390 @cindex harmonic indications in tablature notation
391 @cindex tablature and harmonic indications
392 @funindex \harmonic
393 @funindex \harmonicByFret
394 @funindex \harmonicByRatio
395
396 Harmonic indications can be added to tablature notation as sounding
397 pitches:
398
399 @lilypond[verbatim,quote]
400 \layout { \omit Voice.StringNumber }
401 firstHarmonic = {
402   d'4\4\harmonic
403   g'4\3\harmonic
404   b'2\2\harmonic
405 }
406 \score {
407   <<
408     \new Staff {
409       \clef "treble_8"
410       \firstHarmonic
411     }
412     \new TabStaff { \firstHarmonic }
413   >>
414 }
415 @end lilypond
416
417 Note that the command @code{\harmonic} must always be attached to single
418 notes (possibly inside of a chord) instead of whole chords.
419 It only makes sense for open-string harmonics
420 in the 12th fret. All other harmonics should be calculated by LilyPond.
421 This can be achieved by indicating the fret where a finger of the
422 fretting hand should touch a string.
423
424 @lilypond[verbatim,quote]
425 fretHarmonics = {
426   \harmonicByFret #5 d16\4
427   \harmonicByFret #4 d16\4
428   \harmonicByFret #3 d8\4
429   \harmonicByFret #5 <g\3 b\2>2.
430 }
431 \score {
432   <<
433     \new Staff {
434       \clef "treble_8"
435       \fretHarmonics
436     }
437     \new TabStaff { \fretHarmonics }
438   >>
439 }
440 @end lilypond
441
442 Alternatively, harmonics can be computed by defining the ratio of
443 string lengths above and below the harmonic fingering.
444
445 @lilypond[verbatim,quote]
446 ratioHarmonics = {
447   \harmonicByRatio #1/2 <g\3 b\2 e'\1>4
448   \harmonicByRatio #1/3 <g\3 b\2 e'\1>4
449   \harmonicByRatio #1/4 { g8\3 b8\2 e'4\1 }
450 }
451 \score {
452   <<
453     \new Staff {
454       \clef "treble_8"
455       \ratioHarmonics
456     }
457     \new TabStaff { \ratioHarmonics }
458   >>
459 }
460 @end lilypond
461
462 @snippets
463 @lilypondfile[verbatim,quote,texidoc,doctitle]
464 {stem-and-beam-behavior-in-tablature.ly}
465
466 @lilypondfile[verbatim,quote,texidoc,doctitle]
467 {polyphony-in-tablature.ly}
468
469 @lilypondfile[verbatim,quote,texidoc,doctitle]
470 {open-string-harmonics-in-tablature.ly}
471
472 @lilypondfile[verbatim,quote,texidoc,doctitle]
473 {fretted-string-harmonics-in-tablature.ly}
474
475 @cindex slides in tablature notation
476 @cindex tablature and slides
477
478 @lilypondfile[verbatim,quote,texidoc,doctitle]
479 {slides-in-tablature.ly}
480
481 @cindex chord glissandi
482
483 @lilypondfile[verbatim,quote,texidoc,doctitle]
484 {chord-glissando-in-tablature.ly}
485
486 @cindex hammer on
487 @cindex pull off
488
489 @lilypondfile[verbatim,quote,texidoc,doctitle]
490 {hammer-on-and-pull-off.ly}
491
492 @lilypondfile[verbatim,quote,texidoc,doctitle]
493 {hammer-on-and-pull-off-using-voices.ly}
494
495 @lilypondfile[verbatim,quote,texidoc,doctitle]
496 {hammer-on-and-pull-off-using-chords.ly}
497
498 @seealso
499 Notation Reference:
500 @ref{Chord repetition},
501 @ref{Glissando},
502 @ref{Harmonics},
503 @ref{Stems},
504 @ref{Written-out repeats}.
505
506 Snippets:
507 @rlsr{Fretted strings}.
508
509 Internals Reference:
510 @rinternals{TabNoteHead},
511 @rinternals{TabStaff},
512 @rinternals{TabVoice},
513 @rinternals{Beam}.
514
515 @knownissues
516 Chords are not handled in a special way, and hence the automatic
517 string selector may easily select the same string for two notes in
518 a chord.
519
520 In order to handle @code{\partcombine}, a @code{TabStaff} must use
521 specially-created voices:
522
523 @lilypond[quote,ragged-right,verbatim]
524 melodia = \partcombine { e4 g g g } { e4 e e e }
525 <<
526   \new TabStaff <<
527     \new TabVoice = "one" s1
528     \new TabVoice = "two" s1
529     \new TabVoice = "shared" s1
530     \new TabVoice = "solo" s1
531     { \melodia }
532   >>
533 >>
534 @end lilypond
535
536 Guitar special effects are limited to harmonics and slides.
537
538
539 @node Custom tablatures
540 @unnumberedsubsubsec Custom tablatures
541
542 @cindex tablatures, custom
543 @cindex tablature, banjo
544 @cindex tablature, mandolin
545 @cindex tablature, guitar
546 @cindex tablature, bass guitar
547 @cindex tablature, ukulele
548 @cindex tablature, predefined string tunings
549 @cindex fretted instruments, predefined string tunings
550 @cindex predefined string tunings for fretted instruments
551 @cindex tablature, violin
552 @cindex tablature, viola
553 @cindex tablature, cello
554 @cindex tablature, bass
555 @cindex tablature, double bass
556
557 @funindex stringTunings
558
559 LilyPond tablature automatically calculates the fret for
560 a note based on the string to which the note is assigned.
561 In order to do this, the tuning of the strings must be
562 specified.  The tuning of the strings is given in the
563 @code{stringTunings} property.
564
565 LilyPond comes with predefined string tunings for banjo, mandolin,
566 guitar, bass guitar, ukulele, violin, viola, cello, and double bass.
567 LilyPond automatically sets
568 the correct transposition for predefined tunings.  The following
569 example is for bass guitar, which sounds an octave lower than
570 written.
571
572 @lilypond[quote,ragged-right,verbatim]
573 <<
574   \new Voice \with {
575     \omit StringNumber
576   } {
577     \clef "bass_8"
578     \relative c, {
579       c4 d e f
580     }
581   }
582   \new TabStaff \with {
583     stringTunings = #bass-tuning
584   } {
585     \relative c, {
586       c4 d e f
587     }
588   }
589 >>
590 @end lilypond
591
592 The default string tuning is @code{guitar-tuning}, which
593 is the standard EADGBE tuning.  Some other predefined tunings are
594 @code{guitar-open-g-tuning}, @code{mandolin-tuning} and
595 @code{banjo-open-g-tuning}.  The predefined string tunings
596 are found in @file{ly/string-tunings-init.ly}.
597
598 @funindex stringTuning
599 @funindex \stringTuning
600 @cindex tablature, custom string tunings
601 @cindex custom string tunings
602
603 Any desired string tuning can be created.  The
604 @code{\stringTuning} function can be
605 used to define a string tuning which can be used
606 to set @code{stringTunings} for the current context.
607
608 Its argument is a chord construct
609 defining the pitches of each string in the tuning.
610 The chord construct must be in absolute octave mode,
611 see @ref{Absolute octave entry}.  The string
612 with the highest number (generally the lowest string) must
613 come first in the chord.  For example, we can
614 define a string tuning for a four-string instrument with pitches
615 of @code{a''},  @code{d''},  @code{g'}, and @code{c'}:
616
617 @lilypond[quote,verbatim]
618
619 mynotes = {
620   c'4 e' g' c'' |
621   e''4 g'' b'' c'''
622 }
623
624 <<
625   \new Staff {
626     \clef treble
627     \mynotes
628   }
629   \new TabStaff {
630     \set Staff.stringTunings = \stringTuning <c' g' d'' a''>
631     \mynotes
632   }
633 >>
634 @end lilypond
635
636 The @code{stringTunings} property is also used by
637 @code{FretBoards} to calculate automatic fret diagrams.
638
639 String tunings are used as part of the hash key
640 for predefined fret diagrams
641 (see @ref{Predefined fret diagrams}).
642
643 The previous example could also be written as follows:
644
645 @lilypond[quote,verbatim]
646 custom-tuning = \stringTuning <c' g' d'' a''>
647
648 mynotes = {
649   c'4 e' g' c'' |
650   e''4 g'' b'' c'''
651 }
652
653 <<
654   \new Staff {
655     \clef treble
656     \mynotes
657   }
658   \new TabStaff {
659     \set TabStaff.stringTunings = #custom-tuning
660     \mynotes
661   }
662 >>
663 @end lilypond
664
665 Internally, a string tuning is a Scheme list of string pitches,
666 one for each string, ordered by string number from 1 to N,
667 where string 1 is at the top of the tablature staff and
668 string N is at the bottom.  This ordinarily results in ordering
669 from highest pitch to lowest pitch, but some instruments
670 (e.g. ukulele) do not have strings ordered by pitch.
671
672 A string pitch in a string tuning list is a LilyPond pitch
673 object.  Pitch objects are created with the Scheme function
674 @code{ly:make-pitch} (see @ref{Scheme functions}).
675
676 @code{\stringTuning} creates such an object from chord input.
677
678 LilyPond automatically calculates the number of lines in the
679 @code{TabStaff} and the number of strings in an automatically
680 calculated @code{FretBoard} as the number of elements
681 in @code{stringTunings}.
682
683 To let all TabStaff contexts use the same custom tuning by default,
684 you can use
685
686 @example
687 \layout @{
688   \context @{
689     \TabStaff
690     stringTunings = \stringTuning <c' g' d'' a''>
691   @}
692 @}
693 @end example
694
695
696 @cindex moderntab clef
697 @cindex clef, moderntab
698 @cindex clef, tab
699 @cindex tab clef
700
701 A modern tab clef can also be used.
702
703 @lilypond[quote,ragged-right,verbatim]
704 \new TabStaff {
705   \clef moderntab
706   <a, e a>1
707   \break
708   \clef tab
709   <a, e a>1
710 }
711 @end lilypond
712
713 The modern tab clef supports tablatures from 4 to 7 strings.
714
715 @seealso
716 Notation Reference:
717 @ref{Absolute octave entry},
718 @ref{Predefined fret diagrams},
719 @ref{Scheme functions}.
720
721 Installed Files:
722 @file{ly/string-tunings-init.ly},
723 @file{scm/tablature.scm}.
724
725 Snippets:
726 @rlsr{Fretted strings}.
727
728 Internals Reference:
729 @rinternals{Tab_note_heads_engraver}.
730
731 @knownissues
732 Automatic tablature calculations do not work properly in most
733 cases for instruments where string pitches do not vary
734 monotonically with string number, such as ukuleles.
735
736
737 @node Fret diagram markups
738 @unnumberedsubsubsec Fret diagram markups
739
740 @cindex fret diagrams
741 @cindex chord diagrams
742 @cindex diagrams, fret
743 @cindex diagrams, chord for fretted instruments
744 @cindex fret diagrams, custom
745 @cindex custom fret diagrams
746
747 Fret diagrams can be added to music as a markup to the desired
748 note.  The markup contains information about the desired fret
749 diagram.  There are three different fret-diagram markup
750 interfaces: standard, terse, and verbose.  The three interfaces
751 produce equivalent markups, but have varying amounts of
752 information in the markup string.  Details about the
753 syntax of the different markup strings used to define
754 fret diagrams are found at @ref{Instrument Specific Markup}.
755
756 The standard fret diagram markup string indicates the string
757 number and the fret number for each dot to be placed on the string.
758 In addition, open and unplayed (muted) strings can be indicated.
759
760 @lilypond[quote, verbatim]
761 <<
762   \new ChordNames {
763     \chordmode {
764       c1 d:m
765     }
766   }
767   \new Staff {
768     \clef "treble_8"
769     <c e g c' e'>1^\markup {
770       \fret-diagram #"6-x;5-3;4-2;3-o;2-1;1-o;"
771     }
772     <d a d' f'>1^\markup {
773       \fret-diagram #"6-x;5-x;4-o;3-2;2-3;1-1;"
774     }
775   }
776 >>
777 @end lilypond
778
779 @cindex barre indications
780
781 Barre indications can be added to the diagram from
782 the fret-diagram markup string.
783
784 @lilypond[quote, verbatim]
785 <<
786   \new ChordNames {
787      \chordmode {
788        f1 g
789      }
790   }
791   \new Staff {
792     \clef "treble_8"
793     <f, c f a c' f'>1^\markup {
794       \fret-diagram #"c:6-1-1;6-1;5-3;4-3;3-2;2-1;1-1;"
795     }
796     <g, d g b d' g'>1^\markup {
797       \fret-diagram #"c:6-1-3;6-3;5-5;4-5;3-4;2-3;1-3;"
798     }
799   }
800 >>
801 @end lilypond
802
803 @cindex fret-diagram markup
804 @cindex ukulele
805
806 @funindex fret-diagram
807 @funindex \fret-diagram
808
809 The size of the fret diagram, and the number of frets in the diagram
810 can be changed in the fret-diagram markup string.
811
812 @lilypond[quote, verbatim]
813 <<
814   \new ChordNames {
815      \chordmode {
816        f1 g
817      }
818   }
819   \new Staff {
820     \clef "treble_8"
821     <f, c f a c' f'>1^\markup {
822       \fret-diagram #"s:1.5;c:6-1-1;6-1;5-3;4-3;3-2;2-1;1-1;"
823     }
824     <g, b, d g b g'>1^\markup {
825       \fret-diagram #"h:6;6-3;5-2;4-o;3-o;2-o;1-3;"
826     }
827   }
828 >>
829 @end lilypond
830
831 The number of strings in a fret diagram can be changed to accommodate
832 different instruments such as banjos and ukuleles with the fret-diagram
833 markup string.
834
835 @lilypond[quote, verbatim]
836 <<
837   \new ChordNames {
838     \chordmode {
839       a1
840     }
841   }
842   \new Staff {
843     % An 'A' chord for ukulele
844     a'1^\markup {
845       \fret-diagram #"w:4;4-2-2;3-1-1;2-o;1-o;"
846     }
847   }
848 >>
849 @end lilypond
850
851 Fingering indications can be added, and the location of fingering labels
852 can be controlled by the fret-diagram markup string.
853
854 @lilypond[quote, verbatim]
855 <<
856   \new ChordNames {
857     \chordmode {
858       c1 d:m
859     }
860   }
861   \new Staff {
862     \clef "treble_8"
863     <c e g c' e'>1^\markup {
864       \fret-diagram #"f:1;6-x;5-3-3;4-2-2;3-o;2-1-1;1-o;"
865     }
866     <d a d' f'>1^\markup {
867       \fret-diagram #"f:2;6-x;5-x;4-o;3-2-2;2-3-3;1-1-1;"
868     }
869   }
870 >>
871 @end lilypond
872
873 Dot radius and dot position can be controlled with the fret-diagram
874 markup string.
875
876 @lilypond[quote, verbatim]
877 <<
878   \new ChordNames {
879     \chordmode {
880       c1 d:m
881     }
882   }
883   \new Staff {
884     \clef "treble_8"
885     <c e g c' e'>1^\markup {
886       \fret-diagram #"d:0.35;6-x;5-3;4-2;3-o;2-1;1-o;"
887     }
888     <d a d' f'>1^\markup {
889       \fret-diagram #"p:0.2;6-x;5-x;4-o;3-2;2-3;1-1;"
890     }
891   }
892 >>
893 @end lilypond
894
895 @cindex fret-diagram-terse markup
896
897 @funindex fret-diagram-terse
898 @funindex \fret-diagram-terse
899
900 The fret-diagram-terse markup string omits string numbers; the string
901 number is implied by the presence of semicolons.  There is one semicolon
902 for each string in the diagram.  The first semicolon corresponds to the
903 highest string number and the last semicolon corresponds to the first string.
904 Mute strings, open strings, and fret numbers can be indicated.
905
906 @lilypond[quote, verbatim]
907 <<
908   \new ChordNames {
909     \chordmode {
910       c1 d:m
911     }
912   }
913   \new Staff {
914     \clef "treble_8"
915     <c e g c' e'>1^\markup {
916       \fret-diagram-terse #"x;3;2;o;1;o;"
917     }
918     <d a d' f'>1^\markup {
919       \fret-diagram-terse #"x;x;o;2;3;1;"
920     }
921   }
922 >>
923 @end lilypond
924
925 Barre indicators can be included in the fret-diagram-terse markup string.
926
927 @lilypond[quote, verbatim]
928 <<
929   \new ChordNames {
930     \chordmode {
931       f1 g
932     }
933   }
934   \new Staff {
935     \clef "treble_8"
936     <f, c f a c' f'>1^\markup {
937       \fret-diagram-terse #"1-(;3;3;2;1;1-);"
938     }
939     <g, d g b d' g'>1^\markup {
940       \fret-diagram-terse #"3-(;5;5;4;3;3-);"
941     }
942   }
943 >>
944 @end lilypond
945
946 Fingering indications can be included in the fret-diagram-terse markup string.
947
948 @c Need to use override to enable fingerings to show this -- can we do so?
949 @lilypond[quote, verbatim]
950 <<
951   \new ChordNames {
952     \chordmode {
953       c1 d:m
954     }
955   }
956   \new Staff {
957     \override Voice.TextScript.fret-diagram-details.finger-code = #'below-string
958     \clef "treble_8"
959     <c e g c' e'>1^\markup {
960       \fret-diagram-terse #"x;3-3;2-2;o;1-1;o;"
961     }
962     <d a d' f'>1^\markup {
963       \fret-diagram-terse #"x;x;o;2-2;3-3;1-1;"
964     }
965   }
966 >>
967 @end lilypond
968
969 Other fret diagram properties must be adjusted using
970 @code{\override} when using the fret-diagram-terse markup.
971
972 @cindex fret-diagram-verbose markup
973 @cindex capo
974
975 @funindex fret-diagram-verbose
976 @funindex \fret-diagram-verbose
977
978 The fret-diagram-verbose markup string is in the format of a Scheme list.  Each
979 element of the list indicates an item to be placed on the fret diagram.
980
981 @lilypond[quote, verbatim]
982 <<
983     \new ChordNames {
984       \chordmode {
985         c1 d:m
986       }
987     }
988   \new Staff {
989     \clef "treble_8"
990     <c e g c' e'>1^\markup {
991       \fret-diagram-verbose #'(
992         (mute 6)
993         (place-fret 5 3)
994         (place-fret 4 2)
995         (open 3)
996         (place-fret 2 1)
997         (open 1)
998       )
999     }
1000     <d a d' f'>1^\markup {
1001       \fret-diagram-verbose #'(
1002         (mute 6)
1003         (mute 5)
1004         (open 4)
1005         (place-fret 3 2)
1006         (place-fret 2 3)
1007         (place-fret 1 1)
1008       )
1009     }
1010   }
1011 >>
1012 @end lilypond
1013
1014 Fingering indications and barres can be included in a
1015 fret-diagram-verbose markup string.  Unique to the
1016 fret-diagram-verbose interface is a capo indication that
1017 can be placed on the fret diagram.  The capo indication is
1018 a thick bar that covers all strings.  The fret with the
1019 capo will be the lowest fret in the fret diagram.
1020
1021 Fingering indication dots can be colored as well as parenthesized;
1022 the parenthesis's color can also be altered independently.
1023
1024 @c \override is necessary to make fingering visible
1025 @lilypond[quote, verbatim]
1026 <<
1027     \new ChordNames {
1028       \chordmode {
1029         f1 g c c
1030       }
1031     }
1032   \new Staff {
1033     \clef "treble_8"
1034     \override Voice.TextScript.fret-diagram-details.finger-code = #'below-string
1035     <f, c f a c' f'>1^\markup {
1036       \fret-diagram-verbose #'(
1037         (place-fret 6 1)
1038         (place-fret 5 3)
1039         (place-fret 4 3)
1040         (place-fret 3 2)
1041         (place-fret 2 1)
1042         (place-fret 1 1)
1043         (barre 6 1 1)
1044       )
1045     }
1046     <g, b, d g b g'>1^\markup {
1047       \fret-diagram-verbose #'(
1048         (place-fret 6 3 2)
1049         (place-fret 5 2 1)
1050         (open 4)
1051         (open 3)
1052         (open 2)
1053         (place-fret 1 3 3)
1054       )
1055     }
1056     <c g c' e' g'>1^\markup {
1057       \fret-diagram-verbose #'(
1058         (capo 3)
1059         (mute 6)
1060         (place-fret 4 5 1)
1061         (place-fret 3 5 2)
1062         (place-fret 2 5 3)
1063       )
1064     }
1065     \override Voice.TextScript.size = 1.5
1066     <c g c' e' g'>1^\markup {
1067       \fret-diagram-verbose #'(
1068         (place-fret 6 3 1 red parenthesized default-paren-color)
1069         (place-fret 5 3 1 inverted)
1070         (place-fret 4 5 2 blue parenthesized)
1071         (place-fret 3 5 3 blue)
1072         (place-fret 2 5 4 blue)
1073         (place-fret 1 3 1 inverted)
1074       )
1075     }
1076   }
1077 >>
1078 @end lilypond
1079
1080 All other fret diagram properties must be adjusted using
1081 @code{\override} when using the fret-diagram-verbose markup.
1082
1083 @ignore
1084 The following example shows the three fret-diagram markup
1085 interfaces, along with examples of common tweaks.  For example,
1086 the size of the verbose fret diagram is reduced to 0.75, and the
1087 finger indications are specified to appear below the diagram.  The
1088 terse diagram includes tweaks to specify placement of finger code
1089 and color of dots.
1090
1091 @lilypond[verbatim,ragged-right,quote]
1092 \new Voice {
1093   \clef "treble_8"
1094   d4^\markup {
1095     \fret-diagram #"6-x;5-x;4-o;3-2;2-3;1-2;"
1096   }
1097   d4 d d
1098   fis^\markup {
1099     \override #'(size . 0.75) {
1100       \override #'(finger-code . below-string) {
1101         \fret-diagram-verbose #'((place-fret 6 2 1) (barre 6 1 2)
1102                                  (place-fret 5 4 3)
1103                                  (place-fret 4 4 4)
1104                                  (place-fret 3 3 2)
1105                                  (place-fret 2 2 1)
1106                                  (place-fret 1 2 1))
1107       }
1108     }
1109   }
1110   fis4 fis fis
1111   c^\markup {
1112     \override #'(dot-radius . 0.35) {
1113       \override #'(finger-code . in-dot) {
1114         \override #'(dot-color . white) {
1115           \fret-diagram-terse #"x;3-1-(;5-2;5-3;5-4;3-1-);"
1116         }
1117       }
1118     }
1119   }
1120   c4 c c
1121 }
1122 @end lilypond
1123 @end ignore
1124
1125 @cindex customized fret diagram
1126 @cindex fret diagram, customized
1127 @cindex diagram, fret, customized
1128
1129 @funindex fret-diagram-interface
1130
1131 The graphical layout of a fret diagram can be customized according to
1132 user preference through the properties of the
1133 @code{fret-diagram-interface}. Details are found at
1134 @rinternals{fret-diagram-interface}.  For a fret diagram
1135 markup, the interface properties belong to @code{Voice.TextScript}.
1136
1137 @snippets
1138
1139 @lilypondfile[verbatim,quote,texidoc,doctitle]
1140 {changing-fret-orientations.ly}
1141
1142 @lilypondfile[verbatim,quote,texidoc,doctitle]
1143 {customizing-markup-fret-diagrams.ly}
1144
1145 @seealso
1146 Notation Reference:
1147 @ref{Instrument Specific Markup}.
1148
1149 Snippets:
1150 @rlsr{Fretted strings}.
1151
1152 Internals Reference:
1153 @rinternals{fret-diagram-interface}.
1154
1155
1156 @node Predefined fret diagrams
1157 @unnumberedsubsubsec Predefined fret diagrams
1158
1159 @cindex fret diagrams
1160 @cindex fret diagrams, ukulele
1161 @cindex fret diagrams, mandolin
1162 @cindex chord diagrams
1163
1164 @funindex FretBoards
1165 @funindex stringTunings
1166
1167 Fret diagrams can be displayed using the @code{FretBoards} context.  By
1168 default, the @code{FretBoards} context will display fret diagrams that
1169 are stored in a lookup table:
1170
1171 @lilypond[verbatim, ragged-right, quote]
1172 \include "predefined-guitar-fretboards.ly"
1173 \new FretBoards {
1174   \chordmode {
1175     c1 d
1176   }
1177 }
1178 @end lilypond
1179
1180 The default predefined fret diagrams are contained in the file
1181 @file{predefined-guitar-fretboards.ly}.  Fret diagrams are
1182 stored based on the pitches of a chord and the value of
1183 @code{stringTunings} that is currently in use.
1184 @file{predefined-guitar-fretboards.ly} contains predefined
1185 fret diagrams only for @code{guitar-tuning}.  Predefined fret
1186 diagrams can be added for other instruments or other tunings
1187 by following the examples found in
1188 @file{predefined-guitar-fretboards.ly}.
1189
1190 Fret diagrams for the ukulele are contained in the file @*
1191 @file{predefined-ukulele-fretboards.ly}.
1192
1193 @lilypond[verbatim, ragged-right, quote]
1194 \include "predefined-ukulele-fretboards.ly"
1195
1196 myChords = \chordmode { a1 a:m a:aug }
1197
1198 \new ChordNames {
1199   \myChords
1200 }
1201
1202 \new FretBoards {
1203   \set Staff.stringTunings = #ukulele-tuning
1204   \myChords
1205 }
1206 @end lilypond
1207
1208 Fret diagrams for the mandolin are contained in the file @*
1209 @file{predefined-mandolin-fretboards.ly}.
1210
1211 @lilypond[verbatim, ragged-right, quote]
1212 \include "predefined-mandolin-fretboards.ly"
1213
1214 myChords = \chordmode { c1 c:m7.5- c:aug }
1215
1216 \new ChordNames {
1217   \myChords
1218 }
1219
1220 \new FretBoards {
1221   \set Staff.stringTunings = #mandolin-tuning
1222   \myChords
1223 }
1224 @end lilypond
1225
1226 Chord pitches can be entered
1227 either as simultaneous music or using chord mode (see
1228 @ref{Chord mode overview}).
1229
1230 @lilypond[verbatim, ragged-right,quote]
1231 \include "predefined-guitar-fretboards.ly"
1232 \new FretBoards {
1233   \chordmode { c1 }
1234   <c' e' g'>1
1235 }
1236 @end lilypond
1237
1238 @cindex chord names with fret diagrams
1239 @cindex fret diagrams with chord names
1240
1241 @funindex ChordNames
1242 @funindex chordmode
1243 @funindex \chordmode
1244
1245 It is common that both chord names and fret diagrams are displayed together.
1246 This is achieved by putting a @code{ChordNames} context in parallel with
1247 a @code{FretBoards} context and giving both contexts the same music.
1248
1249 @lilypond[verbatim, ragged-right, quote]
1250 \include "predefined-guitar-fretboards.ly"
1251 mychords = \chordmode{
1252   c1 f g
1253 }
1254
1255 <<
1256   \new ChordNames {
1257     \mychords
1258   }
1259   \new FretBoards {
1260     \mychords
1261   }
1262 >>
1263 @end lilypond
1264
1265 @cindex transposing fret diagrams
1266 @cindex fret diagrams, transposing
1267 @cindex diagrams, fret, transposing
1268
1269 Predefined fret diagrams are transposable, as long as a diagram for the
1270 transposed chord is stored in the fret diagram table.
1271
1272 @lilypond[verbatim, ragged-right, quote]
1273 \include "predefined-guitar-fretboards.ly"
1274 mychords = \chordmode{
1275   c1 f g
1276 }
1277
1278 mychordlist = {
1279   \mychords
1280   \transpose c e { \mychords }
1281 }
1282 <<
1283   \new ChordNames {
1284     \mychordlist
1285   }
1286   \new FretBoards {
1287     \mychordlist
1288   }
1289 >>
1290 @end lilypond
1291
1292
1293 The predefined fret diagram table for guitar contains eight chords (major, minor,
1294 augmented, diminished, dominant seventh, major seventh, minor seventh, dominant ninth)
1295 for each of 17 keys.
1296 The predefined fret diagram table for ukulele contains these chords
1297 plus an additional three chords (major sixth, suspended second, and
1298 suspended fourth).
1299 A complete list of the predefined fret diagrams is
1300 shown in @ref{Predefined fretboard diagrams}.  If there is no entry in
1301 the table for a chord, the FretBoards engraver will calculate a
1302 fret-diagram using the automatic fret diagram functionality described in
1303 @ref{Automatic fret diagrams}.
1304
1305 @lilypond[verbatim, ragged-right, quote]
1306 \include "predefined-guitar-fretboards.ly"
1307 mychords = \chordmode{
1308   c1 c:maj9
1309 }
1310
1311 <<
1312   \new ChordNames {
1313     \mychords
1314   }
1315   \new FretBoards {
1316     \mychords
1317   }
1318 >>
1319 @end lilypond
1320
1321 @cindex fret diagrams, adding custom
1322 @cindex custom fret diagrams, adding
1323 @cindex adding custom fret diagrams
1324
1325 Fret diagrams can be added to the fret diagram table.  To add a diagram,
1326 you must specify the hash table for the diagram, the chord for the
1327 diagram, the tuning to be used, and
1328 a definition for the diagram.  Normally, the hash table will be
1329 @var{default-fret-table}.  The diagram definition can be either a
1330 fret-diagram-terse definition string or a fret-diagram-verbose
1331 marking list.
1332
1333 @lilypond[verbatim, ragged-right, quote]
1334 \include "predefined-guitar-fretboards.ly"
1335
1336 \storePredefinedDiagram #default-fret-table
1337                         \chordmode { c:maj9 }
1338                         #guitar-tuning
1339                         #"x;3-2;o;o;o;o;"
1340
1341 mychords = \chordmode {
1342   c1 c:maj9
1343 }
1344
1345 <<
1346   \new ChordNames {
1347     \mychords
1348   }
1349   \new FretBoards {
1350     \mychords
1351   }
1352 >>
1353 @end lilypond
1354
1355 Different fret diagrams for the same chord name can be stored using different
1356 octaves of pitches.  The different octave should be at least two octaves
1357 above or below the default octave, because the octaves above and  below the
1358 default octave are used for transposing fretboards.
1359
1360 @lilypond[verbatim, ragged-right, quote]
1361 \include "predefined-guitar-fretboards.ly"
1362
1363 \storePredefinedDiagram #default-fret-table
1364                         \chordmode { c'' }
1365                         #guitar-tuning
1366                         #(offset-fret 2 (chord-shape 'bes guitar-tuning))
1367
1368 mychords = \chordmode {
1369   c1 c''
1370 }
1371
1372 <<
1373   \new ChordNames {
1374     \mychords
1375   }
1376   \new FretBoards {
1377     \mychords
1378   }
1379 >>
1380 @end lilypond
1381
1382 @cindex fretted instruments, chord shapes
1383 @cindex chord shapes for fretted instruments
1384
1385 @funindex \addChordShape
1386 @funindex addChordShape
1387 @funindex storePredefinedDiagram
1388 @funindex \storePredefinedDiagram
1389
1390 In addition to fret diagrams, LilyPond stores an internal list of chord
1391 shapes.  The chord shapes are fret diagrams that can be shifted along
1392 the neck to different positions to provide different chords.  Chord
1393 shapes can be added to the internal list and then used to define
1394 predefined fret diagrams.  Because they can be moved to various
1395 positions on the neck, chord shapes will normally not contain
1396 any open strings.  Like fret diagrams, chord shapes can be
1397 entered as either fret-diagram-terse strings or fret-diagram-verbose
1398 marking lists.
1399
1400 @lilypond[verbatim, ragged-right, quote]
1401 \include "predefined-guitar-fretboards.ly"
1402
1403 % Add a new chord shape
1404
1405 \addChordShape #'powerf #guitar-tuning #"1-1;3-3;3-4;x;x;x;"
1406
1407 % add some new chords based on the power chord shape
1408
1409 \storePredefinedDiagram #default-fret-table
1410                         \chordmode { f'' }
1411                         #guitar-tuning
1412                         #(chord-shape 'powerf guitar-tuning)
1413 \storePredefinedDiagram #default-fret-table
1414                         \chordmode { g'' }
1415                         #guitar-tuning
1416                         #(offset-fret 2 (chord-shape 'powerf guitar-tuning))
1417
1418 mychords = \chordmode{
1419   f1 f'' g g''
1420 }
1421
1422 <<
1423   \new ChordNames {
1424     \mychords
1425   }
1426   \new FretBoards {
1427     \mychords
1428   }
1429 >>
1430 @end lilypond
1431
1432 The graphical layout of a fret diagram can be customized according to
1433 user preference through the properties of the
1434 @code{fret-diagram-interface}. Details are found at
1435 @rinternals{fret-diagram-interface}.  For a predefined fret diagram,
1436 the interface properties belong to @code{FretBoards.FretBoard}.
1437
1438 @snippets
1439
1440 @lilypondfile[verbatim,quote,texidoc,doctitle]
1441 {customizing-fretboard-fret-diagrams.ly}
1442
1443 @lilypondfile[verbatim,quote,texidoc,doctitle]
1444 {defining-predefined-fretboards-for-other-instruments.ly}
1445
1446 @lilypondfile[verbatim,quote,texidoc,doctitle,ragged-right]
1447 {chordchanges-for-fretboards.ly}
1448
1449 @lilypondfile[verbatim,quote,texidoc,doctitle]
1450 {fretboards-alternate-tables.ly}
1451
1452 @seealso
1453 Notation Reference:
1454 @ref{Custom tablatures},
1455 @ref{Automatic fret diagrams},
1456 @ref{Chord mode overview},
1457 @ref{Predefined fretboard diagrams}.
1458
1459 Installed Files:
1460 @file{ly/predefined-guitar-fretboards.ly}, @*
1461 @file{ly/predefined-guitar-ninth-fretboards.ly}, @*
1462 @file{ly/predefined-ukulele-fretboards.ly}, @*
1463 @file{ly/predefined-mandolin-fretboards.ly}.
1464
1465 Snippets:
1466 @rlsr{Fretted strings}.
1467
1468 Internals Reference:
1469 @rinternals {fret-diagram-interface}.
1470
1471
1472 @node Automatic fret diagrams
1473 @unnumberedsubsubsec Automatic fret diagrams
1474
1475 @cindex fret diagrams, automatic
1476 @cindex chord diagrams, automatic
1477 @cindex automatic fret diagrams
1478 @cindex automatic chord diagrams
1479
1480 Fret diagrams can be automatically created from entered notes using the
1481 @code{FretBoards} context.  If no predefined diagram is available for
1482 the entered notes in the active @code{stringTunings}, this context
1483 calculates strings and frets that can be used to play the notes.
1484
1485 @lilypond[quote,ragged-right,verbatim]
1486 <<
1487   \new ChordNames {
1488     \chordmode {
1489       f1 g
1490     }
1491   }
1492   \new FretBoards {
1493     <f, c f a c' f'>1
1494     <g,\6 b, d g b g'>1
1495   }
1496   \new Staff {
1497     \clef "treble_8"
1498     <f, c f a c' f'>1
1499     <g, b, d g b' g'>1
1500   }
1501 >>
1502 @end lilypond
1503
1504 @funindex predefinedFretboardsOff
1505 @funindex \predefinedFretboardsOff
1506 @funindex predefinedFretboardsOn
1507 @funindex \predefinedFretboardsOn
1508
1509 As no predefined diagrams are loaded by default, automatic calculation
1510 of fret diagrams is the default behavior.  Once default diagrams are
1511 loaded, automatic calculation can be enabled and disabled with predefined
1512 commands:
1513
1514 @lilypond[quote,ragged-right,verbatim]
1515
1516 \storePredefinedDiagram #default-fret-table
1517                         <c e g c' e'>
1518                         #guitar-tuning
1519                         #"x;3-1-(;5-2;5-3;5-4;3-1-1-);"
1520 <<
1521   \new ChordNames {
1522     \chordmode {
1523       c1 c c
1524     }
1525   }
1526   \new FretBoards {
1527     <c e g c' e'>1
1528     \predefinedFretboardsOff
1529     <c e g c' e'>1
1530     \predefinedFretboardsOn
1531     <c e g c' e'>1
1532   }
1533   \new Staff {
1534     \clef "treble_8"
1535     <c e g c' e'>1
1536     <c e g c' e'>1
1537     <c e g c' e'>1
1538   }
1539 >>
1540 @end lilypond
1541
1542
1543
1544 Sometimes the fretboard calculator will be unable to find
1545 an acceptable diagram.  This can often be remedied by
1546 manually assigning a note to a string.  In many cases, only one
1547 note need be manually placed on a string; the rest of
1548 the notes will then be placed appropriately by the
1549 @code{FretBoards} context.
1550
1551 @cindex fret diagrams, adding fingerings
1552 @cindex fingerings, adding to fret diagrams
1553
1554 Fingerings can be added to FretBoard fret diagrams.
1555
1556 @lilypond[quote, verbatim]
1557 <<
1558   \new ChordNames {
1559     \chordmode {
1560       c1 d:m
1561     }
1562   }
1563   \new FretBoards {
1564     <c-3 e-2 g c'-1 e'>1
1565     <d a-2 d'-3 f'-1>1
1566   }
1567   \new Staff {
1568     \clef "treble_8"
1569     <c e g c' e'>1
1570     <d a d' f'>1
1571   }
1572 >>
1573 @end lilypond
1574
1575 @funindex minimumFret
1576
1577 The minimum fret to be used in calculating strings and frets for
1578 the FretBoard context can be set with the @code{minimumFret}
1579 property.
1580
1581 @lilypond[quote, verbatim]
1582 <<
1583   \new ChordNames {
1584     \chordmode {
1585       d1:m d:m
1586     }
1587   }
1588   \new FretBoards {
1589     <d a d' f'>1
1590     \set FretBoards.minimumFret = #5
1591     <d a d' f'>1
1592   }
1593   \new Staff {
1594     \clef "treble_8"
1595     <d a d' f'>1
1596     <d a d' f'>1
1597   }
1598 >>
1599 @end lilypond
1600
1601 The strings and frets for the @code{FretBoards} context depend
1602 on the @code{stringTunings} property, which has the same meaning
1603 as in the TabStaff context.  See @ref{Custom tablatures} for
1604 information on the @code{stringTunings} property.
1605
1606 The graphical layout of a fret diagram can be customized according to
1607 user preference through the properties of the
1608 @code{fret-diagram-interface}. Details are found at
1609 @rinternals{fret-diagram-interface}.  For a @code{FretBoards} fret
1610 diagram, the interface properties belong to
1611 @code{FretBoards.FretBoard}.
1612
1613
1614 @predefined
1615 @code{\predefinedFretboardsOff},
1616 @code{\predefinedFretboardsOn}.
1617 @endpredefined
1618
1619 @seealso
1620 Notation Reference:
1621 @ref{Custom tablatures}.
1622
1623 Snippets:
1624 @rlsr{Fretted strings}.
1625
1626 Internals Reference:
1627 @rinternals {fret-diagram-interface}.
1628
1629 @knownissues
1630 Automatic fretboard calculations do not work properly for instruments
1631 with non-monotonic tunings.
1632
1633
1634 @node Right-hand fingerings
1635 @unnumberedsubsubsec Right-hand fingerings
1636
1637 @cindex fretted instruments, right hand fingerings
1638 @cindex fingerings, right hand for fretted instruments
1639 @cindex right hand fingerings for fretted instruments
1640
1641 @funindex rightHandFinger
1642 @funindex \rightHandFinger
1643
1644 Right-hand fingerings @var{p-i-m-a} must be entered using
1645 @code{\rightHandFinger} followed by a number.
1646
1647 @warning{If the number is entered in Scheme notation, remember to append
1648 a space before following it with a closing @code{>} or similar.}
1649
1650 @lilypond[quote,verbatim,relative=0]
1651 \clef "treble_8"
1652 c4\rightHandFinger #1
1653 e\rightHandFinger #2
1654 g\rightHandFinger #3
1655 c\rightHandFinger #4
1656 <c,\rightHandFinger #1 e\rightHandFinger #2
1657  g\rightHandFinger #3 c\rightHandFinger #4 >1
1658 @end lilypond
1659
1660 For convenience, you can abbreviate @code{\rightHandFinger} to something
1661 short, for example @code{RH},
1662
1663 @example
1664 RH=#rightHandFinger
1665 @end example
1666
1667
1668 @snippets
1669
1670 @lilypondfile[verbatim,quote,texidoc,doctitle]
1671 {placement-of-right-hand-fingerings.ly}
1672
1673 @lilypondfile[verbatim,quote,texidoc,doctitle]
1674 {fingerings,-string-indications,-and-right-hand-fingerings.ly}
1675
1676 @seealso
1677 Snippets:
1678 @rlsr{Fretted strings}.
1679
1680 Internals Reference:
1681 @rinternals{StrokeFinger}.
1682
1683
1684 @node Guitar
1685 @subsection Guitar
1686
1687 Most of the notational issues associated with guitar music are
1688 covered sufficiently in the general fretted strings section, but there
1689 are a few more worth covering here.  Occasionally users want to
1690 create songbook-type documents having only lyrics with chord
1691 indications above them.  Since LilyPond is a music typesetter,
1692 it is not recommended for documents that have no music notation
1693 in them.  A better alternative is a word processor, text editor,
1694 or, for experienced users, a typesetter like GuitarTeX.
1695
1696 @menu
1697 * Indicating position and barring::
1698 * Indicating harmonics and dampened notes::
1699 * Indicating power chords::
1700 @end menu
1701
1702 @node Indicating position and barring
1703 @unnumberedsubsubsec Indicating position and barring
1704
1705 @cindex indicating position and barring for fretted instruments
1706 @cindex fretted instruments, indicating position and barring
1707
1708 This example demonstrates how to include guitar position and
1709 barring indications.
1710
1711 @lilypond[quote,ragged-right,verbatim,relative=0]
1712 \clef "treble_8"
1713 b16 d g b e
1714 \textSpannerDown
1715 \override TextSpanner.bound-details.left.text = #"XII "
1716 g16\startTextSpan
1717 b16 e g e b g\stopTextSpan
1718 e16 b g d
1719 @end lilypond
1720
1721 @seealso
1722 Notation Reference:
1723 @ref{Text spanners}.
1724
1725 Snippets:
1726 @rlsr{Fretted strings},
1727 @rlsr{Expressive marks}.
1728
1729
1730 @node Indicating harmonics and dampened notes
1731 @unnumberedsubsubsec Indicating harmonics and dampened notes
1732
1733 @cindex fretted instruments, dampened notes
1734 @cindex fretted instruments, harmonics
1735 @cindex dampened notes on fretted instruments
1736 @cindex harmonics on fretted instruments
1737
1738 Special note heads can be used to indicate dampened notes or
1739 harmonics.  Harmonics are normally further explained with a
1740 text markup.
1741
1742 @lilypond[quote,ragged-right,verbatim]
1743 \relative c' {
1744   \clef "treble_8"
1745   \override Staff.NoteHead.style = #'harmonic-mixed
1746   d^\markup { \italic { \fontsize #-2 { "harm. 12" }}} <g b>1
1747 }
1748 @end lilypond
1749
1750 Dampened notes (also called @notation{dead notes}) are supported
1751 within normal and tablature staves:
1752
1753 @lilypond[quote,ragged-right,verbatim]
1754 music = \relative c' {
1755   < a\3 \deadNote c\2 a'\1 >4
1756   < b\3 \deadNote d\2 b'\1 >
1757   < c\3 \deadNote e\2 c'\1 >
1758   \deadNotesOn
1759   \tuplet 3/2 { g8 b e }
1760   \deadNotesOff
1761   < a,\3 c\2 e\1 >1
1762 }
1763 \new StaffGroup <<
1764   \new Staff {
1765     \clef "treble_8"
1766     \music
1767   }
1768   \new TabStaff {
1769     \music
1770   }
1771 >>
1772 @end lilypond
1773
1774 Another playing technique (especially used on electric guitars) is
1775 called @notation{palm mute}.  The string is hereby partly muted by the
1776 palm of the striking hand (hence the name).  Lilypond supports
1777 the notation of palm mute-style notes by changing the note head to a
1778 triangle shape.
1779
1780 @lilypond[quote,ragged-right,verbatim]
1781 \new Voice { % Warning: explicit Voice instantiation is
1782              %    required to have palmMuteOff work properly
1783              %    when palmMuteOn comes at the beginning of
1784              %    the piece.
1785   \relative c, {
1786     \clef "G_8"
1787     \palmMuteOn
1788     e8^\markup { \musicglyph #"noteheads.u2do"  = palm mute }
1789     < e b' e > e
1790     \palmMuteOff
1791     e e  \palmMute e e e |
1792     e8 \palmMute { e e e } e e e e |
1793     < \palmMute e b' e >8 \palmMute { e e e } < \palmMute e b' e >2
1794   }
1795 }
1796 @end lilypond
1797
1798 @seealso
1799 Snippets:
1800 @rlsr{Fretted strings}.
1801
1802 Notation Reference:
1803 @ref{Special note heads},
1804 @ref{Note head styles}.
1805
1806
1807 @node Indicating power chords
1808 @unnumberedsubsubsec Indicating power chords
1809
1810 @funindex powerChords
1811 @funindex \powerChords
1812
1813 @cindex power chords
1814 @cindex chords, power
1815
1816 Power chords and their symbols can be engraved in chord mode or as chord
1817 constructs:
1818
1819 @lilypond[quote,ragged-right,verbatim]
1820 ChordsAndSymbols = {
1821   \chordmode {
1822     \powerChords
1823     e,,1:1.5
1824     a,,1:1.5.8
1825     \set minimumFret = #8
1826     c,1:1.5
1827     f,1:1.5.8
1828   }
1829   \set minimumFret = #5
1830   <a, e>1
1831   <g d' g'>1
1832 }
1833 \score {
1834   <<
1835     \new ChordNames {
1836     \ChordsAndSymbols
1837     }
1838     \new Staff {
1839       \clef "treble_8"
1840       \ChordsAndSymbols
1841     }
1842     \new TabStaff {
1843       \ChordsAndSymbols
1844     }
1845   >>
1846 }
1847 @end lilypond
1848
1849 Power chord symbols are automatically switched off as soon as one of the
1850 other common chord modifier is used:
1851
1852 @lilypond[quote,ragged-right,verbatim]
1853 mixedChords = \chordmode {
1854   c,1
1855   \powerChords
1856   b,,1:1.5
1857   fis,,1:1.5.8
1858   g,,1:m
1859 }
1860 \score {
1861   <<
1862     \new ChordNames {
1863       \mixedChords
1864     }
1865     \new Staff {
1866       \clef "treble_8"
1867       \mixedChords
1868     }
1869     \new TabStaff {
1870       \mixedChords
1871     }
1872   >>
1873 }
1874 @end lilypond
1875
1876 @seealso
1877 Music Glossary:
1878 @rglos{power chord}.
1879
1880 Notation Reference:
1881 @ref{Extended and altered chords},
1882 @ref{Printing chord names}.
1883
1884 Snippets:
1885 @rlsr{Fretted strings}.
1886
1887
1888 @node Banjo
1889 @subsection Banjo
1890
1891 @menu
1892 * Banjo tablatures::
1893 @end menu
1894
1895 @node Banjo tablatures
1896 @unnumberedsubsubsec Banjo tablatures
1897
1898 @cindex banjo tablatures
1899 @cindex tablature, banjo
1900
1901 LilyPond has basic support for the five-string banjo.  When making tablatures
1902 for five-string banjo, use the banjo tablature format function to get
1903 correct fret numbers for the fifth string:
1904
1905 @c due to crazy intervals of banjo music, absolute pitch is recommended
1906
1907 @lilypond[quote,ragged-right,verbatim]
1908 music = {
1909   g8 d' g'\5 a b g e d' |
1910   g4 d''8\5 b' a'\2 g'\5 e'\2 d' |
1911   g4
1912 }
1913
1914 <<
1915   \new Staff \with { \omit StringNumber }
1916   { \clef "treble_8"  \music }
1917   \new TabStaff \with {
1918     tablatureFormat = #fret-number-tablature-format-banjo
1919     stringTunings = #banjo-open-g-tuning
1920   }
1921   { \music }
1922 >>
1923 @end lilypond
1924
1925 @cindex banjo tunings
1926 @cindex tunings, banjo
1927
1928 @funindex banjo-c-tuning
1929 @funindex banjo-modal-tuning
1930 @funindex banjo-open-d-tuning
1931 @funindex banjo-open-dm-tuning
1932 @funindex four-string-banjo
1933
1934 A number of common tunings for the five-string banjo are predefined:
1935 @code{banjo-c-tuning} (gCGBD), @code{banjo-modal-tuning} (gDGCD),
1936 @code{banjo-open-d-tuning} (aDF#AD) and @code{banjo-open-dm-tuning}
1937 (aDFAD).
1938
1939 These may be converted to four-string tunings using the
1940 @code{four-string-banjo} function:
1941
1942 @example
1943 \set TabStaff.stringTunings = #(four-string-banjo banjo-c-tuning)
1944 @end example
1945
1946 @seealso
1947 Installed Files:
1948 @file{ly/string-tunings-init.ly}.
1949
1950 Snippets:
1951 @rlsr{Fretted strings}.