{-
anny fm: battery 1,2,3
originally recorded live @ the loft, brighton, 4th july 2014
  _____
 /    /
/____/
anny.audio/track/battery-123-live
      __
  c|||  o_
c||||| ___o
soundcloud.com/anny-fm/battery-123-live
-}

cps (125/60)

-- multi-silence
let msil = mapM_ ($ silence)

-- shortfix for bps->cps
let cf = slow 2

-- alternative every
let every' n o f = when ((== (o-1)) . (`mod` n)) f

-- osc patterns
let halfosc = (/2).(+0.5)
    halfosc1 = (+1).(/2)
    thirdosc1 = (+1).(/3)

-- channel mapping
let d'drum = d1
    d'perc = d2
    d'bass = d3
    d'hand = d4
    d'warb = d5 -- warbler
    d'bass2 = d6 -- more bass right at the end
    d'arpy = d7
    d'tr = d8 -- trump
    d'tac = d9 -- tacscan

{-
[1]
-}

let b1'bass = s "bass3 [~ bass3] ! ~"
              # begin "0.2"

let b1'hand = slow 8 $ rev . striate 256 $ s "hand*8"
              # speed "0.7"

let b1'perc = slow 2 $ s "uxay [~ uxay] [psr uxay] ~"

let b1'tac = s "[~ tacscan] ! ~ ~"
             # gain "0.8"
             # vowel (slow 3 "e u")

let b1'warbler = slow 4 $ striate 32 $ s "warbler"
                 # n (slow 7 $ run 7)
                 # gain "0.8"

-- go
hush
d'bass $ slow 4 $ b1'bass

d'bass $ slow 4 $ b1'bass
  # n "0 1 0 0"

d'bass $ slow 4 $ b1'bass
  # n "0 1 0 0"
  # speed (thirdosc1 <$> slow 8 sinewave1)

d'hand $ b1'hand

d'hand $ b1'hand
  # shape ((/2) <$> slow (10%4) sinewave1)

-- nice drum
d'perc $ cf $ b1'perc

d'hand $ b1'hand
  # shape ((/2) <$> slow (10%4) sinewave1)
  # pan (halfosc <$> slow (8%3) sinewave1)

d'perc $ cf $ b1'perc
  # n (density 3 $ run 2)

d'perc $ cf $
  jux (0.25 <~) $ b1'perc
  # n (density 3 $ run 2)

-- good bass
d'bass $ cf $
  spread slow [1,3] $
  striate 16 $
  b1'bass
  # n "0 1 0 0"
  # speed (halfosc1 <$> slow 8 sinewave1)
  # gain "0.9"

d'drum $ cf $ sound "~ psr:1"

d'drum $ cf $
  overlay (sound "~ psr:1") $
  slow 2 $ s "peri [~ peri] ! ~"

d'drum $ cf $ sound "~ psr:1"

-- good drum
d'drum $ cf $
  overlay (sound "~ psr:1") $
  every 4 (density 1.5) $ slow 2 $ s "peri [~ peri] ! ~"

d'drum $ cf $ sound "~ psr:1"

-- bring a funk
d'tac $ cf $ b1'tac
d'tac $ cf . whenmod 7 4 (density 1.5) $ b1'tac

d'drum $ overlay (s "peri") $ cf $
  sound "~ psr:1"

d'drum $ cf $ sound "~ psr:1"

-- birdsong. don't play it for too long. gets annoying
d'warb $ b1'warbler

d'perc $ cf $
  spread slow [2,1] $
  jux (0.25 <~) $ b1'perc
  # n (density 3 $ run 2)

d'drum $ overlay (s "peri") $ cf $
  sound "~ psr:1"

d'drum $ overlay (s "peri") $ cf $
  every 2 (density 3) $ sound "~ psr:1"

msil [d'bass, d'tac]

-- drum + perc are real nice at this point
d'drum $ overlay (s "peri") $ cf $
  every' 8 8 (density 1.5) $
  every 2 (density 3) $ sound "~ psr:1"

d'perc $ cf $
  slow 2 . spread slow [2,4,2,3] $
  jux (0.25 <~) $ b1'perc
  # n (density 3 $ run 2)

