chord-diagramlilypondguitar

\Lilypond Overriding Chord Grid Names


I have a set of guitar chords that I'm notating w/ chord grid diagrams and most of them have non-standard names (quartal voicings). I can add a custom name under the notation between the treble clef and Tab. Is there a way to override the chord name used in the fretboard diagram?

In the output of the code below, the issue is the "A7 sus 4 b10 b13" above the chord grid. I would like to be able to replace that text with the following:

  1. Custom text, like "A:Quartal"
  2. Add flats or sharps w/ note numbers, similar to what Lilypond generates. In this case, a:Min11 \flat 6 => "A^min11b6

ChordGrid Name Issue

%%%%%%%%% ChordGrid Name Issue Code
\include "predefined-guitar-fretboards.ly"

%%% A Quartal
aQuartal = \relative c' { < a d g c f >1-\markup { \super "Quartal" } }
\storePredefinedDiagram #default-fret-table \aQuartal
#guitar-tuning
#"x; 12-1; 12-1; 12-1; 13-2; 13-2;"

%%% Exceptions
chExceptionMusic = {
  \aQuartal
}

chExceptions = #( append
                  ( sequential-music-to-chord-exceptions chExceptionMusic #t)
                  ignatzekExceptions)


formNames = \chordmode {
  %  \NOTE Adding \set chordNameExceptions doesn't work here!
  \set chordNameExceptions = #chExceptions
  \aQuartal
}

music = {
  \set chordNameExceptions = #chExceptions
  \aQuartal  \bar "||"
}

\version "2.22.2"  % necessary for upgrading to future LilyPond versions.

\book {
    \header { title = "ChordGrid Name Issue" }

%%% Chords
    \score { <<
        %%% Chord Names
        \new ChordNames {
            \set chordChanges = ##t
            \formNames
        }

%%% Chord diagrams
        \new FretBoards {
            \override FretBoards.FretBoard.size = #'1.2
            \override FretBoard.fret-diagram-details.number-type = #'roman-
            \music
         }
        
%%% Staff
        \new Staff \with { instrumentName = #'"Ex. 1" } {
            \clef "treble_8"
            \new Voice {
            \music
            }
         }

%%% TAB
    \new TabStaff { \music }
    >>
    
    \layout {
        \context {
            \Score
            \override SpacingSpanner.base-shortest-duration = #(ly:make-moment 1/16)
        }
     }
  }
}

Solution

  • The chord exceptions should be entered in absolute (not relative) mode, and expressed as chords transposed (manually) so that C is the root note.

    %%% Exceptions
    chExceptionMusic = {
      <c f bes ees' aes'>1-\markup { \super {"Quartal"} }
      <c ees g aes f'>1-\markup { \super {"min11 "\flat6} }
    }
    

    same as image in question (chord symbol, fretboard diagram, staff, and tab), but with chord symbol displayed as "A-Quartal" rather than "A-7-sus4-flat-10-flat 13