Use the edge~ to detect zero to non-zero (and vice versa) signal transitions and report a bang out of one of its two outlets according to which direction the transition has occurred.
Common Box Attributes
Multichannel Group Attributes
Multichannel Group Messages
Out left outlet: Sent when the input signal changes from zero to non-zero. The minimum time between
Out right outlet: Sent when the input signal changes from non-zero to zero. The output will not happen more often than the time represented by the number of samples in the current input/output vector size.