-- region Touchés par la grace: techno-gospel
-- Tags: Techno, gospel, funk
resetCycles
-- endregion

do
let gG a = (gain ("^77" * a)) -- gain Global
let gM' l h a = (gG (range l h a)) -- gain Modéré
let gM a = (gM' 0.2 0.8 a) -- gain Modéré doux
let gDJF = (# djfbus 1 (range 0.1 0.9 "^49"))
let novaOn  ch pat = (sometimesBy ch pat)
let novaOff ch pat = sometimesBy (1 - ch) (pat)
let g = (gDJF)
setcps (120/60/4)
d1 -- Kick regulier degradé
  $ g
  $ whenmod 16 12 (mask "t(1,4)") -- Respire
  -- $ whenmod 16 8 ( -- Double degradé
      -- sometimesBy "<0!2 0.25 [0.25 0.5]>" (fast 2 . degradeBy 0.2))
  -- $ whenmod 8 6 (# lpf 200)
  $ "k k k <k k*[1|2|3|4]>"
  # "[kick:5,house,jazz]"
  # note 2
  # gM' 0 1.4 "^78"
d2 -- Cymbales gravitantes
  $ g
  $ novaOn "^42" (<| "h*16")
  $ whenmod 16 8 (jux (rev . (hurry "<2!3 0.5>")))
  $ degradeBy "0 <0.5!6 0.25!2>!7" $ "ho:1*4 hc:3*4"
  # note ("<0!<3 2> -4 -8 <[-8 -4] -12>>")
  # room 0.2 # sz 0.4
  # pan (slow 16 $ range 0.8 0.4 sine)
  # gM' 0 1.5 "^79"
d3 -- Drumroll ma foi bien classique
  $ g
  $ fast "<4 8 [8 . 4 8] 8 <16 [16 4]>>"
  $ "dr"
  # pan (slow 16 $ range 0.9 0.4 cosine)
  # gM' 0 1.5 "^80"
d4 -- Bassline "maybe mad smirk smirk"
  $ g
  $ loopAt 2
  -- FIXME(#94) d4 drives more controls than the grid gives it (BT4 + BL4). ^58 now belongs to another orbit, so this step STILL FIRES ACROSS COLUMNS — turning ^58 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 d4's own control with gSel.
  -- FIXME(#94) d4 drives more controls than the grid gives it (BT4 + BL4). ^58 now belongs to another orbit, so this step STILL FIRES ACROSS COLUMNS — turning ^58 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 d4's own control with gSel.
  $ slice 8 (
    stack [
    (sometimesBy "^44" (>| "0")
      "0 1 2 3 4 5 6 7*<1 2 4 1>"),
    (degradeBy (1 - "^76") $ "0(3,8)"), -- Megamask!
    (degradeBy (1 - "^58") $ "0 0 0 0") -- MULTIMASK!
  ]
  )
  $ s "fbass:8"
  # gM' 0 2 "^81"
  # cut 6
  # crush (range 16 5 "^32")
d5 -- Chopped choir
  $ g
  $ sometimesBy "^57" (slow 2) -- TODO end: Rarefy
  $ slice 8 (
    whenmod 16 12 (|> "<0!2 2!2>*8") $
    whenmod 16 8 (|> "0*4") $
    ("0 1 2 3") -- Welcome!
    -- "0 <1!2 0!2> <2 7 6 3> <3 5>" -- WELCOME
    -- "0 1 <0 2> [3 4]" -- Choeurs fous!
  )
  $ every' 4 3 (superimpose (# n 1) . (# legato "<1!3 2>"))
  $ "pray"
  # cut 5
  # legato 1
  # pan "0.4 0.6"
  # gM' 0 1.3 "^82"
d7 -- Claps répartis
  $ g
  $ novaOn "^59" (fast 2)
  $ jux (# lpf 2000)
  $ note "~ <-4!3 -8>" # "clap"
  # hpf 2000
  # gM' 0.4 1.5 "^83"
  # pan (range 0.3 0.7 perlin)



once $ s "fbass:10" # gain 0.8
