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