adsr icon indicating copy to clipboard operation
adsr copied to clipboard

Gain jump at start of release phase

Open bgins opened this issue 8 years ago • 2 comments

When the sustain value is low, the gain seems to jump at the start of the release phase. I used the included tests with the following values:

attack: 0.5892
decay: 0.6596
sustain: 0.1108
release: 1.7864
startValue: 0
endValue: 0

It's audible with trigger 1s and trigger hold (when held long enough).

bgins avatar Jul 13 '16 18:07 bgins

Yeah it does sound a bit off. Not sure if this is a bug or just how linear ramps sound. You're welcome to tinker with the code and see if you can fix it (PRs accepted). I have found (more recently since writing this) that using setTargetAtTime for everything in an envelope sounds much better.

You may also want to check out https://github.com/itsjoesullivan/envelope-generator which was was inspired by this module, but has more control over the curves 😸

mmckegg avatar Jul 13 '16 22:07 mmckegg

I am new to web audio, but I will take a look and see what I can do.

I will definitely check out envelope-generator. Thanks for suggesting it.

bgins avatar Jul 14 '16 15:07 bgins