Forums > Gen

Gen~ Phasor with Stalling

Jul 06 2012 | 4:11 am

Cross posting from a failed thread-hijacking.

The custom phasor I’ve been working on, needs a ‘stall time’ as well as phase control similar to the built in MSP phasor. Stall time is set in MS – essentially, the phasor does one ramp, then sits at 0 until the stall time has passed, then does another ramp from 0 to 1.

Included in the patch are two possible options – the first one doesn’t work completely, but it’s nice and clean. Sadly, doing the phase merely as a [+] before wrapping, makes the stalltime function screw up majorly.

The second option is MUCH more complex, but it was the only way I could come up with to make phase work, as well as stall time. But it’s just… so ugly! And the phase isn’t clean, nor is it elegant – it’s essentially a delay, but I’m sure after a while it would cause multiple stall-phasors to fall out of sync a touch. (Also I never thought to use a named history object before, so the ‘reset’ function on it is still clunky).

Anyone have any great insights on how to make the simpler patch do what I need it to do?

— Pasted Max Patch, click to expand. —
Jul 06 2012 | 3:20 pm

The easier way of doing it (rather than substituting the phase increment) is to calculate the period of both waves together, use that to set the frequency, then scale the wave and clip it. Notice that here the phase control applies to the entire waveform (including the stall). If you only want it to apply to the ramp, then you could divide it by the scaling factor.

This is probably not the super-efficient way of doing it what with all the divides, but it should work well.

-- Pasted Max Patch, click to expand. --

Jul 06 2012 | 3:42 pm

Thanks, Peter! This is gonna take me a little while to parse completely (I’m sleep deprived, at the moment).

Jul 06 2012 | 4:04 pm

This is a non-gen~ solution, but it should illustrate how you could do it in gen~.

-- Pasted Max Patch, click to expand. --

Jul 06 2012 | 4:13 pm

Oh, but in the example I posted above, the output doesn’t go to 1, it just goes to the fraction specified as the "duty cycle". Here’s a better solution.

-- Pasted Max Patch, click to expand. --

Jul 06 2012 | 11:16 pm

Thanks, Christopher – sadly I do need it to take stall time in MS, and frequency for just the ramp – I need to be able to use the phase input across multiple phasors, to make them sync (IE blast out 0, .25, .5, and .75 to four of them simultaneously) – because yours sort of decouples the stall time from the phasor, setting the stall of one to .5 and the other to 0 makes them sort of alternate, instead of overlap by half a ramp. (It’s a weirdly specific problem, but I’m enjoying seeing all the ways other people attack it!)


Jul 06 2012 | 11:50 pm

Peter – yours seems to work really well for what I need (though I need to figure out if stalling at 1 instead of 0 is going to cause issues) – now to just figure out what it’s actually doing…. :P Thanks!

Viewing 7 posts - 1 through 7 (of 7 total)

Forums > Gen