Kuramoto Model (Synchronicity) Software or Module?

I’ve been looking at the phenomenon of synchronicity and I’d like to use it in a track I’m working on (specifically as multiple separate clocks a la the sudden synchronization of metronomes). I’ve seen the Kuramoto model express this mathematically, although it is a bit over my head. Does anyone know of a VST, Eurorack module, Max for Live device, etc. that makes use of this model to move from chaos to order?
Failing that, is this something that I could reasonably well code on my Teletype?

Edit: spelling

4 Likes

The Kumamoto model is simpler than that video makes it sound. It is just a set of phase locked loops.

Say you have two LFOs, A & B, and they are at close, but not quite the same frequency. Now if you compare the phase of B to A, and see that B is a little ahead… then you slow down the frequency of B a little bit; if it is behind, you speed it up. And if you do the same thing for A compared to B… then you have the Kumamoto model: Each participant in the system is forever adjusting it’s frequency a little bit to fall in line with the others.

How can you do this in a modular? Take two LFOs with simple ramps (0 to 5V). Sum them, after inverting one of them. Now scale that difference down to a small bit, and use it to frequency control the LFO you inverted. Do the same with the other.

But warning: The wonderful curious effects demonstrated in that video - and things like phase transitions, are all dependent on very careful tuning of the scaling of the difference, and how much it affects the frequency of the LFO. There will be only a small range where it’ll exhibit those magical “coming together”. Some values will seem to have no effect, and others will make the system go wildly chaotic. What’s more, it is very hard in most modulars to get the same values in multiple repetitions of the circuit. If you have multiple LFOs you want to do this will, you’re going to have a bear of a tuning session!

18 Likes

Tried this in a digital system. It’s rather interesting although it keeps getting in a loop when I’d expect chaos. I also tried it with S&Hs as intermediates. A simple idea, but I can see it being quite interesting if expanded.

1 Like

i’m very intrigued by this patch but i don’t seem to be able to replicate it. i possibly do something wrong … so i subtract the inverted wave b from wave a and get the difference of the two lfo waves (does the waveform matter?). this voltage i scale down to be very small and use it to frequency modulate both? lfo waves… is this correct? because when i do this i don’t hear that the frequency falls in line with the other…or better, it seems to make no difference to a patch with no freq modulation where the phasing makes the lfo “meet” sometimes but then drift away again…
or is this just too difficult to do with analogue synths?

edit: btw, isn’t this model called kuramoto rather than kumamoto?

1 Like

Yes it is; my bad on spelling. Updated to fix.

I was also intrigued but couldn’t really wrap my head around how this would achieve the effect. I ended up coding a Teletype Scene that has two separate, regular trigger pulses whose intervals progress towards each other in time. Basically multiple independent ms clocks

Both of the scripts check to see if they need to add or subtract from their own time value, then does so with a small fraction of the difference between the two intervals (1/50 or 1/100 seems to be pretty good). Then the script triggers itself after a delay corresponding to its revised interval. I also had to hard-code a fix for when they get synced to the same time interval because by default they are out of phase.

It works okay and sounds kinda like the metronomes syncing up but I think it needs a bit more polish.

In particular I think that each clock should affect the other trigger intervals rather than its own. I’d also like to make some sort of inertia/mass variable which would determine how much of an effect one trigger has on the others. Stretch goal is getting at least 3 concurrent ‘clocks’ to affect each other. Also this technically doesn’t modify values continuously but I think for just using it as a metronome it should be a reasonable facsimile.

The true ideal would be to have a dedicated module or mode in an existing module. If it were within my expertise I’d code a Teletype OP, Ansible alt firmware, or Daisy patch for it…

2 Likes

It shouldn’t control both frequencies, at least it did not in my patch. What I did was

A - B = X
B - A = Y

X controls frequency of B
Y controls frequency of A

I also tried more complex patches with two S&Hs grabbing the X and Y data at intervals determined by A and B respectively.

It didn’t get as unruly as I expected, at least not in G2 engine. it seems to be a good way to get a moving clock.

1 Like

the live coding system Sema uses the kuramoto model to sync multiple laptops on a network: https://www.sema.codes/

It is not surprising that it is hard to do. You need some careful measuring and adjusting to get everything right…

The Kuramoto (yes, I had spelled it wrong) equation is:
kuramoto model

May look daunting, but to read it out it is just:

The change in angle of an oscillator (θ) is …
… the base rate of that oscillator (ω)
… plus the average of the differences between its angle, and the angle of each other oscillator
… only using the sine of the difference, not the difference directly
… and scaled by some factor K

So to do this with analog hardware - you need:

  • The output of the LFO to represent the angle - and so a simple ramp waveform works (as the ramp goes from 0V to 5V linearly, then jumps back to 0V for the next cycle.).

  • The average difference can be a pain to do: If you have just two LFOs, then summing them, one inverted, will work. BUT - if you have several, then doing this will eat a lot of hardware, and you have to be very careful to not clip the results anywhere in the chain.

  • The sine operation can be ignored - it makes things smoother, but it isn’t essential to the idea. You could put the signal through an appropriate waveshaper - but unlikely you have one that does exactly ramp to sine.

  • Now you have to scale by K - which is just attenuation, and finally mix this into the C.V. control of the LFO.

  • And do it all again for the other LFOs…

