Expand description
§Euclidean Rhythm
A Rust library for generating Euclidean rhythms using Bjorklund’s algorithm.
Euclidean rhythms distribute pulses as evenly as possible across a given number of steps, creating musically interesting patterns found in traditional music from cultures worldwide.
§Quick Start
use euclidean_rhythm::euclidean;
// Generate a Cuban tresillo pattern: [x . . x . . x .]
let pattern = euclidean(8, 3, 0);
// Generate and rotate a West African bell pattern
let pattern = euclidean(8, 5, 2);§Algorithm Background
The algorithm was developed by E. Bjorklund in 2003 for timing neutron beams at particle accelerators. In 2005, Godfried Toussaint discovered its musical applications, showing these patterns appear in traditional music worldwide.
§Common Patterns
- E(3,8): Cuban tresillo -
[x . . x . . x .] - E(5,8): West African bell -
[x . x x . x x .] - E(5,12): Persian rhythm -
[x . . x . x . . x . x .] - E(7,16): Brazilian bossa nova -
[x . . x . x . x . . x . x . x .]
§References
- Toussaint, G. (2005). “The Euclidean Algorithm Generates Traditional Musical Rhythms”
- Bjorklund, E. (2003). “The Theory of Rep-Rate Pattern Generation in the SNS Timing System”
Functions§
- euclidean
- Generates a Euclidean rhythm pattern using Bjorklund’s algorithm.
- pattern_
to_ string - Converts a boolean pattern to a string representation.
- rotate_
pattern - Rotates a pattern by a given number of steps.