Created
December 9, 2012 03:54
-
-
Save matschaffer/4243260 to your computer and use it in GitHub Desktop.
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 otexplore.core | |
(:use overtone.live)) | |
(def server (osc-server 44100 "osc-clj")) | |
;; (zero-conf-on) | |
;; (zero-conf-off) | |
;; (osc-listen server (fn [msg] (println msg)) :debug) | |
;; (osc-rm-listener server :debug) | |
(definst basic-sin [freq 440] | |
(* (env-gen (perc 0.08 1) :action FREE) (sin-osc freq))) | |
(defn control-basic [val] | |
(let [val (scale-range val 0 1 50 1000)] | |
(ctl basic-sin :freq val))) | |
(defn play-note [inst note] | |
(inst (midi->hz note))) | |
(defn pad-on [action] | |
(fn [msg] | |
(if (== 1 (first (:args msg))) | |
(action)))) | |
(osc-handle server "/1/fader1" (fn [msg] (control-basic (first (:args msg))))) | |
(osc-handle server "/2/push1" (pad-on #(play-note basic-sin 64))) | |
(osc-handle server "/2/push2" (pad-on #(play-note basic-sin 65))) | |
;; (basic-sin) | |
;; (stop) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment