resetCycles
-- TRAPPED IN SPACE: Glitchy trap beat

do
setcps (120/60/4)
let whenTrap = (whenmod 32 16)
let prog = "<0 0 0 0 1 2 0 0 1 2 1 2 3 4 1 0>"
let modIndex = pF "modIndex"
d1
  $ whenTrap (|<| "k ~ ~ k . ~")
  $ "k ~ ~ k . ~"
  # "reverbkick"
  # lpf 1500
  # orbit 0
  # legato 2
  # room 0.2 # dry 1
  # gain 0.85
d2
  $ "~ hh27:9"
  # lpf 1000
  # room 0.87 # dry 0.99
  # gain 1
  # orbit 1
d3
  $ whenTrap (<| "<~ h*4> <~ h*8>")
  $ "h*<4 8> h*<8!3 16>"
  # "[hh27:3,dr]"
  # gain (slow 16 $ range 0.5 0.8 saw)
  # lpf 4500
  # orbit 0
d4
  $ whenTrap (
    (|+ note 12)
    . (# hpf 1500)
    . (# lpf 10000)
    . (# crush (slow 16 $ range 8 3.5 saw) -- Sync whenTrap
    )
  )
  $ whenmod 4 3 (scramble 6)
  $ whenmod 4 3 (scramble 6)
  $ whenmod 8 4 rev
  $ mask "<t f>"
  $ note (scale "aeolian" (
    "<~!3 5 ~!4> . 0 1 3 2 0"
    + "[0]"
    + prog
  ) - 24)
  # "arpy"
  # gain (slow 24 $ range 0.55 0.65 perlin)
  # lpf 500
  # room 0.3
  # orbit 4
  # crush 4
d5
  $ whenTrap (
    (# crush (slow 16 $ range 10 5 saw)) -- Sync 16/whenTrap
    . (|+ gain (slow 16 $ range 0 0.15 saw)) -- Sync whenTrap
  )
  $ note (scale "aeolian" (
    "0 . 0 [0 1]"
    + prog
    + "[0,7]"
    ) - 24)
  # orbit 4
  # "supersaw"
  # voice 0.1
  # pan 0.2
  # gain (slow 16 $ range 0.35 0.65 perlin)
d6
  $ note (scale "aeolian" (
    whenmod 16 9 (+ "<0 -1 -2 -4>")
    "0*[16 8]"
    ))
  # "hh27:4" -- Clochettes
  # gain (slow 16 $ range 0.5 0.8 saw)
d7 -- ARPS <3
  $ degradeBy (slow 8 $ range 0.8 0.2 saw)
  $ fast "1 2"
  $ arp "pinkyup"
  $ note (scale "aeolian" (
      "<0 ~> 0"
      + prog)
      + "0 -12"
  )
  # "FMRhodes1"
  # modIndex "[0,5,10]"
  # pan 0.6
  # gain 0.9




once $ "hh27:0" -- Drum metal echo
  -- # gain 1.5

once $ "hh27:1" -- Ho lo
once $ "hh27:7" -- Ho hi
once $ "hh27:10" -- Ho hi soft

once $ "hh27:2" -- Maracas fermées
once $ "hh27:9" -- Maracas fermées lo

once $ "hh27:3" -- Maracas ouvertes / balai
once $ "hh27:8" -- Same plus aigu

once $ "hh27:4" -- Clochettes

once $ "hh27:5" -- Kick neige
once $ "hh27:6" -- Kick sec

once $ "hh27:12" -- Snare lo
once $ "hh27:11" -- Snare hi