\version "2.22.1"
\language "english"

\header {
  % title = "Rach 1 Snippets"
}

\paper {
  system-system-spacing = #'((basic-distance . 0.1) (padding . 4))
}

global = {
  \key fs \minor
  \time 4/4
  \set Staff.printKeyCancellation = ##f
  \numericTimeSignature
  \compressEmptyMeasures
  \omit Voice.StringNumber
  \override TupletBracket #'bracket-visibility = #'if-no-beam
  \override MultiMeasureRest.expand-limit = #3
  \override Score.ChordName.font-name = #"Noto Serif"
  \override Score.ChordName.font-size = #0
  \override Score.LyricText.font-name = #"Noto Serif"
  \override Score.LyricText.font-size = #0
}

mainTheme = \relative c' {
  \global
  fs4 gs a cs | bs e2 ds4 |
  cs ds e gs | fss b2 as4 | \break
  a! ds, ~ ds8 e fs8. g16 | g4 cs, ~ cs8 d! e8. fs16 |
  fs4 \tuplet 3/2 { fs'8 e d } cs4 \tuplet 3/2 { b8 a gs } |
  gs4 \tuplet 3/2 { fs8 e d } gs,4 cs |
  \bar "||" fs,4 r4 r2 |
  \bar "|."
}

\parallelMusic #'(cadenzaR cadenzaL) {
  R1*9 |
  R1*9 |

  \clef treble \tuplet 3/2 4 { a''8 ds, cs ~ cs gs fs ds cs ds fs gs cs } |
  \clef treble r4 <ds \tweak color #green fs>2 <cs ds fs \tweak color #green gs>4 ~ |

  \tuplet 3/2 4 { fs8 cs gs ~ gs fs ds cs fs, ds' fs gs cs } |
  q4 <b ds \tweak color #green a'>2  <a ds fs \tweak color #green cs'>4 |

  r8 \tuplet 3/2 { fs,16 gs b } a2.\trill |
  <<
    { \tweak color #green bs'4 \tweak color #green e2 \tweak color #green ds4 } \\
    { <gs,, fs' bs>1\arpeggio }
  >> |

  \tuplet 3/2 4 { a8 fs ds cs gs fs fs' ds cs } gs16 fs ds cs' |
  \clef bass r4 <ds \tweak color #green fs> <cs ds fs \tweak color #green gs> <b ds \tweak color #green a'> |

  r8 \tuplet 3/2 { fs,16 gs b } a2.\trill |
  <<
    { \tweak color #green df'4 gf2. } \\
    { <f,, ef' a df>1\arpeggio }
  >> |

  \break

  <<
    { ds,4 e2 f4 ~ } \\
    { a,2. a4 }
  >> |
  <<
    { ds'4( e2 f4) } \\
    { \stemUp \once \override NoteColumn.force-hshift = #1.2 cs2( c) } \\
    { \stemDown fs,2. f4 }
  >> |

  <<
    { f'4 gf af2 ~ } \\
    { bf,2 b4 c }
  >> |
  <ef df' gf>2 <d fs'> |

  <<
    { <df af'>4 a'2( bf4) } \\
    { s4. \stemUp d,8 ef e4 f8 } \\
    { s2 \stemDown c2 }
  >> |
  <<
    { \change Staff = "secondR" \stemDown gf'2\glissando \change Staff = "secondL" \stemUp gf } \\
    { <af,, af' ~ >2 af' }
  >> |

  \key bf \minor
  <<
    { bf'4 c8 df d4 s4 } \\
    { <f,, df' f>\arpeggio r8 s4 }
  >> |
  \key bf \minor
  \tuplet 6/4 4 { <df, df,>8 af'16 f' af df } f4 s2 |

  \break


}

\parallelMusic #'(movementTwoR movementTwoL) {
   \key b \minor
  \tuplet 3/2 { \stemUp ds8 e8. fs16 } \stemNeutral fs8 b,  ds fs \tuplet 3/2 4 { g4 a8 } |
  \clef bass \key b \minor <<
    {
       \tuplet 3/2 4 { \change Staff = "movementTwoR" \stemDown \tupletDown c'8 b8. a16\glissando \tupletNeutral \change Staff = "movementTwoL" \stemUp a8 g fs ~ fs e ds ~ ds a b, ~ \tupletNeutral }
    } \\
    { \tuplet 3/2 4 { b8 <fs' a> ds' } <a b>2 r4 }
  >> |

  \tuplet 3/2 4 { a8 g8. fs16 fs4 ~ fs16 e } \tuplet 5/4 4 { fs d fs cs e fs c fs b, e } |
  \tuplet 3/2 { b,8 g' d'! } \clef treble
  <<
    {
      <<
        { \tuplet 3/2 4 { fs b d, fs gs d <a fs'> a' d, } } \\
        { \omit TupletNumber \omit TupletBracket \tuplet 3/2 4 { s8 b'4 s8 gs4 s8 a4 } }
      >>
    } \\
    { gs,2 a4 }
  >> |

  \tuplet 3/2 4 { <\tweak color #red as, \tweak color #red fs'!>4 bf8 ef f8. gf16 bf8 gf'4 ~ gf8 ef df } |
  \clef bass \tuplet 3/2 4 { <ef, df' gf>8 bf'8 gf' }
  <<
    { ef'4 s4 gf'4 } \\
    { \tuplet 3/2 4 {  ef,8 \clef treble gf,8 ef' bf' bf, gf' } gf'4 }
  >> |
}

staffOne = \new Staff {
  \mainTheme
  \break
}

pianoStaff = \new PianoStaff <<
  \set PianoStaff.connectArpeggios = ##t
  \new Staff = "secondR" \with {
    midiInstrument = "acoustic grand"
  } \relative c'' \cadenzaR
  \new Staff ="secondL" \with {
    midiInstrument = "acoustic grand"
  } { \relative c' \cadenzaL }
>>


chordExceptionMusic = {
  <c e g b d'>1-\markup { "maj9" }
  <c e g b fs'>1-\markup { "maj7" \sharp "11" }
  <c ef f g bf>1-\markup { "m7sus4" }
  <c ef gf bff>1-\markup { "°7" }
  <c ef gf bf>1-\markup { \super { "ø7" } }
  <c e g d'>1-\markup { "add9" }
  <c ef g d'>1-\markup { "m(add9)" }
  <c e fs as>1-\markup { \super { \sharp "11" \sharp "13" } }
  <c g>1-\markup { "5" }
  <c e g bf>1-\markup { "7" }
  <c e g b>1-\markup { "maj7" }
  <c ef g bf>1-\markup { "m7" }
  <c f g>1-\markup { "sus4" }
  <c d g>1-\markup { "sus2" }
  <c e g bf df'>1-\markup { "7" \super { \flat "9" } }
  <c e g f'>1-\markup { "add11" }
  <c e gs bf df'>1-\markup { "+7" \super { \flat "9" } }
}

chordExceptions = #(append
  (sequential-music-to-chord-exceptions chordExceptionMusic #t)
  ignatzekExceptions
)

chordValues = \chordmode {
  \global
  \set chordNameExceptions = #chordExceptions
  \set majorSevenSymbol = \markup "maj7"
  fs2:m ds:1.3-.5-.7 | gs2:1.3.5+.7.9- gs:7 |
  cs2:m as:1.3-.5-.7 | ds2:1.3.5+.7.9- ds:7 |

  gs:1.3.5.7.9- cs4:m a | fs2:1.3.5.7.9- b4:m e:7 |
  b2:m6/gs b:m6/a | b:m6 b4:m6/d cs:7 |

  fs:m
}

chordNames = \new ChordNames {
  \set chordChanges = ##t
  \set chordNameExceptions = #chordExceptions
  \chordValues
}

#(set-global-staff-size 18)

\score {
  <<
    \chordNames
    \staffOne
    \pianoStaff
  >>
  \layout {

    indent = 0
    \context {
      \Score \omit BarNumber
    }
    \context {
      \Staff \RemoveEmptyStaves
      \override Glissando.minimum-length = #4
      \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods
      \override Glissando.thickness = #2
      \override VerticalAxisGroup.remove-first = ##t
    }
  }
}


\score {
  <<
    \overrideProperty Score.NonMusicalPaperColumn.line-break-system-details #'((extra-offset . (0 . 0)))
    \new PianoStaff <<
      \set PianoStaff.connectArpeggios = ##t
      \new Staff = "movementTwoR" \with {
        midiInstrument = "acoustic grand"
      } \relative c'' \movementTwoR
      \new Staff ="movementTwoL" \with {
        midiInstrument = "acoustic grand"
      } { \relative c' \movementTwoL }
    >>
  >>
  \layout {
    indent = 0
    \context {
      \Score \omit BarNumber
    }
    \context {
      \Staff \RemoveEmptyStaves
      \override Glissando.minimum-length = #4
      \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods
      \override Glissando.thickness = #2
      \override VerticalAxisGroup.remove-first = ##t
    }
  }
}

\parallelMusic #'(movementThreeR movementThreeL) {
  \key fs \minor \time 12/8
  \change Staff = "movementThreeL" \stemUp e,16 b' e b' \change Staff = "movementThreeR" \stemDown \ottava #1 e b' e8 \ottava #0
    r8 r8 r8 \stemUp \override NoteHead.color = #blue <gs,, c e>16[ s16 <gs c e>16] s16 <gs c e>8 r8 r8 |
  \key fs \minor
  s4. r4. r8 \change Staff = "movementThreeR" \stemDown s16
    \override NoteHead.color = #blue
    <g'' b ds>16[ s16 <g b ds>16] \change Staff = "movementThreeL" r4. |

  r8 \stemUp <gs c e>16[ s16 <gs c e>16] s16 <gs c e>8 \revert NoteHead.color \stemNeutral r8 r8 r8 e'16 c a e f g <a a'>8 <bf bf'> |
  r8 \change Staff = "movementThreeR" \stemDown s16 <g b ds>16[ s16 <g b ds>16] \revert NoteHead.color
  \change Staff = "movementThreeL" r4. r8 \stemNeutral e16 c a e f g a8 bf |

}

\score {
  <<
    \overrideProperty Score.NonMusicalPaperColumn.line-break-system-details #'((extra-offset . (0 . 1)))
    \new PianoStaff <<
      \set PianoStaff.connectArpeggios = ##t
      \new Staff = "movementThreeR" \with {
        midiInstrument = "acoustic grand"
      } \relative c'' \movementThreeR
      \new Staff ="movementThreeL" \with {
        midiInstrument = "acoustic grand"
      } { \relative c' \movementThreeL }
    >>
  >>
  \layout {
    indent = 0
    \context {
      \Score \omit BarNumber
    }
    \context {
      \Staff \RemoveEmptyStaves
      \override Glissando.minimum-length = #4
      \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods
      \override Glissando.thickness = #2
      \override VerticalAxisGroup.remove-first = ##t
    }
  }
}

\parallelMusic #'(rachThreeR rachThreeL) {
   \time 4/4
  \override Beam.auto-knee-gap = #4


  \numericTimeSignature \key ef \major
    r8 ef32 e f fs
      \override NoteHead.color = #blue <ef g>8[ r16 \change Staff = "rachThreeL" <bf d fs>16] \change Staff = "rachThreeR"
      <ef g>8[ r16 <ef g>32 \change Staff = "rachThreeL" <d fs>] \change Staff = "rachThreeR"
      <ef g>16 \change Staff = "rachThreeL" <d fs bf> \change Staff = "rachThreeR" <ef g cf> \change Staff = "rachThreeL" <bf d fs> \change Staff = "rachThreeR" |
  \numericTimeSignature \key ef \major
    r8 cf'32 c df d s2.  |

  <ef g>16[ q32 \change Staff = "rachThreeL" <d fs> \change Staff = "rachThreeR" <ef g>8] ~
    q16[ \change Staff = "rachThreeL" <cf d fs> \change Staff = "rachThreeR" <ef g>8] ~
    q16 \change Staff = "rachThreeL" <bf d fs> \change Staff = "rachThreeR" <ef g> \change Staff = "rachThreeL" <a, df f> \change Staff = "rachThreeR"
    <ef' g> \revert NoteHead.color f32 fs g16 f32 fs |
    s2. r16 <af c> ef' <g, b> |

}

\score {
  <<
    %\overrideProperty Score.NonMusicalPaperColumn.line-break-system-details #'((extra-offset . (0 . 10)))
    \new PianoStaff <<
      \set PianoStaff.connectArpeggios = ##t
      \new Staff = "rachThreeR" \with {
        midiInstrument = "acoustic grand"
      } \relative c'' \rachThreeR
      \new Staff ="rachThreeL" \with {
        midiInstrument = "acoustic grand"
      } { \relative c' \rachThreeL }
    >>
  >>
  \layout {
    indent = 0
    \context {
      \Score \omit BarNumber
    }
    \context {
      \Staff \RemoveEmptyStaves
      \override Glissando.minimum-length = #4
      \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods
      \override Glissando.thickness = #2
      \override VerticalAxisGroup.remove-first = ##t
    }
  }
}