A.11.6 Instrument-specific markup

\fret-diagram definition-string (string)

Make a (guitar) fret diagram based on definition-string.

For example, say

\markup \fret-diagram "s:1.25;6-x;5-x;4-o;3-2;2-3;1-2;"

[image of music]

for fret spacing 5/4 of staff space, D chord diagram.

Syntax rules for definition-string:

  • − Diagram items are separated by semicolons.
  • − Possible items:
    • s:number – Set the fret spacing of the diagram (in staff spaces). Default: 1.
    • t:number – Set the line thickness (relative to normal line thickness). Default: 0.5.
    • h:number – Set the height of the diagram in frets. Default: 4.
    • w:number – Set the width of the diagram in strings. Default: 6.
    • f:number – Set fingering label type (0 = none, 1 = in circle on string, 2 = below string). Default: 0.
    • d:number – Set radius of dot, in terms of fret spacing. Default: 0.25.
    • p:number – Set the position of the dot in the fret space. 0.5 is centered; 1 is on lower fret bar, 0 is on upper fret bar. Default: 0.6.
    • c:string1-string2-fret – Include a barre mark from string1 to string2 on fret.
    • string-fret – Place a dot on string at fret. If fret is ‘o’, string is identified as open. If fret is ‘x’, string is identified as muted.
    • string-fret-fingering – Place a dot on string at fret, and label with fingering as defined by the f: code.
  • − Note: There is no limit to the number of fret indications per string.

Used properties:

  • thickness (0.5)
  • fret-diagram-details
  • size (1.0)
  • align-dir (-0.4)
\fret-diagram-terse definition-string (string)

Make a fret diagram markup using terse string-based syntax.

For example,

\markup \fret-diagram-terse "x;x;o;2;3;2;"

[image of music]

displays a D chord diagram.

Syntax rules for definition-string:

  • Strings are terminated by semicolons; the number of semicolons is the number of strings in the diagram.
  • Mute strings are indicated by ‘x’.
  • Open strings are indicated by ‘o’.
  • A number indicates a fret indication at that fret.
  • If there are multiple fret indicators desired on a string, they should be separated by spaces.
  • Fingerings are given by following the fret number with a ‘-’ followed by the finger indicator, e.g., ‘3-2’ for playing the third fret with the second finger.
  • Where a barre indicator is desired, follow the fret (or fingering) symbol with -( to start a barre and -) to end the barre.

Used properties:

  • thickness (0.5)
  • fret-diagram-details
  • size (1.0)
  • align-dir (-0.4)
\fret-diagram-verbose marking-list (pair)

Make a fret diagram containing the symbols indicated in marking-list.

The following example produces a standard D chord diagram without fingering indications.

\markup \scale #'(1.5 . 1.5)
    #'((mute 6) (mute 5) (open 4)
       (place-fret 3 2) (place-fret 2 3) (place-fret 1 2))

[image of music]

Possible elements in marking-list:

(mute string-number)

Place a small ‘x’ at the top of string string-number.

(open string-number)

Place a small ‘o’ at the top of string string-number.

(barre start-string end-string fret-number)

Place a barre indicator (much like a tie) from string start-string to string end-string at fret fret-number.

(capo fret-number)

Place a capo indicator (a large solid bar) across the entire fretboard at fret location fret-number. Also, set fret fret-number to be the lowest fret on the fret diagram.

(place-fret string-number fret-number [finger-value] [color-modifier] [color] ['parenthesized ['default-paren-color]])

Place a fret playing indication on string string-number at fret fret-number with an optional fingering label finger-value, an optional color modifier color-modifier, an optional color color, an optional parenthesis 'parenthesized and an optional paranthesis color 'default-paren-color.

By default, the fret playing indicator is a solid dot. This can be globally changed by setting the value of the property dot-color or for a single dot by setting the value of color. The dot can be parenthesized by adding 'parenthesized. By default the color for the parenthesis is taken from the dot. Adding 'default-paren-color will take the parenthesis color from the global dot-color property; as a fallback black will be used. Setting color-modifier to inverted inverts the dot color for a specific fingering.

