% title: Framingham
% composer: William Billings
% editor: Michael Lauer

\version "2.10.0"

\include "english.ly"
\include "../mrlUtil.ly"

% a little smaller than the default 20 to get
% 3 systems on the first page
#(set-global-staff-size 17)

#(ly:set-option 'point-and-click #f)

headerMarkup = \markup { "Billings:" \italic "Framingham" } 

\paper {
  #(set-paper-size "letter")
  top-margin = .2\in
  bottom-margin = .2\in
  left-margin = .75\in
  line-width = 7\in
  between-system-padding = 0.08\in
  page-top-space = 0.3\in
  %ragged-last-bottom = ##t
  
    oddHeaderMarkup = \markup
    \on-the-fly #not-first-page \fill-line {
      ""
      \on-the-fly #not-first-page \headerMarkup
      \on-the-fly #print-page-number-check-first \fromproperty #'page:page-number-string
    }

    evenHeaderMarkup = \markup
    \fill-line {
      \on-the-fly #print-page-number-check-first \fromproperty #'page:page-number-string
      \on-the-fly #not-first-page \headerMarkup
      ""
    }
    
    
    myStaffSize = #17
  #(define fonts
    (make-pango-font-tree "Baskerville1757"
                          "Sans"
                          "Mono"
                           (/ myStaffSize 20)))
}


#(define-markup-command (basCaps layout props str) (markup?)
    "Real small capitals in Baskerville"
    (interpret-markup layout props (markup #:bold #:italic str)))

# (define (tsaFn grob)
  (interpret-markup
   (ly:grob-layout grob)
   '(( ))
   (markup #:rotate 180 #:musicglyph "timesig.C22")))
   
tsThreeTwo = { \time 3/2 \tempo 2=60 }
tsTwoFour = { \time 2/4 \tempo 4=120 }
tsThreeFour = { \time 3/4 \tempo 4=80 }
tsAllegro = { \once \override Staff.TimeSignature #'stencil = #tsaFn \time 2/2 \tempo 2=60 }
   
global = {
  % main
  %\set Staff.forceClef = ##t
  %\set Staff.forceTime = ##f
  %\set Timing.defaultBarType = ""

  \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)

  \key a \minor

  \tsThreeTwo
  \partial 2
  \skip 2
  \skip 1.*12
  \tsAllegro
  \skip 1
  \repeat volta 2 {
      \skip 1*15
  } \alternative {
      { \skip 1 }
      { \skip 1 }
  }
  \bar "|."
    
}

commonLyrics = \lyricmode {
    Shall Wis -- dom cry __ a -- loud
    And not __ her speech __ be heard?
    The voice of God’s __ e -- ter -- nal 
    \tag #'soprano { Word, __ }
    \tag #'alto \tag #'tenor \tag #'bass { Word, }
    De -- serves __ it __ no __ re -- gard?
    
    The voice of God’s e -- ter -- nal Word,
    De -- serves it no re -- gard?
    
    \tag #'soprano { 
        The voice of God’s e -- ter -- nal Word,
        De -- serves it no re -- gard?
    }
    \tag #'alto {
        De -- serves it no re -- gard?
        De -- serves it no re -- gard? __
    }
    \tag #'tenor {
        Shall Wis -- dom cry a -- loud
        And not her speech be heard?
        And not her speech be heard?
    }
    \tag #'bass {
        De -- serves it no re -- gard?
        The voice of God’s e -- ter -- nal Word,
        De -- serves it no re -- gard?
        De -- serves it __ no re -- gard?
    }
    The voice of God’s e -- ter -- nal Word,
    De -- serves it no re -- gard?
    \tag #'bass { The }
    gard?
       
    
}

sopranoNotes = {
  \relative a' {
    \set Staff.instrumentName = "Treble"
    \clef "treble"
            a2 |
            c4.( d8 c2) b |
            a4.( b8 a2) b |
            c1 b2 |
            a2( b) b |
        %5
            c4.( e8 d4 c) b2 |
            c1 c2 |
            e1 d4( b) |
            c4.( d8 e2) e |
            e4( c d b) c(a) |
        %10
            b4.( a8 g4. a8) b2 |
            a4.( b8 a4. b8) c4( e) |
            d4( c b a) gs2 |
            %allegro
            a2. r4 |
        \repeat volta 2 {
            R1 |
        %15
            r2 r4 a4 |
            e'4 e d d |
            e8([ d]) c([ b]) c4 c |
            b4 b c a |
            b1 |
        %20
            r2 r4 b4 |
            c4 d8([ c]) b4 b |
            a4 a b c8( d) |
            e4 e e8([ d]) c([ b]) |
            c4.( b8 a4) a |
        %25
            e'4 e e e8( d) |
            c4 d e d |
            c2 b |
            a2 gs |
        } \alternative {
            { a2. r4 }
            { a1 }
        }   
  }
}

sopranoLyrics = \lyricmode {
    \keepWithTag #'soprano \commonLyrics
}

altoNotes = {
  \relative e' {
      \set Staff.instrumentName = "Counter"
      \clef "treble"
            e2 |
            e1 e2 |
            e1 g2 |
            g1 g2 |
            e4.( f8 g2) g2 |
        %5
            e2( a) gs |
            a1 a2 |
            a2( e) g |
            g2( a) g |
            e2( f) e |
        %10
            e1 g2 |
            a4.( g8 f2) e |
            d4( e f2) e |
            %allegro
            e2. r4 |
        \repeat volta 2 {
            R1 |
        %15
            R1 |
            r2 r4 e8( f) |
            g4 g8( f) e4 e8( f) |
            g4 g a e8( f) |
            g4 g g g8( f) |
        %20
            e2. f4 |
            e4 f g g |
            a2 g |
            e4 e e e |
            e2.( f4 |
        %25
            g2.) g8( f) |
            e4 d c f |
            e4 e8( f) g4 g |
            f4 f e e |
        } \alternative {
            { e2. r4 }
            { e1 }
        }
  }
}

