Next: , Previous: Fret diagram markups, Up: Common notation for fretted strings


Predefined fret diagrams

Fret diagrams can be displayed using the FretBoards context. By default, the FretBoards context will display fret diagrams that are stored in a lookup table:

     
     \include "predefined-guitar-fretboards.ly"
     \context FretBoards {
       \chordmode {
         c1 d
       }
     }

[image of music]

The default predefined fret diagrams are contained in the file predefined-guitar-fretboards.ly. Fret diagrams are stored based on the pitches of a chord and the value of stringTunings that is currently in use. predefined-guitar-fretboards.ly contains predefined fret diagrams only for guitar-tuning. Predefined fret diagrams can be added for other instruments or other tunings by following the examples found in predefined-guitar-fretboards.ly.

Chord pitches can be entered either as simultaneous music or using chord mode (see Chord mode overview).

     
     \include "predefined-guitar-fretboards.ly"
     \context FretBoards {
       \chordmode {c1}
       <c' e' g'>1
     }

[image of music]

It is common that both chord names and fret diagrams are displayed together. This is achieved by putting a ChordNames context in parallel with a FretBoards context and giving both contexts the same music.

     
     \include "predefined-guitar-fretboards.ly"
     mychords = \chordmode{
       c1 f g
     }
     
     <<
       \context ChordNames {
         \mychords
       }
       \context FretBoards {
         \mychords
       }
     >>

[image of music]

Predefined fret diagrams are transposable, as long as a diagram for the transposed chord is stored in the fret diagram table.

     
     \include "predefined-guitar-fretboards.ly"
     mychords = \chordmode{
       c1 f g
     }
     
     mychordlist = {
       \mychords
       \transpose c e { \mychords}
     }
     <<
       \context ChordNames {
         \mychordlist
       }
       \context FretBoards {
         \mychordlist
       }
     >>

[image of music]

The predefined fret diagram table contains seven chords (major, minor, augmented, diminished, dominant seventh, major seventh, minor seventh) for each of 17 keys. A complete list of the predefined fret diagrams is shown in Predefined fretboard diagrams. If there is no entry in the table for a chord, the FretBoards engraver will calculate a fret-diagram using the automatic fret diagram functionality described in Automatic fret diagrams.

     
     \include "predefined-guitar-fretboards.ly"
     mychords = \chordmode{
       c1 c:9
     }
     
     <<
       \context ChordNames {
         \mychords
       }
       \context FretBoards {
         \mychords
       }
     >>

[image of music]

Fret diagrams can be added to the fret diagram table. To add a diagram, you must specify the chord for the diagram, the tuning to be used, and the fret-diagram-terse definition string for the diagram.

     
     \include "predefined-guitar-fretboards.ly"
     
     \storePredefinedDiagram \chordmode {c:9} 
                             #guitar-tuning
                             #"x;3-2;2-1;3-3;3-4;x;"
     
     mychords = \chordmode{
       c1 c:9
     }
     
     <<
       \context ChordNames {
         \mychords
       }
       \context FretBoards {
         \mychords
       }
     >>

[image of music]

Different fret diagrams for the same chord name can be stored using different octaves of pitches.

     
     \include "predefined-guitar-fretboards.ly"
     
     \storePredefinedDiagram \chordmode {c'} 
                             #guitar-tuning
                             #(offset-fret 2 (chord-shape 'bes))
     
     mychords = \chordmode{
       c1 c'
     }
     
     <<
       \context ChordNames {
         \mychords
       }
       \context FretBoards {
         \mychords
       }
     >>

[image of music]

In addition to fret diagrams, LilyPond stores an internal list of chord shapes. The chord shapes are fret diagrams that can be shifted along the neck to different posistions to provide different chords. Chord shapes can be added to the internal list and then used to define predefined fret diagrams.

     
     \include "predefined-guitar-fretboards.ly"
     
     % add a new chord shape
     
     \addChordShape #'powerf #"1-1;3-3;3-4;x;x;x;"
     
     % add some new chords based on the power chord shape
     
     \storePredefinedDiagram \chordmode {f'} 
                             #guitar-tuning 
                             #(chord-shape 'powerf)
     \storePredefinedDiagram \chordmode {g'} 
                             #guitar-tuning
                             #(offset-fret 2 (chord-shape 'powerf))
     
     mychords = \chordmode{
       f1 f' g g' 
     }
     
     <<
       \context ChordNames {
         \mychords
       }
       \context FretBoards {
         \mychords
       }
     >>

[image of music]

The graphical layout of a fret diagram can be customized according to user preference through the properties of the fret-diagram-interface. Details are found at fret-diagram-interface. For a predefined fret diagram, the interface properties belong to FretBoards.FretBoard.

Selected Snippets

Customizing fretboard fret diagrams

Fret diagram properties can be set through fret-diagram-details. For FretBoard fret diagrams, overrides are applied to the FretBoards.FretBoard object.

     
     \include "predefined-guitar-fretboards.ly"
     \storePredefinedDiagram \chordmode { c' }
                             #guitar-tuning
                             #"x;1-1-(;3-2;3-3;3-4;1-1-);"
     <<
       \context ChordNames {
         \chordmode { c1 c c d }
       }
       \context FretBoards {
         % Set global properties of fret diagram
         \override FretBoards.FretBoard #'size = #'1.2
         \override FretBoards.FretBoard #'fret-diagram-details
                                       #'finger-code = #'in-dot
         \override FretBoards.FretBoard #'fret-diagram-details
                                       #'dot-color = #'white
         \chordmode {
           c
           \once \override FretBoards.FretBoard #'size = #'1.0
           \once \override FretBoards.FretBoard #'fret-diagram-details
                   #'barre-type = #'straight
           \once \override FretBoards.FretBoard #'fret-diagram-details
                   #'dot-color = #'black
           \once \override FretBoards.FretBoard #'fret-diagram-details
                   #'finger-code = #'below-string
           c'
           \once \override FretBoards.FretBoard #'fret-diagram-details
                   #'barre-type = #'none
           \once \override FretBoards.FretBoard #'fret-diagram-details
                   #'number-type = #'arabic
           \once \override FretBoards.FretBoard #'fret-diagram-details
                   #'orientation = #'landscape
           \once \override FretBoards.FretBoard #'fret-diagram-details
                   #'mute-string = #"M"
           \once \override FretBoards.FretBoard #'fret-diagram-details
                   #'label-dir = #-1
           \once \override FretBoards.FretBoard #'fret-diagram-details
                   #'dot-color = #'black
           c'
           \once \override FretBoards.FretBoard #'fret-diagram-details
                   #'finger-code = #'below-string
           \once \override FretBoards.FretBoard #'fret-diagram-details
                   #'dot-radius = #0.35
           \once \override FretBoards.FretBoard #'fret-diagram-details
                   #'dot-position = #0.5
           \once \override FretBoards.FretBoard #'fret-diagram-details
                   #'fret-count = #3
           d
         }
       }
       \context Voice {
         c'1 c' c' d'
       }
     >>

[image of music]

See also

Notation Reference: Custom tablatures, Automatic fret diagrams, Chord mode overview, Predefined fretboard diagrams.

Installed Files: ly/predefined-guitar-fretboards.ly.

Snippets: Fretted strings.

Internals Reference: fret-diagram-interface.

Cette page documente LilyPond-2.11.58 (branche de développement).

Rapportez toute anomalie en français à lilypond-user-fr@gnu.org ou en anglais à http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs

Vos suggestions à propos de la documentation sont les bienvenues.