Created
November 16, 2011 21:33
-
-
Save kawabata/1371488 to your computer and use it in GitHub Desktop.
tarai mawashi in overtone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Really great stuff - I'm looking forward to seeing what you do next...