Seamlessly reversing a signal

soda's icon

Hello,

I can't seem to figure out how to seamlessly reverse the output of phasor~ or count~. That is, when the count~ is counting forward, I'd like to reverse the count at the precise count position and to begin counting backwards. Simply switching to a signal that is the inversion (maximum minus the current count value) of the current count will of course cause a discontinuity. I'm looking for a solution that is strictly in the signal domain. Any help would be really appreciated.

Thanks,
soda

Peter McCulloch's icon

sah~, !-~, and selector~ ought to do the trick.

soda's icon

Thanks for the replies.

I'm just using the phasor~ for loop playback. I made another attempt using pong~, but there's still discontinuities and it doesn't really work. Basically, my approach is to establish a forward signal and an inverted reverse signal and then to add an offset at the moment the direction is changed. At that moment the signals should have the same value and a selector~ switches to the other signal. I know there is a problem in that when the direction is changed, the current offset needs to be taken into account which it is not in this patch. I wasn't able to implement that without creating a feedback loop with sah~, and I wanted to avoid using send~/receive~. I'm sure the solution is simple and straight forward, so maybe I'm totally on the wrong track.

Here's the current patch:

3819.loopplayback.maxpat
Max Patch
soda's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Sorry, copied inline:

Floating Point's icon
Max Patch
Copy patch and select New From Clipboard in Max.

you need to make your own phasor (using +=~), so you don't have to deal with the idiosyncrasies of the existing one, then it's really quite simple:

soda's icon

Thanks a lot, Terry. Exactly the elegant solution I was hoping existed. Still feeling my way around the signal domain...

~ s