Cabbage Logo
Back to Cabbage Site

Extracting the "Clock" from Euclidean Sequencer plugin

Hello! Decided to sit down and join the Cabbages to get my first effect plugin idea realized.
I am looking to make a sequencer for effects, to “glitch” an audio stream.

I’ve been reading the documentation and following the examples, and I’m mainly interested in the elements of the Euclidean sequencer from this topic:

Essentially, when a synth voice is enabled, a clock appears to show the current step and which steps to trigger the voice.

I can’t figure out how to get the “clock” element by itself. It is coupled to the voice instruments using “GenerateCirclePoints” and I am having trouble grasping what can be removed and what has to be modified.

If I could extract and repurpose this code, I would then try to figure out how to remove the arm to instead highlight the current “circle” with an outline and have the circles clickable for a selection of effects (icons or dropdown).

In summary, what would an independent “GenerateCirclePoints” code look like?

Here’s also an example Rory made, maybe you can find something useful here.

1 Like

Ah, thank you for sharing that, I didn’t know this was in the examples.
It is the same code however. I’m still not able to discern how to get the clock by itself.

Welcome to the forum @circuitdust :slight_smile:

I create a lot of elements for this instrument on the fly when the instrument first starts. I was just trying to illustrate how this can be done. But if you don’t need this, I’d suggest you build the basic circle interface in the Cabbage section of your code. You can then manipulate the various elements more easily. This will also make it easier if you want each point in the circle to be interacted with. You will have a few challenges here if I follow correctly what you are trying to do. But feel free to post questions along the way :+1:

I suppose it will be easier to write it from scratch. I wanted to avoid dealing with figuring out the math for placing objects along a circumference, but I guess there’s no escaping that!

If I get this working, I will make a post showcasing placing buttons around a circle, for future reference.

That code is easy to extract, just lift the GetPositionForPoint UDO and do something like this:

1 Like

Sorry, I should maybe give a little more help here. You don’t need to call cabbageCreate if you’ve already created your 16 circles. Best if you name them with an index after each one, i.e, point1, point2, point3, etc. Then you’d do something like this:

while iCnt < 16 do
    iXPoint, iYPoint GetPositionForPoint iCircleCentreX, iCircleCentreY, iCircleRadius, iCnt, iPoints
    SChannel sprintf "point%d", iVoice, iCnt
    cabbageSet SChannel, "bounds", iXPoint, iYPoint, 5, 5
    iCnt += 1
od

Untested code, but should get you going…

1 Like

No worries, I adjusted the code and it’s working. Didn’t realize that the opcode was doing all of the heavy lifting, so this was much quicker to finish than anticipated.

For anyone interested, here is the code for placing elements in a circle. Using 1 opcode, 1 instrument, and assigned variables, it draws blank images. But, the code can be adjusted for anything, from knobs to buttons, by modifying SCircleString.
WidgetsInCircle.csd (1.3 KB)

1 Like