Retriggerable single-cycle ramp from a phase/rate signal

Luca Schwarz's icon

Hi everyone,

I'm working on a timing system in Max / gen~ and I'm trying to build a small component that behaves like a phase-synchronous one-shot ramp.

Context:

I have a continuously running phase signal (0→1 ramp), produced by rate / phasor.
This phase is the master timing reference in my patch and must keep running continuously.

What I would like to generate is a retriggerable ramp that:

• starts when I send a single-sample trigger
• follows the exact timing of the existing phase signal
• outputs one or more full 0→1 cycles
• then stops again

Example behaviour:

trigger → output N ramps (adjustable)

So essentially:

trigger → phase-synchronous ramp generator with adjustable number of cycles

Important constraints:

• the original phase signal must NOT be reset
• the ramp must stay perfectly synchronized to that phase
• the trigger is a single-sample impulse

Thanks a lot!

MakePatchesNotWar's icon

What are you struggling with? It seems like you have a good idea of how to implement this no?

Stevon's icon

I don't know if I understood this correctly but, if its in phase with the "master-phasor"wouldn't that be just a gate that closes after N-Amount of cycles?

Michael Reichmann's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Hello!
I think this patch should pretty much do what you want.

Luca Schwarz's icon

hi michael! thx thats super close yes! the only thing is that it doesnt trigger instantly, it seems like the ramp waits until the master ramp starts, it doesnt gets triggered instantly.

Michael Reichmann's icon

Ah, I see: I thought waiting for the next onset was the whole point, so maybe I misread something.
In that case you can just remove the [latch] → [delta] → [< -0.5] after the [gate] and then it should trigger instantly.