pong~ style waveshaping
Hi,
I need to implement a patch made in max/msp in another platform. My patch uses pong~ extensively, and I need to implement the waveshaping characteristics of pong~ in the other platform but I am a bit lost.
Pong inverts the signal that exceeds the high and low thresholds. I did manage do make a waveshaper that does exactly that. But if the inverted signal passes the other threshold, the signal is inverted again in pong~, and this loop goes forever. So it is like pong is always feeding itself back, folding back the wave back and forth until it fits the given range.
I am a bit of lost on programming same kind of waveshaping function. Hope there is an easy way to make it.
Any suggestions?
Thanks!
Can you post your waveshaper to aid the discussion?
Thanks
On Feb 7, 2007, at 2:25 AM, Batuhan wrote:
>
> Pong inverts the signal that exceeds the high and low thresholds. I
> did manage do make a waveshaper that does exactly that. But if the
> inverted signal passes the other threshold, the signal is inverted
> again in pong~, and this loop goes forever. So it is like pong is
> always feeding itself back, folding back the wave back and forth
> until it fits the given range.
----
Steven M. Miller
Home
SFIFEM
Atrium Sound Space
OVOS
Yes, of course.
If signal exceeds low or hi thresholds, it is treated to the transfer function:
(2*threshold) - signal
This effectively wraps the signal.
But say, if the "wrapped" signal exceeds the high threshold, it needs to be wrapped, and if this "wrapped" signal exceeds the lower thereshold, it needs to be wrapped again, and if this signal exceeds the higher threshold, it needs to be wrapped again, and if this signal exceeds the lower threshold, it needs to be wrapped again... And this goes on and on. But how many times? This example has one pong object for comparison. My foldback patcher effectively folds 4 times then fails to to more. I can connect more in series but it will eventually fail at some point and it looks lame.
So there should be another way I guess? You can switch presets, the last one fails in my implementation.
Thanks
Batuhan
Sounds like you need some modulo arithmetic to get you sorted out.
The "%~" object should do the trick.
Andrew B.
Thanks Andrew, for the response.
%~ surely rings a bell but does not help me with my problem. One can derive a function with %~
thresh. - (sig % thresh.) --> for the high threshold and,
thresh. + (thresh. % sig) --> for the low threshold.
I think this is more expensive than multiplication but my problem lies at the fact that I will eventually have to compare the folded signal with the opposite threshold again, to see if it exceeds. But I could not find a way to see how many times I am going to need this comparison in advance, I just get my head around for the math of it.
Thanks for the help.
This is a control-rate version of pong~ that I wrote. Not signal rate,
but the math may be useful. It works with lists, too...
Peter McCulloch
PM.Pong
On 9-Feb-2007, at 7:51, Peter McCulloch wrote:
> This is a control-rate version of pong~ that I wrote. Not signal
> rate, but the math may be useful.
Seems to be missing an abstraction named PM.MinMax?
Here's a reminder that lp.scampf and lp.scampi offer pong~
functionality for ints and floats. Part of the free Litter Power
Starter pack. URI below.
-------------- http://www.bek.no/~pcastine/Litter/ -------------
Peter Castine +--> Litter Power & Litter Bundle for Jitter
Universal Binaries on the way
iCE: Sequencing, Recording &
Interface Building for |home | chez nous|
Max/MSP Extremely cool |bei uns | i nostri|
http://www.dspaudio.com/ http://www.castine.de
Thanks for the input!
Andrew was right, I've successfully managed to derive two transfer functions with %~ operator. And it works fine.
I'll be checking out your control rate example tonight, to see if it works more efficiently.
I'll be posting my waveshaper later today. So thanks for all the help!
>
> Seems to be missing an abstraction named PM.MinMax?
>
Whoops. Here is PM.MinMax
Ok, this is my implementation of a foldback distortion. I think it works identical to pong~ foldback mode. It is more than 4 times inefficient and cpu hungry. :) The formulas I used are commented in patcher.
Implementing mathematical formulas with objects is killing me. In max I have expr, is there anything something like it in signal domain? I've looked for something like expr~ but had no luck.