Unfortunately, I still haven't found a better solution for the LyricExtender.

Anyway, maybe the code could be useful for someone... so here's a new snippet:
http://lsr.di.unimi.it/LSR/Item?id=967

Still, any suggestions are welcome.  :)

Cheers,
Klaus
% http://lsr.di.unimi.it/LSR/Item?id=967
% http://lists.gnu.org/archive/html/lilypond-user/2014-12/msg00123.html
% Contributed by Klaus Blum

\paper {
  indent = 0
  ragged-right = ##f
}

\header {
  tagline = ##f
}

% ---------------------------------------------------------------
% -----         The "central" function
% Usage:
% FunctionLetter SopranoNote BassNote OptA OptB OptC OptD OptE FillStr
% ---------------------------------------------------------------

#(define-markup-command (fsymbol layout props FunctionLetter SopranoNote BassNote OptA OptB OptC OptD OptE FillStr)
   (markup? markup? markup? markup? markup? markup? markup? markup? markup?)
   (interpret-markup layout props
     #{
       \markup{
         \concat {
           \override #'(baseline-skip . 1.4)
           \center-column {
             \override #`(direction . ,UP)
             \override #'(baseline-skip . 2.0)
             \dir-column {
               \halign #CENTER
               $FunctionLetter
               \tiny
               \halign #CENTER
               $SopranoNote
             }
             \tiny
             $BassNote
           }
           \tiny
           \override #`(direction . ,UP)
           \override #'(baseline-skip . 0.8)
           \dir-column {
             " "
             {
               \override #`(direction . ,UP)
               \override #'(baseline-skip . 1.3)
               \dir-column { $OptA  $OptB $OptC $OptD $OptE }
             }
           }
           $FillStr
         }
       }
     #}))

% ---------------------------------------------------------------
% ----- cross out the letter for "shortened dominants" (where base is omitted):
% ---------------------------------------------------------------

#(define-markup-command (crossout layout props letter)
   (markup?)
   (interpret-markup layout props
     #{
       \markup{
         \concat {
           \override #'(baseline-skip . 0.4)
           \left-column {
             $letter
             \with-dimensions #'(-0.0 . 0.0) #'(0 . 0)
             \translate-scaled #'(-0.4 . 0.4)
             \with-dimensions #'(-0.0 . 0.0) #'(0 . 0)
             \draw-line #'(2.4 . 1.7)
           }
         }
       }
     #}))

% ---------------------------------------------------------------
% ----- double-printed letters for double dominant or double subdominant:
% ---------------------------------------------------------------

#(define-markup-command (double layout props letter)
   (markup?)
   (interpret-markup layout props
     #{
       \markup{
         \concat {
           \override #'(baseline-skip . 0.4)
           \left-column {
             $letter
             \with-dimensions #'(-0.4 . 0.6) #'(0 . 0)
             $letter
           }
         }
       }
     #}))

% ---------------------------------------------------------------
% opening round bracket before a chord:
% ---------------------------------------------------------------

openbracket = { \set stanza = \markup {\normal-text \magnify #1.1 " ("} }

% ---------------------------------------------------------------
% ----- Voices: soprano, alto, tenor
% ---------------------------------------------------------------

global  = { \key c \major  \time 4/4}

sopranmel = \relative c'' {
  \clef treble
  \stemUp
  \global
  e4 e e( d)
  c4 d d2
  d4 e8 d c4 c
  d8( c) <b g>4 c2\fermata

}

altmel = \relative c'' {
  \clef treble
  \stemDown
  \global
  c4 bes a2
  a4 c c( b)
  b2 g4 a
  a4 \hideNotes g8 s \unHideNotes g2
}

tenormel = \relative c' {
  \clef treble
  \stemDown
  \global
  g'4 g f2
  d4 a' a( g)
  e2 e4 f
  d4 d8( f) e2
}



% ---------------------------------------------------------------
% ----- hidden bass voice (for containing the "lyrics")
% ---------------------------------------------------------------

bassmelhidden =
\relative c {
  \clef bass
  \stemDown
  \global
  \hideNotes
  \override NoteHead.color = #red
  \override NoteColumn #'ignore-collision = ##t
  f,4 cis'4 d d
  f4 fis4 g g
  gis4 gis8 gis bes4 a8 g
  fis8 fis g8 g c,2
}

% ---------------------------------------------------------------
% ----- bass voice to be displayed
% ---------------------------------------------------------------

bassmelshown = \relative c {
  \clef bass
  \stemNeutral
  \global
  %    \hideNotes
  c4 cis4 d2
  f4 fis4 g2
  gis2 bes4 a8 g
  fis4 g4 c,2
  %    \unHideNotes
}

% ---------------------------------------------------------------
% ----- "lyrics" stanza 1: Symbols for functional harmony
% ---------------------------------------------------------------

lyr = \lyricmode {
  \override LyricText.self-alignment-X = #LEFT
  \override LyricExtender.left-padding = #-0.5
  \override LyricExtender.extra-offset = #'(0 . 0.5)

  % Usage:
  %
  % FunctionLetter SopranoNote BassNote OptA OptB OptC OptD OptE FillStr

  \set stanza = #"C-Dur:"
  \markup \fsymbol "T" "3" ""  "" "" "" "" ""   ""
  \openbracket
  \markup \fsymbol \crossout "D" "" "3"  "7" "9>" "" "" ""   ")"
  \markup \fsymbol "Sp" "" ""  "9" "" "" "" ""   ""
  \markup \fsymbol "" "" ""  "8" "" "" "" ""   ""
  \markup \fsymbol "S" "" ""  "5" "6" "" "" ""   ""
  \openbracket
  \markup \fsymbol "D" "" "3"  "7" "" "" "" ""   ")"
  \markup \fsymbol "D" "" ""  "2" "4" "" "" ""   ""
  \markup \fsymbol "" "" ""  "1" "3" "" "" ""   ""
  \openbracket
  \markup \fsymbol "D" "" "3"  "7" "" "" "" ""   ""
  \markup \fsymbol "" "" ""  "8" "" "" "" ""   ""
  \markup \fsymbol "" "" ""  "7" "" "" "" ""   " )[Tp]"
  \openbracket
  \markup \fsymbol "D" "" "7"  "" "" "" "" ""   ")"
  \markup \fsymbol "S" "" "3"  "" "" "" "" ""   ""
  \markup \fsymbol " " "" "2"  "" "" "" "" ""   ""
  \markup \fsymbol \double "D" "" "3"  "8" "" "" "" ""   ""
  \markup \fsymbol "" "" ""  "7" "" "" "" ""   ""
  \markup \fsymbol "D" "" ""  "5" "" "" "" ""   ""
  \markup \fsymbol "" "" ""  "7" "" "" "" ""   ""
  \markup \fsymbol "T" "" ""  "" "" "" "" ""   ""
}


% ---------------------------------------------------------------
% ----- "lyrics" stanza 2: Extender lines
% ---------------------------------------------------------------

lyrExt = \lyricmode {
  \override LyricText.self-alignment-X = #LEFT
  %
  \override LyricExtender.extra-offset = #'(0 . 3.3)
  \override LyricText.extra-offset = #'(0 . 3.3)
  % These invisible dots are used to consume space before the extender lines:
  \markup \null _
  \markup { \transparent "....." } __ _
  \markup \null _
  \markup { \transparent "..." } __ _
  \markup { \transparent "..." } __ _ _
  \markup \null
  \markup { \transparent "..." } __ _
  \markup { \transparent "...." } __ _
  \markup { \transparent "..." } __ _
}


\score {
  \new GrandStaff <<
    \new Staff = upper
    \with { printPartCombineTexts = ##f }
    {
      <<
        \sopranmel \\
        \partcombine \altmel \tenormel
      >>
    }
    \new Staff = lower
    \new Voice = "bassstimmeSichtbar"
    \with { printPartCombineTexts = ##f }
    {
      <<
        \bassmelshown
        \new Voice = "bassstimme" {\shiftOff  \bassmelhidden}
        \new Lyrics \lyricsto "bassstimme" \lyr
        \new Lyrics \lyricsto "bassstimme" \lyrExt
      >>
    }
  >>
}

\markup \vspace #2

\score {
  \relative c' { c1 c c2 c c c c c }
  \addlyrics {
    \override LyricText.self-alignment-X = #LEFT
    \set stanza = #"Usage:"
    \markup \fsymbol "F" "2" "3"  "4" "5" "6" "7" "8"   "9"
    \markup \fsymbol "Function" "Soprano" "Bass"  "OptA" "OptB" "OptC" "OptD" "OptE"   "FillStr       "
    \override LyricText.self-alignment-X = #CENTER
    \markup \fsymbol "S" "" ""  "" "" "" "" ""   ""
    \markup \fsymbol "D" "" ""  "" "" "" "" ""   ""
    \markup \fsymbol \double S "  \double S  " ""  "" "" "" "" ""   ""
    \markup \fsymbol \double "D" "  \double D  " ""  "" "" "" "" ""   ""
    \markup \fsymbol \crossout "D" "  \crossout D  " ""  "" "" "" "" ""   ""
    \markup \fsymbol \crossout \double "D" "  \crossout\double D  " ""  "" "" "" "" ""   ""
  }
}
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to