-- Le naufrage : funky piano jumpy hypnotique
-- Tags: Techno, funk, piano
-- Ready: 5/10
-- Intro lead piano
-- TODO: "Grande theorie" avant drop kick
resetCycles

do
  solo 1 -- KICK!
  solo 2 -- Hats rolling
  solo 3 -- LEAD piano
  solo 4 -- guitar riff
  solo 5 -- Théorie du naufrage
  solo 6 -- Glitches
  setcps (110/60/4)
  d1 -- KICK
    $ whenmod 16 10 (slow 2)
    $ superimpose ((# "glitch") . (|* gain 0.9))
    $ "k k k <k k [~ k] k*2>" # "[jazz,techno]"
    # gain 1
  d2
    $ superimpose (const
      $ stut' 4 "<s s e s>" (("q" <~) . (|* gain 0.85))
      $ "ho" # n "<[2|4|5] 1>"
      # gain (slow 16 $ range 0.5 0.85 saw)
    )
    $ juxBy "<<0.2 0.8> 0.5>" (rev . (hurry 2))
    $ note (stack [
      "0(3,8,<0 4>)",
      "4(<4!3 8>,8)"]
    ) # "hh"
    # gain (slow 8 $ range 0.9 1.2 saw)
  d3 -- Piano lead!
    $ whenmod 128 64 (# legato "<0.4 [0.4|0.8] 0.65 0.8>")
    $ whenmod 128 64 (often rev)
    $ whenmod 64 48 (# n "<2!7 <4 [4 2]>>")
    $ whenmod 16 12
      (off "e" (
          (|+ note 12)
        . (|* gain 0.85)
        )
    )
    $ s "fpiano"
    # n (slow 4 $ "<0 1>")
    # gain (slow 32 $ range 0.7 0.9 saw)
    # legato 1
    -- # room 0.5 # sz 0.8
    # pan (slow 4 $ "<0.5 0.6>")
  d4
    $ whenmod 4 3 (often (striate 4))
    $ slice 2 ("<0!4 1!4>")
    $ "fbass:35"
    # gain 0.85
    # crush (slow 32 $ range 16 6 saw)
    -- # room (slow 32 $ range 0 0.6 sine)
    -- # sz 0.5
    # cut 4
    # pan (slow 4 $ "<0.2 0.4>")
  d5 -- Macron : le naufrage
    $ every 4 (# waveloss 0)
    $ ply "<1!4 1 1 2 1 1 2 2 1!5>"
    $ ("q" ~>)
    $ slice 3 "2"
    $ s "macron:8/2"
    # begin "<0.1!4 0!4 0.5!3 0.8!5>"
    # waveloss (slow 16 $ range 20 30 sine)
    # gain (slow 16 "<0 0.75 0.8 0.9>")
    # cut 5
  d6
    $ "glitch:2(5,8)"
    # note (
      scale "major" "<0 2 4 12>" + (run 4)
    ) # gain 0.7

once $ "fpiano" # gain 0.8 # cut 1

once $ s "fguitar:36"
  # gain 0.75 # cut 42

once $ s "[jazz,techno]"
# gain 1
