{- just composition notes here, setup in scratch.tidal -}
-- pt 1: intro

d'drum $ stack [
  n "1/4" # s "drum"
  ]

d'wax $ slow 16 . striate 256 $ s "icarus"

d'drum $ stack [
  n "1/4" # s "drum",
  n "[~ 0]" # s "kit"
  ]

d'drum $ stack [
  n "[1*2, 0*8]/8" # s "drum",
  n "[~ 0]" # s "kit"
  ]

d'wax $ retrig $ slow 20 $ n "1" # s "icarus"

-- drop 1
d'nim $ slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"
d'wax silence

d'drum $ stack [
  n "[1*2, 0*8, [~!! [~!! 0] ! ~!!]]/8" # s "drum",
  n "~ 0" # s "kit"
  ]

d'drum $ stack [
  n "[1*2, 0*8, [~!! [~!! 0] ! ~!!]]/8" # s "drum",
  n "[[~ 0] [[2!! ~]/4 0]]/2" # s "kit"
  ]

d'wax $ slow 16 . striate 256 $ s "icarus"

d'drum $ stack [
  n "[1*2, 0*8, [~!! [~!! 0] ! ~!!]]/8" # s "drum",
  withmod 11 5 0.5 1 (density 2) $
  n "[[~ 0] [[2!! ~]/4 0]]/2" # s "kit"
  ]

d'nim $ superimpose (iter 4) $
  slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

d'nim $ superimpose (iter 4 . nim'osc) $
  slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

d'drum $ stack [
  n "[1*2, 0*8, [~!! [~!! 0] ! ~!!]]/8" # s "drum",
  whenmod 3 2 (density 2) $
  withmod 11 5 0.5 1 (density 2) $
  n "[[~ 0] [[2!! ~]/4 0]]/2" # s "kit"
  ]

d'nim $ superimpose (iter 6 . nim'osc) $
  slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

-- pt 2

d'drum $ mt 16 16 $ stack [
  n "[1*2, 0*8, [~!! [~!! 0] ! ~!!]]/8" # s "drum",
  whenmod 3 2 (density 2) $
  withmod 11 5 0.5 1 (density 2) $
  n "[[~ 0] [[2!! ~]/4 0]]/2" # s "kit"
  ]

