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