Hi, I just implemented curved envelopes into my [else/envgen~] object. The exponential parameter is plainly getting a vertical distance, normalize it from 0 to 1 and apply a power raised exponential. For instance, a parameter of 4 is like using [pow~ 4] with an input from 0 to 1!
I wonder if this is all that there is to generating exponential curves or if I should also look into other functions.
Moreover, I also have a much simpler object called [else/adsr~] and I'm thinking of providing a hard coded exponential setting for it. What would be a good one and only choice for that? I mean a more "classic" and common design for the attack/decay and release stages.
cheers
I'm curious about the range of values accepted. I believe there should be no problem with fractional exponents (square roots), 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. 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?
On Fri, Jul 12, 2019 at 4:55 PM Alexandre Torres Porres porres@gmail.com wrote:
Hi, I just implemented curved envelopes into my [else/envgen~] object. The exponential parameter is plainly getting a vertical distance, normalize it from 0 to 1 and apply a power raised exponential. For instance, a parameter of 4 is like using [pow~ 4] with an input from 0 to 1!
I wonder if this is all that there is to generating exponential curves or if I should also look into other functions.
Moreover, I also have a much simpler object called [else/adsr~] and I'm thinking of providing a hard coded exponential setting for it. What would be a good one and only choice for that? I mean a more "classic" and common design for the attack/decay and release stages.
cheers _______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Am 13. Juli 2019 03:27:44 MESZ schrieb
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.
why not? are all the numbers you ever use in Pd nicely in the range of -1..+1?
mfg.hdgg.ifd IOhannes
Em sex, 12 de jul de 2019 às 22:30, Joey Dodson joey.dodson3@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
On 13/07/2019 08:11, Alexandre Torres Porres wrote: 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
Dear Alexandre
Wouldn’t the “classical” approach be convex attack (0 < pow < 1) and concave decay and release (pow > 1)? If so, you would be looking at a set of hardcoded exponents, not a single exponent for all segments, right?
FWIW, if you have the configurable [envgen~], I would make life easy for yourself and leave [adsr~] as linear.
Best
m
-- matthew brandi | 020 8882 4616
Em sáb, 13 de jul de 2019 às 04:36, matthew brandi mfbrandi@outlook.com escreveu:
On 13/07/2019 08:11, Alexandre Torres Porres wrote:
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
Dear Alexandre
Wouldn’t the “classical” approach be convex attack (0 < pow < 1) and concave decay and release (pow > 1)?
if you say so, I'm buying :)
If so, you would be looking at a set of hardcoded exponents, not a single exponent for all segments, right?
yup, I meant a set
FWIW, if you have the configurable [envgen~], I would make life easy for yourself and leave [adsr~] as linear.
Best
I see, but I also think a preconfigured [adsr~] makes things easier if that's all you want.
I actually know of two other adsr envelopes out there for Pd, both non linear, they are: bsaylor/aenv~ and creb/eadsr~ - both are hardcoded. I haven't checked them yet, I hope I can figure it out by looking at the code, since the documentation doesn't say much.
cheers
Em sáb, 13 de jul de 2019 às 05:40, Christof Ressi christof.ressi@gmx.at escreveu:
Hey,
I actually know of two other adsr envelopes out there for Pd, both non
linear, they are: bsaylor/aenv~ and creb/eadsr~ - both are hardcoded.
attached you'll find my own personal envelope generator (cadsr~) which allows you to set the shape individually for each segments.
cool, but I only see 1 exponential parameter for all lines.
Exponential segments take another argument to control the shape ( >0 fast rise, <0 slow rise).
and its minimum value is "1".
For a "natural" envelope generator, like those found in analog
synthesizers, you can use a 1-pole lowpass filter and change the frequency for each segment to emulate the behavior of a capacitor.
I see, makes total sense.
with 5 time constants, the envelope generator will reach 99.3% of the target value. Note that the target value is always approached asymptotically and - at least in theory - never fully reached.
I see, so that's what asymptotic means then. The bsaylor/aenv~ object says it's asymtotic, so I bet it uses the same 1-pole design (I'm yet to check the code). Anyway, I was able to make envgen~ get to a pretty close curvature to your patch with a time value of "5". I used an exponential value of 4 and that did fit reasonably well. I don't thin the difference is perceivable in any significant way. So I guess I'm going with that approach to the design of my hardcoded adsr~ exponential setting.
Thanks
yeah, both creb/eadsr~ and bsaylor/aenv~ seem to use a one pole filter design, even though both generate slightly different shapes.
Em sáb, 13 de jul de 2019 às 20:40, Alexandre Torres Porres < porres@gmail.com> escreveu:
Em sáb, 13 de jul de 2019 às 05:40, Christof Ressi christof.ressi@gmx.at escreveu:
Hey,
I actually know of two other adsr envelopes out there for Pd, both non
linear, they are: bsaylor/aenv~ and creb/eadsr~ - both are hardcoded.
attached you'll find my own personal envelope generator (cadsr~) which allows you to set the shape individually for each segments.
cool, but I only see 1 exponential parameter for all lines.
Exponential segments take another argument to control the shape ( >0 fast rise, <0 slow rise).
and its minimum value is "1".
For a "natural" envelope generator, like those found in analog
synthesizers, you can use a 1-pole lowpass filter and change the frequency for each segment to emulate the behavior of a capacitor.
I see, makes total sense.
with 5 time constants, the envelope generator will reach 99.3% of the target value. Note that the target value is always approached asymptotically and - at least in theory - never fully reached.
I see, so that's what asymptotic means then. The bsaylor/aenv~ object says it's asymtotic, so I bet it uses the same 1-pole design (I'm yet to check the code). Anyway, I was able to make envgen~ get to a pretty close curvature to your patch with a time value of "5". I used an exponential value of 4 and that did fit reasonably well. I don't thin the difference is perceivable in any significant way. So I guess I'm going with that approach to the design of my hardcoded adsr~ exponential setting.
Thanks
On Sat, Jul 13, 2019 at 7:59 PM Alexandre Torres Porres porres@gmail.com wrote:
yeah, both creb/eadsr~ and bsaylor/aenv~ seem to use a one pole filter design, even though both generate slightly different shapes.
Also mrpeach/rc~ does that. And banging the same value into a [line~] faster than it ramps will give a piecewise-linear approximation. The 555 timer chip uses the middle third of the curve, which is more nearly linear. Martin
Em dom, 14 de jul de 2019 às 03:57, Christof Ressi christof.ressi@gmx.at escreveu:
cool, but I only see 1 exponential parameter for all lines.
then look closer ;-)
hmm, I was looking at ceadsr~-help.pd, I now see you were talking about the other one. Anyway, ceadsr~ seems to be quite similar and I got the general idea. Thanks for the reference, I shall get back to it later.
Em sáb, 13 de jul de 2019 às 21:08, Martin Peach chakekatzil@gmail.com escreveu:
Also mrpeach/rc~ does that.
haven't looked closely, but that seems like my else/slew~ object, which converges to within 0.01% of the target value in the given time. One could use [rpole~] instead, and the formula to get the filter coefficient from the time in seconds is: coef = exp(ln(0.001) / (sec * samplerate))
So I'm using this one pole filter from my slew~ object to offer a hardcoded exponential option for both else/asr~ and else/adsr~
I'm avoiding the idea to set a parameter to change the one pole coefficient and also offer that option for envgen~ and stuff to avoid too much complexity, but I've put a pin on it.
cheers