lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guitar Chord Fret Diagram - "T" above string fretted with thumb


From: Klaus Blum
Subject: Re: Guitar Chord Fret Diagram - "T" above string fretted with thumb
Date: Mon, 17 Aug 2015 17:19:34 -0700 (MST)

Hi Tone, 

that's not a big problem: You can insert another markup above the fingering
chart. Its contents is passed as another parameter. If the thumb isn't used,
just pass an empty string "" instead of a "T".

Cheers, 
Klaus

%-------------------------------------------------------------------------
% Want to add "T" above string fretted with thumb in fret diagram
% Note: this is for the fretting hand, rather than the strumming hand.
\version "2.19.15"
\pointAndClickOff
%% Custom Fret Diagrams with Scale Degrees
#(define-public (stack-stencil-overlay stencils)
   "Recursive function to add stencils together"
   (if (and (pair? stencils)
            (ly:stencil? (car stencils)))
       (if (and (pair? (cdr stencils))
                (ly:stencil? (cadr stencils)))
           (let ((tail (stack-stencil-overlay (cdr stencils)))
                 (head (car stencils)))
             (ly:stencil-add head tail))
           (car stencils))
       point-stencil))
%
#(define-markup-command (overlay layout props args)
   (markup-list?)
   "Overlay arguments one on top of the next"
   (let ((stencils (interpret-markup-list layout props args)))
     (stack-stencil-overlay
      (remove ly:stencil-empty? stencils))))
%
#(define-markup-command (custom-fret layout props control six five four
three two one thumb)
   (string? markup? markup? markup? markup? markup? markup? markup?)
   (interpret-markup layout props
     #{
       \markup {
       \override #'(size . 1.5) {
       \override #'(fret-diagram-details . (
                    (number-type . arabic)
                    (fret-label-vertical-offset . -0.2)
                    (fret-label-horizontal-offset . -0.3)
                    (top-fret-thickness . 4)))
       \left-column {
           \fontsize #-4
           \sans
           \overlay {
             \translate #'(-0.1 . 0) \center-align \transparent "."
             \with-dimensions #'(0 . 0) #'(0 . 0)
             \translate #'(0.2 . -2.5) 
             \center-align $thumb
           }
           \fret-diagram-terse $control
           \vspace #0.1
           \fontsize #-8
           \sans
           \overlay {
             % find the following values by trial-and-error:
             \translate #'(-0.1 . 0) \center-align \transparent "."
             \translate #'(0.2 . 0) \center-align $six
             \translate #'(1.7 . 0) \center-align $five
             \translate #'(3.2 . 0) \center-align $four
             \translate #'(4.7 . 0) \center-align $three
             \translate #'(6.2 . 0) \center-align $two
             \translate #'(7.7 . 0) \center-align $one
           }
         }
       }}
     #}))
%
#(define-markup-command (with-flat layout props text)
   (markup?)
   (interpret-markup layout props
     #{
       \markup \concat {\raise #0.2 \flat $text }
     #}))
%
#(define-markup-command (with-sharp layout props text)
   (markup?)
   (interpret-markup layout props
     #{
       \markup \concat {\raise #0.4 \sharp $text }
     #}))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\score { <<
\chords {
% Bb7(b5)
bes1:7.5-
% E9#11
e:9.11+
}
%
\new Lyrics \lyricmode{
% Bb7(b5)
\markup{ \custom-fret #"6;7;6;7;5;x;" "1" \with-flat "5" \with-flat "7" "3"
\with-flat "5" "" "T"}
% E9#11
\markup{ \custom-fret #"6;7;6;7;7;x;" \pad-x #-2 \with-sharp "11" "1" "3"
\with-flat "7" "9" "" \bold "T"}
}
%
\chordmode {\clef "treble_8" \override Staff.TimeSignature #'stencil = ##f
% Bb7(b5)
<bes, e aes d' e'>1
% E9#11
<bes, e aes d' ges'>
}
%
>>
\layout {
indent = 0
\context { \Score \remove "Bar_number_engraver" }
\context {
 \Lyrics
 \override LyricSpace #'minimum-distance = #1.5
 \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
 \override LyricText #'self-alignment-X = #CENTER
}
\context {
 \ChordNames
 \override ChordName #'font-size = #1
 \override ChordName #'self-alignment-X = #CENTER
 \override ChordName #'X-offset =
#ly:self-alignment-interface::aligned-on-x-parent
} } }
%-------------------------------------------------------------------------



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Guitar-Chord-Fret-Diagram-T-above-string-fretted-with-thumb-tp179738p179740.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]