@y0g1 said:
Here "phasor~"'s phase is reset when receiving a non zero signal.
The use case is resetting a sample counter.
Phasor~in puredata doesn't act the same,
Does anyone have a clue how to make a vanilla adaptation ?
I forget who is the pd forum user who taught me this trick, but, here's a neat way to have a signal reset a phasor:
[phasor~]
| \
| [samphold~]
| |
[-~]
|
[wrap~]
Then the reset trigger goes into the right inlet of samphold~ (but IIRC it should be inverted, because samphold samples its input signal when its trigger signal decreases, see its help file).
Always works (think about it a minute, and it becomes clear why).
Btw phasor * sample rate is not safe as a sample counter, due to floating point rounding error. (Maybe ok for one second.) In pd vanilla, [rpole~ 1] can serve as an accumulator but resetting it at signal rate is a bit trickier. I'm not at the computer now but I could track that down later. Or use cyclone's count~.
hjh