Skip to content
A Live Programming language for music
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A language for live programming music in Clojure

Music as Data (MAD) is a live programming language/environment based on written in Clojure.

MAD lets you treat music as data and apply data transformation on the fly so you can experiment with notes and samples.

You can see (and hear) examples at

The documentation still lacks a lot of stuff, so this is NOT for the faint-hearted.


It's best to go at where more examples are (with audio).

Play a sample or note like this: (play! [kick])

Play two samples (or notes): (play! [kick kick])

Each sample is being played at one time.

If you want to play a sample at the same time: (play! [kick (+snare hihat)])

This will play kick at one time and snare+hihat at another.

You can also play triplets: (play! [kick [snare snare snare]])

Now kick will be at one time and for the same duration, you'll have three snare hits.

Of course you can play notes: (play! [A4 B4 D#5])

Mix, notes and samples: (play! [hihat A4 kick G6])

The fun begins when you understand that you can manipulate music as data by apply tranformations. For example:

(p (reverse (pattern [kick kick])))

Now, instead of using play! (which plays samples in a loop - perfect for building stuff on the fly) you can create a pattern and then run it only for once using the p function. The advantage is that you can manipulate data and their properties thus mess around with note frequences, tempo, scaling whatever.

How to use

First of all, don't run lein deps. All libraries and samples are included (bad bad bad). Change the globals.clj into the path where samples are (so you can have drum sets).

Then, start your repl (lein swank) and go to core.clj.

Compile core.clj and

    (start main)

Don't close the window that will pop-up. This is the processing window (so you can have graphics too!). After that, run


and you are ready to start playing!

(p (pattern [A4 A2]))

(p (pattern [kick snare (+ hihat snare)]))

You can have it playing on a loop by executing: (keep-looping)

and then:

(play! [A4])
(play! [C5])


Still cleaning up the repository from deps, so some jars might not be inside project.clj yet.

lein deps


Designed and developed by Jon Vlachoyiannis (

Something went wrong with that request. Please try again.