Skip to content

Instantly share code, notes, and snippets.

@kawabata
Created November 16, 2011 21:33
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kawabata/1371488 to your computer and use it in GitHub Desktop.
Save kawabata/1371488 to your computer and use it in GitHub Desktop.
tarai mawashi in overtone
(ns tarai.core
(:use [overtone.live]))
;; basic.clj より
(defsynth foo [freq 200 dur 0.5]
(let [src (saw [freq (* freq 1.01) (* 0.99 freq)])
low (sin-osc (/ freq 2))
filt (lpf src (line:kr (* 10 freq) freq 10))
env (env-gen (perc 0.1 dur) :action FREE)]
(out 0 (pan2 (* 0.1 low env filt)))))
;; この関数はお好みで。
(defn foo-play [x y z j]
(foo (* 110 (+ x 3)) 1.0)
(Thread/sleep 150)
(foo (* 110 (+ y 3)) 1.0)
(Thread/sleep 150)
(foo (* 110 (+ z 3)) 1.0)
(Thread/sleep 150)
(foo (* 110 (+ j 3)) 1.0)
(Thread/sleep 150))
(defn tarai [x y z j]
(println x y z j)
(foo-play x y z j)
(if (<= x y)
y
(tarai (tarai (- x 1) y z j) (tarai (- y 1) z j x) (tarai (- z 1) j x y) (tarai (- j 1) x y z))))
(tarai 8 3 2 3)
@samaaron
Copy link

samaaron commented Dec 2, 2011

Really great stuff - I'm looking forward to seeing what you do next...

@neatonk
Copy link

neatonk commented Dec 2, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment