From 87f400b27d68d622746dd6bb0c7801873feaa35a Mon Sep 17 00:00:00 2001 From: "Michael \"Z\" Goddard" <mzgoddard@gmail.com> Date: Mon, 11 Jun 2018 15:23:12 -0400 Subject: [PATCH] set DECAY_TIME to 25ms Use a DECAY_TIME that envelopes half of the lowest frequency a person can hear. --- src/AudioEngine.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/AudioEngine.js b/src/AudioEngine.js index f76d150..23cf144 100644 --- a/src/AudioEngine.js +++ b/src/AudioEngine.js @@ -77,13 +77,20 @@ class AudioEngine { } /** - * A short duration, for use as a time constant for exponential audio parameter transitions. - * See: - * https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/setTargetAtTime + * A short duration to transition audio prarameters. + * + * Used as a time constant for exponential transitions. A general value + * must be large enough that it does not cute off lower frequency, or bass, + * sounds. Human hearing lower limit is ~20Hz making a safe value 25 + * milliseconds or 0.025 seconds, where half of a 20Hz wave will play along + * with the DECAY. Higher frequencies will play multiple waves during the + * same amount of time and avoid clipping. + * + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/setTargetAtTime} * @const {number} */ get DECAY_TIME () { - return 0.001; + return 0.025; } /**