{-
Anny FM: Battery 1,2,3
anny.audio

Current version: 1.1.0
Compatibility: Tidal Cycles 1.0-dev + SuperDirt 1.0-dev + SuperCollider 3.8
License: CC-BY-SA https://creativecommons.org/licenses/by-sa/4.0/

See README.md for more information
-}

let bpm b = cps (b/60)
    msil = mapM_ ($ silence)
    cf = slow 2
    every' n o f = when ((== (o-1)) . (`mod` n)) f
    d'drum = d1
    d'perc = d2
    d'bass = d3
    d'hand = d4
    d'warb = d5
    d'bass2 = d6
    d'arpy = d7
    d'tr = d8
    d'tac = d9

{-
@b1
Battery 1
-}

bpm 125

-- @b1bass1
d'bass $ slow 4 $ s "bass3 [~ bass3] ! ~"
  # begin 0.2
  -- # n "0 1 0 0" -- (1)
  -- # speed (scale 1 (4/3) $ slow 8 sine1) -- (2)

-- b1bass1 @ 1
-- b1bass1 @ 2

-- @b1hand
d'hand $ slow 8 $ rev . striate 256 $ s "hand*8"
  # speed 0.7
  -- # shape (scale 0 0.5 $ slow (10/4) sine1) -- (1)
  -- # pan (scale 0.25 0.75 $ slow (8/3) sine1) -- (2)

-- b1hand @ 1
-- b1hand @ 2

-- @b1perc
d'perc $ cf $
  -- fastspread slow [2,1] $ -- (3)
  -- slow 2 . fastspread slow [2,4,2,3] $ -- (4) replace (3)
  -- jux (0.25 <~) $ -- (2)
  slow 2 $ s "uxay [~ uxay] [psr uxay] ~"
  -- # n (density 3 $ run 2) -- (1)

-- b1perc @ 1
-- b1perc @ 2

-- @b1bass2
d'bass $
  spread slow [1,3] $
  striate 16 $
  s "bass3 [~ bass3] ! ~"
  # begin 0.2
  # n "0 1 0 0"
  # speed (scale 1 1.5 $ slow 8 sine1)
  # gain 0.9

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

-- b1drum1 @ 1
-- b1drum1 @ 2

-- b1drum1 @ 0

-- @b1tac
d'tac $ cf $
  -- whenmod 7 4 (density 1.5) $ -- (1)
  s "[~ tacscan] ! ~ ~"
  # gain 0.8
  # vowel (slow 3 "e u")

-- b1tac @ 1

-- @b1drum2
d'drum $ cf $
  stack [
    s "peri*2", -- (-1) remove
    -- every' 8 8 (density 1.5) $ -- (2)
    -- every 2 (density 3) $ -- (1)
    sound "~ psr:1"
    ]

-- b1drum2 @ -1

-- @b1warbler
d'warb $ slow 4 $ striate 32 $ s "warbler"
  # n (slow 7 $ run 7)
  # gain 0.8

-- b1perc @ 3

-- b1drum2 @ 0
-- b1drum2 @ 1

msil [d'bass, d'tac]

-- b1drum2 @ 2
-- b1perc @ 4

d'hand silence

-- b1drum2 @ 2, w/o peri

d'drum silence

{-
@b2
Battery 2
-}

bpm 125

-- @b2perca
d'perc $ cf $ s "uxay*2" -- (1) uxay*4
  # n "1 0 1 2"
  -- # speed "[0.7 1 1.2]/2" -- (2)

-- b2perca @ 1
-- b2perca @ 2

-- @b2drum
d'drum $ -- overlay (s "peri") $ -- (3,4) toggle
  cf $
  -- every 3 (0.125 <~) $ -- (2)
  s "psr*4 psr*2"
  -- s "[[psr*4 psr*2] ! ! psr*8]/4" -- (1)
  # gain 0.6

-- b2drum @ 1

-- @b2percb
let -- b = brak . iter 4 -- (1)
    b = cf . brak
  in d'perc $ b $ s "uxay*4"
     # n "1 0 1 2"
     # gain 0.8
     # shape "0.4 0.3 0.6"
     # speed "[0.7 1 1.2]/2"

d'warb silence

-- b2drum w/o peri

-- @b2trump
d'tr $ cf $ whenmod 5 4 rev $ s "[~ trump ! !] ~"
  # n (slow 3.2 $ run 4)
  # gain 0.8
  # vowel (slow 3.2 "a e o")
  # shape 0.6
  -- # speed (scale 0.5 1.5 $ slow 4 sine1) -- (1)

-- b2drum w/ peri
-- b2percb @ 1

-- @b2bass
d'bass $ slow 8 $
  s "[jvbass ~] [jvbass [~ ~ ~ ~ jvbass]] [~ [~ ~ ~ ~ jvbass]] [~ jvbass !]"
  # n (slow 2.8 "0 1 2")
  # vowel "i"
  # speed 0.8
  -- # shape 0.3 -- (1) increase 0->0.3
  -- # shape (scale 0.25 0.75 $ saw1) -- (2) replaces (1)

d'tr silence

-- b2bass @ 1
-- b2bass @ 2

-- @b2arpy
d'arpy $ cf $
  -- whenmod 7 4 (# vowel "a") $ -- (2)
  -- iter 9 $ -- (1)
  s "arpy*8"
  # n "2 1 3 1"
  # gain 0.7

msil [d'perc, d'bass]

-- b2drum w/o peri

-- b2arpy @ 1

-- b2percb @ 1
-- b2drum w/ peri

msil [d'drum, d'perc]

{-
@b3
Battery 3
-}

bpm 125

-- b2arpy @ 2
-- b1perc @ 4

-- @b3drum
d'drum $ cf $
  -- every 3 rev $ -- (f4) and (f5) remove
  -- every' 8 8 rev $ -- (f3)
  stack [
    -- slow 2 $ s "peri [~ ~ ~ peri] [~ peri peri ~] ~", -- (2), (3) ^peri*2 -- (f5) remove
    -- whenmod 5 3 (density 2) $ -- (f1)
    -- iter 2 $ -- (f2)
    sound "[tok*2 [rm tok]] [psr:1 tok*2]"
    -- # n (slow 3 $ run 4) -- (1)
    ]

-- @b3bass
let p = "bass*4" -- "{bass*4, wobble*3}" (4)
  in d'bass $ cf $
     -- spread slow [2,(7/4)] $ -- (2)
     -- whenmod 7 6 (density 1.5) $ -- (1)
     -- iter 4 $ -- (3)
     s p
     # n "0 1"
     # begin 0.4
     # speed 1.2
     # shape 0.2

-- b3bass @ 1

-- b3drum @ 1

-- b3bass @ 2
-- b3bass @ 3

-- b1hand @ 3

-- b1tac @ 1
-- b2arpy @ 1

msil [d'bass, d'hand]

-- b3drum @ 2

d'tac silence

-- b3drum @ 3

-- b1hand @ 2
-- b1perc @ 4

-- b3bass @ 3
-- b1tac @ 1

-- b3bass @ 4

msil [d'perc, d'tac, d'hand]

-- b3drum @ f1-f5

msil [d'bass, d'arpy]

-- b1perc @ 4
-- b3drum @ 3

-- b2percb @ 1
-- b2bass @ 2
-- b1tac
-- b1bass1 [on channel d'bass2]
-- b3arpy @ 1
-- b1warbler
-- b1hand @ 2

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

hush
