# Euclidean rhythms

**URL:** <https://forum.cabbageaudio.com/t/euclidean-rhythms/2424>\
**Category:** Csound Noobs\
**Created:** [3 April 2021 13:44 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424 "2021-04-03T13:44:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scabrosus](https://forum.cabbageaudio.com/letter_avatar_proxy/v4/letter/s/8c91f0/32.png) [@Scabrosus](https://forum.cabbageaudio.com/u/Scabrosus)\
**Post date:** [3 April 2021 13:44 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/1 "2021-04-03T13:44:47Z")

</div>

Has anyone experienced the implementation of Euclidean rhythms in Csound?

[https://codepen.io/teropa/details/zPEYbY[bridges2005-47.pdf|attachment](upload://3UG3Vsw4jcKvRIIC8JiPsveJz5Y.pdf)](https://codepen.io/teropa/details/zPEYbY%5Bbridges2005-47.pdf%7Cattachment%5D(upload://3UG3Vsw4jcKvRIIC8JiPsveJz5Y.pdf)) (91.2 KB)

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [3 April 2021 15:10 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/2 "2021-04-03T15:10:23Z")

</div>

No but I can’t imagine it wouldn’t be that tricky. Do you have some code that can generate the sequences?

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [3 April 2021 20:10 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/3 "2021-04-03T20:10:58Z")

</div>

I saw Steven’s post on the Csound list. That’s a nice UDO. Let me throw something together…

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [3 April 2021 23:09 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/4 "2021-04-03T23:09:11Z")

</div>

I’m not 100% sure I’ve implemented this correctly but it was fun getting to here. Improvements welcome.

[Euclidean.csd](https://forum.cabbageaudio.com/uploads/short-url/A2O1YKeUGQspSXG8TLmfm1yM5p6.csd) (5.9 KB)

---

<div class="post-metadata">

**Author:** ![iainmccurdy](https://forum.cabbageaudio.com/letter_avatar_proxy/v4/letter/i/8baadc/32.png) [@iainmccurdy](https://forum.cabbageaudio.com/u/iainmccurdy)\
**Post date:** [4 April 2021 08:31 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/5 "2021-04-04T08:31:26Z")

</div>

Very nice! Maybe I’ll add graphics to it at some point.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [5 April 2021 08:29 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/6 "2021-04-05T08:29:59Z")

</div>

I was thinking of that myself, but by 11.30 on Saturday night the enthusiasm was leaving me.. 🙈

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [10 April 2021 22:04 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/7 "2021-04-10T22:04:30Z")

</div>

Someone on this list (you know how you are!) challenged me to create something like the Max4Live Euchlidean pattern generator. So I took another shot at this, using the new widget opcodes to generate and update most of the graphics.  
[Euclidean2.csd](https://forum.cabbageaudio.com/uploads/short-url/tEjov9Cmf3NWzdSp3RXGzx3Xri3.csd) (11.2 KB)

[![](https://img.youtube.com/vi/08gboH8eWqs/maxresdefault.jpg "Euclidean sequencer 1") ](https://www.youtube.com/watch?v=08gboH8eWqs)

---

<div class="post-metadata">

**Author:** ![hdale94](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/hdale94/32/6371_2.png) [@hdale94](https://forum.cabbageaudio.com/u/hdale94)\
**Post date:** [10 April 2021 22:15 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/8 "2021-04-10T22:15:24Z")

</div>

Wow!

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [10 April 2021 22:44 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/9 "2021-04-10T22:44:46Z")

</div>

Here’s another video.

[![](https://img.youtube.com/vi/UFaW7-Z9cCo/maxresdefault.jpg "Euclidean sequencer 2") ](https://www.youtube.com/watch?v=UFaW7-Z9cCo)

[Latest version](https://forum.cabbageaudio.com/uploads/short-url/pzrlCJWAPg7du01ohzNlcs7UX3T.csd) (11.5 KB)

---

<div class="post-metadata">

**Author:** ![Scabrosus](https://forum.cabbageaudio.com/letter_avatar_proxy/v4/letter/s/8c91f0/32.png) [@Scabrosus](https://forum.cabbageaudio.com/u/Scabrosus)\
**Post date:** [11 April 2021 13:49 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/10 "2021-04-11T13:49:59Z")

</div>

Great! this is an excellent result

---

<div class="post-metadata">

**Author:** ![iainmccurdy](https://forum.cabbageaudio.com/letter_avatar_proxy/v4/letter/i/8baadc/32.png) [@iainmccurdy](https://forum.cabbageaudio.com/u/iainmccurdy)\
**Post date:** [14 April 2021 21:45 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/11 "2021-04-14T21:45:51Z")

</div>

Beautiful work, Rory!

---

<div class="post-metadata">

**Author:** ![iainmccurdy](https://forum.cabbageaudio.com/letter_avatar_proxy/v4/letter/i/8baadc/32.png) [@iainmccurdy](https://forum.cabbageaudio.com/u/iainmccurdy)\
**Post date:** [18 April 2021 21:38 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/12 "2021-04-18T21:38:41Z")

</div>

I’m encountering something odd with this. It runs fine the first time, but the second time it doesn’t hide the widgets it’s supposed to hide at start up.

  
I guess it’s more likely a Cabbage thing than anything related to this example specifically.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [19 April 2021 10:12 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/13 "2021-04-19T10:12:31Z")

</div>

I just tried it here with Cabage 2.5.34 and it runs fine. Can you try [upgrading](https://dev.azure.com/rorywalsh/cabbage/_build/results?buildId=1268&view=artifacts&pathAsName=false&type=publishedArtifacts)? Also, you can remove the `guiMode("hybrid")` and use` guiMode("queue")`, I was disabling the “queue” mode while testing, but forgot to reinstante it. Passing anything but `polling` or `queue` to `guiMode()` will cause Cabbage to employ methods of updating widgets. It’s going to be slower than either method on its own, but can be handy to test older code with the new system.

---

<div class="post-metadata">

**Author:** ![iainmccurdy](https://forum.cabbageaudio.com/letter_avatar_proxy/v4/letter/i/8baadc/32.png) [@iainmccurdy](https://forum.cabbageaudio.com/u/iainmccurdy)\
**Post date:** [19 April 2021 16:02 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/14 "2021-04-19T16:02:43Z")

</div>

That’s it, Rory. I thought I was up to date, but I just can’t keep up with Cabbage’s rate of change.  
I was going to add some features to this, would you object?

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [19 April 2021 16:05 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/15 "2021-04-19T16:05:38Z")

</div>

By all means. I was hoping someone would bite! Go easy on the macros; I’d like to be able to understand your additions 🤣

---

<div class="post-metadata">

**Author:** ![giovannibedetti](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/giovannibedetti/32/4146_2.png) [@giovannibedetti](https://forum.cabbageaudio.com/u/giovannibedetti)\
**Post date:** [29 August 2021 13:35 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/16 "2021-08-29T13:35:19Z")

</div>

I’m very curious to try this! (I wanted to create an example for CsoundUnity)  
When I run the latest version on Cabbage 2.7.0 (on Windows) I get:

```
error: Unable to find opcode entry for 'cabbageCreate' with matching argument types:
Found: (null) cabbageCreate S
Line: 170

```

What’s wrong?

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [29 August 2021 15:56 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/17 "2021-08-29T15:56:50Z")

</div>

Later versions of that opcode take a widget type and then identifiers. If you don’t want to update your version, just use a single string with the widget type…

---

<div class="post-metadata">

**Author:** ![giovannibedetti](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/giovannibedetti/32/4146_2.png) [@giovannibedetti](https://forum.cabbageaudio.com/u/giovannibedetti)\
**Post date:** [29 August 2021 16:00 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/18 "2021-08-29T16:00:18Z")

</div>

The strange thing is that cabbageCreate works in other examples.  
Here it fails because SArmString seems to be null, but I don’t understand why it could be:

lines 169-171

```
;create arm
SArmString = sprintf("image bounds(%d, %d, %d, 2), channel(\"%s\") colour(%d, %d, %d)", iCircleCentreX, iCircleCentreY+1, iCircleRadius-25, sprintf("voice%dArm", iVoice), iR, iG, iB) 
cabbageCreate SArmString

```

I grabbed the first example you posted and it works great, I’ll use that as my starting point 😉

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [30 August 2021 09:12 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/19 "2021-08-30T09:12:48Z")

</div>

Hi @giovannibedetti, I think tehre are some examples in the wild that use the older syntax of

`cabbageCreate SFullString`

while more up to date examples use:

`cabbageCreate SType, SIdentifierString`

Looks like you got caught somewhere in between.

---

<div class="post-metadata">

**Author:** ![giovannibedetti](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/giovannibedetti/32/4146_2.png) [@giovannibedetti](https://forum.cabbageaudio.com/u/giovannibedetti)\
**Post date:** [30 August 2021 12:12 UTC](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424/20 "2021-08-30T12:12:44Z")

</div>

I fixed the cabbageCreate calls, this works with Cabbage 2.7.0

[Euclidean3.csd](https://forum.cabbageaudio.com/uploads/short-url/kFbJWFxxkRKLQw6qbWG2b3i1utj.csd) (11.5 KB)

[Next page](https://forum.cabbageaudio.com/t/euclidean-rhythms/2424.md?page=2)
