<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. </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 <span style="color: rgb(50, 49, 48); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", 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 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: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", 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: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", 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: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", 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: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", 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: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", 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 <chuck-users-bounces@lists.cs.princeton.edu> namens Mario Buoninfante <mario.buoninfante@gmail.com><br>
<b>Verzonden:</b> dinsdag 18 februari 2020 9:18<br>
<b>Aan:</b> ChucK Users Mailing List <chuck-users@lists.cs.princeton.edu><br>
<b>Onderwerp:</b> Re: [chuck-users] ADSR AttackRate, decayRate, sustainRate</font>
<div> </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 => ADSR a1 => blackhole;<br>
step => ADSR a2 => blackhole;<br>
step.next(1);<br>
<br>
second / samp => float SR;<br>
250::ms => dur attack;<br>
750::ms => dur decay;<br>
0.34 => float sustain;<br>
890::ms => 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 => int c; c < 20; c++)<br>
{<br>
<<< a1.last(), a2.last() >>>;<br>
100::ms => 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 => int c; c < 20; c++)<br>
{<br>
<<< a1.last(), a2.last() >>>;<br>
100::ms => 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 <<a href="mailto:hverb54@hotmail.com">hverb54@hotmail.com</a>> 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 AttackRate, decayRate, sustainRate in ADSR. </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Normally when using an ADSR, 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>