-- Bain Electrique, ex Bain Bouillant

do
-- resetCycles
setcps (128/60/4)
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 gMute1 = (midiOn "^73" (mask "f*16"))
let gMute2 = (midiOn "^74" (mask "f*16"))
let gMute3 = (midiOn "^75" (mask "f*16"))
let gM1 = gMask . gMute1
let gM2 = gMask . gMute2
let gM3 = gMask . gMute3
let gO = (# octersubbus 5 (range 0 1 "^29")) . (# octerbus 6 (range 0 0.52 "^29"))
d1 $ gF1 $ gM2 -- Kick FIXME PLUS PUISSANT!!1!
  -- $ superimpose ((# crush 5) . (# lpf 2000) . (# gain 2))
  -- $ fix ((|* gain 0.9) . (# lpf 1000)) "jazz"
  -- $ fix ((# att 0.02) . (# rel 0.5) . (# lpf 5000)) "kick:4"
  $ midiOn "^42" ((<| "k k k <k!7 [<k ~> k]>"))
  $ midiOff "^42" (
    -- (<| "<k!24 ~!8> ~ ~ <~!3 k> . ~ <~!7 k> ~ ~")
    (<| "k . ~ k ~ <~ k>")
    )
  $ "[jazz,kick:4]"
   -- # n "[5 5 5 <6 5>]" # note "0 [1 <0>]"
  -- $ "[rampleA0:3,jazz]"
  # gain 1.4
d2 $ gF1 $ gM1
  $ midiOn  "^43" (<| "~ s ~ s*<1 1 2 <1 4>>")
  $ midiOff "^43" (<| "~ s ~ s*<1 2 <1 2> 1>")
  $ "[rampleA0:11,rampleA2:11]" -- Basic snare
  # note "-5"
  # gain 0.9
d3 $ gF1 $ gM1 -- Contretemps
  $ midiOn "^76" (slow 2)
  $ midiOff "^44" (slow 2)
  $ "~ h ~ h ~ h ~ h*<1 2 2 <1 2>>"
-- $ "~ h ~ <~!4 h!28> ~ <~!3 h ~!3 h h!8> ~ <h ~ h ~ h!3 <h*2 [~ h*<1 2>]>>"
  # "[snare:38]"
  # room 0
  # gain 1.3
d4 $ gO $ gF2 $ gMute3 -- SUBSUB INFRABASS
  $ superimpose (
    # crushbus 41 (range 12 2 "^53")
  )
  $ midiOn "^57" (struct "t*8 t(<3!3 5>,8)")
  $ midiOn "^89" (stut 4 0.9 "e")
  -- $ juxBy 0.8 (
    -- (# crushbus 41 (slow 16 $ range 12 2.5 saw))
    -- . (# lpfbus 41 (slow 16 $ range 10000 2000 saw))
  -- )
  $ note "<g3!4 c3!4>(3,8)"
  # "jungbass:3"
  # cut 4
  # att 0.1 # rel 1
  # octersubsubbus 42 (range 0 1.2 "^33")
  # gain 1.8
  # pan 0.3
d5
  -- $ superimpose ((# distortbus 51 (range 0 1.2 "^34")) . (|+ cut 1))
  $ gO $ gMute3 $ gF2 -- Basse appel important
  $ note "<fs3 [fs3@7 b3] [fs3@7 g3] [fs3@5 g3 fs3 d2] [b2@7 d2] [b2@7 d2] [b2@7 gs2] [b2 . b2 d3 <fs3 g3>]>"
  # "giorgio_syn:0"
  # pan 0.351
  # lpfbus 52 (range 400 2000 "^54")
  # cut 5
  # gain 1.5
  # pan 0.7
d7 $ gO $ gF3 -- guitare salvatrice
  -- $ mask "<f!32 t!32>"
  $ slice 16 "0*[4 <4 4 1 1 4 4 1 4 1 1 4 4> 4 <1!3 4>]"
  $ chop 16
  $ loopAt 2
  $ "fguitar:55"
  # cut 7
  # gain 1.1
d6 $ gO $ gM1 $ gF1 -- Rim drums
  $ fix ((|* gain (1.2 + 0.1 * perlin))) (n 18)
  $ n (stack [
    "~ ~ ~ <~!7 <13 14 15 16 17>>", -- Cy
    "<~!0 18([<2 3> <1 <3!3 5>>],8)!16> 18(<1 1 3 1>,8)"
  ])
  # "h2ogmhh:1"
  |* gain (range 0.8 1 perlin)
  # gain 1.5
d8 $ gM1 $ gF1 -- BOOM BOOM THE BREAKS
  $ midiOn "^60" (mask "f(4,8)")
  $ midiOn "^92" ( -- Bouton Nassim <3
    superimpose ((# lpf 200) . (|* gain 1.5)) .
    slice 16 "[0 .. 7] . <[0 .. 7]!3 [0 1 . [2 3]]>"
    . loopAt 0.5 . (# "breaks165")
    . (# octer 0.4)
    . (# room 0)
    . (|* gain 1.2)
  )
  $ fix (|* gain 0.8) ("jungle_breaks:24")
  $ whenmod 8 7 (slice 4 "0 3 2*<1 2> 1*<1 2 4 4>")
  $ midiOn "^36" ((# n "24") . (|* gain 1.1)) -- Pure variations!
  $ midiOn "^56" ((# n "23") . (|* gain 1.1)) -- Raise COMEON!
  -- $ midiOn "^60" (const $ loopAt 2 $ chop 8 $ "jungle_breaks:60" # gain 0.8)
  $ chop 16 $ loopAt 2
  $ "jungle_breaks:24"
  # gain 1.4
d10 $ gF3 -- Ambient Pads
  $ whenmod 64 32 (ply "1 2 <1 <2 4 8 2>> <<2 1 4 <1 4>> 1>")
  $ chop 8
  $ "jungle_pads:24/4"
  # note (2 + (slow 2 $ "<0 -5>"))
  # cut 9
  # gain 1.4
  # lpf 5000
d11 $ gF1 -- CONSTRUCTION NOISES
  -- $ fix (|* gain (slow 32 $ range 1 0.3 saw)) "giorgio_syn"
  $ (stack [
  "<~!12 giorgio_syn:52!4>/2"
  ])
  # note (slow 2 "<0 <-4.5 -7>>")
  # cut 10
  # gain 1
d9 $ slow 4 -- Movie Dialogs on Electricity
  $ cat [
  "",
  ("weird_dialogs:1" # end 0.51 # lpf 5000 # gain 0.9), -- Atomic
  ("[~ weird_dialogs:1]" # begin 0.52 # lpf 5000  # gain 0.9), -- Predict
  "",
  ("weird_dialogs:8" # end 0.65 # gain 0.75), -- Do you think Wrong?
  ("~ weird_dialogs:8" # begin 0.2 # gain 0.75), -- Wrong electricity
  "",
  ("weird_dialogs:9" # end 0.27), -- Faith
  ("weird_dialogs:9" # begin 0.31 # end 0.8), -- Not Faith
  ("weird_dialogs:9" # end 0.27), -- Faith
  (ply 2 $ "weird_dialogs:9" # begin 0.8), -- Curiosity
  ("weird_dialogs:14" # begin 0), -- Theory
  (off "1" id $ "weird_dialogs:14" # begin 0.5 # end 0.8), -- Tested
  ("weird_dialogs:14" # begin 0 # end 0.4), -- So sure
  ("weird_dialogs:8" # begin 0.2 # end 0.59 # gain 0.75), -- Something Wrong
  ("weird_dialogs:14" # begin 0 # end 0.4 # gain 0.9), -- So sure
  ("weird_dialogs:8" # begin 0.2 # gain 0.75), -- Something Wrong
  ("weird_dialogs:22" # gain 0.9), -- Explain my mission
  ("weird_dialogs:10" # end 0.47), -- I find it works
  ("weird_dialogs:10" # begin 0.5), -- To get me from one planet to another
  ("weird_dialogs:29" # gain 0.9), -- Planet
  ("weird_dialogs:22" # gain 0.9), -- Explain my mission
  ("weird_dialogs:14" # begin 0.5 # end 0.65), -- Have you?
  ("weird_dialogs:14" # begin 0.5 # end 0.65), -- Have you?
  ("weird_dialogs:14" # begin 0.5 # end 0.65), -- Have you?
  ("weird_dialogs:14" # begin 0.5 # end 0.65) -- Have you?
  ]
  |* gain 1.8 -- Global movie gain
  # cut 9
  # "weird_dialogs"

once $ "weird_dialogs:38" # cut 9 # orbit 8 # gain 1.7
  -- # end 0.51
  -- # begin 0.3
  -- # end 0.4

d1 $ slow 4 $ ply 4
  $ cat [
  "cp*<1!3 2>",
  "bd*4",
  "dr*[8 16]",
  note (arpeggiate "c'maj'4") # "giorgio_syn"]
  # cut 1
