<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em sex, 12 de jul de 2019 às 22:30, Joey Dodson <<a href="mailto:joey.dodson3@gmail.com">joey.dodson3@gmail.com</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I'm curious about the range of values accepted. </div></blockquote><div><br></div><div>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.</div><div><br></div><div>I do allow negative exponentials, but what I do is that I invert/mirror the function. </div><div><br></div><div>Well, here's what I do then.</div><div><br></div><div>





<p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-Apple-converted-space">        </span><span class="gmail-s1" style="color:rgb(155,35,147)"><b>if</b></span>(x->x_power >= <span class="gmail-s2" style="color:rgb(28,0,207)">0</span>){ <span class="gmail-s3" style="color:rgb(83,101,121)"><i>// positive exponential</i></span></p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-Apple-converted-space">            </span><span class="gmail-s1" style="color:rgb(155,35,147)"><b>if</b></span>((x->x_delta > <span class="gmail-s2" style="color:rgb(28,0,207)">0</span>) == (x->x_gain > <span class="gmail-s2" style="color:rgb(28,0,207)">0</span>))</p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-Apple-converted-space">                </span>step = pow(step, x->x_power);</p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-Apple-converted-space">            </span><span class="gmail-s1" style="color:rgb(155,35,147)"><b>else</b></span></p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-Apple-converted-space">                </span>step = <span class="gmail-s2" style="color:rgb(28,0,207)">1</span>-pow(<span class="gmail-s2" style="color:rgb(28,0,207)">1</span>-step, x->x_power);</p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-Apple-converted-space">        </span>}</p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><br></p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)">Because of this, an ascending curve with the same exponential parameter of a descending curve will "look" the same, but mirrored. </p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><br></p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)">As for negative exponentials, it's the opposite.</p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><br></p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><br></p><p class="gmail-p2" style="margin:0px;font:12px Menlo;color:rgb(83,101,121);background-color:rgb(255,255,255)"><span class="gmail-s4" style="color:rgb(0,0,0)"><span class="gmail-Apple-converted-space">        </span></span><span class="gmail-s1" style="color:rgb(155,35,147)"><b>else</b></span><span class="gmail-s4" style="color:rgb(0,0,0)">{ </span><i>// negative exponential</i></p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-Apple-converted-space">            </span><span class="gmail-s1" style="color:rgb(155,35,147)"><b>if</b></span>((x->x_delta > <span class="gmail-s2" style="color:rgb(28,0,207)">0</span>) == (x->x_gain > <span class="gmail-s2" style="color:rgb(28,0,207)">0</span>))</p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-Apple-converted-space">                </span>step = <span class="gmail-s2" style="color:rgb(28,0,207)">1</span>-pow(<span class="gmail-s2" style="color:rgb(28,0,207)">1</span>-step, -x->x_power);</p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-Apple-converted-space">            </span><span class="gmail-s1" style="color:rgb(155,35,147)"><b>else</b></span></p><p class="gmail-p1" style="margin:0px;font:12px Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-Apple-converted-space">                </span>step = pow(step, -x->x_power);</p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
















</p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-Apple-converted-space">        </span>}</p></div><div><br></div><div>Hope this makes sense.</div><div> </div><div>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.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I believe there should be no problem with fractional exponents (square roots), </div></blockquote><div><br></div><div>no problem at all</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">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. </div></blockquote><div><br></div><div>since the input values are always from 0 to 1, a small fraction will just make it jump to "1", but not exceed it.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">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?<br></div></blockquote><div><br></div><div>you can have a different exponential parameter for each segment in [envgen~] </div><div><br></div><div>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~].</div><div><br></div><div>cheers</div></div></div>