Skip to content
MIDI pattern generator in Java. Generates rhythmic patterns based on the Euclidean algorithm.
Java
Find file
Pull request Compare This branch is 1 commit ahead, 18 commits behind WouterHisschemoller:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
app/Euclidean-Pattern-Generator.app/Contents
bin
jar
launch
lib
src
README
gpl.txt

README

Euclidean Pattern Generator

Code:
This is a Java project that I made in Eclipse on Mac OS X. An Eclipse .launch file is included for easy setup.
I used Pure MVC (www.puremvc.org) as the framework that holds it all together.
 
Overview 
This sequencer lets you generate rhythm patterns and sends those patterns as MIDI notes to connected MIDI soft- or hardware.

Patterns
The patterns are generated using a simple mathematical formula called the Bjorklund algorithm. This algorithm takes two values: 
The length the pattern should have. Measured in steps of 16th notes in this software.
How many notes are played in the pattern.

The algorithm then spreads the played notes as evenly as possible along the length of the pattern.
An example: 
If the pattern is eight steps in length and has two notes, the resulting pattern would be x...x... (where 'x' is a played note and '.' is a silent step). 

And as a slightly less obvious example: 
A length of eight and three notes produces this pattern: x..x..x.  It's much clearer if you try it out yourself.

Creating a pattern 
In the main empty area of the application double click on the background. This creates a new default pattern. 
A default pattern is sixteen steps in length and has four played notes. On screen that's represented as the ring of sixteen circles of which four are filled.
Click the Play button and you'll see the pattern play: The pointer rotates to indicate the position and played steps jump out when they play.
Drag the pattern's center circle to move it around the screen. If there's more patterns on screen a click on the center selects that pattern for editing.

Modifying a pattern
Once a pattern is created or selected, it's settings are shown in the Settings panel on the right: 
Steps is the length of the pattern.
Fills is the number of played notes. 
Steps and Fills are the basic pattern settings. Each time one of them changes the algorithm is recalculated.
Rotate rotates the pattern. As you'll note when you play with the Steps and Fills sliders, a basic pattern always starts with a note on the first step. To overcome this limitation you can rotate the pattern. The small zero at the top moves along with the pattern to indicate the original start point and a little flag appears on top as extra indication the pattern is rotated.

MIDI settings 
This application generates MIDI notes. To hear actual sounds you'll have to connect it to some soft- or hardware that receives MIDI and translates it to audio.
Use the MIDI Out combobox next to the Play and Tempo controls to select the appropriate MIDI port. Which one you choose depends on how you connected your software (probably through an internal MIDI port like MIDI Yoke on Windows or the IAC Bus on OSX) or hardware (likely with a USB to MIDI interface).

Each pattern has its own MIDI settings:
Channel is one of the sixteen channels a MIDI port has.
Pitch is one of the 128 note numbers in MIDI. For melodic sounds it's mostly used to transfer its pitch (in the note scale), for percussive sounds each note number is often a different percussion instrument sound.
Velocity is a number from 0 to 127 that usually indicates the volume at which the note plays.
Length is the amount of time until the note is stopped.This is for now a number between 0 and 96, where 96 is one full measure (16 steps). Using 96 for one measure has to do with the internal sequencer resolution which is 24 PPQN.

OSC settings
This application also generates OSC messages.  By default OSC messages are sent to localhost at port 9000.  These values will be made configurable in the near future.

Each pattern has its own OSC address.  To this OSC address are sent integer values for channel, pitch, velocity, and length, as described in the MIDI section above.

Projects
You can save your patterns with their position and settings as a project file, which is in fact a simple XML text file. A project includes the tempo in BPM as well. 
To manage projects use the File menu. There you'll find the familiar New, Open, Save and Save As options with their standard keyboard shortcuts.

External references 
http://www.hisschemoller.com - My website, check it for updates or other interesting projects I work on.
http://cgm.cs.mcgill.ca/~godfried/publications/banff.pdf - The original article about using the Bjorklund algorithm for musical rhythms by Godfried Toussaint of McGill University (Montreal, Canada).
http://ruinwesen.com/blog?id=216 - Interesting article on Ruin & Wesen's website with LISP example. This is where I first read about Euclidean rhythms.
Something went wrong with that request. Please try again.