lilypond-user
[Top][All Lists]
Advanced

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

Re: Guitar Fret Diagram - scale degree below string


From: Thomas Morley
Subject: Re: Guitar Fret Diagram - scale degree below string
Date: Sun, 16 Aug 2015 17:42:38 +0200

2015-08-16 16:34 GMT+02:00 Klaus Blum <address@hidden>:
> Hi tone,
>
> welcome to the forum!  :-)
>
> The most elegant solution would be to take "fret-diagrams.scm" and use it to
> build a modified fretboard command that accepts markup for fingerings. But
> as I'm not an expert, this is out of reach for me.
>
> Anyway, I've played around with explicit positioning of markups. The code
> may be a horrible mess, but at least it is a function that's (more or less)
> easy to use.
> I hope this helps.
>
> Cheers,
> Klaus
>
> %
> --------------------------------------------------------------------------------------------------------------------
> % Chord Chart.
> % Want to add scale degree below strings.
> % Example:  below the Db7#5#9 diagram there should be:
> %           "3 b7 #9 #5" (without the quotes).
[...]
>
> #(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 }
>      #}))
>

How about the code below, using fret-diagram-verbose and slightly
modifying \with-flat and \with-sharp already offered by Klaus.
It's not fully automated but will scale better fo different sizes.
I'm not sure, if a fully automated way is possible...

\version "2.19.25"

#(define-markup-command (with-flat layout props text)
   (markup?)
   (interpret-markup layout props
     #{
       \markup \concat { \raise #0.1 \fontsize #-3 \flat $text }
     #}))

#(define-markup-command (with-sharp layout props text)
   (markup?)
   (interpret-markup layout props
     #{
       \markup \concat { \raise #0.3 \fontsize #-5 \sharp $text }
     #}))

%% note the "`" (don't use "'") and the ","
"b:13sus4" =
\markup {
  \fret-diagram-verbose #`(
    (place-fret 6 7 ,#{ \markup \fontsize #-4 1 #})
    (mute 5)
    (place-fret 4 7 ,#{ \markup \fontsize #-4 \with-flat 7 #} )
    (place-fret 3 9 ,#{ \markup \fontsize #-4 4 #})
    (place-fret 2 9 ,#{ \markup \fontsize #-4 13 #})
    (mute 1)
  )
}

"des:7.5+.9+" =
\markup {
  \fret-diagram-verbose #`(
    (mute 6)
    (place-fret 5 7 ,#{ \markup \fontsize #-4 3 #})
    (place-fret 4 8 ,#{ \markup \fontsize #-4 \with-flat 7 #})
    (place-fret 3 8 ,#{ \markup \fontsize #-4 \with-sharp 9 #})
    (place-fret 2 9 ,#{ \markup \fontsize #-4 \with-sharp 5 #})
    (mute 1)
  )
}

chrds =
\chordmode {
  b:13sus4
  des:7.5+.9+
}

m =
\chordmode {
  \clef "treble_8"
  <b, a e' aes'>4
  <f b e' a'> }

fd = {
  s4^\"b:13sus4"
  s^\"des:7.5+.9+"
}

\layout {
  \context {
    \ChordNames
    \override ChordName #'font-size = #-2
    \override ChordName #'self-alignment-X = #CENTER
    \override ChordName #'X-offset =
      #ly:self-alignment-interface::aligned-on-x-parent
  }
  \context {
    \Staff
    \override TimeSignature #'stencil = ##f
    %% 'in-dot is possible as well:
    \override TextScript.fret-diagram-details.finger-code = #'below-string
    \override TextScript.padding = #4
  }
}

<<
  \new ChordNames \chrds
  \new Staff
    << \fd \m >>
>>


HTH,
  Harm



reply via email to

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