Tuesday, March 15, 2011

Euclidean Rhythm MIDI 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”.

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 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




9 comments:

  1. 5k 9n is also blue rondo a la turk
    http://www.youtube.com/watch?v=kc34Uj8wlmE

    3k 7n... another example would be Zappa's 'dont eat the yellow snow'
    http://www.youtube.com/watch?v=Ws5Xeu3BEQk

    ive been reading polychords to polya (adventures in musical combinatorics) ... lots more inspiration!!!

    have you tried applying the algorithm to pitches?

    ReplyDelete
  2. since the algorithm yields a Boolean array you'd have to devise your own system to translate that into pitches. in the video, i just stole the Boolean rhythms and randomly forced them into different scales. i'm thinking 99% of any systems that act on frequency vs. "note" will sound harsh.

    robert schneider from apples in stereo has a great writeup on alternative non-Pythagorean scales that may be worth checking out if you're interested in developing your own system. his non-Pythagorean scale sounds alien, but that might just be because we grew up listening to Pythagorean scales. in an alternate universe where non-Pythagorean scales are popular, ours may be the one that sounds alien.

    ReplyDelete
  3. I haven't tried with frequencies only a chromatic scale.

    12n for 12 notes of the chromatic scale.

    2k 12n gives a tritone
    3k 12n gives an augmented triad
    4k 12n gives a diminished seventh arpeggio
    5k 12n gives a minor pentatonic scale
    6k 12n gives whole tone scale
    7k 12n gives dorian scale
    8k 12n gives diminished W/H scale

    it then gets kinky

    9k 12n gives T,S,S,T,S,S,T,S,S
    10k 12n gives T,S,S,S,S,T,S,S,S,S

    11 and 12k are obvious

    I found it interesting.
    not as useful as the rhythmic stuff though

    2 octaves gave something nice though

    24n 9k was a cool modulating pattern.

    Maybe larger intervals (2,3 or 4 octaves) and some kind of Slonimsky-esque permutational additions could be fun

    ReplyDelete
  4. Thanks for the article, Tony, it's very inspiring.

    When I load the TonyPulses.als into Ableton it says missing media files which are a bunch of files starting from Sine_12.ams to Sine_111.ams. It would be very helpful to have these for the basic experimentation. Is there any way you could pack them up and share?

    ReplyDelete
  5. hi dmitry, those files should have come with your live install (maybe under components folder in simpler?), but our install locations may be a little different. you can maybe rescan to find them or switch those sounds out with whatever file you like (or none at all). the only reason i routed all the tracks into the simpler was to hear a preview of what the rhythm would sound like in the working live set. that's the project i'd be doing my experimentation in... if i were to do it over again, i'd probably use something more percussive instead of a sinewave for the preview.

    ReplyDelete
  6. Hi there, I recently came across your site from CDM and was excited to see what you have done. I downloaded the live set and am now really confused.
    I (think) I understand what you say this accomplishes... any number of pulses over any number of intervals. So say for example you could have 5 notes play in the time of 4, (5 notes in one "measure" of quarter notes).

    When I look at the Live set I see for example the clip that says 5_8 This is 5 pulses evenly distributed over 8 intervals? In that clip I see 5 five pulses but they are not evenly distributed, they are on the 1st, 3rd, 4th, 6th & 7th spots exactly. I'm sure I'm missing something here, can you explain?

    ReplyDelete
  7. thanks! can't wait to check this out.

    ReplyDelete
  8. Hi Tony, I see this page is a few years old now but I've just downloaded your Euclidean Ableton template and I want to pay you for it. I hope you still check this site from time to time and will let me know how to reach you. I see there are some payment options listed but as this is now 2016, I'd like to check if its still valid or if you have another site somewhere. Your work is excellent and I really appreciate it. I'd like to pay you.

    ReplyDelete
  9. Hello Tony,
    Thank you for distributing these amazing Live session files.
    However, I'm having the exact same problem as Dmitry, and I cannot find any of the AMS files in my entire computer. I would love to hear how it sounds with those files, and would sincerely appreciate it if you share your folder with those files.
    Thanks,
    LS

    ReplyDelete