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" ( 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 ( in a prior thread.
    Many thanks! J

    • Jun 23 2021 | 6:50 am
      Hi, Thank you very much! It seems to me working better than any other euclidean rhythm sequencer I have tried before. So this is very good and flexible. Of course, visual clock object would make setting fluent (but possible to full use also without). I have idea to figure out how to make automatic setting templates (for all parameters for all clocks same time) for different kind of use.
      Here is some improvised examples, where I use this patch:
      - Janne
    • Jun 26 2021 | 9:10 am
      Thank for your shoutout. Your versions is awesome. It corrects a bug i did not notice for a long time where some sequences came out already rotated. ()
    • Jun 27 2021 | 2:32 pm
      here's another version i made a while back based on this
      haven't checked if it is 100% correct but there's a fun trick with the histo object