setcps 0.62

do
  let bars = 4
      key = "8"
      rightHand = "[4 -3]      [0 . ~ [0 -3]] . [~ -8]       [7 5 4 0]"
      leftHand =  "[0 9 12 16] [4 12 16 19]   . [5 12 17 19] [2 12 17 16]"
      cutPreEnd = "1!4 1 <1!7 0> <1!3 0> 0"
      cutPostBegin = "[0 <1!3 0>] 1!7"
  d6 -- Piano, with cutting progression
     $ slow bars
     $ degradeBy (slowcat [
       "1",
       cutPreEnd, cutPreEnd,
       cutPostBegin,
       "0.75", "0.5", "0.25", "0",
       "0", "0"
       ])
     $ stack [
      degradeBy (slow 4 $ "<1 0 [0 1] 1>") $
      n (rightHand + key+ "<24 36>/2"),
      degradeBy (slow 4 $ "<0 [1 0.5] 0 0>") $
      n (leftHand + key)
      ]
     # "superpiano"
     # velocity 0.5
     # octave "3"
     # sustain "[2 0.7]*4"
  d1  -- Beat slowly varying
    $ s "k(<3!3 5>,8,<0!4 3!3 0>)"
    # s "kick:5"
    # hpf (slow 16 $ range 50 150 sine)
    # gain 0.6
  d2
    $ whenmod 8 6 (hurry 2)
    $ whenmod 8 4 (often (stut 4 0.8 (1/16)))
    $ s "~ . <s!3 s*2> ~"
    # "snare:20"
    # gain 0.8
  d3 -- Drumroll
    $ fast "<<4!3 <16 32>> [16 <16 8>]>"
    $ s "drum:2"
    # gain (slow 8 $ range 0.8 1 sine)
  d4 -- Bass
    $ slow bars
    $ rarely rev
    $ bite 4 (
      "[0, ~ ~ <3 [3|2|1]>*4 1]"
    )
    $ note (leftHand + key)
    |- note 36
    # s "bassWarsaw"
    # gain 0.9
  d5 -- Choir
    $ whenmod 4 2 (|+ note 12)
    $ slow (bars * 2)
    $ bite 4 "0"
    $ note (leftHand + key)
    |- note 36
    # s "moogBass"
    # gain (slow 32 $ range 0.7 0.9 saw)


---- # Initial

setcps 0.62
solo 2


do
  let bars = 4
      key = "8"
      rightHand = "[4 -3]      [0 . ~ [0 -3]] . [~ -8]       [7 5 4 0]"
      leftHand =  "[0 9 12 16] [4 12 16 19]   . [5 12 17 19] [2 12 17 16]"
  d1
     $ slow bars
     $ stack [
      n (rightHand + key+ "<24 36>/2")
      # sustain 1, -- TODO find right value
      n (leftHand + key)
     ]
     # "superpiano"
     # velocity 0.65
     # octave "3"
     # sustain "[2 0.7]*4"
