Max-only Euclidean Sequence/Rhythm Generator
May 16 2020 | 2:30 pm
Hi Maxers, N00b coder here.
I've been working on a MIDI sequencer project and got the itch to add Euclidean rhythms. Bad. Decision. Totally fell down the rabbit hole...
I read Godfried Toussaint's seminal paper "The Euclidean Algorithm Generates Traditional Musical Rhythems" countless times - as others have pointed out, it's a nice explanation of what Euclidean rhythms are but not how to turn Euclid's 2000+ year-old Greatest Common Divisor algorithm into usable code.
I finally came across a Computer Music Design article on "Simplest Euclidean Rhythm algorithm, explained" (https://www.computermusicdesign.com/simplest-euclidean-rhythm-algorithm-explained/) that included procedural (rather than recursive) pseuodocode.
Based on this, I've hammered out what looks like a usable Max-only implementation:
My request to all of you Maxers out there is to please have a look at it and critique candidly. Please feel free to suggest a more canonical way to code this. I learned C.S. in the days of the dinosaurs and haven't coded in years (not my day job) - I'm 2-3 weeks into learning Max.
BTW, huge shout out to 11oLsen for his comments and code (https://cycling74.com/forums/using-euclideanbjorklund-algorithm-for-rhythm-generation-purely-in-max/) in a prior thread.
Many thanks! J