You can see that getting everything tuned right is going to be a chore - and best done with an oscilloscope or module like Mordax DATA. If any of these operations are scaled wrong - things will likely just peg at too fast or too slow.

BTW - you can see that despite all the lovely videos of the effect on YT, it is actually hard to do with physical systems as well: Notice in that video the quick shot of the attempts with the metronomes failing: This is what happens when the tuning is off.

4 Likes

thanks alot @mzero and just to clarify:
if i use two lfos… i mix this attenuated average difference into both lfos cv in, correct?

ah wait no i read too fast, so like @ParanormalPatroler described above i create the difference per lfo:
LFO A - LFO B = X
LFO B - LFO A = Y
and then add X to A and Y to B frequency

1 Like

But notice in the case of just two LFOs:

X = LFO A - LFO B = - ( LFO B - LFO A) = - Y

So you can simply mix LFO A with inverted LFO B - then scale that - and finally, add it into LFO A’s frequency C.V., and subtract it from LFO B’s. If the C.V. inputs on the LFOs have attunverters - this is pretty convenient.

5 Likes

thanks for posting this, it’s joined some dots for me.

this is very similar to the rules that govern human timing when people play together (here’s a study: https://www.pnas.org/doi/10.1073/pnas.1324142111 - which i used for my group humaniser m4l devices - Group Humanizer version 1.4 by humanize on maxforlive.com)

BUT the difference is that sine term in the formula, which I presume is where some of the more fun behaviour comes from? or does it just keep the ‘correction amount’ in-bounds and so damp down really chaotic behaviour?

Wondering also is this how the Wogglebug circuit works? I’ve tried so many times to replicate it from the description in the manual to no avail.

3 Likes

But the wooglebug doesn’t change its timing, does it?

it has the random gate out which goes on and off the clock in cool ways related to the other controls. the manual (v1) was vague but mentioned something about a feedback loop of things trying to follow each other, i always assumed it was something like this but configured to go wild sometimes, rereading the wogglebug manual i may have been completely wrong.

Hey, just wanted to close the loop on this…

TL;DR I stumbled on this white paper “Kuroscillator: A Max-MSP Object for Sound Synthesis using Coupled-Oscillator Networks” that describes the process of creating a Kuramoto-modeled set of linked oscillators in Max-MSP. Buried in there is a link to the downloadable repo: Bitbucket

I popped open the example patches to give them a shot and they do what I was looking for. Gonna need to do some tweaking and deeper digging to get them to output Midi or bake them into a M4L device.

For completeness, other things I tried before finding the Max-MSP device:

  • The Teletype Script I was working on will not work accurately enough for this application. It relies on the Delay commands which have a tolerance of +9/-10ms. Over the course of the dozens or hundreds of iterations it takes to reach a synchronized mean value, the multiple clocks drift out of phase quite noticeably.

  • I also looked into achieving the effect with LFO objects in Ableton Live. I did one set of tests with Frequency and another with Phase. In both tests I made automation curves to take the LFOs from very different Freq/Phase to synced Freq/Phase. I just did a straight line from starting Freq/Phase to mean Freq/Phase so I didn’t expect it to sound perfect. In any case, the Freq test ran into the same phase drift as the TT scene. Not sure if it is due to minute timing inaccuracies as well, but it might be solvable by having the automation take place over a span of time which is the least common multiple of the two starting frequencies? The Phase test similarly did not yield desired results mostly because the starting state never felt chaotic enough.

  • I looked into using the Quadrature LFO mode on an Ornaments & Crime as well. There is a “Coupling” Parameter whose description reads “sets the degree of phase-modulation “bleed” between each successive channel.” There is no further description so I looked into testing it with a friend’s module. Didn’t get the opportunity to but after the Phase test with Ableton LFOs I’m none too hopeful that this would work as desired.

So, that’s where it’s at for now. When I can, I’m going to plumb the depth of Max & Max for Live to see if I could make a device that does what I’m looking for. If I put together something usable I’ll be sure to share it here.

3 Likes

Hm, I had forgotten about this. I will give this another shot with hardware.

I wonder how it sounds with audio range oscillation.

This discussion reminds me to the “64 SYNCHRONIZING FIREFLIES” project that was available as a diy kit around 2009: 64 Synchronizing Fireflies | Hackaday

Around two or three years ago I picked up a licence of Max/Msp because I wanted to port this idea into a musical context … shortly after my first attempts to sketch this out in Max I found Dillon Bastan’s “Swarmalators” M4L patch (Swarmalators N) which had this (and more) wrapped in a very nice and clever userinterface. I use it mostly inside the box for note events and for generating triggers but combined with f.e. a ES-9 this would be also a perfect modular companion.

1 Like

Jus stumbled onto this thread. Wondering if this might be implemented on norns

Unfortunately I’m not a coder at all yet, so just speculating at this point.

Think THX sound but less tonal. I think the audio rate implementation really struggles to be musically relevant.

Thanks for the tip on Swarmalators, I’m gonna check it out!

I don’t see why it couldn’t be…as with most of the Norns app wishlist, it is just waiting for someone with the time and desire to figure it out.

I will say: from my testing with the M4L device I linked above, the parameters are very picky. It was quite difficult to get something that lasted long enough before synchronizing to be interesting while also not starting at a glacial rate. The big value would be in someone abstracting the variables of the Kuramoto Model and presenting parameters tuned to usable ranges.

1 Like