[Stk] Bug in ADSR.setAllTimes decay rate?

Gary Scavone gary at ccrma.Stanford.EDU
Fri Jan 24 11:45:26 PST 2014


After a quick read of the emails and a glance at the code, I see the following issue:

- setDecayTime() uses the current sustain level value to determine the release rate
- setAllTimes() uses the _previous_ sustain level to determine the decay rate, even though the “new" sustain level is an argument to the function

So, unless I’m missing something, I think the change to the setAllTimes() function previously proposed makes sense given the way the ADSR class already functions.  The way it was working in the past is simply a bug because it represents inconsistent class behaviour.  While the default sustain level is 0.5, it could previously have been modified using the setSustainLevel() function.

Personally, I doubt the change will be obvious in most cases, as decay time will generally be short anyway.

—gary

On Jan 20, 2014, at 10:21 PM, Zacko Belsch <zackobelsch at gmail.com> wrote:

> Sounds reasonable.  The issue for a new user would be that other descriptions of the ADSR concept (not as specific to SDK) generally describe decay as time from full to sustain.
> 
> Would it be useful to add a note to the ADSR class description indicating something along the lines of Perry's latest description?  Currently the description at
> https://ccrma.stanford.edu/software/stk/classstk_1_1ADSR.html#a3567b02a0e8ab82d18eb949d362f9708
> just says that time settings are in seconds and must be positive, but gives no indication of the semantic meaning of decay or release times.  In the current implementation decay is interpreted as time to go from full to one-half (more correctly, from full to the previous sustain) and release is the time to go from new sustain to zero.  A brief note there could help new users, who can easily just call the individual set routines (.setAttackTime, etc.) to get decay that corresponds to time from full to sustain (providing they set sustain before they set decay).
> 
> Bob H
> 
> _______________________________________________
> Stk mailing list
> Stk at ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/stk




More information about the Stk mailing list