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

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

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

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

dottedLines = {
  \override TextSpanner.style = #'dashed-line
  \override TextSpanner.dash-period = #1.5
  \override TextSpanner.dash-fraction = #0.1
  \override TextSpanner.bound-details.right.attach-dir = #1
  \override TextSpanner.bound-details.right.padding = #0.5
  \override TextSpanner.bound-details.left-broken.text = ##f
}

normalLines = {
  \revert TextSpanner.style
  \revert TextSpanner.dash-period
  \revert TextSpanner.dash-fraction
  \revert TextSpanner.bound-details.right.attach-dir
  \revert TextSpanner.bound-details.right.padding
  \revert TextSpanner.bound-details.left-broken.text
}

uu = \upbow
dd = \downbow

flutes = \relative c {
  %% measure 2
  <e' gs>8 <e gs>16 -. \( <b fs'> -. \)
  <gs e'>8 <gs' b>16 -. \( <fs a> -. \)

  %% measure 3
  <e gs>8 <e gs>16 -. \( <b fs'> -. \)
  <gs e'>8 <gs e'>16 -. \( <b fs'> -. \)

  %% measure 4
  <e gs>8 <b fs'>16 -. \( <e gs> -. \)
  <fs a>8 <b, fs'>16 -. \( <fs' a> -. \)

  %% measure 5
  <gs b>8 <fs a>16 -. \( <e gs> -. \)
  <b fs'>8 <gs' b>16 -. \( <fs a> -. \)

  %% measure 6
  <e gs>8 <e gs>16 -. \( <b fs'> -. \)
  <gs e'>8 <b' gs>16 -. \( <fs a> -. \)

  %% measure 7
  <e gs>8 <e gs>16 -. \( <b fs'> -. \)
  <gs e'>8 <gs e'>16 -. \( <b fs'> -. \)

  %% measure 8
  <e gs>8 <fs a>16 -. \( <e gs> -. \)
  <b fs'>8 <e gs>16 -. \( <b fs'> -. \)

  %% measure 9
  <gs e'>4 \stopTextSpan
  r8 \pOff
  \once \override TextSpanner.bound-details.left.text = \markup \upright \general-align #Y #CENTER \tiny "imitando il Corno "
  <gs, e'>16 \f \startTextSpan <e' gs>

  %% measure 10
  <b fs'>8 <e gs>16 -. \( <fs a> -. \)
  \pIII <gs b>8 <a cs>16 -. \( <gs b> -. \)

  %% measure 11
  \pOff <fs a>8 <e gs>16 -. \( <fs a> -. \)
  <b, fs'>8 <gs e'>16 -. \( <e' gs> -. \)

  %% measure 12
  <b fs'>8 <e gs>16 -. \( <fs a> -. \)
  \pIII <gs b>8 <a cs>16 -. \( <gs b> -. \)

  %% measure 13
  \pOff <fs a>8 <e gs>16 -. \( <fs a> -. \)
  <b, fs'>8 \noBeam \stopTextSpan

  \once \override TextSpanner.bound-details.left.text = \markup \upright \tiny \general-align #Y #CENTER "il Flauto "
  \pIV <gs'' b>16 -. \p \startTextSpan \( <fs a> -. \)

  %% measure 14
  <e gs>8 <e gs>16 -. \( <b fs'> -. \)
  <gs e'>8 \noBeam \stopTextSpan

  \once \override TextSpanner.bound-details.left.text = \markup \upright \general-align #Y #CENTER \tiny "il Corno "
  <gs b>16 -. \f \startTextSpan \( \pOff <fs a> -. \)

  %% measure 15
  <e gs>8 <e gs>16 -. \( <b fs'> -. \)
  <gs e'>8 \noBeam \stopTextSpan

  \once \override TextSpanner.bound-details.left.text = \markup \upright \general-align #Y #CENTER \tiny "il Flauto "
  \pIV <gs' e'>16 -. \p \startTextSpan \( <b fs'> -. \)

  %% measure 16
  <e gs>8 <fs a>16 -. \( <e gs> -. \)
  <b fs'>8 <e gs>16 -. \( <b fs'> -. \)
}

intro = \relative c {
  \key e \major
  \dottedLines

  \set Score.measureLength = #1/8
  \once \override TextSpanner.bound-details.left.text = \markup \upright \general-align #Y #CENTER \tiny "Sulla tastiera imitando il Flauto "

  \pIV <gs'' b>16 -.
  ^\markup { \halign #0 { \null \raise #1 { \large Allegretto. }}}
  _\markup \italic "dolce"
  \startTextSpan \( <fs a> -. \)
  \set Score.measureLength = #2/4

  \flutes

  %% measure 17
  <gs, e'>4 \stopTextSpan r8
  \normalLines
}

horns = \relative c {
  %% measure 17 (continued)
  \key g \major \pOff \fingerRight
  b''8 \f

  %% measure 18
  \pVI <e,, b' e g b>8 -- ^\markup \barnum #"VII" #"" <a'\2>16 -. \( g -. \)
  <ds,-1 b'-3 ds-2 a'-4>8\5\4\3\2 -- <g'>16 -. \( fs -. \)

  %% measure 19
  <e, b' e g>8 -- <fs'>16 -. \( e -. \)
  \pVIII <c, g' c e g>8 -- ^\markup \barnum #"VIII" #"" <fs'>16 -. \( e -. \)

  %% measure 20
  \pVI <b, e b' e g>8 -- ^\markup \barnum #"VII" #"" <fs''>16 -. \( e -. \)
  <as,, fs' as e'>8 -- <ds'>16 -. \( e -. \)

  %% measure 21
  <b, e b' e g>4 ^\markup \barnum #"VII" #""
  <b fs' b ds fs>8 ^\markup \barnum #"VII" #""
  \noBeam d'\2

  %% measure 22
  \pOff <g,, d'-0 g-0 b-0 g'>8 -- <fs''>16 -. \( g -. \)
  <d,-0 a' d a'>8\4\3\2\1 -- g'16 -. \( a -. \)

  %% measure 23
  <g,,-1 d'-0 g-0 b-0 b'-4>8\6\4\3\2\1 -- <a''>16 -. \( b -. \)
  \pVIII <c,, g' c e g c>8 -- ^\markup \barnum #"VIII" #"" <d''>16 -. \( e -. \)

  %% measure 24
  \pOff <d,,-0 g-0 b-0 g'>8 -- <a''>16 -. \( b -. \)
  <d,,-0 a' d a'>8\4\3\2\1 -- d''16 -. \( fs,\2 -. \)

  %% measure 25
  <g,, d'-0 g-0 b-0 g'>4
  r8
  <b''\2>8

  %% measure 26
  \pVI <ds,, b' ds a'>8\5\4\3\2 -- <g'>16 -. \( fs -. \)
  \barre "VII" ""
  <e, b' e g>8 -- \startTextSpan <fs'>16 -. \( e -. \) \stopTextSpan

  %% measure 27
  <b, fs' b ds>8 -- ^\markup \barnum #"VII" #""
  <b'-3>16 -. \( <c-4> -. \)
  b8 b'

  %% measure 28
  <ds,, b' ds a'>8\5\4\3\2 -- <g'>16 -. \( fs -. \)
  \barre "VII" ""
  <e, b' e g>8 -- \startTextSpan <fs'>16 -. \( e -. \) \stopTextSpan

  %% measure 29
  <ds, b' ds fs b>8\6\5\4\3\2 -- ^\markup \barnum #"IX" #""
  \pIX <as''\2>16 -. \( c -. \) b8 b

  %% measure 30
  <gs,-2 b e gs e'-4>\5\4\3\2\1 -- ^\markup \barnum #"IX" #""
  <d''>16 -. \(
  \barre "VII" ""
  b -. \startTextSpan \)
  <a, e' a c>8 -- b'16 -. \( a -. \) \stopTextSpan

  %% measure 31
  <fs, a d fs d'>8\5\4\3\2\1 -- ^\markup \barnum #"VII" #""
  <c''-1>16 -. \( <a-2\2> -. \)
  <g, d'-3 g-3 b-3>8\5\4\3\2 -- ^\markup \barnum #"X" #""
  <a'>16 -. \( g -. \)

  %% measure 32
  \pV <e,-2 g c e c'-4>8 -- ^\markup \barnum #"V" #""
  <b''-3>16 -. \( <g-4\2> -. \)
  <fs, c' ds a'>8\5\4\3\2 -- g'16 -. \( fs -. \)

  %% measure 33
  \barre "VII" ""
  <b,, fs' a ds fs b>8 -- \startTextSpan
  <a''>16 -. \( fs -. \)
  <e, b' e g>8 -- <fs'>16 -. \stopTextSpan \( <e-0>\1 -. \)

  %% measure 34
  \pOff <c, e g c g'>8 -- <fs'>16 -. \( e -. \)
  <as,,-1 e'-2 g-0 cs-3 g'-4>8 -- <fs''>16 -. \( e -. \)
  \barre "II" ""
  <b, fs' b ds>8 -- \startTextSpan <e'>16 -. \( fs -. \) \stopTextSpan

  %% measure 35
  <c, g' c e>8 -- ^\markup \barnum #"III" #"" <fs'>16 -. \( g -. \)
  \pOff <a,, f' c'>8\5\4\3 -- <a''>16 -. \( <f>\2 -. \)
  <b,, fs' b b-0 e-0>8\5\4\3\2\1 -- <fs''>16\2 -. \( ds\3 -. \)

  %% measure 36
  \break
  <e,, e' b' e b e>4\6\5\4\3\2\1 r8
}

flutesAgain = \relative c {
  \dottedLines
  \key e \major
  \once \override TextSpanner.bound-details.left.text = \markup \upright \general-align #Y #CENTER \tiny "il Flauto "

  \pIV <gs'' b>16 -. \p _\markup \italic "dolce"
  \startTextSpan \( <fs a> -. \) _\markup \italic "restez"

  \flutes
  <gs, e'>4 \stopTextSpan r8
  \normalLines
}

%% so-named for the recurring 5-note theme of "bibble bibble bib"
bibble = \relative c {
  %% measure 53 (continued)
  \key c \major
  \pVII <e e'>8 \f

  | %% measure 54
  <a a'>4. -> <e e'>8 ->

  | %% measure 55
  <c c'>8 -> \pV <a a'> ->
  r32
  \pXII <a'\5> \( b c <d\4> \pXIII e fs <gs\3>

  | %% measure 56
  a16 \)
  b32 \( <c\2> d e <fs\1> gs a8 \)
  c16 -. \( b -. \)

  | %% measure 57
  a4 \trill \( gs8 \)
  <d,, d'>8\5\3 \noBeam

  | %% measure 58
  <f f'>4.\5\3 -> <d d'>8\5\3 ->

  | %% measure 59
  <b b'>\6\4 -> <gs gs'>\6\4 ->
  r32
  \pXIV <b'\5> \( c d <e\4> fs gs <a\3>

  | %% measure 60
  b16 \) c32 \( \pXV <d\2> e fs <gs\1> a b8 \)
  \once \override TextSpanner.bound-details.left-broken.text = ##f
  \once \override TextSpanner.bound-details.left.text = \markup \italic \general-align #Y #CENTER "restez"
  \textSpannerDown
  \pV d,16 -. \startTextSpan \( c -. \)

  | %% measure 61
  b4 \trill \( a8 \) \noBeam <e'-1> -.

  | %% measure 62
  <a-4> -.
  \pIII <e,,-4\5>32 -.\uu \stopTextSpan
  \( [ <d-2> -.\dd <cs-1> -.\uu <b-4> -.\uu ] \) <a-2>8 -.\dd
  <a'''-4>32 -. \( [ <g-3> -. <f-2> -. <e-1> -. ] \)
  \textSpannerUp

  | %% measure 63
  <f-2>8 -.
  \pVIII <a,,-4\5>32 -.
  \( [ <g-2> -. <f-1> -. <e-4> -. ] \) <d-2>8 -.
  <f''-4>8 -. \noBeam

  | %% measure 64
  \pII <d-1> -. <d,,-4\5>32 -. \( [ <c-2> -. <b-1> -. <a-4> -. ] \)
  <g-2>8 -. <g'''-4>32 -. \( [ <f-3> -. <e-2> -. <d-1> -. ] \)

  | %% measure 65
  <e-2>8 -. \pVII <g,,-4\5>32 -. \( [ <f-2> -. <e-1> -. <d-4> -. ] \)
  <c-2>8 -. \noBeam \pX e'' -.

  | %% measure 66
  \stringDown
  d -. <d,-4\4>32 -. \( [ <c-2> -. <b-1>\4 -. <a-4> -. ] \)
  <gs-3>8 -. \noBeam d'' -.

  | %% measure 67
  \pV c -. <e,-4\3>32 -. \( [ <d-2> -. <c-1> -. <b-4> -. ] \)
  <a-2>8 -. \pVII <c-4\4>32 -. \( [ <b-3> -. <a-1> -. <g-4> -. ] \)

  | %% measure 68
  <f-2>8 -. \pIII <a-4\4>32 -. \( [ <g-3> -. <f-1> -. <e-4> -. ] \)
  <ds-3>8 -. \pV <c''-4\1>32 -.\dd
  \( [ <a-1> -.\uu <f-2\2> -.\uu <ds-3\3> -.\uu ] \)

  | %% measure 69
  <e-4>8\3 -.\dd \pVI <e-4\3>32 -. \uu
  \( [ <b-3\4> -. \uu <gs-1> -. \dd <b-4> -. \uu ] \)
  <e,-2\5>8 -. \uu \noBeam
  \pV <g g'> \f

  | %% measure 70
  <c c'>4. -> <g g'>8 ->

  | %% measure 71
  \pVII <e e'>8 -> <c c'> ->
  \pXV r32 <c'-1\5> \( d e <f-1> g a \pXVI <b-1>

  | %% measure 72
  c16 \) d32 \( \pXVII <e-1> f g <a-1> b c8 \)
  e,16\1 -. \( \pV d -. \)

  | %% measure 73
  c4 \trill \( b8 \) \noBeam <d,, d'>

  | %% measure 74
  <f f'>4.\5\3 -> <d d'>8 ->

  | %% measure 75
  <b b'> -. <g g'>\6\4 ->
  \pXIV r32 <b'-1\5> \( c d <e-1> f g <a-1>

  | %% measure 76
  b16 \) c32 \( <d-1> e f <g-1> a b8 \)
  \pVIII f16 -. \( e -. \)

  | %% measure 77
  d4 \trill \( c8 \) g -. \noBeam
}

moreBibble = \relative c {
  | %% measure 78
  \pVII c''8 -.
  <g,-4\5>32 -. \( [ f -. e -. d -. ] \) c8 -. \noBeam
  <c''-2>32\2 -. \( e -. g -. e -. \)

  | %% measure 79
  f8 -. <c,-4\4>32 -. \( [ bf -. a -. g -. ] \)
  f8 -. \noBeam f'' -.

  | %% measure 80
  d -. \pIX <a,-4\5>32 -. \( [ g -. fs -. e -. ] \)
  d8 -. <d''-2>32\2 -. \( [ fs -. a -. fs -. ] \)

  | %% measure 81
  g8 -. <d,-4\4>32 -. \( [ c -. b -. a -. ] \)
  g8 -. \noBeam g'' -.

  | %% measure 82
  \pX e -. <b,-4\5>32 -. \( [ a -. gs -. fs -. ] \)
  e8 -. <e''-2>32\2 -. \( [ gs -. b -. gs -. ] \)

  | %% measure 83
  a8 -. <e,-4\4>32 -. \( [ d -. c -. b -. ] \)
  a8 -. e'32 -. \( [ c -. a -. g! -. ] \)

  | %% measure 84
  f8 -. <f''-2>32\2 -. \( [ a -. c -. a -. ] \)
  f8\2 -. \barre "X" "" f,32 -.\uu \startTextSpan
  \( [ c -.\uu \stopTextSpan <a-3> -.\uu <f-4> -.\uu ] \)
  | %% measure 85
  \stringDown
  <e-2>8 -.\dd \barre "XVII" "" e''32 -. \startTextSpan
  \( [ a -. c -. a -. ] \)
  e8 -. \stopTextSpan
  \pX <e,-4>32 -.\dd \( [ <c-1> -.\uu <a-3\5> -.\uu <e-2\6> -.\uu ] \)

  | %% measure 86
  <ds-1>8 -.\dd <ds''-1>32\2 -. \( [ <a'-2> -. c -. a -. ] \)
  <ds,-1>8\2 -. <ds,-4\4>32 -.\dd
  \( [ <c-1> -.\uu <a-2\5> -.\uu <fs-3\6> -.\uu ] \)

  | %% measure 87
  <e-1>8 -.\dd <e''-2\2>32 -. \( [ g -. b -. g -. ] \)
  e8\2 -.
  \pV \stringNeutral
  <b,-4\4>32 -. \( [ g -. <e\5> -. d -. ] \)

  | %% measure 88
  <c\6>8 -. <e'-2\3>32 -. \( [ <g-1> -. <c-4>\2 -. <g-1> -. ] \)
  <e-2>8\3 -.
  \barre "V" "" c32 -.\uu \startTextSpan
  \( [ g -.\uu \stopTextSpan <e-3> -.\uu <c-4> -.\uu ] \)

  | %% measure 89
  <b-1>8 -.\dd <e'-2\3>32 -. \( [ <g-1> -. <b-4>\2 -. <g-1> -. ] \)
  <e-2>8\3 -. <b-4\4>32 -.\dd
  \( [ <g-1> -.\uu <e-3\5> -.\uu <b-2\6> -.\uu ] \)

  | %% measure 90
  <as-1>8 -.\dd <e''-2\3>32 -. \( [ <g-1> -. <as-4>\2 -. <g-1> -. ] \)
  <e-2>8\3 -. <as,-4\4>32 -.\dd
  \( [ <g-1> -.\uu <e-2\5> -.\uu <cs-4\6> -.\uu ] \)

  | %% measure 91
  <b-2>8 -.\dd \pXIV <ds''-2\2>32 -. \( [ b' -. fs -. <ds-3> -. ] \)
  <b-2>8 -. \pV <a\1>32 -. \( [ b -. a -. <fs\2> -. ] \)

  | %% measure 92
  e8 -. e32 -. \( [ g -. e -. <d\3> -. ] \)
  c8 -. <c-1>32 -. \( [ <e-4\3> -. <c-1> -. <as-3\4> -. ] \)

  | %% measure 93
  <b-4>8 -. \barre "VII" "" ds32 -.\dd \startTextSpan
  \( [ b' -.\uu fs -.\uu \stopTextSpan ds -.\uu ] \)
  b8 -.\uu \pII <a\3>32 -. \( [ b -. a -. <fs\4> -. ] \)

  | %% measure 94
  e8 -. e32 \( [ g -. e -. <d\5> -. ] \)
  c8 -. <c-1>32 -. \( [ <e-4\5> -. <c-1> -. <as-3\6> -. ] \)

  | %% measure 95
  <b-4>8\6 -. \barre "IV" ""
  \tuplet 6/4 { <b-4>32 -. _\markup \italic \tiny "(sweep)"
               \( [ <ds-3> -. fs -. b -.
                    ds -. <fs-4> -. \glissando ] \) }
  <b-4\2>8 -. \pOff
}

finale = \relative c {
  \key e \major
  \dottedLines
  \key e \major
  \once \override TextSpanner.bound-details.left.text = \markup \upright \general-align #Y #CENTER \tiny "il Flauto "

  \pIV <gs'' b>16 -. \p _\markup \italic "dolce"
  \startTextSpan \( <fs a> -. \)

  \flutes
  <gs, e'>4
  <b fs'>8 <e gs>16 -_ <b fs'> -_

  <gs e'>8. q16 q4 \fermata
  \stopTextSpan
  \normalLines
}

music = {
  \time 2/4
  \intro
  \bar "||"
  \horns
  \pOff \flutesAgain
  \bar "||"
  \bibble
  \moreBibble
  \bar "||"
  \finale
  \bar "|."
}

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

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

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

\paper {
   indent = 8\mm
   after-title-spacing =
   #'((basic-distance . 0) (padding . 1.5) (stretchability . 3) (minimum-distance . 0))
   bottom-system-spacing =
   #'((basic-distance . 0) (padding . 1.5) (stretchability . 3) (minimum-distance . 0))
   ragged-last-bottom = ##f
   min-systems-per-page = 5
   max-systems-per-page = 5
   page-count = 5
}
