JUCE ADSR

#1

I jumped to the definition of Juce’s ADSR class just to check to see what was going on in there and I saw the method calculateRates, why is the float value of 1.0 being divided by the attack parameter * samplerate?

        attackRate  = (parameters.attack  > 0.0f ? static_cast<float> (1.0f / (parameters.attack * sr))  : -1.0f);
#2

That gives the duration of the attack time in samples at the current sample rate. Then the reciprocal

1.0 being divided by the attack parameter * samplerate

…gives the the amount that envelope value needs to increment on each output sample to transition from 0 to 1 in the attack time

#3

I see what you mean, thanks