% title: Hartford
% 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 "Hartford" } 

\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.2\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 g \major
  \tsTwoFour
  
  s2*23
  \repeat volta 2 {
      s2*7
  }  
}

commonLyrics = \lyricmode {
        \tag #'soprano \tag #'alto \tag #'tenor {
            Glor -- ious Je -- sus,
        }
        \tag #'soprano \tag #'tenor \tag #'bass {
            Glor -- ious Je -- sus,
        }
        Thy dear name to praise:
        This shall please us,
        \tag #'alto \tag #'tenor {
            This shall please us,
        }
        great -- ly all our days.
        \tag #'soprano {
            Oh thy beau -- ties, how di -- vine
        }
        \tag #'alto \tag #'tenor \tag #'bass {
            How they in the Gos -- pel shine
        }
        Ho -- ly Sa -- vior
        \tag #'alto \tag #'tenor {
            Live for -- e -- ver
        }
        All our songs be thine.
}

sopranoNotes = {
  \relative b' {
    \set Staff.instrumentName = "Treble"
    \clef "treble"
            b4 a |
            b4 d |
            d4 d |
            d4 e |
        %5
            d4 d8( c) |
            b4 a |
            a2 |
            g4 b |
            d4 d |
        %10
            R2*2 |
            a4 b8( d) |
            c8( b) a4 |
            b2 |
        %15
            R2 |
            g8( a) b( c) |
            d4 d |
            d8( e) d( c) |
            b2 |
        %20
            R2 *4 |
            \repeat volta 2 {
                g4 b |
        %25
                d4 d |
                R2*2 |
                a4 b8( c) |
                d4 d |
        %30
                <b d> 2 |
            }
  }
}

sopranoLyrics = \lyricmode {
    \keepWithTag #'soprano \commonLyrics
}

altoNotes = {
  \relative c' {
      \set Staff.instrumentName = "Counter"
      \clef "treble"
            d4 d |
            d d |
            R2*2 |
        %5 
            g4 fs |
            g8( fs) e4 |
            fs2 |
            d4 d |
            g4 fs |
        %10
            e4 e |
            e4 g |
            d4 g8( fs) |
            e4 d |
            d2 |
        %15
            R2*5 |
        %20
            d4 d8( g) |
            fs4 e |
            d4 d |
            d2 |
            \repeat volta 2 {
                d4 d |
        %25
                g4 fs |
                e4 e |
                e4 g |
                fs4 g8( a) |
                g4 fs |
        %30
                g2 |
            }
  }
}

altoLyrics = \lyricmode {
    \keepWithTag #'alto \commonLyrics
}

%\noacc = { \once \override Accidental #'transparent = ##t }
%\ficnat = \markup { \tiny \natural }

tenorNotes = {
  \relative g {
    \set Staff.instrumentName = "Tenor"
    \clef "treble_8"
            g4 d |
            g4 b |
            a4 fs |
            a4 c |
        %5
            b4 a |
            b4 c |
            d2 |
            b4 g |
            b4 d |
        %10
            c4 a |
            c4 e |
            fs4 d |
            e4 fs |
            g2 |
        %15
            R2*5 |
        %20
            b,4 a8( g) |
            d'4 c |
            b4 a |
            g2 |
            \repeat volta 2 {
                b4 g |
        %25
                b4 d |
                c4 a |
                c4 e |
                d4 d8( c) |
                b4 a |
        %30
                g2 |
            }
  }
}

tenorLyrics = \lyricmode {
    \keepWithTag #'tenor \commonLyrics
}

bassNotes = {
  \relative d {
    \set Staff.instrumentName = "Bass"
    \clef "bass"
            R2*2 |
            d4 d |
        %5
            d4 c |
            <g g'>4 d'4 |
            <g, g'>4 <a a'> |
            d2 |
            <g, g'>4 <g g'>
        %10
            <g g'>4 <b b'> |
            R2*2 |
            d4 b |
            c4 e |
            <g, g'>2 |
        %15
            R2*5
        %20
            g'4 fs8( e) |
            d4 e8( fs) |
            g4 d |
            g,2 |
            \repeat volta 2 {
                <g g'>4 <g g'> |
        %25
                <g g'>4 <b b'> |
                R2*2 |
                d4 <g, g'>8( <fs fs'>) |
                <g g'>4 d' |
        %30
                g,2 |
            }
  }
}

bassLyrics = \lyricmode {
    \keepWithTag #'bass \commonLyrics
}

engravedLine = #(string-append "Engraved by LilyPond " (lilypond-version))

\header {
	composer = \markup { \bigger { \basCaps "William Billings" (1746-1800) }}
    %subtitle = ""
    poet = "“Words from Relly”"
    opus = \markup { \bigger \italic { "The Psalm-Singer's Amusement" (1781) }}
	title = \markup { \bigger \medium \italic  "Hartford" }
    tagline =""
    copyright = \markup { \smaller \center-align {
        "Copyright © 2005 by Michael Lauer."
        "This edition may be freely distributed, duplicated, performed, or recorded." 
        \engravedLine } } 
}

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 120 4)
      }
    }



}
