%{
    Caprice #6 (Paganini)
    Arranged for guitar by Steve Yegge

  compile-command:
  /Applications/LilyPond.app/Contents/Resources/bin/lilypond \
       [-d fret-diagrams] --png caprice-6.ly \
    && /Users/stevey/bin/refresh-lilypond \
    && /Users/stevey/bin/midi caprice-6.midi
%}

\version "2.26.0"  % for upgrading to future LilyPond versions

\include "english.ly"
\include "../common.ly"

trem =
#(define-music-function (music) (ly:music?)
  "Double-string tremolos."
  #{
    \override Beam.gap-count = #3
    \override TupletNumber.transparent = ##t
    \override TupletBracket.transparent = ##t
    \tuplet 3/2 \repeat tremolo 3 $music
    \revert Beam.gap-count
  #})

intro = {
  <<
    %% measure 1
    \relative c {
      <d'>4. \p ^\markup \large \right-align { "Adagio." }
      \stringUp <g-4\2>8 \stringNeutral <fs-4> <ef-2>
    }
    \\
    \relative c {
      \tuplet 6/4 {
        \stringUp \barre "III" "3"
        <g'>32 \startTextSpan
        [ \(
          \fretboard #"x;x;5-3;3-1;3-1;x;"
          <bf> g bf g bf ]
      }
      \tuplet 6/4 {
        g bf g bf g bf
      }
      \tuplet 6/4 {
        g [ bf g bf g bf \stopTextSpan \) ]
      }

      \tuplet 6/4 {
        \pV <g-\tweak extra-offset #'(0 . -2.5)-1> \(
        \fretboard #"x;x;5-1;8-3;8-4;x;"
        \moveString #'(0 . 1.5) <ef'-3\3> <g,> ef' g, ef'
      }
      \tuplet 6/4 {
        \pIV \moveFingering #'(0 . 0.3) <g,-1> [
          \fretboard #"x;x;5-1;7-3;7-4;x;"
          \moveFingering #'(0 . -0.2) <d'-3> g, d' g, d' ]
      }
      \tuplet 6/4 {
        <g,-3>
        \fretboard #"x;x;5-2;5-3;4-1;x;"
        <c-4> g c g c \)
      }
    }
  >>
  \cleanup
  \break
  <<
    %% measure 2
    \relative c {
      d'4. _\markup \italic "simile - sempre legato" d8 \( c bf \)
    }
    \\
    \relative c {
      \fretboard #"x;x;5-3;3-1;3-1;x;"
      \phrasingSlurUp
      \barre "III" "3"
      \trem { g'32 \startTextSpan \( bf }
      \trem { g bf }
      \trem { g bf \) \stopTextSpan } \phrasingSlurNeutral
      \fretboard #"x;8-2;7-1;7-1;x;x;"
      \fingerRight
      \pVII \trem { <f-2> ^\markup \barnum #"VII" #"" a }
      \fretboard #"x;6-2;5-1;5-1;x;x;"
      \pV \trem { <ef-2> ^\markup \barnum #"V" #"" g }
      \fretboard #"x;5-3;3-1;3-1;x;x;"
      \pIII \trem { <d-3> ^\markup \barnum #"III" #"" f }
      \fingerNeutral
    }
  >>
  \cleanup
  <<
    %% measure 3
    \relative c {
      \fingerUp
      \pI <a'-2>4. <c-4>8\3 \( \fingerInsideOnce <a-1> <g-0>\3 \)
      ^\markup \smaller { \italic { "(hinge)" } }
      \fingerNeutral
    }
    \\
    \relative c {
      \fingerRight
      \fretboard #"x;3-3;1-1;2-2;x;x;"
      \trem { <c-3>32 \( <ef-1>\4 }
      \trem { c ef }
      \trem { c ef \) }

      \fretboard #"x;3-3;1-1;5-4;x;x;"
      \trem { <c-2> <ef-1> }
      \fretboard #"x;4-3;2-1;2-1;x;x;"
      \barre "II" ""
      \pII \trem { <cs-3> \startTextSpan <e-1> \stopTextSpan }
      \fretboard #"x;4-3;2-1;o;x;x;"
      \trem { <cs-3> <e-1> }
      \fingerNeutral
    }
  >>
  \cleanup
  \break
  <<
    %% measure 4
    \relative c {
      \fingerUp \fingerInside
      \fretboard #"x;5-3;5-4;3-1;x;x;"
      \trem { <g'-4>32 \( <bf-1> }
      \trem { g bf }
      \fretboard #"x;5-3;4-2;2-1;x;x;"
      \pII \trem { <fs-2> <a-1> \) } \fingerOutside

      \fretboard #"x;3-3;1-1;2-2;x;x;"
      \pI \trem { <ef-1> <a-2> }
      \fretboard #"x;1-1;o;o;x;x;"
      \pOff \trem { <d,-0> <g-0> }
      \fretboard #"5-3;5-4;4-2;x;x;x;"
      \pIV \trem { <d-4> <fs-2> }
    }
    \\
    \relative c {
      \fingerRight
      <d-3>4. <c-3>8 \( <bf-1> <a-3> \)
    }
  >>
  \cleanup
  <<
    %% measure 5
    \relative c {
      \fingerRight
      <d'>4. <d-1>8 \( <ef-2> ef \)
    }
    \\
    \relative c {

      \fretboard #"3-1;x;5-3;3-1;3-1;x;"
      \grace <g-1>\6
      \stemDown
      \barre "III" "6"
      \trem { <g'-3>32 \startTextSpan \( bf }
      \trem { g bf }
      \trem { g bf \) \stopTextSpan }

      \fretboard #"x;x;5-3;4-2;3-1;x;"
      \trem { <g-3> <b-2> }
      \fretboard #"x;x;5-3;5-4;4-2;x;"
      \trem { g <c-4> }
      \fretboard #"x;x;4-1;5-4;4-2;x;"
      \trem { <gf-1> c }
    }
  >>
  \cleanup
  \break
  <<
    %% measure 6
    \relative c {
      \fingerUp
      <ef'-2>4. <ef-2>8 \( d d \)
    }
    \\
    \relative c {
      \fretboard #"x;x;3-1;5-4;4-2;x;"
      \trem { <f-1>32 \( <c'-4> }
      \trem { f, c' }
      \trem { f, c' \) }

      \fretboard #"x;x;4-1;5-4;4-2;x;"
      \trem { <fs,-1> { \moveFingering #'(0 . -0.3) <c'^4> } }
      \fretboard #"x;x;5-3;3-1;3-1;x;"
      \trem { <g-3> ^\markup \barnum #"III" #"" <bf> }
      \fretboard #"x;x;8-2;7-1;7-1;x;"
      \pVII \trem { <f-2> ^\markup \barnum #"VII" #"" <a> }
    }
  >>
  \cleanup
  <<
    %% measure 7
    \relative c {
      \fingerRight
      c'4. <df-3>8 \( <c-1> <bf-1> \)
    }
    \\
    \relative c {
      \fretboard #"x;6-2;5-1;5-1;x;x;"
      \barre "V" "5"
      \trem { <ef-2>32 \startTextSpan \( <g> }
      \trem { ef g }
      \trem { ef g \) }

      \fretboard #"x;6-2;5-1;6-3;x;x;"
      \trem { ef g }
      \fretboard #"x;7-4;5-1;5-1;x;x;"
      \trem { <e-4> g \stopTextSpan }
      \fretboard #"x;7-4;5-2;3-1;x;x;"
      \pIII \trem { <e-4> <g-2> }
    }
  >>
  \cleanup
  \break
  <<
    %% measure 8
    \relative c {
      \pV \fretboard #"x;8-4;7-3;5-1;x;x;"
      \trem { <a'-3>32 \( <c-1> }
      \fretboard #"x;6-1;7-2;10-4;x;x;"
      \trem { <a-2> <f'-4>\3 }
      \fretboard #"x;5-1;8-2;10-4;x;x;"
      \trem { <bf,-2> <f'-4>\3 \) }

      \fretboard #"x;9-4;7-2;5-1;x;x;"
      \trem { <a,-2> \( <c-1> }
      \fretboard #"x;8-3;8-4;7-2;x;x;"
      \trem { <bf-4> <d-2> }
      \fretboard #"x;6-1;7-2;10-4;x;x;"
      \trem { <a-2> <f'-4>\3 \) }
    }
    \\
    \relative c {
      <f-4>8 <ef-1> _> <d-1>
      \moveFingering #'(-1 . -1.5) <gf-4> _>
      <f-3> <ef-1> _>
    }
  >>
  \cleanup
  <<
    %% measure 9
    \relative c {
      \fretboard #"x;5-1;8-2;10-4;x;x;"
      \trem { <bf'-2>32 <f'-4>\3 }
      \fretboard #"x;5-1;8-2;11-4;x;x;"
      \override Stem.length-fraction = #1.2
      \trem { <bf,-2> <fs'-4>\3 }
      \revert Stem.length-fraction
      \stemDown \fingerDown
      \fretboard #"x;6-4;5-3;3-1;x;x;"
      \pIII \trem { <ef,-4> <g-3> }
      \stemUp \fingerRight

      \fretboard #"x;x;2-1;3-2;2-1;x;"
      \pII \trem { bf ^\markup \barnum #"II" #"" \( <df-2> }
      \fretboard #"x;x;5-1;6-2;5-1;x;"
      \pV \trem { df ^\markup \barnum #"V" #"" _\markup \italic "cresc." <e-2> }
      \fretboard #"x;x;8-1;9-2;8-1;x;"
      \pVIII \trem { e ^\markup \barnum #"VIII" #"" <g-2> \) }
    }
    \\
    \relative c {
      \fingerRight
      <d-1>4 \(
      \stemUp \fingerUp
      <bf'-1>8 \)
      \stemDown
      e, [ g bf ]
    }
  >>
  \cleanup
  \break
  <<
    %% measure 10
    \relative c {
      f'8 \( [ bf ] \) bf,4
      \stemDown
      ef,8 c
    }
    \\
    \relative c {
      \fingerRight \pVI
      \fretboard #"x;x;8-3;7-2;6-1;x;"
      \barre "VI" "2"
      \trem { <bf'-3>32 \startTextSpan <d-2> }
      \fretboard #"x;x;x;7-2;6-1;6-1;"
      \trem { <d-2> <f> \f \stopTextSpan }

      \fretboard #"x;5-3;3-1;3-1;x;x;"
      \barre "III" ""
      \trem { d, \( \startTextSpan f }
      \trem { d f \stopTextSpan }

      \fretboard #"x;x;1-1;2-2;1-1;x;"
      \stemUp
      \barre "I" ""
      \trem { a \startTextSpan c }
      \fretboard #"x;3-3;1-1;2-2;x;x;"
      \trem { ef, a \stopTextSpan \) }
    }
  >>
  \cleanup
  <<
    %% measure 11
    \relative c {
      \pOff <bf'-4>4. \pIII <f-1>8 \pIV <g-2> \pIII <gf-1>
    }
    \\
    \relative c {
      \fretboard #"x;1-1;o;3-4;x;x;"
      \trem { <bf-1>32 \( <d-0> }
      \trem { bf d }
      \trem { bf d \) }

      \fretboard #"6-3;5-2;3-1;x;x;x;"
      \trem { <bf-4> \( <d-3> }
      \fretboard #"6-3;6-4;5-2;x;x;"
      \trem { <bf-3> <ef-4> }
      \fretboard #"6-3;6-4;4-1;x;x;"
      \trem { <bf-3> <ef-4> \) }
    }
  >>
  \cleanup
  \break
  <<
    %% measure 12
    \relative c {
      <gf'-1>4 f8 f g gf
    }
    \\
    \relative c {
      \fretboard #"5-2;6-3;4-1;x;x;x;"
      \trem { <a-2>32 ^\> \( <ef'-4> }
      \trem { a, ef' \! }
      \fretboard #"6-3;5-2;3-1;x;x;x;"
      \trem { bf d \) }

      \trem { bf \( d }
      \fretboard #"6-3;6-4;5-2;x;x;"
      \trem { bf ef }
      \fretboard #"6-3;6-4;4-1;x;x;"
      \trem { bf ef \) }
    }
  >>
  \cleanup
  <<
    %% measure 13
    \relative c {
      <gf'-1>4 <f-1>8
      <bf-1> <bf-1> <c-1>
    }
    \\
    \relative c {
      \fretboard #"5-2;6-3;4-1;x;x;x;"
      \trem { <a-2>32 ^\> \( <ef'-4> }
      \trem { a, ef' \! }
      \fretboard #"x;6-4;5-3;3-1;x;x;"
      \trem { <bf-4> <d-3> \)}

      \fretboard #"x;x;5-3;6-4;3-1;x;"
      \trem { <d-3> \p \( <af'-4> }
      \fretboard #"x;x;6-4;5-3;3-1;x;"
      \trem { <ef-3> <g-2> \) }
      \fretboard #"x;x;7-3;8-4;5-1;x;"
      \pV \trem { <e-3> \( <bf'-4> \) }
    }
  >>
  \cleanup
  \break
  <<
    \relative c {
      %% measure 14
      <c'-1>8 <d-1> <d-1> <f-1> <f-1> <a-4\2>

      %% measure 15
      <bf-1>8 <bf-1> <c-1> <cs-3> <e-3> <cs-3>
    }
    \\
    \relative c {
      %% measure 14
      \fretboard #"x;x;8-4;7-3;5-1;x;"
      \trem { <f-3>32 <a-2> }
      \fretboard #"x;x;4-2;5-3;3-1;x;"
      \pVII \trem { <fs-3> \( <c'-4> }
      \fretboard #"x;x;5-3;3-1;3-1;x;"
      \trem { <g-3> <bf-2> \) }

      \fretboard #"x;x;7-2;8-3;6-1;x;"
      \pX \trem { <a-3> \( <ef'-4> }
      \fretboard #"x;x;8-3;7-2;6-1;x;"
      \trem { <bf-3> <d-2> \) }
      \fretboard #"x;x;x;5-2;4-1;5-3;"
      \pVIII \trem { <c-3> _\markup \italic "cresc." \( <ef-1> }

      %% measure 15
      \fretboard #"x;x;x;7-2;6-1;6-1;"
      \barre "VI" "2"
      \trem { <d-2> \startTextSpan \) f }
      \fretboard #"x;x;x;8-3;8-4;6-1;"
      \trem { <ef-2> \( <g-3> \stopTextSpan }
      \fretboard #"x;x;x;9-2;8-1;8-1;"
      \barre "VIII" "2"
      \trem { <e-2> \startTextSpan g \stopTextSpan \) }

      \fretboard #"x;x;x;9-2;8-1;9-3;"
      \trem { <e-2> \( <g-1> }
      \fretboard #"x;x;x;12-2;11-1;12-3;"
      \pXI \trem { <g-2> <bf-1> }
      \fretboard #"x;x;x;9-2;8-1;9-3;"
      \pVIII \trem { <e,-2> <g-1> \) }
    }
  >>
  \cleanup
  \break
  <<
    %% measure 16
    \relative c {
      \pX <d''-3>8 \f [ bf f ]
      \stemDown
      f, [ ef c ]
    }
    \\
    \relative c {
      \fretboard #"x;x;x;10-1;11-3;10-2;"
      \trem { <f'-2>32 \( <bf-4> }
      \fretboard #"x;x;x;7-2;6-1;6-1;"
      \barre "VI" "2"
      \trem { d, \startTextSpan f \stopTextSpan }
      \fretboard #"x;x;x;3-3;3-4;1-1;"
      \pI \trem { bf, d _\markup \italic "dim." \) }
      \phrasingSlurUp

      \stemUp
      \fretboard #"x;x;3-2;3-3;3-4;x;"
      \trem { bf \( d }
      \fretboard #"x;x;1-1;2-2;1-1;x;"
      \trem { a c }
      \fretboard #"x;3-3;1-1;2-2;x;x;"
      \trem { ef, a \) }
    }
  >>
  \cleanup
  <<
    %% measure 17
    \relative c {
      \fretboard #"x;1-1;o;3-4;x;x;"
      \pOff \trem { d32 \( bf' }
      \fretboard #"x;1-1;o;2-3;x;x;"
      \trem { d, a' }
      \fretboard #"x;1-1;o;1-2;x;x;"
      \trem { d, af' \) }

      \fretboard #"x;1-1;1-2;o;x;x;"
      \trem { ef \( <g-0> }
      \fretboard #"5-2;6-3;4-1;x;x;x;"
      \pIII \trem { <ef-4> <gf-1> }
      \fretboard #"5-2;6-3;3-1;x;x;x;"
      \trem { <ef-4> <f-1> \) }
    }
    \\
    \relative c {
      bf8 bf bf bf <a!-2> <a-2>
    }
  >>
  \cleanup
  \break
  <<
    %% measure 18
    \relative c {
      \fretboard #"6-3;6-4;3-1;x;x;x;"
      \trem { <ef-4>32 \p \( <f-1> }
      \trem { ef f }
      \fretboard #"6-3;5-2;3-1;x;x;x;"
      \trem { <d-2> <f-1> }
      \trem { d f \) }
      \fretboard #"5-3;5-4;4-2;x;x;"
      \trem { <d-4> \( <fs-2> }
      \trem { d fs \) }
    }
    \\
    \relative c {
      <bf-3>4 <bf-3> <a-3>
    }
  >>
  \cleanup
}

climb = {
  <<
    %% measure 19/1
    \relative c {
      \fingerRight
      \override Stem.length-fraction = #1.3
      \fretboard #"x;x;x;o;8-2;7-1;"
      \pVII \trem { <g''>32 \( <b> }
      \revert Stem.length-fraction
      \trem { g b }
      \trem { g b \) }
      \trem { g b \( }
      \fretboard #"x;x;x;o;10-3;8-1;"
      \pVIII \trem { <a> <c> }
      \fretboard #"x;x;x;o;12-3;10-1;"
      \pX \trem { <bf> <d> \) }
    }
    \\
    \relative c {
      \fingerRight
      <g'-0>4.\3 _\markup \italic "cresc." <g-0>8\3 <g-0>\3 <g-0>\3
    }
  >>
  \cleanup
  \break
  <<
    %% measure 20/2
    \relative c {
      \fretboard #"x;x;x;o;13-3;11-1;"
      \trem { <c''>32 \( <ef> }
      \fretboard #"x;x;x;o;15-3;13-1;"
      \pXIII \trem { d f }
      \fretboard #"x;x;x;o;16-3;15-2;"
      \trem { ef g \) }
      \trem { ef g \( }
      \fretboard #"x;x;x;o;15-3;13-1;"
      \trem { d f }
      \fretboard #"x;x;x;o;13-3;11-1;"
      \pX \trem { c ef \) }
    }
    \\
    \relative c {
      g'8\3 g\3 g\3 g\3 g\3 g\3
    }
  >>
  \cleanup
  <<
    %% measure 21/3
    \relative c {
      \fretboard #"x;x;x;o;12-3;10-1;"
      \trem { <b''>32 \( <d> }
      \trem { b d }
      \trem { b d \) }
      \fretboard #"x;x;x;o;6-3;4-1;"
      \pIV \trem { <f,> \( <af> }
      \fretboard #"x;x;x;o;4-3;3-2;"
      \pIII \trem { <ef> <g> }
      \fretboard #"x;x;x;o;3-3;1-1;"
      \pI \trem { <d> <f> \) }
    }
    \\
    \relative c {
      g'4.\3 g8\3 g\3 g\3
    }
  >>
  \cleanup
  \break
  <<
    %% measure 22/4
    \relative c {
      <c'-4>8\3 \f <d-4>\3 <ef-4>\3
      <d-4>\3 <c-4>\3 <bf-4>\3
    }
    \\
    \relative c {
      \fretboard #"x;3-2;1-1;5-4;x;x;"
      \trem { <c-2>32 \( <ef-1> }
      \fretboard #"x;5-2;3-1;7-4;x;x;"
      \pIII \trem { <d-2> <f-1> }
      \fretboard #"x;6-2;5-1;8-4;x;x;"
      \pV \trem { <ef-2> <g-1> \) }
      \fretboard #"x;5-2;3-1;7-4;x;x;"
      \pIII \trem { <d-2> \( <f-1> }
      \fretboard #"x;3-2;1-1;5-4;x;x;"
      \pI \trem { <c-2> <ef-1> }
      \fretboard #"x;1-1;o;3-4;x;x;"
      \pOff \trem { <bf-1> <d-0> \) }
    }
  >>
  \cleanup
  <<
    %% measure 23/5
    \relative c {
      \fretboard #"x;o;7-2;6-1;x;x;"
      \pVI \trem { <a'\4>32 \> \( <cs\3> }
      \trem { a cs }
      \trem { a cs \) \! }
      \trem { a \p \( cs }
      \fretboard #"x;o;9-3;7-1;x;x;"
      \pVII \trem { b d }
      \fretboard #"x;o;11-3;9-1;x;x;"
      \pVIII \trem { cs e \) }
    }
    \\
    \relative c {
      <a-0>4.\5 a8\5 a\5 a\5
    }
  >>
  \cleanup
  \break
  <<
    %% measure 24/6
    \relative c {
      \fretboard #"x;o;12-3;10-1;x;x;"
      \trem { d'32 _\markup \italic "cresc." \( f }
      \fretboard #"x;o;14-3;12-1;x;x;"
      \pXII \trem { e g }
      \fretboard #"x;o;15-3;14-2;x;x;"
      \trem { f a \) }
      \trem { f \( a }
      \fretboard #"x;o;14-3;12-1;x;x;"
      \trem { e g }
      \fretboard #"x;o;12-3;10-1;x;x;"
      \pVIII \trem { d f \) }
    }
    \\
    \relative c {
      a8\5 a\5 a\5 a\5 a\5 a\5
    }
  >>
  \cleanup
  <<
    %% measure 25/7
    \relative c {
      \fretboard #"x;o;11-3;9-1;x;x;"
      \trem { cs'32 \( e }
      \trem { cs e }
      \trem { cs e \) }
      \fretboard #"x;o;5-3;3-1;x;x;"
      \pIII \trem { g, \( bf }
      \fretboard #"x;o;3-3;2-2;x;x;"
      \pI \trem { f a }
      \fretboard #"x;o;2-1;o;x;x;"
      \pOff \trem { e <g_0> \) }
    }
    \\
    \relative c {
      a4.\5 a8\5 a\5 a\5
    }
  >>
  \cleanup
  \break
  <<
    %% measure 26/8
    \relative c {
      \pIII <d'-4>8\3 \f \pV <e-4>\3 \pVII <f-4>
      \pV <e-4>\3 \pIII <d-4>\3 <c-3>
    }
    \\
    \relative c {
      \fretboard #"x;5-2;3-1;7-4;x;x;"
      \trem { <d-2>32 \( <f-1> }
      \fretboard #"x;7-2;5-1;9-4;x;x;"
      \trem { <e-2> <g-1> }
      \fretboard #"x;8-2;7-1;10-4;x;x;"
      \trem { <f-2> <a-1> \) }
      \fretboard #"x;7-2;5-1;9-4;x;x;"
      \trem { <e-2> \( <g-1> }
      \fretboard #"x;5-2;3-1;7-4;x;x;"
      \trem { <d-2> <f-1> }
      \fretboard #"x;5-2;4-1;5-3;x;x;"
      \trem { <d-2> <fs-1> \) }
    }
  >>
  \cleanup
  <<
    %% measure 27/9
    \relative c {
      <c'-4>4 <b-1>8 <bf-1> bf bf
    }
    \\
    \relative c {
      \fretboard #"x;5-2;5-3;5-4;x;x;"
      \trem { <d-2>32 ^\> \( <g-3> }
      \trem { d g }
      \fretboard #"x;5-2;5-3;4-1;x;x;"
      \trem { d g \) \! }
      \fretboard #"x;5-2;5-3;3-1;x;x;"
      \trem { d ^\< \( g }
      \fretboard #"x;5-2;6-4;3-1;x;x;"
      \trem { d <af'-4> }
      \fretboard #"x;5-2;3-1;3-1;x;x;"
      \trem { d, ^\markup \barnum #"III" #"" <f-1> \! \) }
    }
  >>
  \cleanup
  \break
}

spooky = {
  <<
    %% measure 28/1
    \relative c {
      \fingerRight
      \pV <ef'-4>8 \f d df c \pIV cf \pIII bf
    }
    \\
    \relative c {
      \fingerRight
      \fretboard #"x;6-2;8-4;5-1;x;x;"
      \trem { <ef-2>32 \( <g-1> }
      \fretboard #"x;6-2;9-4;7-3;x;x;"
      \trem { ef b' }
      \fretboard #"x;6-2;8-4;6-1;x;x;"
      \trem { ef, bf' \) }
      \fretboard #"x;6-2;7-4;5-1;x;x;"
      \trem { ef, \( a }
      \fretboard #"x;6-2;6-4;4-1;x;x;"
      \trem { ef af }
      \fretboard #"x;6-4;5-3;3-1;x;x;"
      \trem { ef g \) }
    }
  >>
  \cleanup
  <<
    %% measure 29/2
    \relative c {
      \pV <df'-1>4 <c-1>8 <df-1> <c-1> c
    }
    \\
    \relative c {
      \fretboard #"x;7-2;8-4;6-1;x;x;"
      \trem { <e-2>32 ^\> \( <bf'^4> }
      \fretboard #"x;7-2;8-4;5-1;x;x;"
      \trem { e, bf' }
      \trem { e, bf' \) \! }
      \trem { e, ^\< \( bf' }
      \trem { e, bf' }
      \fretboard #"x;7-2;5-1;5-1;x;x;"
      \trem { e,  ^\markup \barnum #"V" #"" <g-1> \) \! }
    }
  >>
  \cleanup
  \break
  <<
    %% measure 30/3
    \relative c {
      \pVII <f'-4>8 \f e ef d \pVI df \pV c
    }
    \\
    \relative c {
      \fretboard #"x;8-2;10-4;7-1;x;x;"
      \trem { <f-2>32 \( <a-1> }
      \fretboard #"x;8-2;11-4;9-3;x;x;"
      \trem { f cs' }
      \fretboard #"x;8-2;10-4;8-1;x;x;"
      \trem { f, c' \) }
      \fretboard #"x;8-2;9-4;7-1;x;x;"
      \trem { f, \( b }
      \fretboard #"x;8-2;8-4;6-1;x;x;"
      \trem { f bf }
      \fretboard #"x;8-4;7-3;5-1;x;x;"
      \trem { f a \) }
    }
  >>
  \cleanup
  <<
    %% measure 31/4
    \relative c {
      \pVII <ef'-1>4 <d-1>8 <ef-1> <d-1> d
    }
    \\
    \relative c {
      \fretboard #"x;9-2;10-4;8-1;x;x;"
      \trem { <fs-2>32 ^\> \( <c'-4> }
      \fretboard #"x;9-2;10-4;7-1;x;x;"
      \trem { fs, c' }
      \trem { fs, c' \) \! }

      \trem { fs, ^\< \( c' }
      \trem { fs, c' }
      \fretboard #"x;9-3;7-1;7-1;x;x;"
      \trem { fs, ^\markup \barnum #"VII" #"" <a-1> \) \! }
    }
  >>
  \cleanup
  \break
  <<
    %% measure 32/5
    \relative c {
      \stringUp \pIX <g''-4\3>8 <f> \pVIII <ef>
      \pVI <c\4> [ \pX <ef> \pVI <c> ]
    }
    \\
    \relative c {
      \phrasingSlurUp
      \fretboard #"x;10-2;9-1;12-4;x;x;"
      \trem { <g'-2>32 -\> \( b }
      \fretboard #"x;10-2;9-1;10-3;x;x;"
      \trem { g b }
      \fretboard #"x;10-2;10-3;8-1;x;x;"
      \trem { g c \) \! }

      \stringDown
      \fretboard #"x;8-2;6-1;10-4;x;x;"
      \trem { <c,\6-2> \f \( <ef\5-1> }
      \fretboard #"x;11-2;10-1;13-4;x;x;"
      \trem { <ef\6-2> <g\5-1> }
      \fretboard #"x;8-2;6-1;10-4;x;x;"
      \trem { <c,\6-2> <ef\5-1> \) }
    }
  >>
  \cleanup
  <<
    %% measure 33/6
    \relative c {
      \stringUp <f'-4\3>8 <ef-3> <d-1>
      <bf-4\4> [ <d-4>\4 <bf-4> ]
    }
    \\
    \relative c {
      \stringDown \phrasingSlurUp
      \fretboard #"x;8-2;7-1;10-4;x;x;"
      \trem { <f-2>32 -\> \( <a-1> }
      \fretboard #"x;8-2;7-1;8-3;x;x;"
      \trem { f a }
      \fretboard #"x;8-2;8-3;7-1;x;x;"
      \trem { <f-2> <bf-3> \) \! }

      \fretboard #"x;6-2;5-1;8-4;x;x;"
      \trem { <bf,\6-2> \f \( <d\5-1> }
      \fretboard #"x;10-2;8-1;12-4;x;x;"
      \trem { <d\6-2> <f\5-1> }
      \fretboard #"x;6-2;5-1;8-4;x;x;"
      \trem { <bf,\6-2> <d\5-1> \) }
    }
  >>
  \cleanup
  \break
  <<
    %% measure 34/7
    \relative c {
      \pV \stringUp <ef'-4\3>8 <d-3> <c-1>
      \pIII <a-4\4> [ \pVI <c-4> \pIII <a-4> ]
    }
    \\
    \relative c {
      \stringDown \phrasingSlurUp
      \fretboard #"x;6-2;5-1;8-4;x;x;"
      \trem { <ef-2>32 -\> \( <g-1> }
      \fretboard #"x;6-2;5-1;7-3;x;x;"
      \trem { ef g }
      \fretboard #"x;6-2;7-4;5-1;x;x;"
      \trem { <ef-2> <a-3> \) \! }

      \fretboard #"5-2;3-1;7-4;x;x;x;"
      \trem { <a,\6-2> \f \( <c\5-1> }
      \fretboard #"8-2;6-1;10-4;x;x;x;"
      \trem { <c\6-2> <ef\5-1> }
      \fretboard #"5-2;3-1;7-4;x;x;x;"
      \trem { <a,\6-2> <c\5-1> \) }
    }
  >>
  \cleanup
  <<
    %% measure 35/8
    \relative c {
      \pIV <d'-4>8 [ <c-3> \pIII <bf-1> ]
      \stemDown
      <f-2> [ \pI <ef-1> <ef-1> ]
    }
    \\
    \relative c {
      \phrasingSlurUp
      \fretboard #"x;5-2;4-1;7-4;x;x;"
      \trem { d32 \( -\> fs }
      \fretboard #"x;5-2;4-1;5-3;x;x;"
      \trem { d fs }
      \fretboard #"x;5-2;5-3;3-1;x;x;"
      \trem { d g \) \! }

      \stemUp
      \fretboard #"x;x;3-1;3-1;3-1;x;"
      \trem { <bf-3> -\< \( <d-4> }
      \fretboard #"x;x;1-1;3-3;3-4;x;"
      \trem { <bf-3> <d-4> }
      \fretboard #"x;x;1-1;3-3;2-3;x;"
      \trem { <bf-3> <cs-2> \) \! }
    }
  >>
  \cleanup
  \break
}

drun = {
  <<
    %% measure 36
    \relative c {
      \phrasingSlurDown
      \fretboard #"x;x;o;7-3;7-2;x;"
      \pVII \trem { <d'\3>32 \f \( <fs\2> }
      \trem { d fs \) }
      \fretboard #"x;x;o;12-3;11-2;x;"
      \pXI \trem { g \( bf }

      \fretboard #"x;x;o;15-3;15-2;x;"
      \pXV \trem { bf d }
      \fretboard #"x;x;o;14-3;13-2;x;"
      \pXIII \trem { a c }
      \fretboard #"x;x;o;12-3;11-2;x;"
      \pXI \trem { g bf \) }
    }
    \\
    \relative c {
      <d_0>4\4 d8\4 d\4 d\4 d\4
    }
  >>
  \cleanup
  <<
    %% measure 37
    \relative c {
      \phrasingSlurDown
      \fretboard #"x;x;o;11-3;10-2;x;"
      \pX \trem { <fs'\3>32 \( <a\2> }
      \fretboard #"x;x;o;8-3;8-2;x;"
      \pVIII \trem { ef g  }
      \fretboard #"x;x;o;7-3;7-2;x;"
      \pVII \trem { d fs \) }

      \phrasingSlurUp \fingerRight
      \fretboard #"x;x;o;5-3;4-2;x;"
      \pIV \trem { c \( ef }
      \fretboard #"x;x;o;3-1;3-1;x;"
      \pIII \trem { bf ^\markup \barnum #"III" #"" d }
      \fretboard #"x;5-3;5-4;3-1;x;x;"
      \trem { { \fingerInsideOnce <g,-3> } <bf-1> \) }
    }
    \\
    \relative c {
      d8\4 d\4 d\4 d\4 d\4
      \stringDownOnce \fingerRightOnce <d\5-4>
    }
  >>
  \cleanup
  \break
  <<
    %% measure 38
    \relative c {
      \fingerRight \stringRight
      \fretboard #"x;5-4;4-3;2-1;x;x;"
      \trem { <fs-3>32 \( 
              { \moveFingering #'(1.8 . -3.2) <a^1>\3
                _\markup \italic "smorzando" }}
      \fretboard #"x;5-4;1-1;o;x;x;"
      \trem { { \fingerInsideOnce <ef^1>\4 } <g-0>\3 }
      \fretboard #"10-3;9-2;o;x;x;x;"
      \trem { <d\6> <fs\5> \) }

      \fretboard #"8-3;6-1;o;x;x;x;"
      \trem { <c\6> \( <ef\5> }
      \fretboard #"6-3;5-2;o;x;x;x;"
      \trem { <bf\6> <d\5> }
      \fretboard #"5-3;3-1;o;x;x;x;"
      \trem { <a\6> <c\5> \) }
    }
    \\
    \relative c {
      \fingerRight \stringDownOnce <d\5-4>8 <d-4>
      \fingerLeft <d-0>\4 <d-0>\4 <d-0>\4 <d-0>\4 
    }
  >>
  \cleanup
}

reprise = {
  <<
    | %% measure 39/1
    \relative c {
      \fingerRight
      \moveFingering #'(-0.5 . 1.3) <d''-1>4.
      <g-3>8 <fs-3> <ef-1>
    }
    \\
    \relative c {
      \fretboard #"x;x;x;12-3;11-2;10-1;"
      \pX \phrasingSlurUp \fingerRight
      \grace <g'_0>\3 \(
      \tupletsOff \tuplet 6/4 {
        \harmonicsOn
        \stringDown
        <g'-3>32\3
        _\markup \small \italic "(touch harmonic)"
        \) \p [
          \( \harmonicsOff
             <bf-2\2> <g-3\3> bf g bf ]
        }
      \trem { g bf }
      \trem { g bf \) }

      \fretboard #"x;x;x;12-1;16-3;15-4;"
      \pXII \trem { <g-1> \( <ef'-4> }
      \fretboard #"x;x;x;12-1;15-3;14-4;"
      \trem { <g,-1> <d'-4> }
      \fretboard #"x;x;x;12-3;13-4;11-2;"
      \pX \trem { <g,-3> <c-4> \) }
    }
  >>
  \cleanup  
  \break
  <<
    %% measure 40/2
    \relative c {
      d''4. d8 \( c bf \)
    }
    \\
    \relative c {
      \fretboard #"x;x;x;12-3;11-2;10-1;"
      \trem { g''32 \( bf }
      \trem { g bf }
      \trem { g bf \) }
      \fretboard #"x;x;15-3;14-2;15-4;x;"
      \trem { f ^\markup \barnum #"III" #"" a }
      \fretboard #"x;x;13-3;12-2;13-4;x;"
      \trem { ef g }
      \fretboard #"x;x;12-3;10-1;11-2;x;"
      \trem { d f }
    }
  >>
  \cleanup
  <<
    %% measure 41/3
    \relative c {
      a''4. c8 \( a g \)
    }
    \\
    \relative c {
      \fretboard #"x;x;10-3;8-1;10-4;x;"
      \barre "VIII" "4" 
      \trem { c'32 \startTextSpan \( ef }
      \trem { c ef }
      \trem { c ef \) }
      \fretboard #"x;x;x;10-3;8-1;x;8-1;"
      \trem { c ef }
      \fretboard #"x;x;10-3;8-1;10-4;x;"
      \trem { c ef \stopTextSpan }
      \fretboard #"x;x;11-3;9-2;8-1;x;"
      \trem { cs e }
    }
  >>
  \cleanup
  \break
  <<
    %% measure 42/4
    \relative c {
      \pXI <bf''-2>4 \pX <a-1>8 a <g-2> <fs-4>
    }
    \\
    \relative c {
      \fretboard #"x;x;12-3;12-4;11-2;x;"
      \trem { <d'-3>32 \( <g-4> }
      \trem { d g }
      \fretboard #"x;x;12-3;11-2;10-1;x;"
      \trem { <d-3> <fs-2> \) }

      \fretboard #"x;x;10-1;11-3;10-2;x;"
      \barre "X" "4"
      \trem { c! \( \startTextSpan <fs-2> \stopTextSpan }
      \fretboard #"x;x;9-3;7-1;8-2;x;"
      \pVII \trem { <bf,-3> <d-1> }
      \fretboard #"x;x;7-3;5-1;7-4;x;"
      \pV \trem { <a-3> <c-1> \) }
    }
  >>
  \cleanup
  <<
    %% measure 43/5
    \relative c {
      <f'-4>4 <e-4>8 <ef-1> <d-1> <ef-2>
    }
    \\
    \relative c {
      \fretboard #"x;x;6-3;4-1;6-4;x;"
      \pIV \trem { <af'-3>32 \( <b-1> }
      \trem { af b }
      \fretboard #"x;x;5-2;5-3;5-4;x;"
      \trem { <g-3> <c-2> \) }
      \fretboard #"x;x;5-2;5-3;4-1;x;"
      \trem { <g-3> \( <c-2> }
      \fretboard #"x;x;5-3;4-2;3-1;x;"
      \pIII \trem { <g-3> <b-2> }
      \fretboard #"x;x;5-2;5-3;4-1;x;"
      \trem { <g-3> <c-4> \) }
    }
  >>
  \cleanup
  \break
  <<
    %% measure 44/6
    \relative c {
      <ef'-2>4 <ef-2>8 <ef-2> d \pI <d-3>
    }
    \\
    \relative c {
      \fretboard #"x;x;4-1;5-4;4-2;x;"
      \trem { <fs-1>32 \( <c'-4> }
      \trem { fs, c' }
      \fretboard #"x;x;3-1;5-4;4-2;x;"
      \trem { <f,-1> <c'-4> \) }
      \fretboard #"x;x;4-1;5-4;4-2;x;"
      \trem { <fs,-1> \( <c'-4> }
      \fretboard #"x;x;5-3;3-1;3-1;x;"
      \trem { g ^\markup \barnum #"III" #"" bf }
      \fretboard #"x;x;x;3-2;2-1;3-3;x;"
      \trem { <f-2> <af-1> \) }
    }
  >>
  \cleanup
  <<
    %% measure 45/7
    \relative c {
      \pOff <ef'-4>8 <cs-2> d <bf-1> <c-1> <a-1>
    }
    \\
    \relative c {
      \fretboard #"x;x;1-1;o;4-4;x;"
      \trem { <ef-1>32 \( <g-0> }
      \fretboard #"x;x;1-1;o;2-2;x;"
      \trem { ef g }
      \fretboard #"x;x;o;3-1;3-2;x;"
      \barre "III" "3"
      \trem { <d-0>\4 \startTextSpan bf' \) }
      \fretboard #"x;5-3;5-4;3-1;x;x;"
      \trem { <d,-3> \( <g-4> \stopTextSpan }
      \fretboard #"x;x;o;2-1;1-1;x;"
      \pOff \trem { <d-0> <a'-2> }
      \fretboard #"x;5-4;4-3;2-1;x;x;"
      \pII \trem { <d,-4> <fs-3> \) }
    }
  >>
  \cleanup
  \break
}

finish = {
  <<
    %% measure 46/1
    \relative c {
      \fingerRight
      \fretboard #"x;x;x;o;8-3;6-1;"
      \pVI \trem { g''32 \( bf }
      \fretboard #"x;x;x;o;11-3;10-2;"
      \pX \trem { bf d \) }
      \fretboard #"x;x;x;o;8-3;6-1;"
      \pVI \trem { g, \( bf }

      \fretboard #"x;x;x;o;11-3;10-2;"
      \pX \trem { bf d }
      \fretboard #"x;x;x;o;12-3;10-1;"
      \trem { b d }
      \fretboard #"x;x;x;o;14-3;13-1;"
      \pXIII \trem { d f \) }
    }
    \\
    \relative c {
      \fingerRight
      <g'-0>8\3 g\3 g\3 g\3 g\3 g\3
    }
  >>
  \cleanup
  <<
    %% measure 47/2
    \relative c {
      \fretboard #"x;x;x;o;16-3;15-2;"
      \pXV \trem { ef''32 \( g }
      \fretboard #"x;x;x;o;13-3;11-1;"
      \pXI \trem { c, ef \) }
      \fretboard #"x;x;o;15-2;15-3;x;"
      \pXV \stringRight \trem { <bf\3> \( <d\2> }

      \fretboard #"x;x;o;12-2;11-1;x;"
      \pXI \trem { g, bf }
      \fretboard #"x;x;o;14-2;13-1;x;"
      \pXIII \trem { a c }
      \fretboard #"x;x;o;11-2;10-1;x;"
      \pX \trem { fs, a \) }
    }
    \\
    \relative c {
      <g'-0>8\3 g\3 <d-0>\4 d\4 d\4 d\4
    }
  >>
  \cleanup
  \break
  <<
    %% measure 48/3
    \relative c {
      \pI <g'-4>8 <f-3> <e-2> <ef-1> \pOff <fs-4>4
    }
    \\
    \relative c {
      \fretboard #"3-2;1-1;5-4;x;x;x;"
      \trem { <g-2>32 \p \( <bf-1> }
      \fretboard #"3-2;2-1;3-3;x;x;x;"
      \trem { <g-2> <b-1> }
      \fretboard #"3-2;3-3;2-1;x;x;x;"
      \trem { <g-2> <c-3> }
      \fretboard #"3-2;3-3;1-1;x;x;x;"
      \trem { <g-2> <c-3> \) }
      \fretboard #"3-2;o;4-4;x;x;x;"
      \trem { <g-2> \( <a-0> }
      \trem { g a \) }
    }
  >>
  \cleanup
  <<
    %% measure 49/4
    \relative c {
      \pI g'8 f e ef \pOff fs4
    }
    \\
    \relative c {
      \fretboard #"3-2;1-1;5-4;x;x;x;"
      \trem { g32 \( bf }
      \fretboard #"3-2;2-1;3-3;x;x;x;"
      \trem { g b }
      \fretboard #"3-2;3-3;2-1;x;x;x;"
      \trem { g c }
      \fretboard #"3-2;3-3;1-1;x;x;x;"
      \trem { g c \) }
      \fretboard #"3-2;o;4-4;x;x;x;"
      \trem { g \( a }
      \trem { g a \) }
    }
  >>
  \cleanup
  <<
    %% measure 50/5
    \relative c {
      \pI <g'-4>8 \pOff <bf-3> \pI g \pOff bf \pI g \pOff bf
    }
    \\
    \relative c {
      \fretboard #"3-2;1-1;5-4;x;x;x;"
      \trem { <g-2>32 \( <bf-1> }
      \fretboard #"3-2;x;o;3-3;x;x;"
      \trem { <g-2> <d'-0> }
      \fretboard #"3-2;1-1;5-4;x;x;x;"
      \trem { g, bf }
      \fretboard #"3-2;x;o;3-3;x;x;"
      \trem { g d' }
      \fretboard #"3-2;1-1;5-4;x;x;x;"
      \trem { g, bf }
      \fretboard #"3-2;x;o;3-3;x;x;"
      \trem { g d' \) }
    }
  >>
  \cleanup
  <<
    %% measure 51/6
    \relative c {
      | \pI <g'-4>4 g g
    }
    \\
    \relative c {
      \fretboard #"3-2;1-1;5-4;x;x;x;"
      \trem { g32 \( bf
                     ^\markup \small \italic "morendo"
                   }
      \trem { g bf }
      \trem { g bf }
      \trem { g bf }
      \trem { g bf }
      \trem { g bf \) }
    }
  >>
  \cleanup
  <<
    %% measure 52/7
    \relative c {
      | \pII <g'-4>4 g g8 a8\rest \fermata
    }
    \\
    \relative c {
      \fretboard #"3-2;2-1;5-4;x;x;x;"
      \trem { g32 \pp \( b }
      \trem { g b }
      \trem { g b }
      \trem { g b }
      \trem { g b }
      \trem { g b \) }
    }
  >>
  \cleanup
}

music = {
  \time 3/4
  \key g \minor
  \repeat volta 2 { \intro }
  \climb
  \spooky
  \drun
  \reprise
  \finish
  \bar "|."
}

\header {
  title = "Caprice 6, Op. 1"
  composer = "Niccolò Paganini"
  arranger = "Arranged for guitar by Steve Yegge"
  copyright = "sites.google.com/site/steveysguitarsite"
  tagline = ##f
}

\score {
  %% can use invisible piano-pedal instructions to make the midi notes ring
  %% (though I've turned it off since it creates lots of compiler warnings)
  %% \override Staff.SustainPedal.transparent = ##t
  %% \override Staff.SustainPedal.stencil = ##f

  <<
    \new Staff {
      \commonSetup
      \maybeFretDiagrams \music
    }
    \new TabStaff {
      \music
    }
  >>
}

\score {
  \unfoldRepeats
  \music
  \midi {
    \context {
      \Score
      midiInstrument = #"acoustic guitar (steel)"
      tempoWholesPerMinute = #44/4
    }
    \context {
      \Voice
      \remove "Dynamic_performer"
    }
  }
}

\paper {
   indent = 8\mm
   ragged-last-bottom = ##f
   max-systems-per-page = #5
   page-count = #5
   % ragged-last-right = #(eq? #t (ly:get-option 'fret-diagrams))
   % max-systems-per-page = #(if (eq? #t (ly:get-option 'fret-diagrams)) 6 7)
}
