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