-- Sel Marin
-- Le grand air du large
-- Ses crabes mécaniques
-- Ses baleines mélancoliques

do
setcps (120/60/4)
let width = pF "width"
let gF1 =  (# djfbus 1 (range 0.05 0.95 "^49"))
let gF2 = (# djfbus 2 (range 0.05 0.95 "^50"))
let gF3 = (# djfbus 3 (range 0.05 0.95 "^51"))
let gMask = (midiOn "^41" (mask "t . <f t f <f t>> <t f f <t f>>"))
let gMute = (midiOn "^73" (mask "f*16"))
let gMute2 = (midiOn "^74" (mask "f*16"))
let gM = gMask . gMute
let gM2 = gMask . gMute2
d1 $ gF1 $ gM -- Kick "Underwater Rave"
  $ midiOn "^42" (<| "k k <k!7 ~> <k k*<2 2 2 4 2 4 [4 8] [4 8 16]>>")
  $ midiOff "^42" (<| "k*<1!8 2 1!7> . k(<<3 1> [3 <1 5> 3]>,8)")
  $ "[jazz,clubkick:1]"
  # midiG' "^78" 0 0.8
d2 $ gF1 $ gM2 -- Clap sonar intraitable
  $ fast "<1!4 2 1 2 1 2 2 2 [4!3 [8 4]] 2 2 2 [4@3 8]>"
  -- FIXME Better snare rush progresssion
  $ "~ cp"
  # lpf 4000
  # midiG' "^79" 0 0.8
  # room 0.8 # sz 0.4 # dry 0.985
d3 $ gM $ gF1 -- Drumroll de Sebastien
  $ midiOn "^76" (ply 4)
  $ "drum:2*[4 <4 4 <8 [8 16]>>]"
  # midiG' "^80" 0 0.6
  # pan 0.77
d4 $ gF2 -- Baleine sur la défensive
  $ midiOn "^89" (chop (slow 2 "<[8 16 8 8 . 16 8] 1>"))
  $ fix ((# width 0.5) . (# cut 12)) "bassWarsaw"
  $ fix ((# voice 0.1) . (# cut 11) . (# lfo 0) . (|* gain 0.8)) "supersaw"
  $ note "<<d3 d3(<3 [3 5]>,8)> <a2 a2(<3 [5 3]>,8)>>"
  -- TODO: seconde voix
  # "[bassWarsaw,supersaw]"
  # midiG' "^81" 0 0.8
  # octerbus 41 (range 0 0.85 "^53")
  # crushbus 41 (range 16 3.5 "^53")
  # room 0.3 # sz 0.4 # dry 1.1
  # pan 0.4
  # cut 1
d5 $ gF3 -- Accusation juste
  $ note "d . <[~ <~ ~ ~ d ~ d d*2 d*4> ~ a4] [~ e f <e [e|a]>]>"
  # "cpluck:7"
  # midiG' "^82" 0 0.8
  # pan 0.8
  # cut 5
d6 $ gM $ gM2  -- Sirènes lointaines
  $ whenmod 8 0 (>| note "<a c6 d6 e6> <g a5 c6 d6> <f g a5 c6> . ~ ~ <e f g e6> <d e f f6>")
  $ note "a g f  . ~ ~ e <d!3 f>"
  # "superfork"
  # pan "0.8@3 0.2"
  # midiG' "^83" 0 0.8
d7 $ gF2 -- La certitude du verre brisé
  $ note "<d <e g> d [a ~ ~ g ~ f e ~ ~]>" -- TODO: Variations sur la fin
  # "90s_glassatm:0"
  # cut 7
  # midiG' "^18" 0 0.8
d8 $ gF2 -- Crystal de sel
  $ "90s_synatm:2"
  # note "<0 0 -5 -5>"
  # midiG' "^19" 0 (range 0.23 0.45 perlin)
  # room 0.4 # sz (range 0 0.6 perlin)
  # delay 0.5
  # delayt 0.125
  # delayfb 0.9
  # cut 8
d9 $ gF1 $ gM $ gM2 -- Break clap your hands sous-marin
  $ midiOn "^92" (ply "[1 <2 4 [4 8 4] [8 8 4 8]>]")
  $ chop 16
  $ loopAt 2
  $ "break:82"
  # midiG' "^84" 0 0.8
  # cut 9
d10 $ gF1 -- Marche rapide des crabes mécaniques
  $ slice 8 "<0 1 2 3 4 5 6 7>"
  $ loopAt 4
  $ "drums_commodore:0"
  # midiG' "^20" 0 0.4
  # pan 0.3
  # cut 10
