@nicnut

i dont know about pd, but in max you can not be sure that phasor~ really reaches a "true" 1.0 in float IEEE. ;)

so you are better advised to track for the direction change in order to find the "1." within the same sample of the "1." - or actually the "0.", because "1." and "0." is the same moment in a phase accumulator.

in case there is no factory external you might need to use a delay~ 1 to track the direction change, which means that your system will have 1 sample latency.

but this is still better to use than treshold~ 0.5 - which will work, but brings new problems when used in a complex application.