d'hand silence

d'drum $ cf $
  every' 8 8 (density 1.5) $ every 2 (density 3) $ s "~ psr:1"

d'drum silence

{-
[2]
-}

let b2'uxp = (# gain "0.8") .
             (# speed "[0.7 1 1.2]/2")

let b2'ux = cf $ s "uxay*4"
            # n "1 0 1 2"

let b2'ux2 i = (if i then brak . iter 4 else cf . brak) $
               b2'uxp $ s "uxay*4"
               # n "1 0 1 2"
               # shape "0.4 0.3 0.6"

let b2'psr = s "psr*4 psr*2"
             # gain "0.6"
    b2'psrf = s "[[psr*4 psr*2] ! ! psr*8]/4"
              # gain "0.6"

let b2'trump p = whenmod 5 4 rev $ s p
                 # n (slow 3.2 $ run 4)
                 # gain "0.8"
                 # speed (halfosc1 <$> slow 4 sinewave1)
                 # vowel (slow 3.2 "a e o")
                 # shape "0.6"

let b2'bass = slow 8 $ s "[jvbass ~] [jvbass [~ ~ ~ ~ jvbass]] [~ [~ ~ ~ ~ jvbass]] [~ jvbass !]"
              # n (slow 2.8 "0 1 2")
              # vowel "i"
              # speed "0.8"

let b2'arpy = s "arpy*8"
              # n "2 1 3 1"
              # gain "0.7"

-- go
d'perc $ cf $ s "uxay*2"
  # n "1"

d'perc $ b2'ux

d'perc $ b2'ux
  # speed "[0.7 1 1.2]/2"

d'drum $ cf $ b2'psr
d'drum $ cf $ b2'psrf
d'drum $ cf $ every 3 (0.125 <~) $ b2'psrf

d'drum $ overlay (s "peri") $
  cf $ every 3 (0.125 <~) $ b2'psrf

-- this and next 3 parts real quick
d'perc $ b2'ux2 False

d'warb silence

d'drum $ cf $ -- overlay (s "peri") $
  every 3 (0.125 <~) $ b2'psrf

d'tr $ cf $ b2'trump "[~ trump ! !] ~"

d'tr $ cf $ b2'trump "[~ trump ! !] ~"
  # speed (halfosc1 <$> slow 4 sinewave1)

d'drum $ overlay (s "peri") $
  cf $ every 3 (0.125 <~) $ b2'psrf

d'perc $ b2'ux2 True

-- optional, maybe not so great
d'tr $ cf $ b2'trump "trump*8"
  # speed (halfosc1 <$> slow 4 sinewave1)

-- quickly
d'bass $ b2'bass
d'tr silence

d'bass $ b2'bass
  # shape "0.3" -- increase 0->0.3

d'bass $ b2'bass
  # shape (halfosc <$> saw1)

d'arpy $ cf $ b2'arpy

msil [d'perc, d'bass]

d'arpy $ cf $ iter 9 $ b2'arpy

d'drum $ -- overlay (s "peri") $
  cf $ every 3 (0.125 <~) $ b2'psrf

d'perc $ b2'ux2 False
d'perc $ b2'ux2 True

d'drum $ overlay (s "peri") $
  cf $ every 3 (0.125 <~) $ b2'psrf

msil [d'drum, d'perc]

{-
[3]
-}

let b3'perc = sound "[tok*2 [rm tok]] [psr:1 tok*2]"

let b3'bass = s "bass*4"
              # n "0 1"
              # begin "0.4"
              # speed "1.2"
              # shape "0.2"
    b3'bassf = s "{bass*4, wobble*3}"
               # n "0 1"
               # begin "0.4"
               # speed "1.2"
               # shape "0.2"

let b3'drum = slow 2 $ s "peri [~ ~ ~ peri] [~ peri peri ~] ~"
    b3'drumf = slow 2 $ s "peri*2 [~ ~ ~ peri] [~ peri peri ~] ~"

-- go
d'arpy $ cf $
  whenmod 7 4 (|+| vowel "a") $ -- this not used in brighton 2014 live rec.
  iter 9 $ b2'arpy

d'perc $ cf $
  slow 2 . spread slow [2,4,2,3] $
  jux (0.25 <~) $ b1'perc
  # n (density 3 $ run 2)

d'drum $ cf $ b3'perc
d'bass $ cf $ b3'bass

d'bass $ cf $
  whenmod 7 6 (density 1.5) $
  b3'bass

d'drum $ cf $ b3'perc
  # n (slow 3 $ run 4)

d'bass $ cf $
  spread slow [2,(7%4)] $
  whenmod 7 6 (density 1.5) $
  b3'bass

d'bass $ cf $
  spread slow [2,(7%4)] $
  whenmod 7 6 (density 1.5) $
  iter 4 $
  b3'bass

d'tac $ cf . whenmod 7 4 (density 1.5) $ b1'tac

d'hand $ b1'hand
  # shape ((/2) <$> slow (10%4) sinewave1)
  # pan (halfosc <$> slow (8%3) sinewave1)

d'arpy $ cf $ iter 9 $ b2'arpy

-- quickly
msil [d'bass, d'hand]

d'drum $ cf $
  overlay (b3'drum) $
  (b3'perc # n (slow 3 $ run 4))

d'tac silence

d'drum $ cf $
  overlay (b3'drumf) $
  (b3'perc # n (slow 3 $ run 4))

d'hand $ b1'hand
  # shape ((/2) <$> slow (10%4) sinewave1)
  # pan (halfosc <$> slow (8%3) sinewave1)

d'perc $ b2'ux2 True
  # gain "0.8"
  # speed "[0.7 1 1.2]/2"

d'bass $ cf $
  spread slow [2,(7%4)] $
  whenmod 7 6 (density 1.5) $
  iter 4 $
  b3'bass

d'tac $ cf . whenmod 7 4 (density 1.5) $ b1'tac

d'bass $ cf $
  spread slow [2,(7%4)] $
  whenmod 7 6 (density 1.5) $
  iter 4 $
  b3'bassf

msil [d'perc, d'tac]

-- drum solo-ish for a bit
d'drum $ cf $
  overlay (b3'drumf) $
  whenmod 5 3 (density 2) $
  (b3'perc # n (slow 3 $ run 4))

d'drum $ cf $
  overlay (b3'drumf) $
  whenmod 5 3 (density 2) $
  iter 2 $
  (b3'perc # n (slow 3 $ run 4))

d'drum $ cf $
  every' 8 8 rev $
  overlay (b3'drumf) $
  whenmod 5 3 (density 2) $
  iter 2 $
  (b3'perc # n (slow 3 $ run 4))

d'drum $ cf $
  every 3 rev $
  every' 8 8 rev $
  overlay (b3'drumf) $
  whenmod 5 3 (density 2) $
  iter 2 $
  (b3'perc # n (slow 3 $ run 4))

msil [d'bass, d'arpy]

-- remove kick
d'drum $ cf $
  whenmod 5 3 (density 2) $
  iter 2 $
  (b3'perc # n (slow 3 $ run 4))

d'hand silence

d'perc $ cf $
  slow 2 . spread slow [2,4,2,3] $
  jux (0.25 <~) $ b1'perc
  # n (density 3 $ run 2)

-- rebuild yr way out
d'drum $ cf $
  overlay (b3'drumf) $
  (b3'perc # n (slow 3 $ run 4))

-- optional
d'perc $ b2'ux2 True
  # gain "0.8"
  # speed "[0.7 1 1.2]/2"

d'bass $ b2'bass
  # shape (halfosc <$> saw1)

d'tac $ cf . whenmod 7 4 (density 1.5) $ b1'tac

d'bass2 $ slow 4 $ b1'bass
  # n "0 1 0 0"
  # speed (thirdosc1 <$> slow 8 sinewave1)

d'arpy $ cf $ iter 9 $ b2'arpy
d'warb $ b1'warbler

d'hand $ b1'hand
  # shape ((/2) <$> slow (10%4) sinewave1)
  # pan (halfosc <$> slow (8%3) sinewave1)

msil [d'perc, d'bass, d'tac, d'bass2, d'hand]
d'drum silence
d'arpy silence

hush
