79242737

Date: 2024-12-02 00:54:10
Score: 3
Natty:
Report link

The accepted answer on codepen works nicely, however when I implement similar version on my IDE, I have the same problem of the slider not going down to zero. I did get it working however by setting the slider's range to [-20,10]:

<input type="range" step="1" min="-20" max="10" class="range-slider" value="-10" />

I adjusted the values so that the float values range from -1 to 0.5. That way it can be attenuated to zero:

volume_slider.oninput = function () {
  let valFloat = parseFloat(this.value)/20; 
  gain.gain.rampTo(valFloat, 0.1);
}
Reasons:
  • Blacklisted phrase (1): I have the same problem
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Me too answer (2.5): I have the same problem
  • Low reputation (0.5):
Posted by: dbertels