altoLyrics = \lyricmode {
    \keepWithTag #'alto \commonLyrics
}

%\noacc = { \once \override Accidental #'transparent = ##t }
%\ficnat = \markup { \tiny \natural }

tenorNotes = {
  \relative e {
    \set Staff.instrumentName = "Tenor"
    \clef "treble_8"
            e2 |
            a4.( b8 a2) b |
            c4.( d8 c2) d |
            e1 e2 |
            c2( d) e |
        %5
            g2( f) e |
            e1 e2 |
            c1 d2 |
            e4.( d8 c2) b |
            c2( d) c |
        %10
            b1 e2 |
            c2( d) e |
            f4( e d c) b2 |
            %allegro
            a2. r4 |
        \repeat volta 2 {
            r2 r4 a4 |
        %15
            e'4 e e f |
            e c d b |
            c8([ d]) e([ f]) g4 g8( f) |
            e1 |
            r2 r4 e8( d) |
        %20
            c4( b c) d |
            e4 d8( c) d4 e8( d) |
            c4 d8( f) e4 e, |
            a2. e4 |
            a8([ b]) c( d) e4 d8( c) |
        %25
            b2. b4
            c4 b c d |
            e4 c d e8( d) |
            c4 d8( c) b4 b |
        } \alternative {
            { a2. r4 }
            { a1 }
        }
  }
}

tenorLyrics = \lyricmode {
    \keepWithTag #'tenor \commonLyrics
}

bassNotes = {
  \relative a, {
    \set Staff.instrumentName = "Bass"
    \clef "bass"
            a2 |
            a1 e'2 |
            <a, a'>1 <g g'>2 |
            c1 e2 |
            a2( g) e |
        %5
            c2( d) e |
            <a, a'>1 <a a'>2 |
            <a a'>1 <g g'>2 |
            <c c'>4.( <b b'>8 <a a'>2) e'2 |
            c2( b) a |
        %10
            e'1 e2 |
            f4.( e8 d2) c |
            d1 e2 |
            %allegro
            a,2. a4 |
        \repeat volta 2 {
            e'4 e e f |
        %15
            e4 c c d |
            c8([ d]) e( f) g4 g, |
            c2. c8( d) |
            e4 e <a, a'> a |
            e'2. e4 |
        %20
            a4 gs a b |
            c4 b8( a) g4 e |
            f4 d e8([ d]) c( b) |
            a2. a4 |
            a4 a8.( b16) c4 d |
        %25
            e2. e4 |
            <a, a'>4 <gs gs'> <a a'> <b b'> |
            <c c'>4 c g' e |
            f4 d e e |
        } \alternative {
            { a,2. a4 }
            { a1 }
        }
  }
}

bassLyrics = \lyricmode {
    \keepWithTag #'bass \commonLyrics
}

verseOne = \markup { "1." \column {
    "Shall Wisdom cry aloud"
    "And not her voice be heard?"
    "The voice of God’s eternal Word,"
    "Deserves it no regard?"
} }

\header {
	composer = \markup { \bigger { \basCaps "William Billings" (1746-1800) }}
    poet = \markup { \bigger "“Words from Dr. W.”" }
    piece = \markup { \bigger "Isaac Watts, Hymn 92" }
    opus = \markup { \bigger \italic { "The Psalm-Singer's Amusement" (1781) }}
	title = \markup { \bigger \medium \italic  "Framingham" }
    copyright = \markup { \center-align {
        "Copyright © 2005 by Michael Lauer."
        "This edition may be freely distributed, duplicated, performed, or recorded." } } 
}

theMusic =
  \context ChoirStaff = choir <<
      \new Staff {
        \context Voice =
          sopranoNotes << \global \sopranoNotes >>
      }
      \lyricsto sopranoNotes \new Lyrics { \sopranoLyrics }
      \new Staff {
        \context Voice =
          altoNotes << \global \altoNotes >>
      }
      \lyricsto altoNotes \new Lyrics { \altoLyrics }
      \new Staff {
        \context Voice =
          tenorNotes << \global \tenorNotes >>
      }
      \lyricsto tenorNotes \new Lyrics { \tenorLyrics }
      \new Staff {
        \context Voice =
          bassNotes << \global \bassNotes >>
      }
      \lyricsto bassNotes \new Lyrics { \bassLyrics }
  >>

\score {
  \removeWithTag #'midiOnly \theMusic
  \layout {
    \context {
      \Score
      \override MetronomeMark #'transparent = ##t
      \override BarNumber #'padding = #2
    }
    \context {
      \Staff   
      \override InstrumentName #'padding = #0.75
      \override InstrumentName #'font-size = #1
    }
    \context {
      \Voice
      %\override Slur #'transparent = ##t
    }
    \context {
      \Lyrics
      \override LyricText #'font-series = #'medium
      \override LyricText #'font-size = #1
      \override LyricHyphen #'minimum-distance = #0.5
      \override LyricSpace #'minimum-distance = #0.5
    }
  }
}


\score {
  \unfoldRepeats \removeWithTag #'scoreOnly  \theMusic

  
  \midi {
    \context {
      \Score
      tempoWholesPerMinute = #(ly:make-moment 132 4)
      }
    }



}
