Cabbage Logo
Back to Cabbage Site

Euclidean rhythms

Has anyone experienced the implementation of Euclidean rhythms in Csound? (91.2 KB)

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

1 Like

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

1 Like

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

Euclidean.csd (5.9 KB)

1 Like

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

1 Like

I was thinking of that myself, but by 11.30 on Saturday night the enthusiasm was leaving me… :see_no_evil:

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 (11.2 KB)

1 Like


1 Like

Here’s another video.

Latest version (11.5 KB)


Great! this is an excellent result

Beautiful work, Rory!

1 Like

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.

I just tried it here with Cabage 2.5.34 and it runs fine. Can you try upgrading? 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.

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?

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

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?

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…

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 :wink:

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.

1 Like

I fixed the cabbageCreate calls, this works with Cabbage 2.7.0

Euclidean3.csd (11.5 KB)