]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/fretted-strings.itely
Merge commit 'origin' into beamlets2
[lilypond.git] / Documentation / user / 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.  See TRANSLATION for details.
7 @end ignore
8
9 @c \version "2.12.0"
10
11 @node Fretted string instruments
12 @section Fretted string instruments
13
14 @lilypondfile[quote]{fretted-headword.ly}
15
16 This section discusses several aspects of music notation that are unique
17 to fretted string instruments.
18
19 @cindex tablature
20 @cindex tablature, guitar
21 @cindex tablature, banjo
22 @cindex guitar tablature
23 @cindex banjo tablature
24
25 @menu
26 * Common notation for fretted strings::
27 * Guitar::
28 * Banjo::
29 @end menu
30
31 @node Common notation for fretted strings
32 @subsection Common notation for fretted strings
33
34 This section discusses common notation that is unique
35 to fretted string instruments.
36
37 @menu
38 * References for fretted strings::
39 * String number indications::
40 * Default tablatures::
41 * Custom tablatures::
42 * Fret diagram markups::
43 * Predefined fret diagrams::
44 * Automatic fret diagrams::
45 * Right-hand fingerings::
46 @end menu
47
48 @node References for fretted strings
49 @unnumberedsubsubsec References for fretted strings
50
51 Music for fretted string instruments is normally notated on
52 a single staff, either in traditional music notation or in
53 tablature.  Sometimes the two types are combined, and it is
54 especially common in popular music to use chord diagrams above
55 a staff of traditional notation.  The guitar and the banjo are
56 transposing instruments, sounding an octave lower than written.
57 Scores for these instruments should use the @code{"treble_8"} clef.
58 Some other elements pertinent to fretted string instruments
59 are covered elsewhere:
60
61 @itemize
62 @item Fingerings are indicated as shown in @ref{Fingering instructions}.
63
64 @item Instructions for @notation{Laissez vibrer} ties
65 as well as ties on arpeggios and tremolos can be found in
66 @ref{Ties}.
67
68 @item Instructions for handling multiple voices can be found
69 in @ref{Collision resolution}.
70
71 @item Instructions for indicating harmonics can be found in
72 @ref{Harmonics}.
73
74 @end itemize
75
76
77 @seealso
78 Notation Reference:
79 @ref{Fingering instructions},
80 @ref{Ties},
81 @ref{Collision resolution},
82 @ref{Instrument names},
83 @ref{Writing music in parallel},
84 @ref{Arpeggio},
85 @ref{List of articulations},
86 @ref{Clef}.
87
88
89 @node String number indications
90 @unnumberedsubsubsec String number indications
91
92 @cindex string numbers
93 @cindex string vs. fingering numbers
94 @cindex fingering vs. string numbers
95
96 The string on which a note should be played may be indicated by
97 appending @code{\@var{number}} to a note inside a chord construct
98 @code{<>}.
99
100 @warning{String numbers @strong{must} be defined inside a chord
101 construct even if there is only a single note.}
102
103 @lilypond[verbatim,quote,relative=0]
104 \clef "treble_8"
105 <c\5>4 <e\4> <g\3>2
106 <c,\5 e\4 g\3>1
107 @end lilypond
108
109 When fingerings and string indications are used together, their
110 placement is controlled by the order in which the two items appear
111 in the code:
112
113 @lilypond[verbatim,quote,relative=1]
114 \clef "treble_8"
115 <g\3-0>2
116 <g-0\3>
117 @end lilypond
118
119 @snippets
120
121 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
122 {controlling-the-placement-of-chord-fingerings.ly}
123
124 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
125 {allowing-fingerings-to-be-printed-inside-the-staff.ly}
126
127
128 @seealso
129 Notation Reference:
130 @ref{Fingering instructions}.
131
132 Snippets:
133 @rlsr{Fretted strings}.
134
135 Internals Reference:
136 @rinternals{StringNumber},
137 @rinternals{Fingering}.
138
139
140 @node Default tablatures
141 @unnumberedsubsubsec Default tablatures
142
143 @cindex tablatures, basic
144 @cindex tablatures, default
145
146 @funindex TabStaff
147 @funindex TabVoice
148
149 Tablature notation is used for notating music for plucked string
150 instruments.  Pitches are not denoted with note heads, but by
151 numbers indicating on which string and fret a note must be played.
152 LilyPond offers limited support for tablature.
153
154 The string number associated with a note is given as a backslash
155 followed by a number.  By default, string 1 is the highest,
156 and the tuning defaults to the standard guitar tuning (with 6 strings).
157 The notes are printed as tablature, by using @code{TabStaff} and
158 @code{TabVoice} contexts
159
160 @lilypond[quote,ragged-right,fragment,verbatim]
161 \new TabStaff {
162   a,4\5 c'\2 a\3 e'\1
163   e\4 c'\2 a\3 e'\1
164 }
165 @end lilypond
166
167 @funindex minimumFret
168
169 @cindex fret
170
171
172 When no string is specified for a note, the note is assigned to
173 the highest string that can generate the note with a fret number
174 greater than or equal to the value of @code{minimumFret}.
175 The default value for @code{minimumFret} is 0.
176
177
178 @lilypond[quote,ragged-right,verbatim]
179 \new StaffGroup <<
180    \new Staff \relative c {
181      \clef "treble_8"
182      c16 d e f g4
183      c,16 d e f g4
184    }
185    \new TabStaff \relative c {
186      c16 d e f g4
187      \set TabStaff.minimumFret = #5
188      c,16 d e f g4
189    }
190 >>
191 @end lilypond
192
193 @cindex harmonic indications in tablature notation
194 @cindex tablature and harmonic indications
195 @cindex slides in tablature notation
196 @cindex tablature and slides
197
198 Harmonic indications and slides can be added to tablature
199 notation.
200
201 @lilypond[fragment, verbatim, quote, relative=1]
202 \new TabStaff {
203   \new TabVoice {
204     <c g'\harmonic> d\2\glissando e\2
205   }
206 }
207 @end lilypond
208
209
210 @snippets
211
212 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
213 {stem-and-beam-behavior-in-tablature.ly}
214
215 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
216 {polyphony-in-tablature.ly}
217
218
219 @seealso
220 Notation Reference:
221 @ref{Stems}.
222
223 Snippets:
224 @rlsr{Fretted strings}.
225
226 Internals Reference:
227 @rinternals{TabNoteHead},
228 @rinternals{TabStaff},
229 @rinternals{TabVoice},
230 @rinternals{Beam}.
231
232
233 @knownissues
234
235 Chords are not handled in a special way, and hence the automatic
236 string selector may easily select the same string for two notes in
237 a chord.
238
239 In order to handle @code{\partcombine}, a @code{TabStaff} must use
240 specially-created voices:
241
242 @lilypond[quote,ragged-right,verbatim]
243 melodia = \partcombine { e4 g g g }{ e4 e e e }
244 <<
245   \new TabStaff <<
246     \new TabVoice = "one" s1
247     \new TabVoice = "two" s1
248     \new TabVoice = "shared" s1
249     \new TabVoice = "solo" s1
250     { \melodia }
251   >>
252 >>
253 @end lilypond
254
255 Guitar special effects are limited to harmonics and slides.
256
257 @node Custom tablatures
258 @unnumberedsubsubsec Custom tablatures
259
260 @cindex tablatures, custom
261 @cindex tablature, banjo
262 @cindex tablature, mandolin
263 @cindex tablature, bass guitar
264 @cindex tablature, predefined string tunings
265 @cindex fretted instruments, predefined string tunings
266 @cindex predefined string tunings for fretted instruments
267
268 @funindex StringTunings
269
270 LilyPond tabulature automatically calculates the fret for
271 a note based on the string to which the note is assigned.
272 In order to do this, the tuning of the strings must be
273 specified.  The tuning of the strings is given in the
274 @code{StringTunings} property.
275
276 LilyPond comes with predefined string tunings for banjo, mandolin,
277 guitar and bass guitar.  Lilypond automatically sets the correct
278 transposition for predefined tunings.  The following example is
279 for bass guitar, which sounds an octave lower than written.
280
281 @lilypond[quote,ragged-right,verbatim]
282 <<
283   \new Staff {
284     \clef "bass_8"
285     \relative c, {
286       c4 d e f
287     }
288   }
289   \new TabStaff {
290     \set TabStaff.stringTunings = #bass-tuning
291     \relative c, {
292       c4 d e f
293     }
294   }
295 >>
296 @end lilypond
297
298 The default string tuning is @code{guitar-tuning}, which
299 is the standard EADGBE tuning.  Some other predefined tunings are
300 @code{guitar-open-g-tuning}, @code{mandolin-tuning} and
301 @code{banjo-open-g-tuning}.  The predefined string tunings
302 are found in @code{scm/output-lib.scm}.
303
304 A string tuning is a Scheme list of string pitches,
305 one for each string, ordered by string number from 1 to N,
306 where string 1 is at the top of the tablature staff and
307 string N is at the bottom.  This ordinarily results in ordering
308 from highest pitch to lowest pitch, but some instruments
309 (e.g. ukulele) do not have strings ordered by pitch.
310
311 A string pitch in a string tuning list is the pitch difference
312 of the open string from middle C measured in semitones.  The
313 string pitch must be an integer.  Lilypond calculates the actual
314 pitch of the string by adding the string tuning pitch to the
315 actual pitch for middle C.
316
317 LilyPond automatically calculates the number of strings in the
318 @code{TabStaff} as the number of elements in @code{stringTunings}.
319
320 Any desired string tuning can be created.  For example, we can
321 define a string tuning for a four-string instrument with pitches
322 of @code{a''},  @code{d''},  @code{g'}, and @code{c'}:
323
324
325 @lilypond[quote,verbatim]
326 mynotes = {
327     c'4 e' g' c'' |
328     e'' g'' b'' c'''
329 }
330
331 <<
332   \new Staff {
333     \clef treble
334     \mynotes
335   }
336   \new TabStaff {
337     \set TabStaff.stringTunings = #'(21 14 7 0)
338     \mynotes
339   }
340 >>
341 @end lilypond
342
343
344 @seealso
345 Installed Files:
346 @file{scm/output-lib.scm}.
347
348 Snippets:
349 @rlsr{Fretted strings}.
350
351 Internals Reference:
352 @rinternals{Tab_note_heads_engraver}.
353
354
355 @node Fret diagram markups
356 @unnumberedsubsubsec Fret diagram markups
357
358 @cindex fret diagrams
359 @cindex chord diagrams
360 @cindex diagrams, fret
361 @cindex diagrams, chord for fretted instruments
362 @cindex fret diagrams, custom
363 @cindex custom fret diagrams
364
365 Fret diagrams can be added to music as a markup to the desired
366 note.  The markup contains information about the desired fret
367 diagram.  There are three different fret-diagram markup
368 interfaces: standard, terse, and verbose.  The three interfaces
369 produce equivalent markups, but have varying amounts of
370 information in the markup string.  Details about the markup
371 interfaces are found at @ref{Text markup commands}.
372
373 The standard fret diagram markup string indicates the string
374 number and the fret number for each dot to be placed on the string.
375 In addition, open and unplayed (muted) strings can be indicated.
376
377 @lilypond[quote, verbatim]
378 <<
379   \context ChordNames {
380      \chordmode {
381        c1 d:m
382      }
383   }
384   \context Staff {
385     \clef "treble_8"
386     < c e g c' e' > 1 ^\markup
387       \fret-diagram #"6-x;5-3;4-2;3-o;2-1;1-o;"
388     < d a d' f'> ^\markup
389       \fret-diagram #"6-x;5-x;4-o;3-2;2-3;1-1;"
390   }
391 >>
392 @end lilypond
393
394 @cindex barre indications
395
396 Barre indications can be added to the diagram from
397 the fret-diagram markup string.
398
399 @lilypond[quote, verbatim]
400 <<
401   \context ChordNames {
402      \chordmode {
403        f1 g
404      }
405   }
406   \context Staff {
407     \clef "treble_8"
408     < f, c f a c' f'>1 ^\markup
409       \fret-diagram #"c:6-1-1;6-1;5-3;4-3;3-2;2-1;1-1;"
410     < g, d g b d' g'> ^\markup
411       \fret-diagram #"c:6-1-3;6-3;5-5;4-5;3-4;2-3;1-3;"
412   }
413 >>
414 @end lilypond
415
416 @cindex fret-diagram markup
417
418 @funindex fret-diagram
419 @funindex \fret-diagram
420
421 The size of the fret diagram, and the number of frets in the diagram
422 can be changed in the fret-diagram markup string.
423
424 @lilypond[quote, verbatim]
425 <<
426   \context ChordNames {
427      \chordmode {
428        f1 g
429      }
430   }
431   \context Staff {
432     \clef "treble_8"
433     < f, c f a c' f'>1 ^\markup
434       \fret-diagram #"s:1.5;c:6-1-1;6-1;5-3;4-3;3-2;2-1;1-1;"
435     < g, b, d g b g'> ^\markup
436       \fret-diagram #"h:6;6-3;5-2;4-o;3-o;2-o;1-3;"
437   }
438 >>
439 @end lilypond
440
441 The number of strings in a fret diagram can be changed to accomodate
442 different instruments such as banjos and ukeleles with the fret-diagram
443 markup string.
444
445 @lilypond[quote, verbatim]
446 <<
447   \context ChordNames {
448      \chordmode {
449        a1
450      }
451   }
452   \context Staff {
453         %% A chord for ukelele
454     a'1 ^\markup \fret-diagram #"w:4;4-2-2;3-1-1;2-o;1-o;"
455   }
456 >>
457 @end lilypond
458
459 Fingering indications can be added, and the location of fingering labels
460 can be controlled by the fret-diagram markup string.
461
462 @lilypond[quote, verbatim]
463 <<
464   \context ChordNames {
465      \chordmode {
466        c1 d:m
467      }
468   }
469   \context Staff {
470     \clef "treble_8"
471     < c e g c' e' > 1 ^\markup
472       \fret-diagram #"f:1;6-x;5-3-3;4-2-2;3-o;2-1-1;1-o;"
473     < d a d' f'> ^\markup
474       \fret-diagram #"f:2;6-x;5-x;4-o;3-2-2;2-3-3;1-1-1;"
475   }
476 >>
477 @end lilypond
478
479 Dot radius and dot position can be controlled with the fret-diagram
480 markup string.
481
482 @lilypond[quote, verbatim]
483 <<
484   \context ChordNames {
485      \chordmode {
486        c1 d:m
487      }
488   }
489   \context Staff {
490     \clef "treble_8"
491     < c e g c' e' > 1 ^\markup
492       \fret-diagram #"d:0.35;6-x;5-3;4-2;3-o;2-1;1-o;"
493     < d a d' f'> ^\markup
494       \fret-diagram #"p:0.2;6-x;5-x;4-o;3-2;2-3;1-1;"
495   }
496 >>
497 @end lilypond
498
499 @cindex fret-diagram-terse markup
500
501 @funindex fret-diagram-terse
502 @funindex \fret-diagram-terse
503
504 The fret-diagram-terse markup string omits string numbers; the string
505 number is implied by the presence of semicolons.  There is one semicolon
506 for each string in the diagram.  The first semicolon corresponds to the
507 highest string number and the last semicolon corresponds to the first string.
508 Mute strings, open strings, and fret numbers can be indicated.
509
510 @lilypond[quote, verbatim]
511 <<
512   \context ChordNames {
513      \chordmode {
514        c1 d:m
515      }
516   }
517   \context Staff {
518     \clef "treble_8"
519     < c e g c' e' > 1 ^\markup
520       \fret-diagram-terse #"x;3;2;o;1;o;"
521     < d a d' f'> ^\markup
522       \fret-diagram-terse #"x;x;o;2;3;1;"
523   }
524 >>
525 @end lilypond
526
527 Barre indicators can be included in the fret-diagram-terse markup string.
528
529 @lilypond[quote, verbatim]
530 <<
531   \context ChordNames {
532      \chordmode {
533        f1 g
534      }
535   }
536   \context Staff {
537     \clef "treble_8"
538     < f, c f a c' f'>1 ^\markup
539       \fret-diagram-terse #"1-(;3;3;2;1;1-);"
540     < g, d g b d' g'> ^\markup
541       \fret-diagram-terse #"3-(;5;5;4;3;3-);"
542   }
543 >>
544 @end lilypond
545
546 Fingering indications can be included in the fret-diagram-terse markup string.
547
548 @c Need to use override to enable fingerings to show this -- can we do so?
549 @lilypond[quote, verbatim]
550 <<
551   \context ChordNames {
552      \chordmode {
553        c1 d:m
554      }
555   }
556   \context Staff {
557     \override Voice.TextScript
558       #'(fret-diagram-details finger-code) = #'below-string
559     \clef "treble_8"
560     < c e g c' e' > 1 ^\markup
561       \fret-diagram-terse #"x;3-3;2-2;o;1-1;o;"
562     < d a d' f'> ^\markup
563       \fret-diagram-terse #"x;x;o;2-2;3-3;1-1;"
564   }
565 >>
566 @end lilypond
567
568 Other fret diagram properties must be adjusted using @code{\override} when using
569 the fret-diagram-terse markup.
570
571 @cindex fret-diagram-verbose markup
572
573 @funindex fret-diagram-verbose
574 @funindex \fret-diagram-verbose
575
576 The fret-diagram-verbose markup string is in the format of a Scheme list.  Each
577 element of the list indicates an item to be placed on the fret diagram.
578
579 @lilypond[quote, verbatim]
580 <<  \context ChordNames {
581      \chordmode {
582        c1 d:m
583      }
584   }
585   \context Staff {
586     \clef "treble_8"
587     < c e g c' e' > 1 ^\markup
588       \fret-diagram-verbose #'(
589         (mute 6)
590         (place-fret 5 3)
591         (place-fret 4 2)
592         (open 3)
593         (place-fret 2 1)
594         (open 1)
595       )
596     < d a d' f'> ^\markup
597       \fret-diagram-verbose #'(
598         (mute 6)
599         (mute 5)
600         (open 4)
601         (place-fret 3 2)
602         (place-fret 2 3)
603         (place-fret 1 1)
604       )
605   }
606 >>
607 @end lilypond
608
609 Fingering indications and barres can be included in a
610 fret-diagram-verbose markup string.  Unique to the 
611 fret-diagram-verbose interface is a capo indication that 
612 can be placed on the fret diagram.  The capo indication is
613 a thick bar that covers all strings.  The fret with the
614 capo will be the lowest fret in the fret diagram.
615
616 @c \override is necessary to make fingering visible
617 @lilypond[quote, verbatim]
618 <<
619   \context ChordNames {
620      \chordmode {
621        f1 g c
622      }
623   }
624   \context Staff {
625     \clef "treble_8"
626     \override Voice.TextScript
627       #'(fret-diagram-details finger-code) = #'below-string
628
629     < f, c f a c' f'>1 ^\markup
630       \fret-diagram-verbose #'(
631         (place-fret 6 1)
632         (place-fret 5 3)
633         (place-fret 4 3)
634         (place-fret 3 2)
635         (place-fret 2 1)
636         (place-fret 1 1)
637         (barre 6 1 1)
638       )
639     < g, b, d g b g'> ^\markup
640       \fret-diagram-verbose #'(
641         (place-fret 6 3 2)
642         (place-fret 5 2 1)
643         (open 4)
644         (open 3)
645         (open 2)
646         (place-fret 1 3 3)
647       )
648     < c e g c' e'> ^\markup
649       \fret-diagram-verbose #'(
650         (capo 3)
651         (mute 6)
652         (place-fret 4 5 1)
653         (place-fret 3 5 2)
654         (place-fret 2 5 3)
655       )
656    }
657 >>
658 @end lilypond
659
660 All other fret diagram properties must be adjusted using @code{\override}
661 when using the fret-diagram-verbose markup.
662
663 @ignore
664 The following example shows the three fret-diagram markup
665 interfaces, along with examples of common tweaks.  For example,
666 the size of the verbose fret diagram is reduced to 0.75, and the
667 finger indications are specified to appear below the diagram.  The
668 terse diagram includes tweaks to specify placement of finger code
669 and color of dots.
670
671 @lilypond[verbatim,ragged-right,quote]
672 \new Voice {
673   \clef "treble_8"
674   d^\markup \fret-diagram #"6-x;5-x;4-o;3-2;2-3;1-2;"
675   d d d
676   fis^\markup \override #'(size . 0.75) {
677     \override #'(finger-code . below-string) {
678       \fret-diagram-verbose #'((place-fret 6 2 1) (barre 6 1 2)
679                                (place-fret 5 4 3)
680                                (place-fret 4 4 4)
681                                (place-fret 3 3 2)
682                                (place-fret 2 2 1)
683                                (place-fret 1 2 1))
684     }
685   }
686   fis fis fis
687   c^\markup \override #'(dot-radius . 0.35) {
688     \override #'(finger-code . in-dot) {
689       \override #'(dot-color . white) {
690         \fret-diagram-terse #"x;3-1-(;5-2;5-3;5-4;3-1-);"
691       }
692     }
693   }
694   c c c
695 }
696 @end lilypond
697 @end ignore
698
699 @cindex customized fret diagram
700 @cindex fret diagram, customized
701 @cindex diagram, fret, customized
702
703 @funindex fret-diagram-interface
704
705 The graphical layout of a fret diagram can be customized according to
706 user preference through the properties of the @code{fret-diagram-interface}.
707 Details are found at @rinternals{fret-diagram-interface}.  For a fret diagram
708 markup, the interface properties belong to @code{Voice.TextScript}.
709
710 @snippets
711
712 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
713 {customizing-markup-fret-diagrams.ly}
714
715
716 @seealso
717 Notation Reference:
718 @ref{Text markup commands}.
719
720 Snippets:
721 @rlsr{Fretted strings}.
722
723 Internals Reference:
724 @rinternals{fret-diagram-interface}.
725
726
727 @node Predefined fret diagrams
728 @unnumberedsubsubsec Predefined fret diagrams
729
730
731 @cindex fret diagrams
732 @cindex chord diagrams
733
734 @funindex FretBoards
735 @funindex stringTunings
736
737 Fret diagrams can be displayed using the @code{FretBoards} context.  By
738 default, the @code{FretBoards} context will display fret diagrams that
739 are stored in a lookup table:
740
741 @lilypond[verbatim, ragged-right, quote]
742 \include "predefined-guitar-fretboards.ly"
743 \context FretBoards {
744   \chordmode {
745     c1 d
746   }
747 }
748 @end lilypond
749
750 The default predefined fret diagrams are contained in the file
751 @code{predefined-guitar-fretboards.ly}.  Fret diagrams are
752 stored based on the pitches of a chord and the value of
753 @code{stringTunings} that is currently in use.
754 @code{predefined-guitar-fretboards.ly} contains predefined
755 fret diagrams only for @code{guitar-tuning}.  Predefined fret
756 diagrams can be added for other instruments or other tunings
757 by following the examples found in
758 @code{predefined-guitar-fretboards.ly}.
759
760 Chord pitches can be entered
761 either as simultaneous music or using chord mode (see
762 @ref{Chord mode overview}).
763
764 @lilypond[verbatim, ragged-right,quote]
765 \include "predefined-guitar-fretboards.ly"
766 \context FretBoards {
767   \chordmode {c1}
768   <c' e' g'>1
769 }
770 @end lilypond
771
772 @cindex chord names with fret diagrams
773 @cindex fret diagrams with chord names
774
775 @funindex ChordNames
776 @funindex chordmode
777 @funindex \chordmode
778
779 It is common that both chord names and fret diagrams are displayed together.
780 This is achieved by putting a @code{ChordNames} context in parallel with
781 a @code{FretBoards} context and giving both contexts the same music.
782
783 @lilypond[verbatim, ragged-right, quote]
784 \include "predefined-guitar-fretboards.ly"
785 mychords = \chordmode{
786   c1 f g
787 }
788
789 <<
790   \context ChordNames {
791     \mychords
792   }
793   \context FretBoards {
794     \mychords
795   }
796 >>
797 @end lilypond
798
799 @cindex transposing fret diagrams
800 @cindex fret diagrams, transposing
801 @cindex diagrams, fret, transposing
802
803 Predefined fret diagrams are transposable, as long as a diagram for the
804 transposed chord is stored in the fret diagram table.
805
806 @lilypond[verbatim, ragged-right, quote]
807 \include "predefined-guitar-fretboards.ly"
808 mychords = \chordmode{
809   c1 f g
810 }
811
812 mychordlist = {
813   \mychords
814   \transpose c e { \mychords}
815 }
816 <<
817   \context ChordNames {
818     \mychordlist
819   }
820   \context FretBoards {
821     \mychordlist
822   }
823 >>
824 @end lilypond
825
826
827 The predefined fret diagram table contains seven chords (major, minor,
828 augmented, diminished, dominant seventh, major seventh, minor seventh)
829 for each of 17 keys.  A complete list of the predefined fret diagrams is
830 shown in @ref{Predefined fretboard diagrams}.  If there is no entry in
831 the table for a chord, the FretBoards engraver will calculate a
832 fret-diagram using the automatic fret diagram functionality described in
833 @ref{Automatic fret diagrams}.
834
835 @lilypond[verbatim, ragged-right, quote]
836 \include "predefined-guitar-fretboards.ly"
837 mychords = \chordmode{
838   c1 c:9
839 }
840
841 <<
842   \context ChordNames {
843     \mychords
844   }
845   \context FretBoards {
846     \mychords
847   }
848 >>
849 @end lilypond
850
851 @cindex fret diagrams, adding custom
852 @cindex custom fret diagrams, adding
853 @cindex adding custom fret diagrams
854
855 Fret diagrams can be added to the fret diagram table.  To add a diagram,
856 you must specify the chord for the diagram, the tuning to be used, and 
857 a definition for the diagram.  The diagram definition can be either a
858 fret-diagram-terse definition string or a fret-diagram-verbose
859 marking list.
860
861 @lilypond[verbatim, ragged-right, quote]
862 \include "predefined-guitar-fretboards.ly"
863
864 \storePredefinedDiagram \chordmode {c:9}
865                         #guitar-tuning
866                         #"x;3-2;2-1;3-3;3-4;x;"
867
868 mychords = \chordmode{
869   c1 c:9
870 }
871
872 <<
873   \context ChordNames {
874     \mychords
875   }
876   \context FretBoards {
877     \mychords
878   }
879 >>
880 @end lilypond
881
882 Different fret diagrams for the same chord name can be stored using different
883 octaves of pitches.
884
885 @lilypond[verbatim, ragged-right, quote]
886 \include "predefined-guitar-fretboards.ly"
887
888 \storePredefinedDiagram \chordmode {c'}
889                         #guitar-tuning
890                         #(offset-fret 2 (chord-shape 'bes guitar-tuning))
891
892 mychords = \chordmode{
893   c1 c'
894 }
895
896 <<
897   \context ChordNames {
898     \mychords
899   }
900   \context FretBoards {
901     \mychords
902   }
903 >>
904 @end lilypond
905
906 @cindex fretted instruments, chord shapes
907 @cindex chord shapes for fretted instruments
908
909 @funindex \addChordShape
910 @funindex add ChordShape
911 @funindex storePredefinedDiagram
912 @funindex \storePredefinedDiagram
913
914 In addition to fret diagrams, LilyPond stores an internal list of chord
915 shapes.  The chord shapes are fret diagrams that can be shifted along
916 the neck to different posistions to provide different chords.  Chord
917 shapes can be added to the internal list and then used to define
918 predefined fret diagrams.  Because they can be moved to various
919 positions on the neck, chord shapes will normally not contain
920 any open strings.  Like fret diagrams, chord shapes can be
921 entered as either fret-diagram-terse strings or fret-diagram-verbose
922 marking lists.
923
924 @lilypond[verbatim, ragged-right, quote]
925 \include "predefined-guitar-fretboards.ly"
926
927 % add a new chord shape
928
929 \addChordShape #'powerf #guitar-tuning #"1-1;3-3;3-4;x;x;x;"
930
931 % add some new chords based on the power chord shape
932
933 \storePredefinedDiagram \chordmode {f'}
934                         #guitar-tuning
935                         #(chord-shape 'powerf guitar-tuning) 
936 \storePredefinedDiagram \chordmode {g'}
937                         #guitar-tuning
938                         #(offset-fret 2 (chord-shape 'powerf guitar-tuning))
939
940 mychords = \chordmode{
941   f1 f' g g'
942 }
943
944 <<
945   \context ChordNames {
946     \mychords
947   }
948   \context FretBoards {
949     \mychords
950   }
951 >>
952 @end lilypond
953
954 The graphical layout of a fret diagram can be customized according to
955 user preference through the properties of the @code{fret-diagram-interface}.
956 Details are found at @rinternals{fret-diagram-interface}.  For a
957 predefined fret diagram, the interface properties belong to
958 @code{FretBoards.FretBoard}.
959
960 @snippets
961
962 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
963 {customizing-fretboard-fret-diagrams.ly}
964
965 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
966 {defining-predefined-fretboards-for-other-instruments.ly}
967
968
969 @seealso
970 Notation Reference:
971 @ref{Custom tablatures},
972 @ref{Automatic fret diagrams},
973 @ref{Chord mode overview},
974 @ref{Predefined fretboard diagrams}.
975
976 Installed Files:
977 @file{ly/predefined-guitar-fretboards.ly},
978 @file{ly/predefined-guitar-ninth-fretboards.ly}.
979
980 Snippets:
981 @rlsr{Fretted strings}.
982
983 Internals Reference:
984 @rinternals {fret-diagram-interface}.
985
986
987 @node Automatic fret diagrams
988 @unnumberedsubsubsec Automatic fret diagrams
989
990 @cindex fret diagrams, automatic
991 @cindex chord diagrams, automatic
992 @cindex automatic fret diagrams
993 @cindex automatic chord diagrams
994
995 Fret diagrams can be automatically created from entered notes using the
996 @code{FretBoards} context.  If no predefined diagram is available for
997 the entered notes in the active @code{stringTunings}, this context
998 calculates strings and frets that can be used to play the notes.
999
1000 @lilypond[quote,ragged-right,verbatim]
1001 <<
1002   \context ChordNames {
1003      \chordmode {
1004        f1 g
1005      }
1006   }
1007   \context FretBoards {
1008     < f, c f a c' f'>1
1009     < g,\6 b, d g b g'>
1010   }
1011   \context Staff {
1012     \clef "treble_8"
1013     < f, c f a c' f'>1
1014     < g, b, d g b' g'>
1015   }
1016 >>
1017 @end lilypond
1018
1019 @funindex predefinedFretboardsOff
1020 @funindex \predefinedFretboardsOff
1021 @funindex predefinedFretboardsOn
1022 @funindex \predefinedFretboardsOn
1023
1024 As no predefined diagrams are loaded by default, automatic calculation
1025 of fret diagrams is the default behavior.  Once default diagrams are
1026 loaded, automatic calculation can be enabled and disabled with predefined
1027 commands:
1028
1029 @lilypond[quote,ragged-right,verbatim]
1030
1031 \storePredefinedDiagram <c e g c' e'>
1032                         #guitar-tuning
1033                         #"x;3-1-(;5-2;5-3;5-4;3-1-1);"
1034 <<
1035   \context ChordNames {
1036      \chordmode {
1037        c1 c c
1038      }
1039   }
1040   \context FretBoards {
1041     <c e g c' e'>1
1042     \predefinedFretboardsOff
1043     <c e g c' e'>
1044     \predefinedFretboardsOn
1045     <c e g c' e'>
1046   }
1047   \context Staff {
1048     \clef "treble_8"
1049     <c e g c' e'>1
1050     <c e g c' e'>
1051     <c e g c' e'>
1052   }
1053 >>
1054 @end lilypond
1055
1056
1057
1058 Sometimes the fretboard calculator will be unable to find
1059 an accceptable diagram.  This can often be remedied by
1060 manually assigning a note to a string.  In many cases, only one
1061 note need be manually placed on a string; the rest of
1062 the notes will then be placed appropriately by the @code{FretBoards}
1063 context.
1064
1065 @cindex fret diagrams, adding fingerings
1066 @cindex fingerings, adding to fret diagrams
1067
1068 Fingerings can be added to FretBoard fret diagrams.
1069
1070 @lilypond[quote, verbatim]
1071 <<
1072   \context ChordNames {
1073      \chordmode {
1074        c1 d:m
1075      }
1076   }
1077   \context FretBoards {
1078     < c-3 e-2 g c'-1 e' > 1
1079     < d a-2 d'-3 f'-1>
1080   }
1081   \context Staff {
1082     \clef "treble_8"
1083     < c e g c' e' > 1
1084     < d a d' f'>
1085   }
1086 >>
1087 @end lilypond
1088
1089 The minimum fret to be used in calculating strings and frets for
1090 the FretBoard context can be set with the @code{minimumFret}
1091 property.
1092
1093 @lilypond[quote, verbatim]
1094 <<
1095   \context ChordNames {
1096      \chordmode {
1097        d1:m d:m
1098      }
1099   }
1100   \context FretBoards {
1101     < d a d' f'>
1102     \set FretBoards.minimumFret = #5
1103     < d a d' f'>
1104   }
1105   \context Staff {
1106     \clef "treble_8"
1107     < d a d' f'>
1108     < d a d' f'>
1109   }
1110 >>
1111 @end lilypond
1112
1113 The strings and frets for the @code{FretBoards} context depend
1114 on the @code{stringTunings} property, which has the same meaning
1115 as in the TabStaff context.  See @ref{Custom tablatures} for
1116 information on the @code{stringTunings} property.
1117
1118 The graphical layout of a fret diagram can be customized according to
1119 user preference through the properties of the @code{fret-diagram-interface}.
1120 Details are found at @rinternals{fret-diagram-interface}.  For a
1121 @code{FretBoards} fret diagram, the interface properties belong to
1122 @code{FretBoards.FretBoard}.
1123
1124
1125 @predefined
1126 @code{\predefinedFretboardsOff},
1127 @code{\predefinedFretboardsOn}.
1128 @endpredefined
1129
1130
1131 @seealso
1132 Notation Reference:
1133 @ref{Custom tablatures}.
1134
1135 Snippets:
1136 @rlsr{Fretted strings}.
1137
1138 Internals Reference:
1139 @rinternals {fret-diagram-interface}.
1140
1141
1142 @node Right-hand fingerings
1143 @unnumberedsubsubsec Right-hand fingerings
1144
1145 @cindex fretted instruments, right hand fingerings
1146 @cindex fingerings, right hand for fretted instruments
1147 @cindex right hand fingerings for fretted instruments
1148
1149 @funindex rightHandFinger
1150 @funindex \rightHandFinger
1151
1152 Right-hand fingerings @var{p-i-m-a} must be entered within a
1153 chord construct @code{<>} for them to be printed in the score,
1154 even when applied to a single note.
1155
1156 @warning{There @strong{must} be a hyphen after the note and a space
1157 before the closing @code{>}.}
1158
1159 @lilypond[quote,verbatim,relative=0]
1160 \clef "treble_8"
1161 <c-\rightHandFinger #1 >4
1162 <e-\rightHandFinger #2 >
1163 <g-\rightHandFinger #3 >
1164 <c-\rightHandFinger #4 >
1165 <c,-\rightHandFinger #1 e-\rightHandFinger #2
1166   g-\rightHandFinger #3 c-\rightHandFinger #4 >1
1167 @end lilypond
1168
1169 For convenience, you can abbreviate @code{\rightHandFinger} to something
1170 short, for example @code{RH},
1171
1172 @example
1173 #(define RH rightHandFinger)
1174 @end example
1175
1176
1177 @snippets
1178
1179 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1180 {placement-of-right-hand-fingerings.ly}
1181
1182 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
1183 {fingerings,-string-indications,-and-right-hand-fingerings.ly}
1184
1185
1186 @seealso
1187 Snippets:
1188 @rlsr{Fretted strings}.
1189
1190 Internals Reference:
1191 @rinternals{StrokeFinger}.
1192
1193
1194 @node Guitar
1195 @subsection Guitar
1196
1197 Most of the notational issues associated with guitar music are
1198 covered sufficiently in the general fretted strings section, but there
1199 are a few more worth covering here.  Occasionally users want to
1200 create songbook-type documents having only lyrics with chord
1201 indications above them.  Since Lilypond is a music typesetter,
1202 it is not recommended for documents that have no music notation
1203 in them.  A better alternative is a word processor, text editor,
1204 or, for experienced users, a typesetter like GuitarTeX.
1205
1206 @menu
1207 * Indicating position and barring::
1208 * Indicating harmonics and dampened notes::
1209 @end menu
1210
1211 @node Indicating position and barring
1212 @unnumberedsubsubsec Indicating position and barring
1213
1214 @cindex indicating position and barring for fretted instruments
1215 @cindex fretted instruments, indicating position and barring
1216
1217 This example demonstrates how to include guitar position and
1218 barring indications.
1219
1220 @lilypond[quote,ragged-right,fragment,verbatim,relative=0]
1221 \clef "treble_8"
1222 b16 d g b e
1223 \textSpannerDown
1224 \override TextSpanner #'(bound-details left text) = #"XII "
1225   g16\startTextSpan
1226   b16 e g e b g\stopTextSpan
1227 e16 b g d
1228 @end lilypond
1229
1230
1231 @seealso
1232 Notation Reference:
1233 @ref{Text spanners}.
1234
1235 Snippets:
1236 @rlsr{Fretted strings},
1237 @rlsr{Expressive marks}.
1238
1239
1240 @node Indicating harmonics and dampened notes
1241 @unnumberedsubsubsec Indicating harmonics and dampened notes
1242
1243 @cindex fretted instruments, dampened notes
1244 @cindex fretted instruments, harmonics
1245 @cindex dampened notes on fretted instruments
1246 @cindex harmonics on fretted instruments
1247
1248 Special note heads can be used to indicate dampened notes or
1249 harmonics.  Harmonics are normally further explained with a
1250 text markup.
1251
1252 @lilypond[quote,ragged-right,fragment,verbatim]
1253 \relative c' {
1254   \clef "treble_8"
1255   \override Staff.NoteHead #'style = #'cross
1256   g8 a b c b4
1257   \override Staff.NoteHead #'style = #'harmonic-mixed
1258   d^\markup { \italic { \fontsize #-2 { "harm. 12" }}} <g b>1
1259 }
1260 @end lilypond
1261
1262
1263 @seealso
1264 Snippets:
1265 @rlsr{Fretted strings}.
1266
1267 Notation Reference:
1268 @ref{Special note heads},
1269 @ref{Note head styles}.
1270
1271
1272 @node Banjo
1273 @subsection Banjo
1274
1275 @menu
1276 * Banjo tablatures::
1277 @end menu
1278
1279 @node Banjo tablatures
1280 @unnumberedsubsubsec Banjo tablatures
1281
1282 @cindex banjo tablatures
1283 @cindex tablature, banjo
1284
1285 LilyPond has basic support for the five-string banjo.  When making tablatures
1286 for five-string banjo, use the banjo tablature format function to get
1287 correct fret numbers for the fifth string:
1288
1289 @c due to crazy intervals of banjo music, absolute pitch is recommended
1290
1291 @lilypond[quote,ragged-right,fragment,verbatim]
1292 \new TabStaff <<
1293   \set TabStaff.tablatureFormat = #fret-number-tablature-format-banjo
1294   \set TabStaff.stringTunings = #banjo-open-g-tuning
1295   {
1296     \stemDown
1297     g8 d' g'\5 a b g e d' |
1298     g4 d''8\5 b' a'\2 g'\5 e'\2 d' |
1299     g4
1300   }
1301 >>
1302 @end lilypond
1303
1304 @cindex banjo tunings
1305 @cindex tunings, banjo
1306
1307 @funindex banjo-c-tuning
1308 @funindex banjo-modal-tuning
1309 @funindex banjo-open-d-tuning
1310 @funindex banjo-open-dm-tuning
1311 @funindex four-string-banjo
1312
1313 A number of common tunings for banjo are predefined in LilyPond:
1314 @code{banjo-c-tuning} (gCGBD), @code{banjo-modal-tuning} (gDGCD),
1315 @code{banjo-open-d-tuning} (aDF#AD) and @code{banjo-open-dm-tuning}
1316 (aDFAD).
1317
1318 These tunings may be converted to four-string banjo tunings using the
1319 @code{four-string-banjo} function:
1320
1321 @example
1322 \set TabStaff.stringTunings = #(four-string-banjo banjo-c-tuning)
1323 @end example
1324
1325
1326 @seealso
1327 Snippets:
1328 @rlsr{Fretted strings}.
1329
1330 The file @file{scm/@/output@/-lib@/.scm} contains predefined banjo tunings.