M4L: Thinking about clocks…

When building a Max For Live sequencer, clocks are a problem…

My ‘Adlais’ sequencer has a counter based clock:

The Metro object automatically synchronizes to Ableton Live’s clock, but only in that it counts upwards at the rate input – in this case 4n – from when Live’s transport is engaged. The plugsync~ object resets the clock when Live’s transport is stopped and restarted.

Well, that’s fine, you might say… and it is up to a point.

It is ‘in sync’ with Live’s clock, but not with Live’s transport, and that is a problem. If I were to set the number of steps in my sequencer to 5, step 1’s position will shift along the transport by on step per 4 beats, so:

 

Transport 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
Counter 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1

 

If I then switch back to 4 steps, this happens:

 

Transport 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
Counter 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1

 

Which is what is happening with Adlais

And renders my upcoming percussion sequencer useless

So far I have found two solutions, one of which is elegant, the other is stupid….

Answers on a postcard please

Really, i would love to know your thoughts…