Euclidean rhythms: Björklund's algorithm in Python
Switch branches/tags
Nothing to show
Clone or download
Latest commit e1e94df Feb 21, 2018
Permalink
Failed to load latest commit information.
LICENSE.txt updated license Feb 1, 2013
README.md Update README.md Feb 21, 2018
__init__.py Update __init__.py Feb 21, 2018
example.py updated license Feb 1, 2013

README.md

Euclidean Rhythms: Björklund's Algorithm in Python

After encountering some buzz about it online, I read and was inspired by Godfried Toussaint’s paper, “The Euclidean Algorithm Generates Traditional Musical Rhythms”. In short, he demonstrates how many classic rhythms, particularly of African origin, can be described by a ubiquitous mathematical principle first documented by Euclid and even used for timing patterns in neutron accelerators.

However, while I found many implementations of the algorithm in various languages, all of the ones I tried (in Ruby, Python, Java, and Javascript) return inaccurate results! Trying 13 steps with 5 pulses was an easy way to break most of them. Luckily, Toussaint’s source, Björklund, provides C code in his paper The Theory of Rep-Rate Pattern Generation in the SNS Timing System. I translated this into Python 3, and found the result to be elegant, efficient, and accurate.

Copyright/License

Copyright (c) 2011 Brian House

This code is released under the MIT License and is completely free to use for any purpose. See the LICENSE file for details.