diff --git a/funstim.js b/funstim.js index 45a0e60..18eb084 100644 --- a/funstim.js +++ b/funstim.js @@ -124,6 +124,10 @@ onmessage = e => { amp = (amp + ampFilter * (filterLength - 1)) / filterLength; } + if (sample >= totalSamples) { + amp = 0; + } + ampFilter = amp; let lVol = getVolume(pos, volumeMap.left); let rVol = getVolume(pos, volumeMap.right);