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