'Pop noise' sounds when audio paused with Javascript
<p>I have an audio tag in my html, and which I have .wav inside it. With Javascript, I select audio tag and play the wav., which I trigger using a keyboard key. <em>What I am trying to achieve is, for example, on press of each 'A' key, replay the .wav/play the sound from the beginning)</em></p>

<p>The playing of the audio works okay, and so does the pause too. However, I get a pop noise, while directly pausing the playing .wav.</p>

<pre><code>var audio = document.getElementById(sound);

if (!isPlaying(audio)) {
   audio.play();     // works
} else {
   audio.pause();    // pops on this line; I checked with commenting below lines.
   audio.currentTime = 0;
   audio.play();
}
</code></pre>

<p>I found <a href="https://stackoverflow.com/a/21525308/4705339">this answer</a>, and as far as I understand, it's happening because I instantly set the volume to 0; but I couldn't figure it out for my case. I believe using a fader with setInterval is not a good approach</p>

<p>I also found <code>audio.muted = true</code>, and tried using it before pausing the volume (and used <code>audio.muted = false</code> just before playing the audio), but this also gives pop noise</p>

<hr>

<p>Update:</p>

<p>I think I need to use fade out to work around this issue. Is there a way to fade out audio instantly?</p>