[Stk] Bug in ADSR.setAllTimes decay rate?

Gary Scavone gary at ccrma.Stanford.EDU
Sat Jan 18 13:20:11 PST 2014


Hi Bob,

Thank you for your careful analysis.  In fact, this was not a known problem (as far as I know).  I made the change, played with the instruments a bit and didn’t hear any major problems.  So, I’ll include this bug fix in the repository for the next release.

Regards,

—gary

On Jan 11, 2014, at 9:34 PM, Zacko Belsch <zackobelsch at gmail.com> wrote:

> Howdy,
> 
> (I'm referring to stk-4.4.4.  Perhaps this is a known problem?)
> 
> I've been looking in detail at how ADSR works for Rhodey, and it looks like the effective decay time is twice what one would expect looking at Rhodey's call to setAllTimes.  For example for adsr_[3] is given a decay time of 0.25 seconds but if a noteOn is sent the decay takes 0.5 secs.
> 
> The problem is that Rhodey gives setAllTimes a sustain level of 0, but ADSR ends up computing the decay rate using the default sustain of .5 before it changes sustain to 0.  So it gets a rate half as fast as needed and thus takes twice as long to get to the real sustain.
> 
> That happens because the setDecayTime is called before setSustainLevel.  I believe this code (in ADSR.setAllTimes)
>    ...
>   this->setDecayTime( dTime );
>   this->setSustainLevel( sLevel );
>    ...
> should really be
>    ...
>   this->setSustainLevel( sLevel );
>   this->setDecayTime( dTime );
>    ...
> 
> Having said that, I realize that correct this behavior would end up changing the sound of every instrument that inherits from FM (To compensate all those calls would need to have their decay time doubled).  That's why I think this might be a known problem.
> 
> Am I correct?
> 
> 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