\version "2.10.10"

\include "english.ly"
\include "../mrlUtil.ly"
\include "../mrlSwash.ly"

#(ly:set-option 'point-and-click #f)

headerMarkup = \markup { "Byrd:" \italic "Galiard II, Earle of Salisbury" } 

#(set-global-staff-size 20)

\paper {
  #(set-paper-size "letter")
  top-margin = .3\in
  bottom-margin = .5\in
  left-margin = .75\in
  line-width = 7\in
  between-system-padding = 0.05\in
  page-top-space = 0.0\in
  %ragged-last-bottom = ##t
  
      oddHeaderMarkup = \markup
    \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 = #20
  #(define fonts
    (make-pango-font-tree "Adobe Garamond Pro"
                          "Sans"
                          "Mono"
                           (/ myStaffSize 20)))
}

%smallCapsACode = #smallCapsACodeLL
%oldStyleZeroCode = #oldStyleZeroCodeLL

engravedLine = #(string-append "Engraved by LilyPond " (lilypond-version))

\header {
	composer = \markup { \realCaps "William Byrd" 
        \concat \oldStyleNum { "(" \smaller \italic "c. " "1540–1623)" } }
    %subtitle = ""
    %poet = ""
    opus = \markup { \italic "Parthenia" \oldStyleNum "(1612/13)," "vii" }
	title = \markup { \medium \italic \makeSwashMarkupG "Galiardo Secundo The Earle of Salisbury" }
    subtitle = \markup { \medium \italic \makeSwashMarkupG  "Mrs. Marye Brownlo" }
    copyright = \markup { \smaller \center-align {
        "Edition copyright © 2007 by Michael Lauer."
        "This edition may be freely distributed, duplicated, performed, or recorded." } } 

}


