[chuck-users] ADSR AttackRate, decayRate, sustainRate

Michael Heuer heuermh at gmail.com
Tue Feb 18 15:12:04 EST 2020


If I understand correctly, rates are the frequency in Hz as a float type, e.g. these pairs are equivalent

1::second => adsr.attackTime;
1.0 => adsr.attackRate;

500::ms => adsr.attackTime;
2.0 => adsr.attackRate;

2::second => adsr.attackTime;
0.5 => adsr.attackRate;

   michael


> On Feb 18, 2020, at 1:38 PM, herman verbaeten <hverb54 at hotmail.com> wrote:
> 
> Hi Mario,
> 
> 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. 
> Is it correct to say that when i use only 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?
> 
> 
> Kind regards,
> 
> herman
> 
> Van: chuck-users-bounces at lists.cs.princeton.edu <chuck-users-bounces at lists.cs.princeton.edu> namens Mario Buoninfante <mario.buoninfante at gmail.com>
> Verzonden: dinsdag 18 februari 2020 9:18
> Aan: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
> Onderwerp: Re: [chuck-users] ADSR AttackRate, decayRate, sustainRate
>  
> Hi Herman,
> 
> These functions (attackRate, decayRate, releaseRate) are the inverse of the time ones (attackTime, decayTime and releaseTime).
> Looking at the source code you'll find the methods at row 4911 of ugen_stk.cpp.
> You can try the following script to see them in action:
> 
> Step step => ADSR a1 => blackhole;
> step => ADSR a2 => blackhole;
> step.next(1);
> 
> second / samp => float SR;
> 250::ms => dur attack;
> 750::ms => dur decay;
> 0.34 => float sustain;
> 890::ms => dur release;
> 
> a1.set(attack, decay, sustain, release);
> a2.attackRate(1::ms / (attack*SR*0.001));
> a2.decayRate( (1 - sustain) / ((decay/ms)*SR*0.001) );
> a2.sustainLevel(sustain);
> a2.releaseRate(sustain / ((release/ms)*SR*0.001));
> 
> // trigger the ADSRs and print their current value every 100 msec
> a1.keyOn(1);
> a2.keyOn(1);
> for(0 => int c; c < 20; c++)
> {
>     <<< a1.last(), a2.last() >>>;
>     100::ms => now;
> }
> 
> // release the ADSRs and print their current value every 100 msec
> a1.keyOff(1);
> a2.keyOff(1);
> for(0 => int c; c < 20; c++)
> {
>     <<< a1.last(), a2.last() >>>;
>     100::ms => now;
> }
> 
> Cheers,
> Mario
> 
> On Mon, 17 Feb 2020 at 10:56, herman verbaeten <hverb54 at hotmail.com <mailto:hverb54 at hotmail.com>> wrote:
> Hi,
> 
> I was wondering what the function is of AttackRate,  decayRate, sustainRate in ADSR. 
> Normally when using an ADSR,  attack only uses time. Same for decay and sustain.
> 
> Also the declaration at the end of de memeber description is not very clear to me:
> The \e state = ADSR::DONE after the
>     envelope value reaches 0.0 in the
>     ADSR::RELEASE state.
> 
> Thanks in advance for your assistance.
> 
> Kind regards,
> 
> Herman
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu <mailto:chuck-users at lists.cs.princeton.edu>
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users <https://lists.cs.princeton.edu/mailman/listinfo/chuck-users>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200218/36901ee9/attachment-0001.html>


More information about the chuck-users mailing list