--T0:  Hip-hop chill exutoire

do
  d1 $ s "<k!3 [~ k]> . <~ k?>" # "reverbkick" # release 0.3 # gain 0.8
  d2 $ hurry 0.5 $ degradeBy "<0 0 0.5>" $ s "~ s*<1 3 6>" # "sn:1" # gain 0.8 # hpf 500
  d3 $ fast ("<4!3 [<4 12> 12]>") $ s "dr" # gain 0.5
  d4
    $ chop 2
    $ note (scale "hexAeolian" "0 0*2 ~ <4!3 6> . <2 5 2 4>"
    - 21
    ) # s "supersaw" # voice 0.1
    # gain 0.7

  d5 $ silence
    $ fast "1 . 1 <1!8 2!4 3!4>"
    $ note (scale "hexAeolian" "0*2 ~ ~. <-1 2>"
    + "<c4'maj7 c4'maj9>" -- progression accords
    + (slow 8 $ "<12 0>") -- variations octave
    ) # s "superpiano"
    # velocity "0.5 0.4 ~ ~ . 0.5"
    # sustain 1
    # gain 0.6

-- T1: Raté ! techno

do
  let bars4 = 128
  let bars2 = 64
  let bars = 32
  let b2Mid = 48
  let bMid = 16
  let gKick = 0.8
  d1 -- KICK! Sait se faire attendre
    $ whenmod bars (bMid + 1) (# gain 0)
    $ whenmod bars bMid       (# gain ("1 0!3" * gKick))
    $ s "k k <<k [k|~k]> [k|~k]> <k k*2>" # "clubkick"
    # gain 0.75
    # lpf 1500
    # pan (slow 8 $ range 0.5 0.4 sine)
    # gain 0.8
  d2 -- Snares ternaires hurried, finissant en rush carré
    $ juxBy 0.6 rev
    $ whenmod bars (bars + 999) (const
      $ degradeBy (slow 2 $ "<0.5 0.25 0.125 0>") -- avance masqué
      $ fast "<4 8 16 [8 16 24 32]>" -- snare rush classique
      $ s "sn:1" # gain 0.8 # hpf 500
    )
    $ every' bars 0 (# gain 0)
    $ hurry "0.5 [1|2]" $ degradeBy "<0 0 0.5>"
    $ s "~ s*<1 3 6>"
    # "sn:1"
    # gain 0.8
    # hpf 500
    # pan 0.3
  d3 -- Drumroll ternaire
    $ fast ("<4!3 [<4 12> 12]>") $ s "dr"
    # gain (slow 32 $ range 0.7 0.9 sine)
  d4
    $ whenmod bars2 b2Mid (chop 2)
    $ note (scale "hexAeolian"
    (
      whenmod bars4 bars2 (0 -)
      "0 0*2 ~ <4!3 6> . <2 5 2 4>"
    |+| "<[0|2] [0 <0 2> 0] 0 [12|0]>")
    - 24
    ) # s "supersaw" # voice 0.1
    # gain (slow 64 $ range 0.4 0.6 saw)
    # pan 0.4
  d8 -- Claps au pont
    $ whenmod bars (bMid + 4) (# gain (slow (bMid - 4) $ range 0.5 1 saw))
    $ s "~ c*<1 2>" # s "cp" # gain 0
    # pan (range 0.25 0.75 rand)
  d9 -- Choeurs nappes secondaires
    $ whenmod bars4 bars2 (# gain 0.5)
    $ superimpose ((mask "t f!8")
    . (# sustain 2)
    . (|- note (slow 4 $ "<12 15 19 10>")))
    $ note (scale "hexAeolian"
    (
      "[0 0*2 ~ <4!3 6> . <2>]" + 7
    |+| "<[0|2] [0 <0 2> 0] 0 [-12|0]>")
    ) # s "moogBass"
    # gain 0
    # pan 0.8

  d5 $ silence
    $ fast "1 . 1 <1!8 2!4 3!4>"
    $ note (scale "hexAeolian" "0*2 ~ ~. <-1 2>"
    + "<c4'maj7 c4'maj9>" -- progression accords
    + (slow 8 $ "<12 0>") -- variations octave
    ) # s "superpiano"
    # velocity "0.5 0.4 ~ ~ . 0.5"
    # sustain 1
    # gain 0.6
