% title: Manchester
% 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 "Manchester" } 

\paper {
  #(set-paper-size "letter")
  top-margin = .3\in
  bottom-margin = .3\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 = #'(-2 . 2)
    
    
    \key e \major
    \tsAllegro
    s1*16
    \bar "||"
    \tsTwoFour
    \autoBeamOff
    s2*9
    \autoBeamOn
    \repeat volta 2 {
        s2*17
    } \alternative {
        { s2 }
        { s2 }
    }
    \bar "|."
    
}

commonLyrics = \lyricmode {
    Let the shrill trum -- pet’s war -- like voice
    make rocks and hills __ His praise re -- bound.
    Praise Him with harps’ __ me -- lo -- dious noise
    and gen -- tle psal -- try’s sil -- ver sound.
    
    \tag #'soprano {
        Let Vir -- gin Troops soft tim -- brels bring
        and some with grace -- ful mo -- tion dance.
    }
    Let in -- stru -- ments with var -- ious strings
    with or -- gans joined,
    \tag #'soprano \tag #'alto \tag #'bass {
        His praise 
        \tag #'soprano \tag #'alto { ad -- vance, __ }
        \tag #'bass { ad -- vance, }
        with or -- gans joined
        His 
        \tag #'soprano \tag #'alto { praise }
        \tag #'bass { praise __ }
        \tag #'soprano { ad -- vance, }
        \tag #'alto \tag #'bass { ad -- vance, __ }
        with or -- gans joined
        His praise ad -- vance.
    }
    \tag #'tenor {
        with or -- gans joined
        with or -- gans joined
        His praise ad -- vance,
        with or -- gans joined
        His praise ad -- vance.
    }
    Let
    vance.
}

sopranoNotes = {
  \relative gs' {
    \set Staff.instrumentName = "Treble"
    \clef "treble"
            gs2 gs4 b |
            b2 b4( e) |
            ds4( cs b) as |
            b1 |
        %5
            gs2 b4 b | 
            cs4( ds e) ds8( cs) |
            b2 b2 |
            b1 |
            gs2 gs4 b |
        %10
            b2( cs4) ds |
            e4( b cs) ds |
            e2. e4 |
            b2 e,2 |
            gs4( b) e,( fs) |
        %15
            gs4( a b) b |
            b1 |
            % 2/4
            R2
            b4 cs8 ds |
            e4 ds8([ cs])
        %20
            b8([ gs]) a([ cs]) |
            b4. a8 |
            gs4 fs8([ e]) |
            b'4 e |
            ds4 \times 2/3 { cs8([ b cs]) } |
        %25
            b4. b8 |
            \repeat volta 2 {
                b4 b |
                b4 e8.( ds16) |
                cs4 b |
                cs4. b8 |
        %30
                b4 b |
                b4 b |
                cs4 b |
                b4( cs |
                ds4 e) |
        %35
                r4 b4 |
                b4 b |
                b4 cs8( a) |
                b4 b |
                b4 b |
        %40
                b8( e) ds4 |
                e8( ds) cs4 |
                b4 b |
            } \alternative {
                { b4. b8 }
                { b2 }
            }
  }
}

sopranoLyrics = \lyricmode {
    \keepWithTag #'soprano \commonLyrics
}

altoNotes = {
  \relative e' {
      \set Staff.instrumentName = "Counter"
      \clef "treble"
            e2 e4 fs |
            gs2 gs |
            a4( gs) fs2 |
            fs1 |
        %5
            e2 gs4 fs|
            gs4( fs e) fs |
            e2 ds |
            e1 |
            e2 e4 fs |
        %10
            gs4.( fs8 gs4) fs |
            gs4( fs e) fs |
            gs2. gs4 |
            gs2 gs4( e) |
            b'2 gs4( fs) |
        %15
            e4( fs gs8 e) <ds fs> 4 |
            <e gs>1 |
            % 2/4
            R2*3 |
        %20
            R2*5 |
        %25
            r4 r8 e8 |
            \repeat volta 2 {
                gs4 fs |
                gs4. e8 |
                a4 gs8( b) |
                a4. fs8 |
        %30
                gs4 gs |
                gs4. e8 |
                a4 fs |
                gs4( a |
                b4) b |
        %35
                a4 fs |
                gs4 gs |
                gs4 fs |
                fs4( e8 fs |
                gs4) e |
        %40
                gs4 b |
                b4 a |
                gs4 fs |
            } \alternative {
                { gs4. e8 } 
                { gs2 }
            }
  }
}

