Forums > MaxMSP

Seamlessly reversing a signal

May 4, 2012 | 4:28 pm

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


May 4, 2012 | 7:13 pm

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


May 4, 2012 | 7:42 pm

an example patch would allow for more specificity of explanation… Peter’s suggestion is my first thought as well, but pong~ also works great(but i can’t tell what you really want without a patch that shows how you’re ranging count~ or phasor~… i mean, what should the reversed-count do when the phasor~ or count~ ramps back to 0 or a minimum…. or maybe you aren’t using phasor~ at all, and instead have count~ counting up continuously forever?)

in any case, a bit like making a triangle wave from a phasor~:

– Pasted Max Patch, click to expand. –

May 5, 2012 | 11:01 am

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:


May 5, 2012 | 4:26 pm

Sorry, copied inline:

– Pasted Max Patch, click to expand. –

May 6, 2012 | 12:28 am

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:

– Pasted Max Patch, click to expand. –

May 9, 2012 | 10:34 am

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

~ s


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