d'nim $ superimpose (iter 6 . nim'osc . (# nudge "0")) $
  mt 16 16 $
  slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

d'wax silence

d'nim $ mt 16 16 $
  slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

d'nim $ mt 16 16 $
  whenmod 5 3 rev $
  slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

-- develop here

d'nim $ mt 16 16 $
  every' 2 2 (within (0, 0.5) (const silence)) $
  whenmod 5 3 rev $
  slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

-- pt 3

solo $ d'nim $ superimpose (iter 4 . nim'osc . (# nudge "0")) $
  mt 16 16 $
  every' 2 2 (within (0, 0.5) (const silence)) $
  whenmod 5 3 rev $
  slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

let s = striate 16
  in d'bass $
     slow 8 $ stack [
       s $ sound "bass",
       s $ sound "sine"
       ]
     # gain "0.9"

d'nim $ superimpose (iter 4 . nim'osc . (# nudge "0")) $
  every' 2 2 (within (0, 0.5) (const silence)) $
  whenmod 5 3 rev $
  slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

d'nim $ superimpose (iter 4 . nim'osc . (# nudge "0")) $
  slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

d'drum $ n "0*4" # s "drum"

d'drum $ swing' $ stack [
  n "[1*2, 0*8, [~!! [~!! 0] ! ~!!]]/8" # s "drum",
  whenmod 3 2 (density 2) $
  withmod 11 5 0.5 1 (density 2) $
  n "[[~ 0] [[2!! ~]/4 0]]/2" # s "kit"
  ]

d'drum $ swing' $ stack [
  n "[1*2, 0*8, [~!! [~!! 0] ! ~!!]]/8" # s "drum",
  every' 16 16 (const $ n "3" # s "kit") $
  whenmod 3 2 (density 2) $
  withmod 11 5 0.5 1 (density 2) $
  n "[[~ 0] [[2!! ~]/4 0]]/2" # s "kit"
  ]

d'nim $ (1 ~>) $ slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

d'nim $ whenmod 16 12 (# vowel "[a i]/3") $
  (1 ~>) $ slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

d'drum $ swing' $ stack [
  n "[1*2, 0*8, [~!! [~!! 0] ! ~!!]]/8" # s "drum",
  every' 16 16 (const $ n "3" # s "kit") $
  whenmod 3 2 (density 2) $
  withmod 11 5 0.5 1 (density 2) $
  n "[[~ 0] [[2!! ~]/4 0]]/2" # s "kit",
  n "[~ 1]/2" # s "sn"
  # gain "0.8"
  ]

d'nim $ every' 16 1 (# vowel "o u") $
  whenmod 16 12 (# vowel "[a i]/3") $
  (1 ~>) $ slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

d'drum $ swing' $ stack [
  n "[1*2, 0*8, [~!! [~!! 0] ! ~!!]]/8" # s "drum",
  every' 16 16 (const $ n "3" # s "kit") $
  whenmod 3 2 (density 2) $
  withmod 11 5 0.5 1 (density 2) $
  n "[[~ 0] [[2!! ~]/4 0]]/2" # s "kit",
  n "[~ [1 0/8 1/2 0/2]]/2" # s "sn"
  # gain "0.8"
  ]

d'bass silence

let s = gap 32
  in d'bass $ swing' $
     (0.25 ~>) $ slow 8 $ stack [
       s $ sound "bass",
       s $ sound "sine"
       ]
     # gain "0.9"

let s = gap 32
  in d'bass $ swing' $
     slowspread (slow) [4%3, 1] $
     (0.25 ~>) $ slow 8 $ stack [
       s $ sound "bass",
       s $ sound "sine"
       ]
     # gain "0.9"

d'nim $ every' 16 1 ((# vowel "o u") . nim'del) $
  whenmod 16 12 (# vowel "[a i]/3") $
  (1 ~>) $ slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

-- experimental
d9 $ swing' $
--  iter 3 $
--  superimpose (0.75 ~>) $
  chop 8 $
  n "[0*2 1 [[~ 0]!] 0]/4" # s "bass2"
  # speed "[2 1]"
  # gain "0.9"

{-
let s = gap 32
  in d'bass $ swing' $
     whenmod 3 2 (within (0, 0.5) (const silence)) $
     whenmod 10 8 (within (0.5, 1) (const silence)) $
     slowspread (slow) [4%3, 1] $
     (0.25 ~>) $
     slow 8 $ stack [
       s $ sound "bass",
       s $ sound "sine"
       ]
     # gain "0.9"
-}

d'nim $ superimpose (iter 4 . nim'osc) $
  every' 16 1 ((# vowel "o u") . nim'del) $
  whenmod 16 12 (# vowel "[a i]/3") $
  (1 ~>) $ slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

d'wax $ slow 16 . striate 256 $ s "icarus"

d'drum $ swing' $ stack [
  n "[1*2, 0*8, [[~ 0] ~! [~!! 0] [~! 0!] ~!!]]/8" # s "drum",
  n "[~ 0]" # s "kit",
  n "[~ [1 0/8 1/2 0/2]]/2" # s "sn"
  # gain "0.8"
  ]

msil [d'nim, d'bass, d'wax]

d'hi $
  swing' $
  every 3 rev $
  whenmod 12 8 (0.5 <~) $
  (0.5 ~>) $
  slow 8 $
  gap 64 $
  n "[0 1]/2" # s "nimble"
  # speed ((-4+).(*(-1)) <$> density 1.1 sine1)
  # gain "0.9"

d'nim $ (0.25 ~>) $
  whenmod 4 2 (const silence) $
  slow 16 . striate 256 $ n "[0 1]/2" # s "nimble"

let s = striate 16
  in d'bass $
     slow 8 $ stack [
       s $ sound "bass",
       s $ sound "sine"
       ]
     # gain "0.9"

d'hi $
  swing' $
  every 3 rev $
  within (0.5, 1) (density 2) $
  whenmod 12 8 (0.5 <~) $
  (0.5 ~>) $
  slow 8 $
  gap 64 $
  n "[0 1]/2" # s "nimble"
  # speed ((-4+).(*(-1)) <$> density 1.1 sine1)
  # gain "0.9"

msil [d'bass, d'hi, d9]

hush
