Experiments In Overtone
The Overtone project is Clojure -meets- SuperCollider. What does this mean? It means that it's using a very interesting programming language to write code for a very interesting music and sound-synthesis runtime. What that needs is a programming environment. While the project has their own ambitions, how far can we get in Field?
It's not clear yet, but it's straightforward to get started. First install Overtone and everything it needs. Thanks to the Clojure community's near obsession with build systems this ought to be very easy. Something like:
curl https://raw.github.com/technomancy/leiningen/stable/bin/lein > lein chmod u+x lein ./lein self-install
That gets you leiningen, a popular Clojure build tool.
Next, the sources for Overtone itself:
git clone https://github.com/overtone/overtone.git
Finally put the two together:
cd overtone
../lein deps
Now we have a directory that looks like this:
In the plugin manager right-click and "Add directory full of jars to classpath". Select that "lib" directory with all the jars in it. Next "Add Jar/Directory to class path" for that "src" directory as well (Clojure looks to the class path to find .clj clojure files). While you in the plugin manager make sure that the wrapInTransformPlugin is turned on — it's very useful when you start writing serious amounts of code in non-Python languages. The jsrscripting_extension plugin should also be on — we'll be writing in Clojure, not Python.
Restart Field.
Finally make sure that Clojure support is enabled in your Field — turn it on in the "lambda" tab (you might want to elect to do this automatically on startup)
Hello Overtone
Now we can say hello to Overtone. In a new code box, start off by telling the WrapInTransform plugin that this box is going to be completely in Clojure (or we can wrap everything we write in a new Text Transform):
To make sure everything is working, try executing this:
(use 'overtone.live)
You should get some enjoyable ASCII art from Overtone. If you find that Field crashes immediately, then check the Console. It's probably SuperCollider dying and taking Field with it — see this thread for details and a solution.
Now we can get Overtone to sing hello:
(use 'overtone.live)
(definst sin-wave [freq 440 attack 0.01 sustain 0.4 release 0.1 vol 0.4]
(* (env-gen (lin-env attack sustain release) 1 1 0 1)
(sin-osc freq)
vol))
(sin-wave)
Many of the features of the text editor work automatically inside Clojure — command-return for line / selection execution; embedded GUI elements (at least the ones that evaluate to plain text rather than complex Python expressions); the execution ruler and so on. At this point you can spend a pleasant evening hacking on Overtone's example code in Field.
Python meets Clojure
Should Field get drawn deeper into Clojure as a language we'll see support for Field's animation and box idioms in Clojure. But there's actually already much you can do with just a tiny little bit of Python to glue your Clojure into the Field environment proper.
For example a box that starts and stops a noisy synth as Field's time line. First a definition, executed once:
(defsynth bizzle [out-bus 10 amp 0.5]
(out out-bus
(* amp
(+ (* (decay2 (* (impulse 10 0)
(+ (* (lf-saw:kr 0.3 0) -0.3) 0.3))
0.001)
0.3)
(apply + (pulse [80 81]))))))
Now in Python, in a separate box:
def start(): _self.b = _clojure.bizzle().intValue() def stop(): _clojure.kill(_self.b) _r = (start, None, stop)
Now we can litter our canvas with these boxes (command-shift-drag to duplicate!) and scrub them with the red-timeline:
We're just beginning to scratch the surface of what we can do with Overtone — unlike the MaxPlugin, the SuperCollider runtime is actually being hosted inside the same process as Field, so we can transport control- and even audio-rate material between the environments. We ought to be able to visualize analysis and control information by piping material straight out of SuperCollider and into Field's graphics system for example. And we ought to be able to come up with a whole bunch of ways in which the graphs and UI design aspects of Field can be brought to bear on Overtone's live coding story.
Stay tuned.



