All possible divisions of a number.
I’m trying to make a patch that generates rhythms that fit within a specified bar length and only use note values that are pre selected.
So for example if I have a bar of 4/4 and I have half-notes, quarter notes and eighth notes I would have all possible rhythmic variations using these note divisions that fit within the 4/4 bar.
Ie. one would be: X x x x X x X X
another could be X x X x X x x x
etc. etc. until all variations are reached.
Sounds like you’re basically building a euclidian rhythm generator?
I guess so. And I’ve looked into the euclidean algorithm. But that distributes beats equally across a given bar length.
What I want to find out about is being able to quantize these distributions using a selected variety of divisions and then to iterate through all possible variations to be probably stored in a dict or a coll.
I’m just wondering what sort of approach I should take to this. and if anyone has made anything similar before.
Aha, thanks Terry. That seems to have done it! It is a case for a looping algorithm then I see.
I wonder if this would be more efficient in js as opposed to max?
What do you think?
It’s a pretty simple algorithm, and if you’re doing it to generate rhythms, I can’t really see the advantage using js (aside from compactness), even in real-time applications. for a more informed opinion someone with js experience would be better qualified to comment
This should get you started, it’s a brute force approach which will put all the permutations into a coll. You could use filtering on the output of the uzi’s to get rid of lengths you are not interested in.
----------begin_max5_patcher---------- 1419.3oc4atsaaiCDF9Z6mBBesWAdVjKPuXeNVTDHaqjnTaICK4jronu6KOY E6zZoQMVLIMsnIkzJTy7oeNCGJluOcxrEUOlWOC82n+EMYx2mNYhqKaGSBsm LaS1iKWmU6trYKq1rIurY1b+m0j+Xiq+Gd3gj04YWubeSS9t6ptsLwboGtrs YMKusn7lq1kurwe6jXRRpXt46hD7bDgkZ+FEmfQeM7SUrxMzUKt6uD5CC00U kMkYaxcez+rqHac6mr6lE1dMCQnmx8aJJWm23LcxQCPcwStAfPau1s6xqMNV VSQU4Ilo8RPRscTQG9RqIZtCU6aNbKv1N+wzo1uL+UBThDsp39hZi4TiptF0 baNZQ1tNHJIUaMOF0YwDZ2.UL1.80ilx7GLl5OQlFzBDAszn15hFRu+Kn.TW bY+v3220Ygd8c07eay8V3rEYk2LaNZVg8wuQI37HzWubj5o0n6pJJ6hRjDJF iITCovRGpD7DQGnRLPTQGBpnmCUV9bQQiUDs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m1R4NCAB6wkM.BaOif+8hEI+q8u3 kZ0YNj9jSmtdf94s1oP3b+1iQUOe7HscMVTk9ZqW5EtQp+DuJBApwIoGNHZ1 dFCuf.Ytc7Vni6V0q3PbxEMp1CCBeDwkOXHSdhTU5f3CMd7gBP+vzw0d5kOj nomYJn1Sjp6CTgMpAVXyQKfu82MmWz0XrbWE.sGgE2hFAYOwQ6Q.yGZbrGv7 gEmmWXn1CON7IEp8Hhi8HfZOx3XObn1S5ug832P+rsauOeWcXLclxrMY2Usy 1TN20rnz2zMhy1k6+UXz8xImZGseL8+QD9rCp -----------end_max5_patcher-----------
Thanks guys. Both are fantastic approaches. I’ll do some modifications and shall report back with the patch I’m using this method in.
Man, those are both just brilliant! My head is spinning…
Forums > MaxMSP