LightTable aims to give developers instant feedback about their code, showing how any change affects their applications. Giving you a developer “surface” to work on, which will bring information to the places you need it the most. The principles of the LightTable design include:
Documentation there when you need it, no need to search
Edit anywhere and anything - not just text and not just as files
Discover by doing, changes produces instantaneous results
I was a little surprised to have an access issue with Heroku when using my new Mac Book Pro, as its always been really easy to deploy my applications to Heroku in the past. I kicked myself when I realised I’d only set up a public key specifically for my Github account.
This got me to wondering the best way to set up keys given I am using different services for both personal project and work.
Sam Aaron and Jeff Rose gave a whirlwind tour of creating music with Overtone, an open source music generator written in Clojure.
You can define your own instruments, map keyboards and other synthesiser hardware, all to make some funky sounds - although you probably want to have headphones on when experimenting!
@samaaron with overtone you can sit on a train and make musicI had fun creating my first overtone project from scratch at the last Overtone Hackday. Have a look at how I set up my environment.
The Design of Overtone
Music is not a very easy concept to define in software. Typically you start with a synthesiser and work your way up to notes and chords. Eventually you may get to a music piece, but this is often driven by a hardware keyboard and recorded.
The difficulty is that everyone has a different idea of how to describe music.
Overtone comes in two parts. The Super-Collider generates all the sounds from over 500 midi building blocks, essentially you create a directed graph that returns values to represent those sounds. The clojure project part allows you to define instruments (synthesisers) and orchestrate these instruments together.
Basic approach to making music
Overtone generally works on the principle of subtractive synthesis. You create a number of different sounds by defining individual instruments and by adjusting the time and frequency of the sound wave to vary the sounds produced.
Once you have some instruments, then adding an envelope generator will give you a changing sound through time by, essentially multiplying the sound by the envelope.
Join sounds together by creating a player function that takes a time and plays the instruments - adding durations to the sound.
To spice up your sounds you can then experiment with playing two different frequencies at the same time, referred to as multi-channel expansion. A resident low pass filter is also fun to experiment with.
Sam and Geoff showed off what they call the stepinator, which seems to emulate a square wave form which steps through a series of values over time. This created some Buck Rogers style music.
Eventually you will want to use an external keyboard or some hardware device to pay your music as calling functions over and over again from within the REPL will only get you so far. If you map functions, frequencies, etc to the external player controls then you can play your clojure code..
To make the music come alive even more, you can use the Java processing framework. Instead of calling processing directly, you can use the clojure project Quil to visualise the overtone sounds, creating a sphere and controlling the size of the sphere with the different frequencies of the sounds.
Sam and Geoff are trying out different ways of sharing the REPL so they can jam together. Many people are sharing their sounds on freesound.org, a collaborative database of Creative Commons Licensed sounds. Browse, download and share sounds
Extreme startup is a practical workshop which simulates the excitement and insanity of working for a high pressure startup company, where every decision (or lack of) can make or loose you money - or in this case points!
Lets delve deeper into the misteries of this kind of coding workshop.
The March edition of the London Clojurians coding dojo all the suggested dojo challenges were to be carried out with ClojureScript. After a long list of ideas we voted to do either Conway’s Game of Life or Monty Carlo graphics.
Getting started with ClojureScript seemed reminiscent of the challenge the group faced a couple of years ago when first trying out Clojure. Although getting started with Clojure itself is pretty easy these days, it feels like ClojureScript still has a way to go in terms of a great developer experience.
I looked at ClojureScript One and was put off a little by the amount of git projects it was downloading as part of its bootstrap process. I am sure its a great project, but seemed too much for the dojo and my netbook!
lein ring server-headless 3000
In hindsight, perhaps we should have looked at the advanced example that came with lein-cljsbuild, although we would probably have also run out of time with that too…
Perhaps if we had spent a bit of time before the dojo with the basics things would have gone better, however it was good to discover as a group the level of challenge involved and it made it easier to get started as we could draw from a range of experiences.
So what else did I learn?
Google Closure libraries
The Google Closure library looks really great, but there seems to be a few challenges to get it to work with ClojureScript. Again this is down to our limited time to get to grips with several APIs, so we had little luck finding something that worked.
Where’s my DOM
Our group got stuck on trying to find elements in the DOM via ClojureScript, repeatedly getting nil when asking for elements in the DOM. We postulated that is was a timing problem, but were not able to code around the problem.
Find an example that works
Find an example ClojureScript project that works and is easy enough to understand - without having to spend an hour setting up Leiningen plugins and dependencies or having to download lots of things from the Internet. This was tricky to find in the time we had.
So first impressions of the experience suggest I need to read some good tutorials on the subject and review code of some more projects. I plan on doing some more projects around Noir, so I’ll try and see where the advantages of using ClojureScript are when using a set of Clojure web frameworks.
I am still excited about ClojureScript, but its one of those things where I need to find more time than I have to get to grips with it. If anyone has any other blog or project recomendations, please let me know.
Another chance to practice Clojure with the help of the great people that are part of the London Clojurians community. Each person at the dojo has a different experience with Clojure and functional programming, so there is always something different to learn. It still amazes me how much I learn and how confident each dojo makes me (by the end of the night anyway).
The coldest night in London of 2012 so far was the warm up to a symphony of music by a collection of unstoppable Clojure hackers. As it was my first hackday with Overtone there was lots of new things to learn, from setting up the environment to a whole load of interesting music theory.
I cant really cant do justice to how much fun it is working with Overtone. Its like getting your hands on a Stylophone for the first time, just after seeing Rolf Haris demo it on TV! The only difference being you can make much better music with Overtone.
There is something just so ultimately geeky and fun in creating music using a functional programming language like Clojure.
I first tried Overtone at a London Clojurian coding dojo and with the help of the rest of the team we were quickly creating weird and wonderful sounds - although not quite in the same leaguge of
Thanks to some great documentation on the overtone github site it was pretty easy to set up my lubuntu laptop with an audio server, Overtone server and a nice lightweight clojure development environment (emacs, leiningen). I am afraid it will take me a bit longer to absorb music theory!
Setting up the audio for Overtone
In order to get sounds out of your overtone project on Linux, you need to add a few packages.
sudo apt-get install jack-tools ant openjdk-6-jdk fftw3 qjackctl
As you grow your overtone project you may want to switch to a linux kernel set up for real time processing, but to start with this is not necessary. If you do get more involved projects, its probably a good idea to also look at Ubuntu studio which provides a great selection of audio, video and graphics tools.
_Mac OSX already has a suitable sound server, so nothing extra is required. If you are using windows, overtone is supported also (not sure if you need to set anything up though).
Create a new overtone project
An overtone project is just like any other clojure project, with the overtone dependency added.
Create a new clojure project with your build management tool of choice: maven, cake or leiningen. I used leiningen as my tool of choice.
lein new tutorial
Add the Overtone dependencies to the project configuration file tutorial/project.clj
(defproject tutorial "1.0"
:dependencies [[org.clojure/clojure "1.3.0"]
With the overtone dependencies added to the project file, used leiningen to download the jars that make up overtone itself.
Leiningen will download about 16 jar files for overtone 0.6.0 and places them in the project lib folder. This gives you all the libraries you need to start creating things in overtone, including an appropriate version of clojure.
Fire up your environment
Emacs not only has great support for the Clojure language, its a great way to try out your code by evaluating individual functions (s-expressions).
My preferred way to launch emacs is to change directory to the project top level and fire off emacs with the project file
emacs project.clj &
Using the dynamic environment of Clojure, the REPL, is a great time saver for trying out functions as well as running your project code. To fire up a repl inside emacs I use the new emacs 24 approach, running Meta-x (clojure-jack-in) to start up and connect to a repl using the underlying lein project file.
I have set up a keyboard shortcut of C-c C-j to make this even easier.
For my initial experiments I run an overtone server on my laptop, that way I can also play on the train home. You can also use an external overtone server called the SuperCollider (no not the LHC)
In the repl, I fired up the internal server (dont try to fire off both servers in the same repl, it crashed my repl)
in the REPL
/ __ /_ _____ _____/ /_____ ____ ___
/ / / / | / / _ \/ ___/ __/ __ \/ __ \/ _ \
/ /_/ /| |/ / __/ / / /_/ /_/ / / / / __/
\____/ |___/\___/_/ \__/\____/_/ /_/\___/
Programmable Music. v0.6
Hello jr0cket, may this be the start of a beautiful music hacking session...
# Defining my first instrument
I soon discovered that it does take a little time to build your instruments. Its like any good programming challenge, there are many ways to do things and there are always lots of surprises. Reading the [getting started guide](https://github.com/overtone/overtone/wiki/Getting-Started) helped me with my first instrument.
(definst annoying-tone  (saw 220))
This is a simple and rather annoying tone that uses the saw function to create the sound. To play the sound I simply call its name:
The easiest way to end your experiment in sound quickly is to use the (stop) function.
Quickly testing out your instruments with emacs
Many cool things were done at the hack day and it was great fun to play with the Ableon Novation Lauchpad. Its a midi controller that can be used to help you play your instruments and make it easier to turn overtone into a song maker.
I got as far as creating a few basic instruments and borrowing a few others, such as the one to create Jingle Bells!
Thanks to Phil Potter for having the energy to organise this event, Thoughtworks for supporting us with the venue and everyone there for making it a great day.
To have a whole day focused on overtone really helped me accomplish something and its going to be easier now to keep the learning going. All my experiments are now uploaded to my github account.
Hope you find the time to make music with Clojure and Overtone, you will love it.