-- region First jam: Techno modulée
do
  setcps 0.5
  d1
    $ whenmod 16 12 (# silence)
    $ s "k(3,8)" # s "jazz"
    # gain 0.4
    -- # lpf (slow 10 $ range 20 2000 sine)
  d2
    $ juxBy 0.5 (rev)
    $ often ((# s "hc:2") . (|* gain 0.8))
    $ s "h(5,8)"
    # pan (slow 8 $ sine)
    # s "ho:[1|2|3]"
    # cut 2
    # gain 0.45
  d3
    $ fast "4 <8!3 16>"
    $ s "ifdrums:1"
    # gain 0.8

  d5 -- Random pistolets
    $ fast 2 $ degradeBy 0.5
    -- $ whenmod 64 0 (sometimes (# gain 0.9))
    $ often (ply 2)
    $ (|+ note "[-12|+6]")
    $ s "~ s(<3!3 5>,8,3)"
    # s "snare:57"
    # pan 0.6
    # gain 0.6
-- endregion

-- region Second jam: Electric jazz fever
do
  unsolo 1
  unsolo 2
  unsolo 3
  unsolo 4
  unsolo 7
  setcps 1.03
  d1 -- Breakbeat
    $ superimpose ( -- BEAT
      const $ fast 2 $ s "kick:8" # hpf 100 # gain 0.55
      )
    $ loopAt 4 -- Break
    $ slice 8 (
      every 4 (|> "0 7!7")
      "0 <1 6> 2*2 3 <4 5> <5 2> <6 1> 7"
      )
    $ s "break" # gain 0.8
  d2
    $ someCycles (often $ ply 2)
    $ every 4 (jux (0.125 ~>))
    $ s "~ sn:12" # gain 0.6
  d3 $ fast "<[8 4] 8!5 4!2>" $ s "dr" # gain 0

  d1 -- KICK!
    -- $ slow 2
    $ whenmod 32 24 (# n (slow 4 "<0 ~ ~ 0>"))
    $ note "0 <0!3 0*2>" # s "jazz"
    # lpf (slow 100 $ range 75 200 saw)
    # gain 0.6
  d3 -- bass
    $ whenmod 32 16 (slice 4 "0 1!3")
    $ jux id
    $ often (off 0.125 (|+ note "[0,7?]"))
    $ slow 2
    $ note (
      scale "major" (
        cat [
          -- " 1  1 ~ . ~ [~ 0]",
          -- "<0!3 5> [<0!4 12!4> <1!3  -2>] ~ ~ . ~  "
          "1 <1!3 3!2> ~ . 1 <1 3!6 5> ~"
        ]
        + "[0,7]" -- gamme
      )
    )
    # s "bass3"
    # pan 0.4
    # gain 0.34
  d2 -- hit roll
    $ superimpose (
      fast "2 <1!3 2>"
      . (# s "ifdrums:1")
      . (# gain 0.8)
    )
    $ s "<h*4 h*4 h*4 [d*4 ~]>"
    # s "hh"
    # release 0.5
    # pan (range 0.2 0.8 perlin)
    # gain (slow 40 $ range 0.8 1.1 perlin)
  d4
    $ someCyclesBy 0.75 (juxBy 0.2 rev)
    $ sometimes (hurry 2)
    $ sometimes (off (1/8) id)
    $ s "d*4"
    # s "electro1" # n "[3 . [2|3]]"
    # gain 0.0
  d7 -- claps
    $ whenmod 4 3 (# room 0.5)
    $ s "<[~ cp]!3 [~ cp . cp ~]>"
    # gain (slow 128 $ range 0.5 0.8 saw)
    # room (slow 10 $ range 0.2 0.5 sine)
    # size (slow 20 $ range 0.2 0.5 sine) # dry 0.65


d5
$ someCycles (fast 2)
-- $ whenmod 32 16 (# silence)
$ whenmod 32 4 (# gain 0.8)
$ every 4 (# silence)
$ s "reverbkick*2"
# gain 0.7

once $ s "macron:7" # gain 1.4 # cut 5
-- endregion

-- region Third round: Planant qui resonne
do
  setcps 0.5
  d1 -- Kick Irregulo-correct juxroomé
    -- $ juxBy 0.2 ((# room 0.2) . (|* gain 0.8))
    $ s "jazz(4,8)" # gain (range 0.55 0.6 perlin)
  d2
    $ sometimesBy "0 0.5" (fast 2)
    $ fast ("<1 1 [2 1] 2>" * "<4!3 8>")
    $ s "ifdrums:1"
    # gain (slow 16 $ range 0.4 0.65 sine)
    # room 0.11
    # sz 0.6
  d3 -- hats suivis reverb
    $ almostAlways (jux (# dry 1.1))
    $ s "hh([<6!2 12!2> <12!3 8>],16)"
    # gain 0.75
    # room 0.4
    # size (slow 64 $ range 0.2 0.85 cosine)
    # dry (slow 8 $ range 0.5 2 sine)
  d7 -- macron gabber guerre
    -- $ superimpose (
      -- (# octersub 8) . (# octersubsub 2)
    -- )
    -- $ every 2 (choose [0,0.125] ~>)
    $ n "0*2"
    # s "macron:0" # begin 0.65
    # gain 0.6
  d8 -- pivert
    $ often (stut 5 0.9 0.05)
    $ s "birds3:6(<1 1 3 1> ,8)"
    # gain 0.9
  d9 -- jambon fromage
    $ slow 4
    $ whenmod 8 6 (
      (# s "~ macron:11")
      . (# cut 19)
      )
    $ often (superimpose ((# squiz 2) . (|* gain 0.9)))
    $ slice 4 ("0 <0!3 1>")
    $ s "macron:7"
    # gain 0.8
    # room 0.5
    # size 0.2
    # speed (range 0.8 0.95 perlin)
    # cut 9

  d4 $ silence

once $ s "macron:8" # gain 0.8
