Clojure, Development, LISP

Adventures in Clojure, with Overtone, Light Table, and Emacs Live

After last week’s Toronto Lisp User Group meeting, I decided to give Clojure a fair shake after all. Since Java has been my arch-nemesis since 1996, I’ve mostly avoided Clojure up to now solely because it is built on and plays so nicely with the JVM—but, I’ve been seeing more and more awesome projects in Clojure lately, to the point where I can no longer justify ignoring it.

In particular, the Clojure project that came up in the after-meeting chats that most grabbed my attention was Overtone. Overtone is, ostensibly, just a wrapper library to the SuperCollider audio engine. I’ve been playing with SuperCollider both natively and through the Common Lisp client, cl-collider, for a few months; but Overtone doesn’t feel like just a wrapper around SuperCollider. As the website describes it, Overtone combines “the powerful SuperCollider audio engine, with Clojure, a state of-the-art lisp, to create an intoxicating interactive sonic experience.” (emphasis my own). Based on what I’ve seen and achieved with it so far, I’m inclined to agree.

I already had Leiningen and Light Table installed, Light Table just needed an update to the latest version from AUR. So, armed with a copy of Practical Clojure, I ran through a quick refresher of Clojure syntax and dived into the Overtone tutorials. This little snippet from the project README, in particular, really shows off the expressiveness and clarity of Clojure syntax over the native SuperCollider language:

(demo 7 (lpf (mix (saw [50 (line 100 1600 5) 101 100.5]))
             (lin-lin (lf-tri (line 2 20 5)) -1 1 400 4000)))

Light Table makes it pretty easy to get up and running with Clojure. The instarepl is a pretty sweet feature; it’s like a scratch file buffer, but it automatically runs the code you type and displays the return result(s) inline, right next to the code. Paired with Overtone, you’re getting instant auditory feedback on everything you type as you type it. One problem with Light Table, however, seems to be how it handles retrieving dependencies through lein. I was having a lot of fun, until Light Table froze up downloading the audio packs for the sampled piano instrument.

Ah, but then I checked out Emacs Live. So many expletives of joy and wonder came streaming out of my mouth! Words do it no justice—you’ll just have to try it out for yourself. There’s also a neat video, demoing both Overtone and Emacs Live. My only regret is that the environment customizations have been fully streamlined for Clojure, and not Common Lisp. I may have to do something about that.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s