Saturday, September 1, 2012

My first meeting with Closure

I got inspired by video of life music hacking jam session
so that I wanted to try Overtone project myself.
First you need to install Lein which is a kind of depency managet for Clojure.
You can follow with instructions at
What I did on Windows was downloading lein.bat from and stand-alone jar from
Then I had to set env. variable LEIN_HOME to my local dir, e.g.: c:/tools/lein and put the stand-alone jar in
and add LEIN_HOME to PATH system variable so that lein.bat could be found globally in system.

Then when I typed
in system console it downloaded missing Clojure dependencies and welcomed me with message:

Leiningen is a tool for working with Clojure projects.
Several tasks are available:
check               Check syntax and warn on reflection.
classpath           Write the classpath of the current project to output-file.
clean               Remove all files from project's target-path.
compile             Compile Clojure source into .class files.
deploy              Build jar and deploy to remote repository.
deps                Show details about dependencies.
do                  Higher-order task to perform other tasks in succession.
help                Display a list of tasks or help for a given task.
install             Install current project to the local repository.
jar                 Package up all the project's files into a jar file.
javac               Compile Java source files.
new                 Generate project scaffolding based on a template.
plugin              DEPRECATED. Please use the :user profile instead.
pom                 Write a pom.xml file to disk for Maven interoperability.
repl                Start a repl session either with the current project or standalone.
retest              Run only the test namespaces which failed last time around.
run                 Run the project's -main function.
search              Search remote maven repositories for matching jars.
show-profiles       List all available profiles or display one if given an argument.
test                Run the project's tests.
trampoline          Run a task without nesting the project's JVM inside Leiningen's.
uberjar             Package up the project files and all dependencies into a jar file.
upgrade             Upgrade Leiningen to specified version or latest stable.
version             Print version for Leiningen and the current JVM.
with-profile        Apply the given task with the profile(s) specified.
Run lein help $TASK for details.
See also: readme, faq, tutorial, news, sample, profiles,
deploying and copying.

Now I can start playing with Overtone...
Then you download sources from github:

git clone git://

and build project with

lein deps

Now launch REPL and follow according to steps at Overtone github:

The quickest way to get started is to launch a clojure repl using lein. In the overtone project directory....
$ lein repl
Then make some noise :)
user> (use '
   ...wait a bit...
user> (demo (sin-osc))
For a better experience try Overtone in emacs or Overtone in vim.
Unfortunately that ain't that easy and first command: (use 'overtone.livebrought me to error message:
--> Loading Overtone...
UnsatisfiedLinkError Unable to load library 'scsynth': Nie mo┐na odnalečŠ okreťlonego modu│u.
  com.sun.jna.NativeLibrary.loadLibrary (
I wish you were more lucky, I will come back to resolve it in a while..stay tuned...

Soo.. after a while I'm back with a different approach.
I followed the following steps:
From command line execute:
lein new tutorial
cd tutorial 

edit project.clj generated in folder tutorial and add dependency:

(defproject tutorial "1.0"
  :dependencies [ [org.clojure/clojure "1.3.0"]
                  [overtone "0.7.1"] ])

Then type:
lein deps
Install SuperCollider ( - during installation enter installation folder name as SuperCollider, without version number. I'm not sure if otherwise Overtune will locate scsynth.exe correctly.

Start REPL (

lein repl
Type commands:

(use 'overtone.core)

and start playing... (