The values for string-number, fret-number, and the optional finger should be entered first in that order. The order of the other optional arguments does not matter. If the finger part of the place-fret element is present, finger-value will be displayed according to the setting of the variable finger-code. There is no limit to the number of fret indications per string.

\markup \scale #'(1.5 . 1.5)
  \fret-diagram-verbose #'(
    (place-fret 6 3 1 red parenthesized default-paren-color)
    (place-fret 5 3 1 inverted)
    (place-fret 4 5 2 blue parenthesized)
    (place-fret 3 5 3 blue)
    (place-fret 2 5 4 blue)
    (place-fret 1 3 1 inverted)

[image of music]

Used properties:

  • thickness (0.5)
  • fret-diagram-details
  • size (1.0)
  • align-dir (-0.4)
\harp-pedal definition-string (string)

Make a harp pedal diagram containing the symbols indicated in definition-string.

Possible elements in definition-string:


pedal is up


pedal is neutral


pedal is down


vertical divider line


the following pedal should be circled (indicating a change)

\markup \harp-pedal "^-v|--ov^"

[image of music]

The function also checks whether the string has the typical form of three pedals, then the divider, and then the remaining four pedals, printing a warning otherwise (without preventing the non-standard order).

Use the size property to control the overall size, and the thickness property for the line thickness of the horizontal line and the divider.

The remaining configuration is done via the harp-pedal-details property; it contains the following elements:


vertical shift of the box center for up/down pedals


box width


box height


spacing between two boxes before the divider


spacing between two boxes after the divider

\markup {
  \override #'((size . 1.5)
               (harp-pedal-details . ((box-width . 1)
                                      (box-offset . 2))))
  \harp-pedal "^-v|--ov^"

[image of music]

For global modification of harp-pedal-details, i.e., outside of the current \markup block, you can also use code similar to

\override Voice.TextScript.harp-pedal-details.box-width = 1

Used properties:

  • thickness (0.5)
  • harp-pedal-details (())
  • size (1.2)
\woodwind-diagram instrument (symbol) user-draw-commands (list)

Make a woodwind-instrument diagram for instrument using user-draw-commands.

user-draw-commands is a list of alists, specifying the left-hand keys, the elements on the central column, and the right-hand keys. For example, this diagram

\markup \woodwind-diagram
  #'oboe #'((lh . (d ees))
            (cc . (five3qT1q))
            (rh . (gis)))

[image of music]

shows an oboe with the left-hand d key, left-hand ees key, and right-hand gis key depressed, while the five-hole of the central column effectuating a trill between 1/4 and 3/4 is closed.

The following instruments are supported:

  • − piccolo
  • − flute
  • − oboe
  • − clarinet
  • − bass-clarinet
  • − saxophone
  • − bassoon
  • − contrabassoon

To see all of the callable keys for a given instrument, include the function call (print-keys 'instrument) in your .ly file, where instrument is the instrument whose keys you want to print.

Certain keys allow for special configurations. The entire gamut of configurations possible is as follows:


1/4 covered


1/2 covered


3/4 covered


ring depressed


fully covered; the default if no state put

Additionally, these configurations can be used in trills. So, for example, three3qTR effectuates a trill between 3/4 full and ring depressed on the three hole. As another example, threeRT effectuates a trill between R and open, whereas threeTR effectuates a trill between open and shut. To see all of the possibilities for all of the keys of a given instrument, invoke (print-keys-verbose 'instrument).

Lastly, substituting an empty list for the pressed-key alist results in a diagram with all of the keys drawn but none filled, for example

\markup \woodwind-diagram #'flute #'()

[image of music]

Used properties:

  • woodwind-diagram-details (())
  • font-size (0)
  • graphical (#t)
  • thickness (0.1)
  • size (1)

Referencia de la notación de GNU LilyPond v2.25.18 (rama de desarrollo).