altoLyrics = \lyricmode {
    \keepWithTag #'alto \commonLyrics
}

%\noacc = { \once \override Accidental #'transparent = ##t }
%\ficnat = \markup { \tiny \natural }

tenorNotes = {
  \relative b {
    \set Staff.instrumentName = "Tenor"
    \clef "treble_8"
            b2 cs4 ds |
            e2 e2 |
            fs4( e ds) cs |
            b1 |
        %5
            b2 e4 ds |
            e4( b cs) a |
            gs2 fs |
            e1 |
            b'2 cs4 ds |
        %10
            e4.( fs8 e4) b |
            cs4( ds e) ds8( cs) |
            b2. b4 |
            e2 b4( cs) |
            b4( gs) e( cs') |
        %15
            b4( a gs) fs |
            e1 |
            % 2/4
            R2*3 |
        %20
            R2*5 |
        %25
            r4 r8 b'8 |
            \repeat volta 2 {
                e4 ds8( fs) |
                e4. gs8 |
                fs4 ds8( b) |
                e4. ds8 |
        %30
                e4 b8( gs)|
                e4. b'8
                e4 ds8( fs) |
                e2 |
                r4 r8 b8|
        %35
                e4 ds8( fs) |
                e4. ds8 |
                e8( ds) cs4 |
                b2 |
                r4 r8 b8 |
        %40
                e4 fs |
                gs4 fs |
                e4 ds |
            } \alternative {
                { e4. e8 }
                { e2 }
            }
  }
}

tenorLyrics = \lyricmode {
    \keepWithTag #'tenor \commonLyrics
}

bassNotes = {
  \relative e {
    \set Staff.instrumentName = "Bass"
    \clef "bass"
            e2 e4 b |
            e2 e |
            ds4( e fs) fs |
            b,1 |
        %5
            e2 e4 b |
            e4( ds cs) ds |
            e2 b |
            <e, e'>1 |
            e'2 e4 b |
        %10
            e4.( ds8 cs4) b |
            e4( ds cs) b |
            e2. e4 |
            e2 gs4( a) |
            gs4( e) b'( a) |
        %15
            gs4( fs e) b |
            e1 |
            % 2/4
            R2*3 |
        %20
            R2*5 |
        %25
            r4 r8 e8 |
            \repeat volta 2 {
                e4 b |
                e4. e8 |
                fs4 gs |
                a4. b8 |
        %30
                e,4 e |
                b'4 gs |
                a4 b |
                e,4 a |
                gs4 e |
        %35
                a4 b |
                e,2~ |
                e4 fs |
                b,4( e8 ds |
                e4) e |
        %40
                e4 b'8.( a16) |
                gs4 a |
                b4 b, 
            } \alternative {
                { e4. e8 }
                { <e, e'>2 }
            }
  }
}

bassLyrics = \lyricmode {
    \keepWithTag #'bass \commonLyrics
}

\header {
	composer = \markup { \bigger { \basCaps "William Billings" (1746-1800) }}
    %subtitle = ""
    poet = \markup { \bigger { Tate \italic & Brady, Psalm 150 } }
    opus = \markup { \bigger \italic { "The Psalm-Singer's Amusement" (1781) }}
	title = \markup { \bigger \medium \italic  "Manchester" }
    copyright = \markup { \smaller \center-align {
        "Copyright © 2006 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 120 4)
      }
    }



}
