Tag Clojure

Fusion Programming: From Python to Clojure and Back

clojure-python-2

Recently we’ve been working on several digital art projects using Field as a development and presentation platform but with Clojure running the core, domain-specific algorithmic code. This choice is, admittedly, partly because Clojure is new and shiny, but we also like the Emacs- and Leiningen-based development environment (complete with continuous integration testing), and Clojure’s clean functional semantics lends itself to realtime, evolutionary artworks. Since Field works at the level of Python-on-Java (via Jython), and Clojure runs in the JVM, the Python and Clojure worlds inevitably collide.

MaxMSP Showing and Telling

m4u_170

We’re workshopping, and gigging, at the M4_u (Max/MSP for Users) Convention, 13th to 14th of January, Phoenix Square, Leicester. The workshop is pretty much going to be a repeat of that given at the Cycling ’74 Expo – building an algorithmic step sequencer and abstract display system using Clojure. The gig will be monome-based, probably with some pulse sequencer action.

Clojure Workshop, Expo ’74, October

expo-74-logo

We are running a workshop on concurrent patchers and data structures with MaxMSP and Clojure at the Cycling ’74 Expo in Brooklyn, October 14-16. Details to follow. For that matter, details to be designed and coded.

Anyone who wants to get a flavour of how the workshop might pan out should check out the existing Python-for-MaxMSP package, and then close their eyes and try to imagine what that might look and feel like if the underlying language were Clojure rather than Python.

I’m anticipating that full-on functional programming techniques will be new to many MaxMSP users, and the uncompromising nature of the Lisp syntax can also be a bit of a hurdle, so I’m planning to spend some workshop time getting up to speed on those aspects before looking at the concurrency features specific to Clojure itself.

Clojure in MaxMSP

AquamacsScreenSnapz001

One of the things moving up my to-do list is an environment for hosting the Clojure language inside MaxMSP. Clojure is hosted on the Java JVM, just like the languages for my other MaxMSP hosting projects, Python and Groovy, although the Clojure interpreter is rather an odd beast compared to the other two. Specifically, it’s not clear to me (yet) exactly what it means to build a Max patcher with several Clojure objects inside it, and one of the strengths of Clojure is its ability to deal cleanly with concurrency and interaction between decoupled computations, so there should only really be “one” Clojure environment which everything somehow shares and uses for communication.

That aside, Clojure is good at Java interoperability, and has a built-in compiler which generates real class files for synthesised Java classes matching interfaces or extending existing classes, so getting a Clojure program into MaxMSP is just a case of configuring this machinery. (The Leiningen build tool does most of the work.)

So, proof of concept: a simple stopwatch for MaxMSP in Clojure. It’s quite stateful, and doesn’t do much with data structures or higher-order functions, so it’s a feeble example of Clojure’s power and not a very convincing use case, but it gets the ball rolling.