{-
anny fm: battery 1,2,3
           __
       c|||  o_
     c||||| ___o
soundcloud.com/anny-fm
-}

bps (125/60)

let preload p s = d9 $ sound (samples p s) |+| end "0.00001"

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

preload "[bass3 hand uxay tok psr peri tacscan warbler trump arpy bass wobble jvbass]*16" (run 16)

{----
PT. 1
----}

-- rumble bass

d3 $ slow 2 $ (sound (samples "bass3 [~ bass3] ! ~" "0 1 0 0") |+| begin "0.2")
|+| speed (thirdosc1 <$> slow 4 sinewave1)

d3 $ spread slow [1,3] $ striate 16 $ (sound (samples "bass3 [~ bass3] ! ~" "0 1 0 0") |+| begin "0.2")
|+| speed (halfosc1 <$> slow 4 sinewave1)
|+| gain "0.8"

-- whine

d4 $ slow 4 $ rev . striate 256 $ sound "hand*8"
|+| speed "0.7"
|+| shape ((/2) <$> slow (5%4) sinewave1)
|+| pan (halfosc <$> slow (4%3) sinewave1)

-- drum

d2 $ slow 2 . spread slow [2,4,2,3] $ jux (0.25 <~) $ slow 2 $ sound (samples "[uxay tok*2] [~ uxay] [psr:8 uxay] ~" (density 3 $ run 2))

d2 $ spread slow [2,1] $ jux (0.25 <~) $ slow 2 $ sound (samples "[uxay tok*2] [~ uxay] [psr:8 uxay] ~" (density 3 $ run 2))

d1 $ stack [
  every 4 (density 1.5) $ slow 2 $ sound "peri:1 [~ peri:1] ! ~",
  sound "peri:1*2",
  whenmod 8 7 (density 1.5) $ every 2 (density 3) $ sound "~ psr:14"
  ]

-- pexpl

d9 $ whenmod 7 4 (density 1.5) $ slow 2 $ sound "[~ tacscan:13] ! ~ ~"
|+| gain "0.8"
|+| vowel (slow 1.5 "e u")

{----
PT. 2
----}

-- birdsong

d6 $ slow 2 $ striate 32 $ sound (samples "warbler" (slow 7 $ run 7))
|+| gain "0.8"

-- side drum

d2 $ sound (samples "uxay*2" "1 0 1 2")
d2 $ density 2 $ brak . iter 4 $ sound (samples "uxay*4" "1 0 1 2")
|+| gain "0.8"
|+| speed (slow 2 "0.7 1 1.2")
|+| shape "0.4 0.3 0.6"

-- kick, snare

d1 $ stack [
  sound "peri:1*2",
  every 3 (0.125 <~) $ sound "psr:8*4 psr:8*2"
  every 3 (0.125 <~) $ slow 4 $ sound "[psr:8*4 psr:8*2] ! ! psr:8*8"
  |+| gain "0.6"
]

-- sweet beep

d8 $ whenmod 5 4 rev $ sound (samples "[~ trump ! !] ~" (slow 1.2 $ run 4))
d8 $ whenmod 5 4 rev $ sound (samples "trump*8" (slow 1.2 $ run 4))
|+| gain "0.8"
|+| speed (halfosc1 <$> slow 2 sinewave1)
|+| vowel (slow 1.6 "a e o")
|+| shape "0.6"

-- chip

d7 $ whenmod 7 4 (|+| vowel "a") $ iter 9 $ sound (samples "arpy*8" "4 2 7 2")
|+| gain "0.7"

-- saw bass

d3 $ slow 4 $ sound (samples "[jvbass ~] [jvbass [~ ~ ~ ~ jvbass]] [~ [~ ~ ~ ~ jvbass]] [~ jvbass !]" (slow 1.4 "0 1 2"))
|+| vowel "i"
|+| speed "0.8"
--  |+| shape "0.4"
|+| shape (halfosc <$> saw1)

{----
PT. 3
----}

-- proper drum

d1 $ stack [
  -- kick
  every 3 rev $ whenmod 8 7 rev $ slow 2 $ sound "peri:1*2 [~ ~ ~ peri:1] [~ peri:1 peri:1 ~] ~",
  -- main perc w snare
  whenmod 5 3 (density 2) $ iter 2 $ sound (samples "[tok*2 [rm tok]] [psr:14 tok*2]" (slow 3 $ run 4))
]

-- fun bass v.2

d3 $ spread slow [2,(7%4)] $ whenmod 7 6 (density 1.5) $ iter 4 $ sound (samples "bass*4" "0 1")
d3 $ spread slow [2,(7%4)] $ whenmod 7 6 (density 1.5) $ iter 4 $ sound (samples "{bass*4, wobble*3}" "0 1")
|+| begin "0.4"
|+| speed "1.2"
|+| shape "0.2"
