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
(require '[clojure.core.async :as async]) | |
(let [l (Object.)] | |
(defn log | |
[fmt & args] | |
(locking l | |
(apply printf fmt args) | |
(flush)))) | |
(let [req (async/chan 10) |
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
#!/bin/bash | |
# Example usage: | |
# | |
# lein-play '[org.craigandera/dynne "0.2.0"] [incanter/incanter-core "1.5.1"]' | |
LIBS=$* | |
PROJECT_DIR=/tmp/lein-play-`date +%Y%m%d%H%M%S` | |
mkdir $PROJECT_DIR |
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
{:i1-channels (plumbing/fnk ^long [] 1) | |
:i1-duration (plumbing/fnk ^double [] 60.0) | |
:i1-amplitude (plumbing/fnk ^double [^double t] (Math/sin (p/* t 440 2.0 Math/PI))) | |
:i2-channels (plumbing/fnk ^long [] 1) | |
:i2-duration (plumbing/fnk ^double [] 60.0) | |
:i2-amplitude (plumbing/fnk [^double t] (let [x (-> t (p/* 440 2.0) long)] | |
(if (even? x) 1.0 -1.0))) | |
:m1-channels (plumbing/fnk ^long [^long i1-channels] i1-channels) |
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 ->op | |
"Create an operation that just samples that sound | |
without additional processing." | |
[s] | |
(let [s* (gensym "sound")] | |
`{:bindings {~s* ~s} | |
:duration (.duration ~s*) | |
:channels (.channels ~s*) | |
:amplitude (.amplitude ~s* ~'t ~'c)})) |
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
// A Java variation on the same theme | |