<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Mario,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks a lot for your answer. Your script is not so easy to read for me and to imagine what is supposed to happen. I run it and it did exactely the same.&nbsp;</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Is it correct to say that when i use only&nbsp;<span style="color: rgb(50, 49, 48); font-family: &quot;Segoe UI&quot;, &quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-system, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif; background-color: rgb(255, 255, 255); display: inline !important">attackRate,
 decayRate, releaseRate it will create a negative envelope. I mean that instead of rising from 0 to the maximum volume attackRate&nbsp; descents from 0 to a negative volume?</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(50, 49, 48); font-family: &quot;Segoe UI&quot;, &quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-system, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(50, 49, 48); font-family: &quot;Segoe UI&quot;, &quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-system, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(50, 49, 48); font-family: &quot;Segoe UI&quot;, &quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-system, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif; background-color: rgb(255, 255, 255); display: inline !important">Kind regards,</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(50, 49, 48); font-family: &quot;Segoe UI&quot;, &quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-system, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif; background-color: rgb(255, 255, 255); display: inline !important"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(50, 49, 48); font-family: &quot;Segoe UI&quot;, &quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-system, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, sans-serif; background-color: rgb(255, 255, 255); display: inline !important">herman</span></div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Van:</b> chuck-users-bounces@lists.cs.princeton.edu &lt;chuck-users-bounces@lists.cs.princeton.edu&gt; namens Mario Buoninfante &lt;mario.buoninfante@gmail.com&gt;<br>
<b>Verzonden:</b> dinsdag 18 februari 2020 9:18<br>
<b>Aan:</b> ChucK Users Mailing List &lt;chuck-users@lists.cs.princeton.edu&gt;<br>
<b>Onderwerp:</b> Re: [chuck-users] ADSR AttackRate, decayRate, sustainRate</font>
<div>&nbsp;</div>
</div>
<div>
<div dir="ltr">
<div>Hi Herman,</div>
<div><br>
</div>
<div>These functions (attackRate, decayRate, releaseRate) are the inverse of the time ones (attackTime, decayTime and releaseTime).</div>
<div>Looking at the source code you'll find the methods at row 4911 of ugen_stk.cpp.</div>
<div>You can try the following script to see them in action:</div>
<div><br>
</div>
<div>Step step =&gt; ADSR a1 =&gt; blackhole;<br>
step =&gt; ADSR a2 =&gt; blackhole;<br>
step.next(1);<br>
<br>
second / samp =&gt; float SR;<br>
250::ms =&gt; dur attack;<br>
750::ms =&gt; dur decay;<br>
0.34 =&gt; float sustain;<br>
890::ms =&gt; dur release;<br>
<br>
a1.set(attack, decay, sustain, release);<br>
a2.attackRate(1::ms / (attack*SR*0.001));<br>
a2.decayRate( (1 - sustain) / ((decay/ms)*SR*0.001) );<br>
a2.sustainLevel(sustain);<br>
a2.releaseRate(sustain / ((release/ms)*SR*0.001));<br>
<br>
// trigger the ADSRs and print their current value every 100 msec<br>
a1.keyOn(1);<br>
a2.keyOn(1);<br>
for(0 =&gt; int c; c &lt; 20; c&#43;&#43;)<br>
{<br>
&nbsp; &nbsp; &lt;&lt;&lt; a1.last(), a2.last() &gt;&gt;&gt;;<br>
&nbsp; &nbsp; 100::ms =&gt; now;<br>
}<br>
<br>
// release the ADSRs and print their current value every 100 msec<br>
a1.keyOff(1);<br>
a2.keyOff(1);<br>
for(0 =&gt; int c; c &lt; 20; c&#43;&#43;)<br>
{<br>
&nbsp; &nbsp; &lt;&lt;&lt; a1.last(), a2.last() &gt;&gt;&gt;;<br>
&nbsp; &nbsp; 100::ms =&gt; now;<br>
}</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Mario<br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Mon, 17 Feb 2020 at 10:56, herman verbaeten &lt;<a href="mailto:hverb54@hotmail.com">hverb54@hotmail.com</a>&gt; wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I was wondering what the function is of&nbsp;AttackRate, &nbsp;decayRate, sustainRate in ADSR.&nbsp;</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Normally when using an ADSR,&nbsp; attack only uses time. Same for decay and sustain.</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Also the declaration at the end of de memeber description is not very clear to me:</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<pre style="margin:0em; font-size:12px; background:rgb(248,248,248) none repeat scroll 0% 0%">The \e state = ADSR::DONE after the
    envelope value reaches 0.0 in the
    ADSR::RELEASE state.
</pre>
<br>
Thanks in advance for your assistance.</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Kind regards,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Herman</div>
</div>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</blockquote>
</div>
</div>
</div>
</body>
</html>