Added auto-synchronization to my rephasor algorithm, a process which resynthesizes an input phasor signal (periodic ramp signal), using a scaling value to change the frequency in relative terms (2=twice as fast, 0.5=twice as slow, etc).

This sound demo consists of 3 oscillators which pitches are being modulated by phasor signals. 2 of these phasors are rephasors with synchronization, sourced from the other phasor.

In the patch, these rephasors speed up and then slow down back to the original rate.

Notice how the voices settle back to the original rate, they gradually line up again.

And here is the same patch using old version of the algorithm.

Without autosync, rephasors will suffer from time drift, even if they are playing at the same rate.

Right where the voices settle down, you can hear some voices consistently playing at the wrong time. It never lines up. This is the "drift".


The rephasor is at the core of my gesture sequencer, Gest. Most of the constructs and complexities in Gest have something to do with mitigating this clock drift.

But now, here it is, clock drift prevention baked into the rephasor as part of the DSP algorithm. This has a lot of implications for what can be possible now.

A new model for a gesture sequencer can be reimagined as a DSP block diagram.

Instead of reading from a fairly linear score like Gest, this new system can be controlled in a more nonlinear way using a state machine and/or VM.

It would be a much more elegant system. A VM would allow for more generative musical structures to emerge. Also, multiple gestures could share the same VM, allowing for concurrent cross-communication between gestures.

@paul Why do they drift? Do they have independent clocks?

@freakazoid Yes, they can be thought of as independent clocks, defined in relative terms.

a big contributor to drift is that I intentionally use truncation instead of wraparound in the new phasors (this is better when it's being used as a clock signal). So that small bit of timing information gets lost. There's also bound to be natural floating point numerical errors at some point too.

The synchronization aspect adds check-in and course correction between the original phasor and the rephasor.

@paul What is the difference between truncation and wraparound in this context?

@freakazoid it's how the phasor handles the extra values that go beyond 1. Wraparound saves the bits (using modulo to be in range 0 and 1 if needed). Truncation discards the bits completely and starts over.

For example, say the phasor is incremented and goes to 1.001. with wraparound, the next value goes to 0.001. with truncation, the next value is 0.

@paul Ah, that makes sense! Why would that make it better suited to use as a clock?

@freakazoid the alternative clock signal I've used in the past is an impulse, a single sample tick that repeats periodically. A phasor is better than a clock because it embeds progress within the beat.

@paul Sure, and you can use it to generate an index into a lookup table to make a NCO.

@freakazoid I use my own quirky system. The core of it is something called sndkit:

@paul Where can I read about Gest, or gestural sequencers? Not sure I understand the term, but I’m interested in composable/combinable sequencers, which it sounds like you’re talking about?

Sign in to participate in the conversation

We are an instance for discussions around cultural freedom, experimental, new media art, net and computational culture, and things like that.

<svg xmlns="" id="hometownlogo" x="0px" y="0px" viewBox="25 40 50 20" width="100%" height="100%"><g><path d="M55.9,53.9H35.3c-0.7,0-1.3,0.6-1.3,1.3s0.6,1.3,1.3,1.3h20.6c0.7,0,1.3-0.6,1.3-1.3S56.6,53.9,55.9,53.9z"/><path d="M55.9,58.2H35.3c-0.7,0-1.3,0.6-1.3,1.3s0.6,1.3,1.3,1.3h20.6c0.7,0,1.3-0.6,1.3-1.3S56.6,58.2,55.9,58.2z"/><path d="M55.9,62.6H35.3c-0.7,0-1.3,0.6-1.3,1.3s0.6,1.3,1.3,1.3h20.6c0.7,0,1.3-0.6,1.3-1.3S56.6,62.6,55.9,62.6z"/><path d="M64.8,53.9c-0.7,0-1.3,0.6-1.3,1.3v8.8c0,0.7,0.6,1.3,1.3,1.3s1.3-0.6,1.3-1.3v-8.8C66,54.4,65.4,53.9,64.8,53.9z"/><path d="M60.4,53.9c-0.7,0-1.3,0.6-1.3,1.3v8.8c0,0.7,0.6,1.3,1.3,1.3s1.3-0.6,1.3-1.3v-8.8C61.6,54.4,61.1,53.9,60.4,53.9z"/><path d="M63.7,48.3c1.3-0.7,2-2.5,2-5.6c0-3.6-0.9-7.8-3.3-7.8s-3.3,4.2-3.3,7.8c0,3.1,0.7,4.9,2,5.6v2.4c0,0.7,0.6,1.3,1.3,1.3 s1.3-0.6,1.3-1.3V48.3z M62.4,37.8c0.4,0.8,0.8,2.5,0.8,4.9c0,2.5-0.5,3.4-0.8,3.4s-0.8-0.9-0.8-3.4C61.7,40.3,62.1,38.6,62.4,37.8 z"/><path d="M57,42.7c0-0.1-0.1-0.1-0.1-0.2l-3.2-4.1c-0.2-0.3-0.6-0.5-1-0.5h-1.6v-1.9c0-0.7-0.6-1.3-1.3-1.3s-1.3,0.6-1.3,1.3V38 h-3.9h-1.1h-5.2c-0.4,0-0.7,0.2-1,0.5l-3.2,4.1c0,0.1-0.1,0.1-0.1,0.2c0,0-0.1,0.1-0.1,0.1C34,43,34,43.2,34,43.3v7.4 c0,0.7,0.6,1.3,1.3,1.3h5.2h7.4h8c0.7,0,1.3-0.6,1.3-1.3v-7.4c0-0.2,0-0.3-0.1-0.4C57,42.8,57,42.8,57,42.7z M41.7,49.5h-5.2v-4.9 h10.2v4.9H41.7z M48.5,42.1l-1.2-1.6h4.8l1.2,1.6H48.5z M44.1,40.5l1.2,1.6h-7.5l1.2-1.6H44.1z M49.2,44.6h5.5v4.9h-5.5V44.6z"/></g></svg>