mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2024-12-22 14:02:29 -05:00
set DECAY_TIME to 25ms
Use a DECAY_TIME that envelopes half of the lowest frequency a person can hear.
This commit is contained in:
parent
0059ff53e1
commit
87f400b27d
1 changed files with 11 additions and 4 deletions
|
@ -77,13 +77,20 @@ class AudioEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A short duration, for use as a time constant for exponential audio parameter transitions.
|
* A short duration to transition audio prarameters.
|
||||||
* See:
|
*
|
||||||
* https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/setTargetAtTime
|
* 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}
|
* @const {number}
|
||||||
*/
|
*/
|
||||||
get DECAY_TIME () {
|
get DECAY_TIME () {
|
||||||
return 0.001;
|
return 0.025;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue