How do I send a waveform of varying amplitude through this expression in Pd?

2 * asin( sin( x *(pi/2)))/pi

]]>How do I send a waveform of varying amplitude through this expression in Pd?

2 * asin( sin( x *(pi/2)))/pi

]]>I suggest you look at the [expr~] object and its help file. You can run a signal through an expression (using the variable "$v1" in place of "x").

]]>@robertsyrett Hi and welcome to the forum and Pd.

I suggest you look at the [expr~] object and its help file. You can run a signal through an expression (using the variable "$v1" in place of "x").

Thanks! good to know a little more about how the expression node works. However it doesn't seem to recognize pi as a constant. Should I just substitute 3.1415926535897932384626433832795028841971693993751058209749445923078164062, or is there a more elegant solution?

]]>`asin(sin(x *(pi/2)))`

is to map values between -1 and 1 to a range between -90 and 90. Calculating this part `sin(x*(pi/2))`

with values for x between -1 and 1, and using an arcsin calculator, for -1 I got -90, for -0.5 I got almost -45, for 0 I got 0, for 0.5 I got almost 45, and for 1 I got 90.So, if you're using values for x between -1 and 1, you could probably replace this with a mapped version of x, and the whole thing could be written like this:

Otherwise, if you want to use `[expr]`

, you should save the 'pi' value to a `[value pi]`

(also abbreviated `[v pi]`

, where 'pi' is the argument), and then use it in `[expr]`

with its variable name. Mind though that `[expr~]`

is pretty CPU hungry, especially when it comes to hardware like the Organelle.

I might be wrong about the whole arcsin thing though...

]]>Yes, the idea of a wavefolder is to reflect the waveform when it exceeds the range of -1 to 1. So the plan is to send the wavefolder a waveform and offset that signal by a varying amounts and multiply it's amplitude many times so that it goes outside -1 to 1 and folds back on itself creating new harmonics. If you open the patch I made you can see what it does. A very similar wavefolder would be sin( $v1 * asin(1)) or even cos (x) but I like 2 * asin (sin( $v1 * (pi/2)))/pi because it has more harmonics.

I would love it if you could upload a patch of your atan concept, I'm still hungry to learn how Pd works and practical examples I can relate to would be welcome.

]]>the object [value] (also called [v]) lets you store a float (like [float]) but you can give it a name and use that name inside [expr] to recall that value. Just make sure the name doesn't contain mathematical symbols like + - . etc.. and also the name can't start with a float, so calling a variable "1pi" won't work, whereas "pi1" will. This is important if you need the name to include $0 (which is internally converted to a unique number for each instance of the patch), remember not to put $0 at the beginning of the name (so you would use pi$0).

Hope this makes sense.

]]>When you say different wavefolders, I would assume you mean different equations as the [expr~ asin(sin($v1 *(pi/2)))] object is itself the wavefolder. The $v or $f variables refer to the object's inlets.

]]>