[PD] best non linear envelope design?

Alexandre Torres Porres porres at gmail.com
Sat Jul 13 09:11:47 CEST 2019


Em sex, 12 de jul de 2019 às 22:30, Joey Dodson <joey.dodson3 at gmail.com>
escreveu:

> I'm curious about the range of values accepted.
>

For [envgen~], this is what I'm doing. The step variable is from 0 to 1 and
reflects the vertical distance. The "delta" is the difference, if it's
positive, then it's an ascending ramp, descending otherwise. I also have a
"gain" parameter, which comes from the gate input. A gate of "1" means a
maximum gain of "1", "0.5" would be "0.5" and so on. Negative gates are
allowed, and the function gets inverted.

I do allow negative exponentials, but what I do is that I invert/mirror the
function.

Well, here's what I do then.

        *if*(x->x_power >= 0){ *// positive exponential*

            *if*((x->x_delta > 0) == (x->x_gain > 0))

                step = pow(step, x->x_power);

            *else*

                step = 1-pow(1-step, x->x_power);

        }


Because of this, an ascending curve with the same exponential parameter of
a descending curve will "look" the same, but mirrored.


As for negative exponentials, it's the opposite.



        *else*{ *// negative exponential*

            *if*((x->x_delta > 0) == (x->x_gain > 0))

                step = 1-pow(1-step, -x->x_power);

            *else*

                step = pow(step, -x->x_power);

        }

Hope this makes sense.

Check out the help file of [envgen~] (beta 22 is already available via
deken) and you can see what kinds of curves you can generate with it.

I believe there should be no problem with fractional exponents (square
> roots),
>

no problem at all


> but I wonder about the case of negative exponents (inverse of the
> exponent) since small fractions would map to large numbers well over 1, so
> I assume those wouldn't be allowed.
>

since the input values are always from 0 to 1, a small fraction will just
make it jump to "1", but not exceed it.


> Also, since both [else/envgen~] and [else/adsr~] are capable of multiple
> envelope "segments", could each segment have a separate parameter or would
> there be one parameter applied to all segments?
>

you can have a different exponential parameter for each segment in
[envgen~]

the [adsr~] object, so far, is only linear, but I'm hoping to offer a
hardcoded exponential setting for it, but not sure yet which one, hence my
mail to the list :) - I figure if you wanna tailor your own special adsr~,
you can go for [envgen~].

cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20190713/273a426a/attachment.html>


More information about the Pd-list mailing list