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