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