lilypond-user
[Top][All Lists]
Advanced

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

Re: Adding aligned text beneath a fret board diagram


From: Klaus Blum
Subject: Re: Adding aligned text beneath a fret board diagram
Date: Wed, 3 Feb 2016 10:22:31 -0700 (MST)

Hi Nat, 

welcome to the forum!


Nat Davis wrote
> I would like to add the interval underneath the fret board diagram

Some time ago, there has been a thread that could be interesting for you:
http://lilypond.1069038.n5.nabble.com/Guitar-Fret-Diagram-scale-degree-below-string-td179664.html#a179693

Adapted to you example, it could look like this:

%------------------------------------------------------------------
\version "2.18.2"
\header {
  title = "Fret Diagrams With Fingering And Chord Intervals Displayed ie
Root 5th b3rd"
  composer = "Nat Davis"
  tagline = \markup {
    Engraved at
    \simple #(strftime "%Y-%m-%d" (localtime (current-time)))
    with \with-url #"http://lilypond.org/";
    \line { LilyPond \simple #(lilypond-version) (http://lilypond.org/) }
  }
}

% the following two functions are borrowed from:
% http://lsr.di.unimi.it/LSR/Item?id=628
#(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)
   (list? markup? markup? markup? markup? markup? markup?)
   (interpret-markup layout props
     #{
       \markup {
         \right-column {
           \fret-diagram-verbose $control
           \vspace #0.3  % space between fret diagram and numbers
           \fontsize #3  % adapt to your needs...
           \overlay {
             % find the following values by trial-and-error:
             \translate #'(0 . 0) \center-align \transparent "."
             \translate #'(-24 . 0) \center-align $six
             \translate #'(-19.5 . 0) \center-align $five
             \translate #'(-15 . 0) \center-align $four
             \translate #'(-10.5 . 0) \center-align $three
             \translate #'(-6 . 0) \center-align $two
             \translate #'(-1.5 . 0) \center-align $one
           }
         }
       }
     #}))

<<
  \new Staff
  {

    \new Voice = “”
    \with
    {
      %% place space between fret diagram and staff
      \override TextScript.padding = #10
    }

    %% f major for guitar, barred on sixth fret
    %  verbose style
    %  roman fret label, finger labels in dots
    <c' f' c'' f'' a'' c'''  >
    ^\markup
    {

      % 450% of default size
      \override #'(size . 4.5)

      {
        \override #'(fret-diagram-details .
                      (
                        (number-type . roman-upper)
                        (finger-code . in-dot)
                        (%finger-code . below-string)
                        (number-type . arabic)
                        (label-dir . -1)
                        )
                      )
        {
          \custom-fret #'(
                                    (place-fret 6 8 1)
                                    (place-fret 5 8 1)
                                    (place-fret 4 10 2)
                                    (place-fret 3 10 3)
                                    (place-fret 2 10 4)
                                    (place-fret 1 8 1)
                                    )
          "5" "1" "5" "1" "3" "5"
        }
      }
    }

  }
>>

%------------------------------------------------------------------

Hope this helps...

Cheers, 
Klaus



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Adding-aligned-text-beneath-a-fret-board-diagram-tp186800p186806.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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