% title: Andover
% composer: William Billings
%% This is a UTF-8 file

\version "2.11.62"

\include "english.ly"
\include "../mrlUtil.ly"
\include "../mrlbillingsdefs.ly"

#(ly:set-option 'point-and-click #f)

#(set-global-staff-size 17)
\paper
{
    myStaffSize = #17
  #(define fonts
    (make-pango-font-tree "Baskerville1757"
                          "Sans"
                          "Mono"
                           (/ myStaffSize 20)))
}

# (define (tsaFn grob)
  (interpret-markup
   (ly:grob-layout grob)
   '(( ))
   (markup #:rotate 180 #:musicglyph "timesig.C22")))
   
tsAdagio = { \time 4/4 \tempo 4=60 }
tsLargo = { \time 2/2 \tempo 2=40 }
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 d \major
  \tsThreeTwo
  s1.*15
  \repeat volta 2 {
      \tag #'midiOnly { \time 3/2 }
      s1.*14
      \tsAllegro
      s1*5
  } 
}

commonLyrics = \lyricmode {
    A -- wake, my heart; __
    a -- \extATB rise, my tongue, 
    Pre -- pare __ a tune -- ful voice;
    In God, the \extTB life of all __ \extT my joys
    A -- loud __ will \extATB I re -- joice.
    \tag #'soprano {
        In God, the life of all __ my joys __
        A -- loud will I re -- joice. __
        A -- loud __ will I __ re -- joice.
    }
    \tag #'alto {
        In God, the life of all my joys
        A -- loud __ will I re -- joice. __
        A -- loud, A -- loud __ will I __ re -- joice. __
    }
    \tag #'tenor {
        In God, the life of __ all my joys
        A -- loud __ will I __ re -- joice.
        In God, the life of all __ my joys
        A -- loud will I __ re -- joice. __
    }
    \tag #'bass {   
        In God, __ the life __ of all my joys,
        In God, the life __ of all __ my joys
        A -- loud, __ a -- loud, __ 
        a -- loud __ will I __ re -- joice. __
    }
        
    In God, the life of all my joys
    A -- loud will \extA I re -- joice.
}

sopranoNotes = {
  \relative a' {
    \set Staff.instrumentName = "Treble"
    \clef "treble"
            r1 a2 |
            a1 a2 |
            a2( e') d4( cs) |
            b1 a2 |
        %5
            a1 a2 |
            d4.( cs8 b2) a |
            a2 gs1 |
            a1 d2 |
            d1 b4( g) |
        %10
            a1 a2 |
            a2( b4 a) gs2 |
            a1 a2 |
            a2( d) b |
            a1 a2 |
        %15
            a1. |
            \repeat volta 2 {
                R1.*3 |
                r1 a2 |
        %20
                d1 a2 |
                a1 e'2 |
                cs2( d) b |
                a2( b) d |
                cs1 cs2 |
        %25
                a1 d2 |
                d2( e) a, |
                a4.( b8 cs2) b |
                cs4.( b8 a2) a |
                a1.~ |
        %30
                a4 a a a |
                b4 b b b |
                a4 a a b |
                a2 a |
                a1 |
            }
  }
}

sopranoLyrics = \lyricmode {
    \keepWithTag #'soprano \commonLyrics
}

altoNotes = {
  \relative e' {
      \set Staff.instrumentName = "Counter"
      \clef "treble"
            r1 d2 |
            fs1 e2|
            fs2( g) fs |
            d4( e8 fs g2) e |
        %5
            fs1 fs2 |
            fs4.( e8 d2) fs |
            fs2 e1 |
            e1 fs2 |
            fs1 d2 |
        %10
            fs1 e2 |
            fs4.( e8 d2) e |
            fs1 fs2 |
            e2( fs) d |
            a'4.( g8 fs2) e |
        %15
            fs1. |
            \repeat volta 2 {
                R1.
                R1.
                r1 e2 |
                fs1 fs2 |
        %20
                fs1 e2 |
                fs1 g2 |
                fs1 d2 |
                fs2( g) a |
                a1 a2 |
        %25
                a4.( g8 fs2) fs |
                g1 fs2 |
                e2( fs) d |
                a'1~ a4 g4 |
                fs1.~ |
        %30
                fs4 e fs fs |
                d4 d g g |
                e4 e fs d |
                a'4.( g8 fs4) e |
                fs1 |
            }
  }
}

