Skip to content

Instantly share code, notes, and snippets.

@illiichi
Created June 18, 2020 14:59
Show Gist options
  • Save illiichi/bdd8ad72d388760caf2a0760b7ff6b77 to your computer and use it in GitHub Desktop.
Save illiichi/bdd8ad72d388760caf2a0760b7ff6b77 to your computer and use it in GitHub Desktop.
aspirated from "Compassion through algoritms" (https://algorave-tokyo.bandcamp.com/album/compassion-through-algorithms)
;; aspirated by illiichi
;;
;; from
;; Compassion through algorithms - Algorave Tokyo
;; (https://algorave-tokyo.bandcamp.com/album/compassion-through-algorithms)
(:use 'overtone.live)
(defmacro switch [trig a b]
`(let [t# (abs ~trig)]
(~'+ (~'* t# ~a) (~'* (~'- 1 t#) ~b))))
(defmacro switch->
[in b eff] `(switch ~b (-> ~in ~eff) ~in))
(defmacro reduce-> [initial f & colls]
`(reduce ~f ~initial ~(first colls)))
(defmacro play [s a d r body]
(let [xs (mapv #(* 10 %) [s a d r])]
`((synth (out 0 (~'* 1/2 (tanh ~body)
(env-gen (envelope [0 0 1 1 0] ~xs) :action FREE)))))))
(play 0 3 6 6
(let [snd (local-in 2)
[s-l s-r] (-> (+ snd (sin-osc [80 1] 2))
(reduce-> #(* %1 (sin-osc (* snd %2))) [300 600 1200])
(mod 1))]
(-> (rotate2 s-l s-r (sin-osc 0.33))
(doto (local-out))
(ringz 10 0.001))))
(play 2 1 12 6
(let [snd (local-in 2)]
(-> (sin-osc (* 30 snd) 1)
(* (lf-pulse:ar (lin-exp (sin-osc:kr 1/32) -1 1/8 8) 0 snd))
(switch-> (lf-saw 1/4 0 0.5) (free-verb 1 0.1))
(mod 1)
(doto (local-out)))))
(play 6 0 12 4
(-> (local-in 2)
(+ (* (switch (lf-pulse 1/4 0 3/4)
(lf-noise0 8)
(lf-noise2 1/4))
2 (- (lf-pulse 128) 1/2)))
(bpf (lin-exp (lf-noise0 1/4) -1 1 10 1000))
(mod 1)
(doto local-out)
leak-dc
(* 4)
(free-verb 1 0.5)))
(play 6 6 6 3
(-> (local-in 2)
(+ (* (lin-lin (lf-pulse (* 1/50 (sample-rate))) 0 1 -1 1)
(lf-noise0 (* 1/50 (sample-rate)))))
(switch-> (lf-pulse 1/2 0 (lf-noise0:kr 1/5))
g-verb)
(switch-> (lf-pulse 1/8 0 (lf-noise0:kr 2))
(* (lf-pulse 8 0 0.5)))
tanh
(doto local-out)
g-verb
(* (lf-pulse (lin-exp (lf-noise1:kr 1) -1 1 1/4 8) 0 1/320))
(free-verb 0.0001 0.01)
(hpf 20)))
(play 0 0 26 0
(let [gate (impulse 1/120 13/24)
r (env-gen (envelope [1 1 0.01] [10 60] :exp) gate)
snd (fn [dr] (-> (bpf (white-noise) (* [1000 2000 10000]) r)
(free-verb 1 0.1)
(comb-l 1/8 1/8 1.2)
mix))
env (env-gen (envelope [0 1 1/2 0] [0 50 20] -4)
gate)]
(-> (map snd [0.999 1.001])
(* 16 env))))
{:deps {overtone/overtone {:mvn/version "0.10.6"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment