g200kg / webaudio-tinysynth

Light-weight GM mapped WebAudio-JavaScript Synthesizer Engine / MIDI Player
Apache License 2.0
229 stars 22 forks source link

Clarify release and decay parameters #5

Closed brianchirls closed 6 years ago

brianchirls commented 6 years ago

Per the documentation on timbre object structure r and d are release and decay times, respectively. However, these values are passed to setTargetAtTime as timeConstant parameters. According to MDN, the true time it takes for the decay or release will be 5x (for 99%) that parameter (or 3x for 95%).

Could you please confirm that my understanding of your code is correct? If so, I suggest updating the documentation.

Thanks.

g200kg commented 6 years ago

Sorry for the late reply. As you said, "d" and "r" are used as timeConstant as they are. Your understanding is correct.

problem is what "true time" means. The duration will be changed depending on whether it means up to 95% or 99%. In that sense, "The d and r are the time to decrease to 63.2%". I think even with general synthesizers, accurate guidelines have not been shown for the "true time" of decay / release.

If you have a good explanation a bit more detail, I would like to use in documentation.

Thank you.