altoLyrics = \lyricmode {
    \keepWithTag #'alto \commonLyrics
}

%\noacc = { \once \override Accidental #'transparent = ##t }
%\ficnat = \markup { \tiny \natural }

tenorNotes = {
  \relative a {
    \set Staff.instrumentName = "Tenor"
    \clef "treble_8"
            r1 a2 |
            d1 cs2 |
            d4( cs b2) a |
            b4( cs8 d e2) cs |
        %5
            d1 d2 |
            a2( b) cs |
            d2 b1 |
            a1 a2 |
            a1 b2 |
        %10
            a2( d) cs |
            d4.( cs8 b4 a) b( cs) |
            d1 d2 |
            cs4.( b8 a2) b |
            a2( d) cs |
        %15
            d1. |
            \repeat volta 2 {
                R1. |
                r1 d2 |
                d1 cs2 |
                d1 cs4( a) |
        %20
                b1 cs2 |
                d1 b2 |
                a2( d) d |
                d2( e) fs |
                e1 e2 |
        %25
                d1 a2 |
                b1 d2 |
                cs4.( b8 a4) a d e |
                fs4 d e( d) cs2 |
                d1.~ |
        %30
                % allegro
                d4 cs d d |
                b4 b e e |
                e8( d) cs4 d d |
                d2 cs |
                d1 |
            }
  }
}

tenorLyrics = \lyricmode {
    \keepWithTag #'tenor \commonLyrics
}

bassNotes = {
  \relative d {
    \set Staff.instrumentName = "Bass"
    \clef "bass"
            r1 d2 |
            d1 a2 |
            d2( e) fs |
            g2( e) <a, a'> |
        %5
            d1 d2 |
            fs2( g) fs |
            d2 e1 |
            a,1 d2 |
            d1 g2 |
        %10
            fs4.( e8 d2) a |
            d2( g4 fs)e2 |
            d1 d2 |
            a'4.( g8 fs2) g |
            fs4.( e8 d2) a |
        %15
            d1. |
            \repeat volta 2 {
                r1 d2 |
                d4.( e8 fs2) g |
                fs4.( e8 d2) a |
                d1 fs2 |
        %20
                b,1 a2 |
                d1 e2 |
                fs4.( e8 d2) g |
                fs2( e) d |
                a'1 a2 |
        %25
                fs4.( e8 d2) d2 |
                g4.( fs8 e2) d |
                a'4.( g8 fs2) g |
                fs4.( g8 a2) a, |
                d1.~ |
        %30
                % allegro
                d4 a d d |
                g4 g e e |
                a4 a8( g) fs4 g |
                a2 a, d1 |
            }
  }
}

bassLyrics = \lyricmode {
    \keepWithTag #'bass \commonLyrics
}

\header {
	composer = \markup { \larger { \bold \italic "William Billings" "(1746-1800)" }}
    poet = \markup { \larger  "Isaac Watts" }
    piece = \markup { \larger \italic { "Hymns and Sacred Songs" (1707-9) }, no. 20 }
    opus = \markup { \larger { \italic "The Psalm-Singer’s Amusement" (1781) }}
	title = \markup { \larger \medium \italic "Andover" }
    copyright = \markup { \center-column {
        "Copyright © 2005 by Michael Lauer.  "
        "This edition may be freely distributed, duplicated, performed, or recorded." } }
    
    headerMarkup = \markup { "Billings:" \italic "Andover" } 

}

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 {
      \Lyrics
      \override LyricText #'font-series = #'medium
      \override LyricText #'font-size = #1
      \override LyricText #'stencil = #add-bligs-print
      \override LyricHyphen #'minimum-distance = #0.5
      \override LyricSpace #'minimum-distance = #0.5
    }
  }
}

\score {
  \unfoldRepeats \removeWithTag #'scoreOnly  \theMusic

  \midi {  }
}
