Tuesday, March 15, 2011

Euclidean Rhythm MIDI File Resource in Ableton Live

"There is geometry in the humming of the strings" - Pythagoras


The Euclidean Algorithm

In 2004, Godfried Toussaint wrote a paper titled "The Euclidean Algorithm Generates Traditional Musical Rhythms" that describes the Euclidean Algorithm in detail. In fact, his paper was the inspiration for this project. You can read it here.

Simply stated, the Euclidean Algorithm computes the greatest common divisor of two integers. In the paper, Toussaint employs this algorithm and describes a very specific process that evenly and precisely distributes some number of things (k) over any other number of things (n).

If we were to imagine (n) as equal time intervals... let's say 16th notes in a bar of music and (k) as pulses that we were interested in triggering as evenly as possible over those time intervals, then we can generate on/off patterns for any combination of pulses and time intervals using the algorithm. These patterns have the distinction of being (as Toussaint described) "Euclidean Rhythms”, in other words.... some number of pulses (k) evenly and precisely distributed over some number of time intervals (n).

What's amazing here is that these Euclidean Rhythms happen to be the exact patterns that many cultures have traditionally defined their music by. Imagine these isolated cultures, independent of each other, with no prior (conscience) knowledge of Euclid, picking up on and embracing 1 pattern from a special set of patterns defined by an algorithm 2300 years ago!

It's best understood by seeing and hearing it in action.

3 pulses (k) evenly distributed over 8 intervals (n) would look like:

[ x . . x . . x . ]






This is the Cuban Tresillo pattern and according to Toussaint it is one of the most popular patterns in the world. It’s found in hundreds of rockabilly and rock n roll hits like “Hound Dog” by Elvis Presley.


5 pulses (k) evenly distributed over 9 intervals (n) would look like:

[ x . x . x . x . x ]





This is an Arab rhythm called Agsag-Samai


3 pulses (k) evenly distributed over 7 intervals (n) would look like:

[ x . x . x . . ]






This is the Ruchenitza rhythm from Bulgarian folk-dance, also used in Pink Floyd’s “Money”


If we were to put these 3 clips together and change the samples a bit, it would sound like this:


(I added a "4-on-the-floor" 1 (k) over 4 (n) kick drum to glue it together)


Pretty neat, and that was just with 3 randomly selected clips. This works to a degree with all combinations of these special patterns.

The Session/MIDI File Collection

I've assembled an Ableton Live Session file that contains the Euclidean Rhythm prime ratios of 1 through 32 pulses (k) over 1 through 32 intervals (n) as discrete clips. If you use another host like ProTools, Cubase, Logic, Reason or FL Studio, I've also included a folder with the individual MIDI files, although I can't guarantee your host will be able to loop them without tweaks. We’re dealing with looping patterns so there’s no sense in including a clip for 4 pulses (k) over 8 intervals (n) if we already have 1 pulse (k) over 2 intervals (n). They would sound and interact with other clips the same way. In other words, I’ve taken all the clips and reduced them so no clip is just a repeating part of another clip.


Each track represents a value of (n), clips represent variance in (k) over (n)


Cool pattern after removing the repeats

The MIDI clips in the resource file can be dragged, dropped and swapped interchangeably within sets. Incredibly syncopated, off time, offbeat rhythms can be made by combining the clips in interesting ways. Try placing a clip in only bar 1 of a 4 bar pattern. The next time it comes around, it sounds purposeful. Try side-chaining the output of one clip with the output of another for instant syncopation. Try “borrowing” the rhythmic component of 2 or 3 of these clips by merging into 1 clip, then randomly forcing the spread into a scale for instant inspiration. You can change the feel of a clip by just moving the start marker.

There are applications beyond dance and experimental music as well. If you play a traditional instrument and have some knowledge of music theory, you can use the Euclidean rhythms as a sort of scaffolding, enabling you to build complex arrangements around a well grounded foundation. Friend of the site, Dave Dominey, was inspired by the project and shared this track.


