[Stk] Bug in ADSR.setAllTimes decay rate?

Zacko Belsch zackobelsch at gmail.com
Sat Jan 11 18:34:47 PST 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ccrma-mail.stanford.edu/pipermail/stk/attachments/20140111/c36ec5c3/attachment.html 


More information about the Stk mailing list