]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/notation/fretted-strings.itely
Merge remote-tracking branch 'origin/translation' into staging
[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 @c \override is necessary to make fingering visible
1002 @lilypond[quote, verbatim]
1003 <<
1004     \new ChordNames {
1005       \chordmode {
1006         f1 g c
1007       }
1008     }
1009   \new Staff {
1010     \clef "treble_8"
1011     \override Voice.TextScript.fret-diagram-details.finger-code = #'below-string
1012     <f, c f a c' f'>1^\markup {
1013       \fret-diagram-verbose #'(
1014         (place-fret 6 1)
1015         (place-fret 5 3)
1016         (place-fret 4 3)
1017         (place-fret 3 2)
1018         (place-fret 2 1)
1019         (place-fret 1 1)
1020         (barre 6 1 1)
1021       )
1022     }
1023     <g, b, d g b g'>1^\markup {
1024       \fret-diagram-verbose #'(
1025         (place-fret 6 3 2)
1026         (place-fret 5 2 1)
1027         (open 4)
1028         (open 3)
1029         (open 2)
1030         (place-fret 1 3 3)
1031       )
1032     }
1033     <c g c' e' g'>1^\markup {
1034       \fret-diagram-verbose #'(
1035         (capo 3)
1036         (mute 6)
1037         (place-fret 4 5 1)
1038         (place-fret 3 5 2)
1039         (place-fret 2 5 3)
1040       )
1041     }
1042   }
1043 >>
1044 @end lilypond
1045
1046 All other fret diagram properties must be adjusted using
1047 @code{\override} when using the fret-diagram-verbose markup.
1048
1049 @ignore
1050 The following example shows the three fret-diagram markup
1051 interfaces, along with examples of common tweaks.  For example,
1052 the size of the verbose fret diagram is reduced to 0.75, and the
1053 finger indications are specified to appear below the diagram.  The
1054 terse diagram includes tweaks to specify placement of finger code
1055 and color of dots.
1056
1057 @lilypond[verbatim,ragged-right,quote]
1058 \new Voice {
1059   \clef "treble_8"
1060   d4^\markup {
1061     \fret-diagram #"6-x;5-x;4-o;3-2;2-3;1-2;"
1062   }
1063   d4 d d
1064   fis^\markup {
1065     \override #'(size . 0.75) {
1066       \override #'(finger-code . below-string) {
1067         \fret-diagram-verbose #'((place-fret 6 2 1) (barre 6 1 2)
1068                                  (place-fret 5 4 3)
1069                                  (place-fret 4 4 4)
1070                                  (place-fret 3 3 2)
1071                                  (place-fret 2 2 1)
1072                                  (place-fret 1 2 1))
1073       }
1074     }
1075   }
1076   fis4 fis fis
1077   c^\markup {
1078     \override #'(dot-radius . 0.35) {
1079       \override #'(finger-code . in-dot) {
1080         \override #'(dot-color . white) {
1081           \fret-diagram-terse #"x;3-1-(;5-2;5-3;5-4;3-1-);"
1082         }
1083       }
1084     }
1085   }
1086   c4 c c
1087 }
1088 @end lilypond
1089 @end ignore
1090
1091 @cindex customized fret diagram
1092 @cindex fret diagram, customized
1093 @cindex diagram, fret, customized
1094
1095 @funindex fret-diagram-interface
1096
1097 The graphical layout of a fret diagram can be customized according to
1098 user preference through the properties of the
1099 @code{fret-diagram-interface}. Details are found at
1100 @rinternals{fret-diagram-interface}.  For a fret diagram
1101 markup, the interface properties belong to @code{Voice.TextScript}.
1102
1103 @snippets
1104
1105 @lilypondfile[verbatim,quote,texidoc,doctitle]
1106 {changing-fret-orientations.ly}
1107
1108 @lilypondfile[verbatim,quote,texidoc,doctitle]
1109 {customizing-markup-fret-diagrams.ly}
1110
1111 @seealso
1112 Notation Reference:
1113 @ref{Instrument Specific Markup}.
1114
1115 Snippets:
1116 @rlsr{Fretted strings}.
1117
1118 Internals Reference:
1119 @rinternals{fret-diagram-interface}.
1120
1121
1122 @node Predefined fret diagrams
1123 @unnumberedsubsubsec Predefined fret diagrams
1124
1125 @cindex fret diagrams
1126 @cindex fret diagrams, ukulele
1127 @cindex fret diagrams, mandolin
1128 @cindex chord diagrams
1129
1130 @funindex FretBoards
1131 @funindex stringTunings
1132
1133 Fret diagrams can be displayed using the @code{FretBoards} context.  By
1134 default, the @code{FretBoards} context will display fret diagrams that
1135 are stored in a lookup table:
1136
1137 @lilypond[verbatim, ragged-right, quote]
1138 \include "predefined-guitar-fretboards.ly"
1139 \new FretBoards {
1140   \chordmode {
1141     c1 d
1142   }
1143 }
1144 @end lilypond
1145
1146 The default predefined fret diagrams are contained in the file
1147 @file{predefined-guitar-fretboards.ly}.  Fret diagrams are
1148 stored based on the pitches of a chord and the value of
1149 @code{stringTunings} that is currently in use.
1150 @file{predefined-guitar-fretboards.ly} contains predefined
1151 fret diagrams only for @code{guitar-tuning}.  Predefined fret
1152 diagrams can be added for other instruments or other tunings
1153 by following the examples found in
1154 @file{predefined-guitar-fretboards.ly}.
1155
1156 Fret diagrams for the ukulele are contained in the file @*
1157 @file{predefined-ukulele-fretboards.ly}.
1158
1159 @lilypond[verbatim, ragged-right, quote]
1160 \include "predefined-ukulele-fretboards.ly"
1161
1162 myChords = \chordmode { a1 a:m a:aug }
1163
1164 \new ChordNames {
1165   \myChords
1166 }
1167
1168 \new FretBoards {
1169   \set Staff.stringTunings = #ukulele-tuning
1170   \myChords
1171 }
1172 @end lilypond
1173
1174 Fret diagrams for the mandolin are contained in the file @*
1175 @file{predefined-mandolin-fretboards.ly}.
1176
1177 @lilypond[verbatim, ragged-right, quote]
1178 \include "predefined-mandolin-fretboards.ly"
1179
1180 myChords = \chordmode { c1 c:m7.5- c:aug }
1181
1182 \new ChordNames {
1183   \myChords
1184 }
1185
1186 \new FretBoards {
1187   \set Staff.stringTunings = #mandolin-tuning
1188   \myChords
1189 }
1190 @end lilypond
1191
1192 Chord pitches can be entered
1193 either as simultaneous music or using chord mode (see
1194 @ref{Chord mode overview}).
1195
1196 @lilypond[verbatim, ragged-right,quote]
1197 \include "predefined-guitar-fretboards.ly"
1198 \new FretBoards {
1199   \chordmode { c1 }
1200   <c' e' g'>1
1201 }
1202 @end lilypond
1203
1204 @cindex chord names with fret diagrams
1205 @cindex fret diagrams with chord names
1206
1207 @funindex ChordNames
1208 @funindex chordmode
1209 @funindex \chordmode
1210
1211 It is common that both chord names and fret diagrams are displayed together.
1212 This is achieved by putting a @code{ChordNames} context in parallel with
1213 a @code{FretBoards} context and giving both contexts the same music.
1214
1215 @lilypond[verbatim, ragged-right, quote]
1216 \include "predefined-guitar-fretboards.ly"
1217 mychords = \chordmode{
1218   c1 f g
1219 }
1220
1221 <<
1222   \new ChordNames {
1223     \mychords
1224   }
1225   \new FretBoards {
1226     \mychords
1227   }
1228 >>
1229 @end lilypond
1230
1231 @cindex transposing fret diagrams
1232 @cindex fret diagrams, transposing
1233 @cindex diagrams, fret, transposing
1234
1235 Predefined fret diagrams are transposable, as long as a diagram for the
1236 transposed chord is stored in the fret diagram table.
1237
1238 @lilypond[verbatim, ragged-right, quote]
1239 \include "predefined-guitar-fretboards.ly"
1240 mychords = \chordmode{
1241   c1 f g
1242 }
1243
1244 mychordlist = {
1245   \mychords
1246   \transpose c e { \mychords }
1247 }
1248 <<
1249   \new ChordNames {
1250     \mychordlist
1251   }
1252   \new FretBoards {
1253     \mychordlist
1254   }
1255 >>
1256 @end lilypond
1257
1258
1259 The predefined fret diagram table for guitar contains eight chords (major, minor,
1260 augmented, diminished, dominant seventh, major seventh, minor seventh, dominant ninth)
1261 for each of 17 keys.
1262 The predefined fret diagram table for ukulele contains these chords
1263 plus an additional three chords (major sixth, suspended second, and
1264 suspended fourth).
1265 A complete list of the predefined fret diagrams is
1266 shown in @ref{Predefined fretboard diagrams}.  If there is no entry in
1267 the table for a chord, the FretBoards engraver will calculate a
1268 fret-diagram using the automatic fret diagram functionality described in
1269 @ref{Automatic fret diagrams}.
1270
1271 @lilypond[verbatim, ragged-right, quote]
1272 \include "predefined-guitar-fretboards.ly"
1273 mychords = \chordmode{
1274   c1 c:maj9
1275 }
1276
1277 <<
1278   \new ChordNames {
1279     \mychords
1280   }
1281   \new FretBoards {
1282     \mychords
1283   }
1284 >>
1285 @end lilypond
1286
1287 @cindex fret diagrams, adding custom
1288 @cindex custom fret diagrams, adding
1289 @cindex adding custom fret diagrams
1290
1291 Fret diagrams can be added to the fret diagram table.  To add a diagram,
1292 you must specify the hash table for the diagram, the chord for the
1293 diagram, the tuning to be used, and
1294 a definition for the diagram.  Normally, the hash table will be
1295 @var{default-fret-table}.  The diagram definition can be either a
1296 fret-diagram-terse definition string or a fret-diagram-verbose
1297 marking list.
1298
1299 @lilypond[verbatim, ragged-right, quote]
1300 \include "predefined-guitar-fretboards.ly"
1301
1302 \storePredefinedDiagram #default-fret-table
1303                         \chordmode { c:maj9 }
1304                         #guitar-tuning
1305                         #"x;3-2;o;o;o;o;"
1306
1307 mychords = \chordmode {
1308   c1 c:maj9
1309 }
1310
1311 <<
1312   \new ChordNames {
1313     \mychords
1314   }
1315   \new FretBoards {
1316     \mychords
1317   }
1318 >>
1319 @end lilypond
1320
1321 Different fret diagrams for the same chord name can be stored using different
1322 octaves of pitches.  The different octave should be at least two octaves
1323 above or below the default octave, because the octaves above and  below the
1324 default octave are used for transposing fretboards.
1325
1326 @lilypond[verbatim, ragged-right, quote]
1327 \include "predefined-guitar-fretboards.ly"
1328
1329 \storePredefinedDiagram #default-fret-table
1330                         \chordmode { c'' }
1331                         #guitar-tuning
1332                         #(offset-fret 2 (chord-shape 'bes guitar-tuning))
1333
1334 mychords = \chordmode {
1335   c1 c''
1336 }
1337
1338 <<
1339   \new ChordNames {
1340     \mychords
1341   }
1342   \new FretBoards {
1343     \mychords
1344   }
1345 >>
1346 @end lilypond
1347
1348 @cindex fretted instruments, chord shapes
1349 @cindex chord shapes for fretted instruments
1350
1351 @funindex \addChordShape
1352 @funindex addChordShape
1353 @funindex storePredefinedDiagram
1354 @funindex \storePredefinedDiagram
1355
1356 In addition to fret diagrams, LilyPond stores an internal list of chord
1357 shapes.  The chord shapes are fret diagrams that can be shifted along
1358 the neck to different positions to provide different chords.  Chord
1359 shapes can be added to the internal list and then used to define
1360 predefined fret diagrams.  Because they can be moved to various
1361 positions on the neck, chord shapes will normally not contain
1362 any open strings.  Like fret diagrams, chord shapes can be
1363 entered as either fret-diagram-terse strings or fret-diagram-verbose
1364 marking lists.
1365
1366 @lilypond[verbatim, ragged-right, quote]
1367 \include "predefined-guitar-fretboards.ly"
1368
1369 % Add a new chord shape
1370
1371 \addChordShape #'powerf #guitar-tuning #"1-1;3-3;3-4;x;x;x;"
1372
1373 % add some new chords based on the power chord shape
1374
1375 \storePredefinedDiagram #default-fret-table
1376                         \chordmode { f'' }
1377                         #guitar-tuning
1378                         #(chord-shape 'powerf guitar-tuning)
1379 \storePredefinedDiagram #default-fret-table
1380                         \chordmode { g'' }
1381                         #guitar-tuning
1382                         #(offset-fret 2 (chord-shape 'powerf guitar-tuning))
1383
1384 mychords = \chordmode{
1385   f1 f'' g g''
1386 }
1387
1388 <<
1389   \new ChordNames {
1390     \mychords
1391   }
1392   \new FretBoards {
1393     \mychords
1394   }
1395 >>
1396 @end lilypond
1397
1398 The graphical layout of a fret diagram can be customized according to
1399 user preference through the properties of the
1400 @code{fret-diagram-interface}. Details are found at
1401 @rinternals{fret-diagram-interface}.  For a predefined fret diagram,
1402 the interface properties belong to @code{FretBoards.FretBoard}.
1403
1404 @snippets
1405
1406 @lilypondfile[verbatim,quote,texidoc,doctitle]
1407 {customizing-fretboard-fret-diagrams.ly}
1408
1409 @lilypondfile[verbatim,quote,texidoc,doctitle]
1410 {defining-predefined-fretboards-for-other-instruments.ly}
1411
1412 @lilypondfile[verbatim,quote,texidoc,doctitle,ragged-right]
1413 {chordchanges-for-fretboards.ly}
1414
1415 @lilypondfile[verbatim,quote,texidoc,doctitle]
1416 {fretboards-alternate-tables.ly}
1417
1418 @seealso
1419 Notation Reference:
1420 @ref{Custom tablatures},
1421 @ref{Automatic fret diagrams},
1422 @ref{Chord mode overview},
1423 @ref{Predefined fretboard diagrams}.
1424
1425 Installed Files:
1426 @file{ly/predefined-guitar-fretboards.ly}, @*
1427 @file{ly/predefined-guitar-ninth-fretboards.ly}, @*
1428 @file{ly/predefined-ukulele-fretboards.ly}, @*
1429 @file{ly/predefined-mandolin-fretboards.ly}.
1430
1431 Snippets:
1432 @rlsr{Fretted strings}.
1433
1434 Internals Reference:
1435 @rinternals {fret-diagram-interface}.
1436
1437
1438 @node Automatic fret diagrams
1439 @unnumberedsubsubsec Automatic fret diagrams
1440
1441 @cindex fret diagrams, automatic
1442 @cindex chord diagrams, automatic
1443 @cindex automatic fret diagrams
1444 @cindex automatic chord diagrams
1445
1446 Fret diagrams can be automatically created from entered notes using the
1447 @code{FretBoards} context.  If no predefined diagram is available for
1448 the entered notes in the active @code{stringTunings}, this context
1449 calculates strings and frets that can be used to play the notes.
1450
1451 @lilypond[quote,ragged-right,verbatim]
1452 <<
1453   \new ChordNames {
1454     \chordmode {
1455       f1 g
1456     }
1457   }
1458   \new FretBoards {
1459     <f, c f a c' f'>1
1460     <g,\6 b, d g b g'>1
1461   }
1462   \new Staff {
1463     \clef "treble_8"
1464     <f, c f a c' f'>1
1465     <g, b, d g b' g'>1
1466   }
1467 >>
1468 @end lilypond
1469
1470 @funindex predefinedFretboardsOff
1471 @funindex \predefinedFretboardsOff
1472 @funindex predefinedFretboardsOn
1473 @funindex \predefinedFretboardsOn
1474
1475 As no predefined diagrams are loaded by default, automatic calculation
1476 of fret diagrams is the default behavior.  Once default diagrams are
1477 loaded, automatic calculation can be enabled and disabled with predefined
1478 commands:
1479
1480 @lilypond[quote,ragged-right,verbatim]
1481
1482 \storePredefinedDiagram #default-fret-table
1483                         <c e g c' e'>
1484                         #guitar-tuning
1485                         #"x;3-1-(;5-2;5-3;5-4;3-1-1-);"
1486 <<
1487   \new ChordNames {
1488     \chordmode {
1489       c1 c c
1490     }
1491   }
1492   \new FretBoards {
1493     <c e g c' e'>1
1494     \predefinedFretboardsOff
1495     <c e g c' e'>1
1496     \predefinedFretboardsOn
1497     <c e g c' e'>1
1498   }
1499   \new Staff {
1500     \clef "treble_8"
1501     <c e g c' e'>1
1502     <c e g c' e'>1
1503     <c e g c' e'>1
1504   }
1505 >>
1506 @end lilypond
1507
1508
1509
1510 Sometimes the fretboard calculator will be unable to find
1511 an acceptable diagram.  This can often be remedied by
1512 manually assigning a note to a string.  In many cases, only one
1513 note need be manually placed on a string; the rest of
1514 the notes will then be placed appropriately by the
1515 @code{FretBoards} context.
1516
1517 @cindex fret diagrams, adding fingerings
1518 @cindex fingerings, adding to fret diagrams
1519
1520 Fingerings can be added to FretBoard fret diagrams.
1521
1522 @lilypond[quote, verbatim]
1523 <<
1524   \new ChordNames {
1525     \chordmode {
1526       c1 d:m
1527     }
1528   }
1529   \new FretBoards {
1530     <c-3 e-2 g c'-1 e'>1
1531     <d a-2 d'-3 f'-1>1
1532   }
1533   \new Staff {
1534     \clef "treble_8"
1535     <c e g c' e'>1
1536     <d a d' f'>1
1537   }
1538 >>
1539 @end lilypond
1540
1541 @funindex minimumFret
1542
1543 The minimum fret to be used in calculating strings and frets for
1544 the FretBoard context can be set with the @code{minimumFret}
1545 property.
1546
1547 @lilypond[quote, verbatim]
1548 <<
1549   \new ChordNames {
1550     \chordmode {
1551       d1:m d:m
1552     }
1553   }
1554   \new FretBoards {
1555     <d a d' f'>1
1556     \set FretBoards.minimumFret = #5
1557     <d a d' f'>1
1558   }
1559   \new Staff {
1560     \clef "treble_8"
1561     <d a d' f'>1
1562     <d a d' f'>1
1563   }
1564 >>
1565 @end lilypond
1566
1567 The strings and frets for the @code{FretBoards} context depend
1568 on the @code{stringTunings} property, which has the same meaning
1569 as in the TabStaff context.  See @ref{Custom tablatures} for
1570 information on the @code{stringTunings} property.
1571
1572 The graphical layout of a fret diagram can be customized according to
1573 user preference through the properties of the
1574 @code{fret-diagram-interface}. Details are found at
1575 @rinternals{fret-diagram-interface}.  For a @code{FretBoards} fret
1576 diagram, the interface properties belong to
1577 @code{FretBoards.FretBoard}.
1578
1579
1580 @predefined
1581 @code{\predefinedFretboardsOff},
1582 @code{\predefinedFretboardsOn}.
1583 @endpredefined
1584
1585 @seealso
1586 Notation Reference:
1587 @ref{Custom tablatures}.
1588
1589 Snippets:
1590 @rlsr{Fretted strings}.
1591
1592 Internals Reference:
1593 @rinternals {fret-diagram-interface}.
1594
1595 @knownissues
1596 Automatic fretboard calculations do not work properly for instruments
1597 with non-monotonic tunings.
1598
1599
1600 @node Right-hand fingerings
1601 @unnumberedsubsubsec Right-hand fingerings
1602
1603 @cindex fretted instruments, right hand fingerings
1604 @cindex fingerings, right hand for fretted instruments
1605 @cindex right hand fingerings for fretted instruments
1606
1607 @funindex rightHandFinger
1608 @funindex \rightHandFinger
1609
1610 Right-hand fingerings @var{p-i-m-a} must be entered using
1611 @code{\rightHandFinger} followed by a number.
1612
1613 @warning{If the number is entered in Scheme notation, remember to append
1614 a space before following it with a closing @code{>} or similar.}
1615
1616 @lilypond[quote,verbatim,relative=0]
1617 \clef "treble_8"
1618 c4\rightHandFinger #1
1619 e\rightHandFinger #2
1620 g\rightHandFinger #3
1621 c\rightHandFinger #4
1622 <c,\rightHandFinger #1 e\rightHandFinger #2
1623  g\rightHandFinger #3 c\rightHandFinger #4 >1
1624 @end lilypond
1625
1626 For convenience, you can abbreviate @code{\rightHandFinger} to something
1627 short, for example @code{RH},
1628
1629 @example
1630 RH=#rightHandFinger
1631 @end example
1632
1633
1634 @snippets
1635
1636 @lilypondfile[verbatim,quote,texidoc,doctitle]
1637 {placement-of-right-hand-fingerings.ly}
1638
1639 @lilypondfile[verbatim,quote,texidoc,doctitle]
1640 {fingerings,-string-indications,-and-right-hand-fingerings.ly}
1641
1642 @seealso
1643 Snippets:
1644 @rlsr{Fretted strings}.
1645
1646 Internals Reference:
1647 @rinternals{StrokeFinger}.
1648
1649
1650 @node Guitar
1651 @subsection Guitar
1652
1653 Most of the notational issues associated with guitar music are
1654 covered sufficiently in the general fretted strings section, but there
1655 are a few more worth covering here.  Occasionally users want to
1656 create songbook-type documents having only lyrics with chord
1657 indications above them.  Since LilyPond is a music typesetter,
1658 it is not recommended for documents that have no music notation
1659 in them.  A better alternative is a word processor, text editor,
1660 or, for experienced users, a typesetter like GuitarTeX.
1661
1662 @menu
1663 * Indicating position and barring::
1664 * Indicating harmonics and dampened notes::
1665 * Indicating power chords::
1666 @end menu
1667
1668 @node Indicating position and barring
1669 @unnumberedsubsubsec Indicating position and barring
1670
1671 @cindex indicating position and barring for fretted instruments
1672 @cindex fretted instruments, indicating position and barring
1673
1674 This example demonstrates how to include guitar position and
1675 barring indications.
1676
1677 @lilypond[quote,ragged-right,verbatim,relative=0]
1678 \clef "treble_8"
1679 b16 d g b e
1680 \textSpannerDown
1681 \override TextSpanner.bound-details.left.text = #"XII "
1682 g16\startTextSpan
1683 b16 e g e b g\stopTextSpan
1684 e16 b g d
1685 @end lilypond
1686
1687 @seealso
1688 Notation Reference:
1689 @ref{Text spanners}.
1690
1691 Snippets:
1692 @rlsr{Fretted strings},
1693 @rlsr{Expressive marks}.
1694
1695
1696 @node Indicating harmonics and dampened notes
1697 @unnumberedsubsubsec Indicating harmonics and dampened notes
1698
1699 @cindex fretted instruments, dampened notes
1700 @cindex fretted instruments, harmonics
1701 @cindex dampened notes on fretted instruments
1702 @cindex harmonics on fretted instruments
1703
1704 Special note heads can be used to indicate dampened notes or
1705 harmonics.  Harmonics are normally further explained with a
1706 text markup.
1707
1708 @lilypond[quote,ragged-right,verbatim]
1709 \relative c' {
1710   \clef "treble_8"
1711   \override Staff.NoteHead.style = #'harmonic-mixed
1712   d^\markup { \italic { \fontsize #-2 { "harm. 12" }}} <g b>1
1713 }
1714 @end lilypond
1715
1716 Dampened notes (also called @notation{dead notes}) are supported
1717 within normal and tablature staves:
1718
1719 @lilypond[quote,ragged-right,verbatim]
1720 music = \relative c' {
1721   < a\3 \deadNote c\2 a'\1 >4
1722   < b\3 \deadNote d\2 b'\1 >
1723   < c\3 \deadNote e\2 c'\1 >
1724   \deadNotesOn
1725   \tuplet 3/2 { g8 b e }
1726   \deadNotesOff
1727   < a,\3 c\2 e\1 >1
1728 }
1729 \new StaffGroup <<
1730   \new Staff {
1731     \clef "treble_8"
1732     \music
1733   }
1734   \new TabStaff {
1735     \music
1736   }
1737 >>
1738 @end lilypond
1739
1740 Another playing technique (especially used on electric guitars) is
1741 called @notation{palm mute}.  The string is hereby partly muted by the
1742 palm of the striking hand (hence the name).  Lilypond supports
1743 the notation of palm mute-style notes by changing the note head to a
1744 triangle shape.
1745
1746 @lilypond[quote,ragged-right,verbatim]
1747 \new Voice { % Warning: explicit Voice instantiation is
1748              %    required to have palmMuteOff work properly
1749              %    when palmMuteOn comes at the beginning of
1750              %    the piece.
1751   \relative c, {
1752     \clef "G_8"
1753     \palmMuteOn
1754     e8^\markup { \musicglyph #"noteheads.u2do"  = palm mute }
1755     < e b' e > e
1756     \palmMuteOff
1757     e e  \palmMute e e e |
1758     e8 \palmMute { e e e } e e e e |
1759     < \palmMute e b' e >8 \palmMute { e e e } < \palmMute e b' e >2
1760   }
1761 }
1762 @end lilypond
1763
1764 @seealso
1765 Snippets:
1766 @rlsr{Fretted strings}.
1767
1768 Notation Reference:
1769 @ref{Special note heads},
1770 @ref{Note head styles}.
1771
1772
1773 @node Indicating power chords
1774 @unnumberedsubsubsec Indicating power chords
1775
1776 @funindex powerChords
1777 @funindex \powerChords
1778
1779 @cindex power chords
1780 @cindex chords, power
1781
1782 Power chords and their symbols can be engraved in chord mode or as chord
1783 constructs:
1784
1785 @lilypond[quote,ragged-right,verbatim]
1786 ChordsAndSymbols = {
1787   \chordmode {
1788     \powerChords
1789     e,,1:1.5
1790     a,,1:1.5.8
1791     \set minimumFret = #8
1792     c,1:1.5
1793     f,1:1.5.8
1794   }
1795   \set minimumFret = #5
1796   <a, e>1
1797   <g d' g'>1
1798 }
1799 \score {
1800   <<
1801     \new ChordNames {
1802     \ChordsAndSymbols
1803     }
1804     \new Staff {
1805       \clef "treble_8"
1806       \ChordsAndSymbols
1807     }
1808     \new TabStaff {
1809       \ChordsAndSymbols
1810     }
1811   >>
1812 }
1813 @end lilypond
1814
1815 Power chord symbols are automatically switched off as soon as one of the
1816 other common chord modifier is used:
1817
1818 @lilypond[quote,ragged-right,verbatim]
1819 mixedChords = \chordmode {
1820   c,1
1821   \powerChords
1822   b,,1:1.5
1823   fis,,1:1.5.8
1824   g,,1:m
1825 }
1826 \score {
1827   <<
1828     \new ChordNames {
1829       \mixedChords
1830     }
1831     \new Staff {
1832       \clef "treble_8"
1833       \mixedChords
1834     }
1835     \new TabStaff {
1836       \mixedChords
1837     }
1838   >>
1839 }
1840 @end lilypond
1841
1842 @seealso
1843 Music Glossary:
1844 @rglos{power chord}.
1845
1846 Notation Reference:
1847 @ref{Extended and altered chords},
1848 @ref{Printing chord names}.
1849
1850 Snippets:
1851 @rlsr{Fretted strings}.
1852
1853
1854 @node Banjo
1855 @subsection Banjo
1856
1857 @menu
1858 * Banjo tablatures::
1859 @end menu
1860
1861 @node Banjo tablatures
1862 @unnumberedsubsubsec Banjo tablatures
1863
1864 @cindex banjo tablatures
1865 @cindex tablature, banjo
1866
1867 LilyPond has basic support for the five-string banjo.  When making tablatures
1868 for five-string banjo, use the banjo tablature format function to get
1869 correct fret numbers for the fifth string:
1870
1871 @c due to crazy intervals of banjo music, absolute pitch is recommended
1872
1873 @lilypond[quote,ragged-right,verbatim]
1874 music = {
1875   g8 d' g'\5 a b g e d' |
1876   g4 d''8\5 b' a'\2 g'\5 e'\2 d' |
1877   g4
1878 }
1879
1880 <<
1881   \new Staff \with { \omit StringNumber }
1882   { \clef "treble_8"  \music }
1883   \new TabStaff \with {
1884     tablatureFormat = #fret-number-tablature-format-banjo
1885     stringTunings = #banjo-open-g-tuning
1886   }
1887   { \music }
1888 >>
1889 @end lilypond
1890
1891 @cindex banjo tunings
1892 @cindex tunings, banjo
1893
1894 @funindex banjo-c-tuning
1895 @funindex banjo-modal-tuning
1896 @funindex banjo-open-d-tuning
1897 @funindex banjo-open-dm-tuning
1898 @funindex four-string-banjo
1899
1900 A number of common tunings for the five-string banjo are predefined:
1901 @code{banjo-c-tuning} (gCGBD), @code{banjo-modal-tuning} (gDGCD),
1902 @code{banjo-open-d-tuning} (aDF#AD) and @code{banjo-open-dm-tuning}
1903 (aDFAD).
1904
1905 These may be converted to four-string tunings using the
1906 @code{four-string-banjo} function:
1907
1908 @example
1909 \set TabStaff.stringTunings = #(four-string-banjo banjo-c-tuning)
1910 @end example
1911
1912 @seealso
1913 Installed Files:
1914 @file{ly/string-tunings-init.ly}.
1915
1916 Snippets:
1917 @rlsr{Fretted strings}.