#(define-markup-command (fcol layout props markups) (markup-list?)
  "Print a column of fingering indications--use a reasonable baseline-skip."
  (interpret-markup layout props
    (markup
        (#:left-align
        (#:override '(baseline-skip . 1.5)
            (#:finger (make-center-align-markup markups) ))))))
            
# (define (timesigFn grob)
  (interpret-markup
   (ly:grob-layout grob)
   '(((baseline-skip . 3)))
   (markup
     #:raise 1 (#:center-align (#:bigger #:musicglyph "timesig.mensural64" #:number "3" )) ) ) )
     
global = {
  % main
  %\set Staff.forceClef = ##t
  %\set Staff.forceTime = ##f
  %\set Timing.defaultBarType = ""

  \set Staff.midiInstrument = "harpsichord"
  \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)

  \set followVoice = ##t
  
  \set subdivideBeams = ##t
  
  %\override NoteHead #'style = #'baroque
  \key a \minor
  %\override Staff.TimeSignature #'style = #'neomensural
  \override Staff.TimeSignature #'stencil = #timesigFn
  
  \time 6/4
  \repeat volta 2 {
      \skip 1.*8
  }
  \repeat volta 2 {
      \skip 1.*8
  }

  \repeat volta 2 {
      \skip 1.*8
  }
}

up = \tag #'scoreOnly { \change Staff = treble }
down = \tag #'scoreOnly { \change Staff = bass }

voiceI = 
    \relative a' {
        \context Voice = "I"
        \voiceOne
        \set fingeringOrientations = #'(up)
        \repeat volta 2
        {
            a4.:16 b8 c4 a c:16-2 d |
            e2.-1-2-4 e4 f2 |
            d2. d4 a b4:16 |
            <e, cs'>1-1-2-4 r4 e'4-4 |
            g2. f2.:16 |
            e2. a,4 d2:16 |
            c4-1-4 b2-5 s4 a2-5 |
            gs4.:16^\markup \fcol { "4 - 3" 1 } 
                a8[ b a gs!:32 fs] gs!2 |
        }
        \repeat volta 2
        {
            b4.:16-1-3 a8 g4 c-3 d2-1-4 |
            e4.:16 d8 c4 f d:16 e |
            f4.:16-3-5 e8 d4:16-1-2 <d g> e:16 fs:16 |
            g4. f8 e2:16^\markup \fcol { "3 - 4" 1 } f4.:16 e8 |
            d2:16 e4. d8[ c b:32 a c] |
            b2:16 r4 c4 f2:16 |
            e4-3-5 d4. c8 c4 r16 
                b32-2[ c d c b a] \times 4/6 { c16[ b c b a b-4] } |
            c2 <c e>4 <b d> c2 |
        }
        \repeat volta 2
        {
            e4.:16 c8[ d b c:32 a b:32 g] a4 |
            g'2 f4:16 e d c |
            b4 d2 <g, c>4 b a |
            gs4.:16 a8[ b c b:32 c d e c:32 d] |
            <gs, e'>2 r4 g'2 f4 |
            e2.:16 <b d>4 <a c>2 |
            b4 d2 c4 b2 |
            a8 d,16[ e f g a b cs d e d cs b cs d] cs4:16 a\fermata |
        } 
    }
    
voiceII =
    \relative a' {
        \context Voice = "II"
        \voiceTwo
        \set fingeringOrientations = #'(up)
        \repeat volta 2
        {
            s1. |
            <a c>1 a2 |
            <f a>1 f2 |
            a2 r4 a4-2 c2:16-3 |
            b2.:16 a2. |
            g2. s2. |
            e2 d4:16 ^\markup \fcol { 2 }
                << {e4~ ^\markup \fcol { 3 1 } \stemDown e4} \\ { c4 s4 }  >> 
                d ^ \markup \fcol { 2 } |
            e1 e2 |
        }
        \repeat volta 2
        {
            g2 s2 a4 b |
            c4. s4. a4 b c |
            d2 b4 g4 c2 |
            b2:16 c4. b8^\markup \fcol { 2 } a2 |
            b2 g a |
            g2 s1 |
            c4. <bf-2>8 a4 g s2 |
            <e g>2 g4 g <e g>2 |
        }
        \repeat volta 2
        {
            s1. |
            g2 r4 g2 e8 fs:32 |
            s2. e8:32 c g'4 e |
            e2 s2 a2 |
            r8 e4 f8[ g:32 a g a b:32 c a b] |
            c2. g4 e2 |
            <e gs>4 <f a> 
                << { gs?4 \stemDown a2 gs?4 } \\ { e2 e4. d8 } >> |
            <cs e>8 s8 s4 s1 |
        } 
    }
    
voiceIII =
    \relative a {
        \context Voice = "III"
        \voiceOne
        \set fingeringOrientations = #'(down)
        \repeat volta 2
        {
            \oneVoice R1. \voiceOne |
            a4.:16 b8 c4 a d:16 e |
            d,4.:16 e8 f4 d f:16 g |
            a4.:16 e8 a,2 c'-3-1 |
            d4 e2 c4 d2 |
            b4:16 c2 a2 <gs b>4 |
            a4 e2 a4 r8 c8[ b:32 a] |
            b4_\markup \fcol { 1 "5 - 2" } e2 b4 r8 b,8 e4 |
        }
        \repeat volta 2
        {
            s1. |
            <c'-1>2. d2 g,4 |
            <a-2-5>4 d4. c8 b4:16 c:16 a |
            d2 c d |
            g4. f8 e2:16 f4.:16 e8 |
            d2 c4 c2 b4 |
            c4 d f8. e16 \times 4/6 { f16[ e f e d c] } g'4. f8 |
            c8 b16[ a g f e d c d e f] g8[ g,] 
            << {s4 b4:16 } \\ { \stemUp e8[ e,8~] \stemDown e4 } >> | 
        }
        \repeat volta 2
        {
            g''2. c,4 d2 |
            <b e>4. c8[ d b c:32 a b:32 g] c4 |
            <d g>4. e8[ f:32 d] r4 d8[ b] a4:16 |
            b2 e a, |
            b2 g d' |
            g,2 s4. g,8 a[ b c d ] |
            s2 b'8[ c b:32 a] b2 |
            a2 a4 e <e a>2\fermata |
        } 
    }
    

voiceIV =
    \relative a {
        \context Voice = "IV"
        \voiceTwo
        \set fingeringOrientations = #'(down)
        \repeat volta 2
        {
            s1. |
            s1. |
            s1. |
            s1 a2 |
            g4 e2 f4 d2 |
            e4 c2 <d f>4 <b d>2 |
            <a e'>4 g2 <a e'>4 f'2-4 |
            e1 e,2 |
        }
        \repeat volta 2
        {
            r4 e''4.:16 d8 c4 f4:16 d |
            r4 a4. e8 f4 g <e g> |
            d2 g2 s2 |
            g2 a <d, a'> |
            <g d'>2 s2 s2 |
            g4. f8 <e g>4 <f a>4. <e g>8 <d f>4 |
            <c g'>4 g' a c <g d'>2 |
            <c, g'>8 s8 s4 s1 |
        }
        \repeat volta 2
        {
            c'2 b4 a g f |
            e4. s8 s2. a4 |
            g4. s4. c,4 g' a |
            e2. g4 f2 |
            e1 d2 |
            c4. d8 e[ f g] s8 s2 |
            e8[ f e:32 d] e2 e4 e, |
            <a e'>1 <a e'>2
        } 
    }
    
    
theMusic =  
\context PianoStaff <<
	\context Staff = "treble" <<
	    \removeWithTag #'lower \global 
	    \clef treble
	    \voiceI
	    \voiceII 
	>>
	\context Staff = "bass" <<
	    \global
	    \clef bass
        \voiceIII
        \voiceIV
	>>
    >>
    
\score {
  %\removeWithTag #'incipit \theMusic
  \removeWithTag #'midiOnly \theMusic
  \layout {
    \context {
      \Score
      \override MetronomeMark #'transparent = ##t
      \override BarNumber #'padding = #2
      %\override BarLine #'transparent = ##t
      %\remove "System_start_delimiter_engraver"
    }
    \context {
      \Voice
      \override StemTremolo #'beam-thickness = #.25
      \override Accidental #'cautionary-style = #'smaller
      %\override NoteHead #'style = #'baroque
    }
    \context {
      \Staff
      %\remove "Time_signature_engraver"
    }
  }
}

\score {
  %\unfoldRepeats 
  \removeWithTag #'scoreOnly \theMusic
  
  \midi {
    \context {
      \Score
      tempoWholesPerMinute = #(ly:make-moment 72 2)
      }
    }



 }