\version "2.10.10"

\include "english.ly"
\include "../mrlUtil.ly"
\include "../mrlSwash.ly"

#(ly:set-option 'point-and-click #f)

#(set-global-staff-size 20)

\paper {
  #(set-paper-size "letter")
  top-margin = .5\in
  bottom-margin = .5\in
  left-margin = .75\in
  line-width = 7\in
  between-system-padding = 0.05\in
  page-top-space = 0\in
  %ragged-last-bottom = ##t
  
  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" \oldStyleNum "(c. 1540–1623)" }
    %subtitle = ""
    %poet = ""
    opus = \markup { \italic "Parthenia" \oldStyleNum "(1612/13)," "vii" }
	title = \markup { \medium \italic \makeSwashMarkupG "Galiardo The Earle of Salisbury" }
    tagline = ""
    copyright = \markup { \smaller \center-align {
        "Edition copyright © 2007 by Michael Lauer."
        "This edition may be freely distributed, duplicated, performed, or recorded." 
        \engravedLine } } 

}

#(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
  
  %\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
  }

}

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
        {
            a1-2 gs2:16 |
            a4. b8 c4:16 d b2:16 |
            c2:16 b1 |
            b2 r4 g4-2 a-1 b-2 |
            c4.:16 d8 e2 d |
            c2 r4 a4-2 b4:16-1 cs-2 |
            d4.^\markup \fcol { 3 1 } e8 f2:16 e |
            d1^\markup \fcol { 5 2 } d2 |
        }
        \repeat volta 2
        {
            e4.:16-3 d8 c4 e-3 d:16 c |
            b4.:16 a8 g4 g'-5 f:16 e-1 |
            d2.:16-3 e4 f2:16 |
            e2 r4 e4 d:16 b |
            c2:16 r4 c4-4 b:16 g |
            a2:16-4 b2. a4 |
            a2.:16 gs8:32 fs
            \tag #'scoreOnly { \afterGrace gs2\trill { fs16[ gs16-4] } }
            \tag #'midiOnly { \times 4/3 { a16[ gs a gs fs gs] } } |
            a1 a2\fermata |
        } 
    }
    
voiceII =
    \relative a' {
        \context Voice = "II"
        \voiceTwo
        \set fingeringOrientations = #'(up)
        \repeat volta 2
        {
            s1. |
            s1. |
            a2 g4:16 a fs2 |
            gs2:16 s1 |
            s1. |
            s1. |
            f4.:16 g8 a2 r4 e4 |
            fs4.:16 g8[ a g fs:32 e] fs2:16 |
        }
        \repeat volta 2
        {
            s1. |
            s1. |
            r4 b4 a c2:16 b4:16 |
            <g c>2 s1 |
            s1. |
            s2 f2:16 e |
            s1. |
            <cs e>1:16 <cs e>2 |
        }
    }
    
voiceIII =
    \relative e' {
        \context Voice = "III"
        \voiceOne
        \set fingeringOrientations = #'(down)
        \repeat volta 2
        {
            e2. f4 d4._\markup \fcol { 2 4 } e8-1 |
            f4:16_\markup \fcol { 2 5 } g-1 e2~ e |
            e4. f8 s2 ds2:16 |
            e2 r4 e4-3 f:16 d |
            g2. g,4 a:16 b |
            c4.:16 d8_\markup \fcol { 2 4 } 
                e4_\markup \fcol { 1 3 } 
                f_\markup \fcol { 1 2 } 
                g_\markup \fcol { 1 5 } 
                e_\markup \fcol { 1 4 }  |
            d2 r4 a4 b:16 cs |
            d1 r4 d4 |
        }
        \repeat volta 2
        {
            g2._\markup \fcol { 1 3 } e4_\markup \fcol { 1 2 } fs2 |
            <d g>2. e4 d c |
            b4 s2 s2. |
            s2 s4 e4 \up \stemDown fs g |
            a4. \down \stemUp s4 s8 c,4_\markup \fcol { 2 4 } 
                d_\markup \fcol { 1 5 } 
                e_\markup \finger 2 |
            f2 r4 d c2:16 |
            c4 d <b e>2 s2 |
            <e, a>4 e8[ f e:32 cs d e] cs4:16 a4\fermata | 
        }
    }
    

voiceIV =
    \relative a {
        \context Voice = "IV"
        \voiceTwo
        \set fingeringOrientations = #'(down)
        \repeat volta 2
        {
            a4. b8 c4:16 d b2 |
            a1 gs2 |
            a2 b1 |
            <e, b'>1 s2 |
            <c' e>2. e,4 f g |
            a4. b8 c4 d g, a |
            <d, a'>2 s4 d4 g a |
            <d, a'>1 <d a'>2 |
        }
        \repeat volta 2
        {
            c'2. c4 b a |
            g1~ g2 |
            g4 g' f:16 e d2 |
            c4.:16 g8 c,4 c' b2 |
            a4. e8 a,4 a' g2 |
            <f c'>2 d e |
            <f a>2 e e, |
            a2 s1 |
        }
    }
    
    
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 = #.3
      %\override NoteHead #'style = #'baroque
    }
    \context {
      \Staff
      %\remove "Time_signature_engraver"
    }
  }
}

\score {
  \unfoldRepeats \removeWithTag #'scoreOnly \theMusic
  
  \midi {
    \context {
      \Score
      tempoWholesPerMinute = #(ly:make-moment 60 2)
      }
    }



 }