That which makes tongues turn blue by SharksFin

When asked to comment on the process as it relates to Euclidean rhythms, Dave says:
9 (k) over 25 (n), which i broke into 11, 11 and 3. 
I just used the Euclidean rhythm as a framework then created variations on it. I was messing about with the longer lengths to try and get away from the counter-rhythms against a basic pulse that the shorter rhythmic blocks tend to lead to.
To make it easier to score I broke the 25/8 (time signature) into 3 packets of 11/8, 11/8, 3/8.
X . . X . X . . X . .
X . . X . X . . X . .
X . .
The whole string of 25 is repeated twice for each theme.
It has four modulations: D Dorian, Eb Lydian, G Mixolydian, C Ionian (which is a standard chord progression of 1, 5, 2, 5 ..or something like that :p)
The whole thing then modulates up a semitone. I tagged on another bar of 3/8 for the final chord.

Much like the Circle of Fifths Chord Resource, you can’t hit a bum note. All these patterns sound good together. Some patterns sound “better” in combination with certain other patterns so you’ll soon develop an instinct for what patterns work. Try sticking to (k)/(n) ratios that are close to or less than 1/2. These tend to interact very well.

I ended up making some MIDI utilities in the process of creating this collection using the excellent nAudio library and I'll post about them in the future. Specifically, I need to clean up and document a text to MIDI command line tool that should allow programmers of any language (or even spreadsheet/notepad++ gurus) to write MIDI files, so long as the language API provides text file I/O.

You’re free to do what you like with the source files. If you end up being inspired or releasing tracks, I’d like to hear about it here… or better yet, you can donate. If everyone who had downloaded the Circle of Fifths Chord Resource had also donated $1, it wouldn't have been much individually, but would have made a big difference in my life.

Download, unzip and enjoy!
TonysPulses.zip




Tuesday, November 9, 2010

Circle of Fifths Chord Resource in Ableton Live


If you've turned on the radio in the last 30 years or so, you've probably noticed that almost all pop music sounds the same: rigidly formulaic, predictable and yet, oddly pleasing and familiar. This is no accident. Our Western ears have been trained to like music built around the circle of fifths.

I'm not an authority on music theory, but I've hacked together (from various resources) an Ableton Live session that can be used as a reference and compositional aid in this style. Yes, now you too can sound like a pop music hack! (Well... to be fair, a lot of really great music fits into this description as well).



The session file is just a container for several midi clips organized around the circle of fifths. Every note's major and minor key are described by the I, II, III, IV, V, VI, VII and VIII chords that are grouped under it's heading. The chords grouped under each heading all sound good in that track's key.

More exotic chord extensions are grouped under the track/note heading and can be used to substitute for any chord they're based on, in any chord progression or grouping.

The beauty of Ableton Live's "object-oriented" session file format is that this container can be used to "inherit" from in your own session, by navigating to the session on disk, expanding individual tracks and dragging and dropping chord clips. The colors and names of the chord clips carry over into your composition. Excellent.

While Ableton Live comes with midi effect plug-ins, I find that having the chords and scales already printed and grouped into musically relevant banks suits a different work-flow.

If you use the session file and enjoy it, please consider making a donation to encourage me to make more of these types of things. Even $1 helps.

Download, unzip and enjoy!
TonysChords.zip





The Super Basic Batch File Renamer


I had a buddy with a problem. He had hundreds and hundreds of audio samples ripped from assorted Akai and Emu disks from years gone by. The files weren't usable in modern computer software until he changed the file extension so I wrote a quick app for him that would auto-increment and rename files in batches (he had the samples organized already by sample type... snare, hi-hat, kick, etc). I figured someone else may get some use out of this so here you go.

Warning: This can do serious damage to your system if you point it to the wrong folder and just start renaming things like a mad man, so be sure you know what you're doing!

Download, Unzip and Enjoy!
BatchRenamer.zip