import Sound.Tidal.ParVagues.Control


resetCycles

do
setcps (80/60/4)
let gF = (whenmod 32 24 (# djf (slow 8 $ range 0.15 0.5 sine)))
let f1 = (# djfbus 1 (range 0.05 0.95 "^49"))
let f2 = (# djfbus 2 (range 0.05 0.95 "^29"))
-- region Params Rhodes
let modIndex = pF "modIndex"
-- endregion
d1 $ f1 $ gF -- KICK
  $ midiOn "^41" (<| "k*4 . k k k k*<1 2>") -- Run
  -- FIXME(#94) d1 drives more controls than the grid gives it (BT1 only — BL1-3 are the family mutes). ^42 now belongs to another orbit, so this step STILL FIRES ACROSS COLUMNS — turning ^42 for its new owner also moves this. NOT commented out: this is a `$`-step and something above it is a partial application waiting for it, so removing it would stop the whole block compiling. Fold it onto d1's own control with gSel.
  -- FIXME(#94) d1 drives more controls than the grid gives it (BT1 only — BL1-3 are the family mutes). ^42 now belongs to another orbit, so this step STILL FIRES ACROSS COLUMNS — turning ^42 for its new owner also moves this. NOT commented out: this is a `$`-step and something above it is a partial application waiting for it, so removing it would stop the whole block compiling. Fold it onto d1's own control with gSel.
  $ midiOn ("^42" - "^41") (<| "k <k!4 ~ k!3> k k*<1 <2 4>>")
  $ midiNo "^41" "^42" (<| "k*<1 1 2 1 2 2 2 1> . k(5,8)")
  $ "[hh27:6,jazz]"
  # midiG' "^78" 0 2
  # room 0.3 # sz 0.5 # dry 0.9
d2 -- Breakbeat
  $ f1 $ gF
  $ midiOn "^42" (fast 4 . often (scramble 2))
  -- $ sometimesBy "0 <0.5!3 0.95>" (ply "``[2|4]")
  $ slice 8 "0 <1 ~> 2*<2 1> 3" $ "break"
  # cut 2
  # midiG' "^79" 0 1.75
d3 $ f1 $ gF
  $ midiOn "^43" (fast 2)
  $ "d ~ ~ d d ~ d <~!3 d>"
  # "snare:22"
  # speed (range 0.5 1.5 "^31")
  # midiG' "^80" 0 2
d4 $ f1  -- Bassline
  $ superimpose ( -- la caution? :)
    (# crushbus 41 (range 10 4.5 "^32"))
    . (# legato 4)
    . mask "t f!7"
  )
  $ midiOn "^76" (-- + Arps aigus!
    superimpose (
      often (off "h" rev)
      . (|+ note (
        "[0 <12 <12 24>>]" -- spread
        + "0(5,8)" |+ "0 7"
        + 12
      ))
      . (|* gain 0.7)
    )
  )
  $ note ("<0 [0 . 0 [0 3] 5 ~]>")
  # "bass1"
  # room 0.25 # sz 0.8
  -- # orbit 4
  # pan 0.2
  # midiG' "^81" 0 1.8
d5 $ f2  -- fmono
  $ midiOn "^89" (chop "<8!3 [8 16]>")
  $ (# lpf (range 10000 5000 "^33"))
  $ slice 8 (
    "0 <1 1 0 0*2> 2 3*<1 <2 4>>" +
    "<0 3>")
  $ "fmono:40"
  # cut 4
  # crushbus 51 (range 12 1.85 "^33")
  # midiG' ("^82" - 0.125 * "^33") 0 1.2
  # room 0.3 # sz 0.8 # dry 1
d9 -- Maracas Hats
  $ f1 $ gF
  $ fix (
    midiOff "^60" (slow 4)
    . whenmod 8 6 (fast "<2 [2 4]>")
    . (>| "hh*[<4 8 8 4> 8 8 16]")
    . (# cut 91)
  ) ("a")
  $ fix (
      midiOff "^60" (fast 2 . (<| "~ c"))
    . midiOn  "^60" (every' 4 3 (fast 2) . (<| "c*[8 16]"))
    . (# "hh27:2")
    ) ("b")
  $ "[a,b]"
  # orbit 9
  # midiG' "^84" 0.2 1.5
d6 -- Pwm steps
 $ f2
 $ whenmod 32 16 (scramble 2)
 $ note (
   "0(<2 2 3 5>,8) . ~ 0*<2 4 2 [8 4]>"
   + "0 <0 12>"
   + (arp "up" "<c'minor'4!3 c'maj'4>")
   + "-24" -- Base gamme
 )
 # "superpwm"
 # voice (range 0.01 2 "^34")
 # pan 0.8
 # room 0.5
 # sz 0.4
 # midiG' "^83" 0 1.2
d7 -- Arps FMRhodes1
  $ f2
  $ superimpose (arp "down up" .
  (|+| note ("c'maj'2 <c'maj'4>" + "0 12" + 12)))
  $ note "<c4 ds4 c4 b3>/2"
  # "FMRhodes1"
  # pan 0.3
  # modIndex (range 0 100 "^35")
  # room 0.6 # sz 0.8
  # midiG' "^55" 0 1.5
d10 $ f1
  $ midiOn "^92" (<| "[~ c]*[4 <4 8 4 [8 4]>]")
  $ midiOff "^92" (<| "~ c")
  $ "clap"
  # speed (range 0.5 1.5 "^56")
  # midiG' "^84" 0 1.7



-- region Sandbox

d3
  $ whenmod 4 2 (someCycles $ ply 2)
  $ slice 4 "<0 1 0 1 2 3 2 3>" $ "break:1" # gain 0.85

d4
  $ note (
    scale "lydian" ("0 4 3 <4 1 5 3>" + "c'maj"
    + "<0 0 1 1 2 2 3 3>")
    - 12
  )
  # "FMRhodes1" # gain 0.9

once
