import Sound.Tidal.ParVagues.Control

-- TODO: Rework and record :)
-- Reboot: From Dark Money to motivating beats
do
setcps (80/60/4)
let whenIntro    pat = someCyclesBy "<t!8 f!24>" pat
let whenNotIntro pat = someCyclesBy "<f!8 t!24>" pat
let whenBrk      pat = whenmod 16 10 pat
let whenNotBrk   pat = someCyclesBy "<t!10 f!6>" pat
let whenBrkLPF  = whenBrk (# lpf "<400 200 100 50 0 0>")
let gDJF = (# djfbus 1  (range 0.05 0.95 "^49"))
let g = (gDJF)
d1 $ g -- Kick
  $ whenBrkLPF
  $ whenNotBrk (# sz "<0.8 0.9 0.95 0.99>")
  $ midiOn "^41"  (<| "k*4 . [k k] <k k*2 k [~ k]>")
  $ midiOff "^41" (<|  "k . k(<3 <5!3 [5 8]>>,8,<0!5 3 0 3>)")
  $ "[reverbkick,jazz]"
d2 $ g -- Contretemps snare
  $ whenBrkLPF
  $ "~ s ~ <~!4 s!12>"
  # "snare" # n "[40,52]"
  # note (-4)
  # gain 0.8
d3 $ g  -- Drumroll fantome
  $ whenBrk (slow "<2 2 4 4 8 8 16 16>")
  $ midiOn "^44" (fast "4 2")
  $ "d*<4 4 8 [4 . <4 16> 16]>" # "[drum:2,cpu:2]"
  # room 0.6 # sz 0.9 # dry 1.01
  # midiG' "^80" 0 1.2
d4 $ g -- A slice of bass
  $ midiOn "^89" (chop 8)
  $ slice 4 "<0 0 [0 1] 3 0*2 [0 1] [3 2] [3*2 3*<2 4>]>"
  -- $ slice 4 "<0!8 1!8 2!8 3!8>*<1!4 2 1 2 4>"
  $ "fbass:8"
  # gain 0.7
  # crushbus 41 (range 8 2.9 "^53")
  # room 0.2
  # pan 0.2
  # cut 4
d5 $ g -- Climbing guitar
  $ whenmod 64 32 (superimpose (
      slice 4 "0*<1 2 1 <2 4>>" .
      (# cut 51) . (|+ note 12)
      . (|* gain (range 0.5 1.5 "^34"))
  ))
  $ slice 4 (
    (whenmod 8 4 (fast 4)) $
    "<0 1 2 3>"
    )
  $ "fguitar:11"
  # cut 5
  # pan 0.4
  # gain 0.5
  # crushbus 51 (range 8 1.9 "^54")
d6 $ g -- Glitchy piano!
  $ whenmod 8 4 (someCyclesBy "0 1 . <0 0.25 0.5 1>" rev)
  $ midiOn  "^59" (slice 8 $ "0 1(<1 3 5 <2 4 8>>,8) 2 3*2" + "<0!8 4!8>")
  $ midiOff "^59" (slice 8 $ "0 1 2 3*2" + "<0!8 4!8>")
  $ "fpiano:11"
  # cut 6
  # pan 0.4
  -- # midiG' "^83" 0 1
d7 $ g -- Sirene
  $ note (
    slow 8
    $ arpeggiate
    $ "d2'min'4" + "<0!8 12!8>"
  )
  # "supersiren"
  # room 0.3 # sz 0.6
  # gain 0.5
  # crushbus 71 (range 8 0.9 "^56")
  # cut 7
d8 $ loopAt 2
  $ "break:12"
  # gain 0.8

  "11" -- Hello :)ô --
