-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathosc-testing-001.clj
47 lines (35 loc) · 1.04 KB
/
osc-testing-001.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
(ns osc-testing)
(use 'overtone.core)
(use 'late-night.core)
;(use 'overtone.osc)
(def PORT 4242)
(def server (osc-server PORT))
(def client (osc-client "localhost" PORT))
(osc-handle server "/beep" (fn [msg] (do (println "MSG: " msg)
(test-beep))))
(osc-send client "/beep" "i" 1)
(doseq [val (range 10)]
(osc-send client "/test" "i" val))
(osc-rm-handler server "/beep")
(def m-1 (metronome 360))
(stop)
(defn send-pattern-tick []
(test-beep)
(osc-send client "/beep" "i" (int (rand 100))))
(def p-1 (ref [1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0]))
(at-zero-beat m-1 8 p-1 #'send-pattern-tick)
(stop)
(send-pattern-tick)
(definst test-beep []
(let [s (sin-osc 300)
e (env-gen (perc 0 0.13 1 0)
1 1 0 1 FREE)
o (* s e)]
(out 0 (pan2 o))))
(test-beep)
(osc-send client "/beep" "i" 1)
(osc-listen server (fn [msg] (println "LISTENER: " msg)) :debug)
(osc-rm-listener server :debug)
(osc-rm-handler server "/beep")
(stop)
(odoc send-reply )