This was surprisingly simple given how many things there were to do! (Usually it seems like something breaks when there's this many steps between me and installing something.)
- Install Sublime Text 2
- Install Sublime Text's Package Control
- Configure things so you can open files with
subl
from command line - Install SublimeREPL using Pacakge Control.
- Install homebrew
- Install leiningen by typing
brew install leiningen
at the command line. - Install SuperCollider
Create a new leiningen project:
$ lein new myproj
$ cd myproj
$ subl project.clj
Edit your project file by adding Overtone to your project's dependencies, then run:
$ lein deps
Start your project as an interactive session with SublimeREPL.
Make sure your project.clj
is the tab in focus and then go to:
Tools -> SublimeREPL -> Clojure -> Clojure
Connect scsynth to your project.
In your REPL session type:
user=> (use 'overtone.core)
Play a saw wave, then stop it.
user=> (definst foo [] (saw 220))
user=> (foo)
user=> #<synth-node[loading]: user/foo 4>
user=> (kill 4) ; kill the synth with ID 4
(Note that 4
will be a different number in your case.)
Update your project.clj file by adding :main myproj.core
right before the :dependencies
line. Now it should look something like this:
(defproject myproj "0.1.0-SNAPSHOT"
:main myproj.core
:dependencies [ [org.clojure/clojure "1.5.1"]
[overtone "0.9.1"]])
The myproj.core
line corresponds to the file called "src/myproj/core.clj" that lein created for you. This file should already have the (necessary) line at the top that says (ns myproj.core)
. Now whenever you start up a REPL, the "myproj.core" namespace is loaded.
You just need to add whatever additional commands you want run when you start up your REPL. So to load Overtone, your "src/myproj/core.clj" file should look like this:
(ns myproj.core)
(use 'overtone.core)
(boot-server)