(def awesome (+ clojure music))


Who said that learning how to code in a new language must be the same every time? Not me, and I would like to share interesting way to begin journey with Clojure and it's ecosystem. It's not detailed technical tutorial, rather guide through external materials and tools.
The talk is about coding music. More specifically about preparing environment for audio generation and experimenting with sounds, which leads to quick learning as side effect.

If you never before had contact with music generated by code, you should try to listen this:


Ok, it may seems a little bit strange and not like 'the real coding'. That's why we need some explenation form Sam Aaron form Meta-Ex, authors of piece above. Talk lasts forty minutes but believe me, it's totally worth your time. It covers Overtone, Clojure's library for audio generation.

Link to 'Programming Music with Overtone'

Thus it's generating music using programming language and external device, which are also configured and controlled by your code. Overtone is very robust and have many possible applications. For instance, Joshep Wilk uses Overtone to create music compositions based on artificial intelligence techniques, without being explicitly programmed. Awesome, right? However, it's story for another article.

In summary, if presented idea appeal to you, probably you would like to do it by yourself. But before we could type words to make sounds, we need prepare environment (libraries, editors and so on) and what obvious, learn at least fundamentals of Clojure. For me, thought that I'll be able to do create my own sounds, was big motivation and chained me to the keyboard for a long time.

After watching several talks from ClojureTV youtube channel, you will notice easily that a lot of speaker use Emacs for live coding. Yup. Emacs.

I was Vim user for some time, after that switched to Sublime and now Atom editor. So I'm not stubborn user of specific editor, but I would never think about using Emacs with it's complicated keys-bindings. Until I saw almost native Clojure integration and excellent responsiveness, with is crucial when working with REPL. By responsiveness I mean having code editing and code execution in single environment.
Light Table has similar functionality and I thinks that it's great for single experiments with Clojure syntax, especially at the beginning of learning process. When inline evaluation of expressions provide immediate feedback for typed code. At present moment, Emasc is more mature and convenient for more advanced tasks.
Of course there are other IDE plugins and tools like Gorilla REPL, but I decided to stick to currently most used solution.


Very surprise for me was 'Clojure for the Brave and Trure' tutorial. Except being clear and really engaging introduction to language, it provides tutorials guides for starting with Emacs and integrating it with Clojure.

As soon as finish first lesson, get familiar with Leiningen project automation tool. It takes some time, but again, it's just clojure tool so expect it to be easy. Just after that, you are ready to jump right into Overtone. Quickly you will discover how important was to choose editor with excellent REPL integration. Selecting and evaluating parts of code, will allow you to make changes in sound, on the fly, without need to stop the music. After playing with it for a while, I discovered how much I learned by the way: Emacs was no longer wired editor, managing projects with lein was easy and I had basic knowledge of best Lisp dialect.

The clue of this post is to encourage you, to try find out your exiting way to learn things.
Maybe your like visuals more than sounds? then try Quil Clojures wrapper for Processing. Do you like video games? what could be better way to learn language than making your own game. As long as it provides big amount of fun and motivation it's awesome way to learn.
Happy hacking!