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
# OSC-level testing. | |
# $Id: arc-test-0.py,v 7e921a75f124 2011/04/07 16:26:54 nick $ | |
from net.loadbang.osc.comms import UDPTransmitter | |
from net.loadbang.osc.data import Message | |
from java.net import InetAddress | |
from java.lang import System | |
RINGSIZE = 64 | |
LEVELS = 16 |
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
; Our legacy Java OSC library: | |
(def transmitter (net.loadbang.osc.comms.UDPTransmitter. (java.net.InetAddress/getByName "localhost") 10332)) | |
; Seriously non-idiomatic code. I'm only 20% of the way through the Joy of Clojure book... | |
(defn xmit [enc buffer] | |
"Transmit to encoder number enc, buffer is a sequence of integers." | |
(let [m (doto (net.loadbang.osc.data.Message. "/example/ring/map") (.addInteger enc))] | |
(doseq [n buffer] (.addInteger m n)) |
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
; shado for the monome 64. | |
(def all-on (.fill (net.loadbang.shado.Block. 8 8) net.loadbang.shado.types.LampState/ON)) | |
(def all-off (net.loadbang.shado.Frame.)) | |
(def renderer (net.loadbang.shado.BinaryRenderer. | |
8 8 | |
(net.loadbang.shado.SerialOSCBinaryOutputter. "localhost" 16543 8 "/shado"))) |
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 monome.display | |
(:refer monome.listener :only [a])) | |
(def my-block (.fill (net.loadbang.shado.Block. 64 4) (net.loadbang.shado.types.LampState. 0.05 0.0))) | |
(def mini-block (doto (net.loadbang.shado.Block. 4 4) (.fill net.loadbang.shado.types.LampState/ON))) | |
(def renderer (net.loadbang.shado.VariableRenderer. | |
64 4 | |
(net.loadbang.shado.ArcVariableOSCOutputter. "localhost" 10332 "/example"))) |
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
;; OSC listener. We use an agent containing a vector of encoder states. | |
(ns monome.listener | |
(:import (monome.types EncoderState)) | |
(:refer monome.types :only [initial-arc-state do-button do-delta])) | |
;; (Using :refer because we're still manually loading files.) | |
(defn interpret [m state] | |
"Interpret an OSC message, apply to an arc state." |
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 maxmsp-clojure-stopwatch.core | |
(:gen-class | |
:name clojure.Stopwatch | |
:prefix max- | |
:extends com.cycling74.max.MaxObject | |
:state lastsample | |
:init init) | |
(:import (com.cycling74.max Atom))) | |
(defn max-init [] |
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
m_Configuration = Manifest( | |
FULL_CANVAS = False, | |
DO_VORONOI = True, | |
TREE_DEPTH = 5, | |
FIELD_TIMER_INTERVAL = 0.033, | |
ASSETS_DIR = "/Users/nick/CASSIEL/FIELDWORKSPACE/" | |
) | |
m_Nested = Manifest( | |
A = Manifest(B = 6, C = "Hello"), |
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
class Manifest: | |
def __init__(self, **kw): | |
for k in kw: | |
setattr(self, k, kw[k]) |
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 oncotrees.util | |
(:import [org.python.core PyFloat PyInteger PyBoolean PyString | |
PyList PyInstance PyNone] | |
[java.util NoSuchElementException])) | |
(defn hashify [py-object] | |
(cond (instance? PyNone py-object) nil | |
(instance? PyInstance py-object) | |
(letfn [(retr [key] (.__getitem__ (.__dict__ py-object) key)) | |
(de-iter [iter result] |
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
(defn kick | |
[m_Configuration m_Geometry] | |
(let [{:keys [DO_VORONOI TREE_DEPTH BRANCH_BEND_PATHS]} | |
(u/hashify m_Configuration) | |
{:keys [CELL_ROWS CELL_COLS CELL_SIZE DELTA | |
INITIAL_LEN LEN_MUL]} | |
(u/hashify m_Geometry)] | |
(fn [t] | |
(let [v-fn (if DO_VORONOI | |
(voronoi-with (* CELL_COLS CELL_SIZE 1/2) |
OlderNewer