title: HTML5 audio: How to quickly stop and restart a clip?
body: <p>See title. I am trying to play an audio file 4 times in a row, every 300 milliseconds. However, the clip is longer than 300ms, so it ignores new play requests until the clip is done playing. I'm looking for some way to stop and restart the clip every 300ms.</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="content-type" content="text/html;charset=UTF-8" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;audio id="note0440"&gt;&lt;source src="0440.a4.wav" type="audio/wav"&gt;&lt;/audio&gt;
      &lt;script type="text/javascript"&gt;
          function playNote (loop) {
              var n = document.getElementById("note0440")
              if (loop &gt; 4)
                  return
              n.volume = 0.05
              // n.currentTime = 0
              n.pause()
              n.play()
              setTimeout("playNote("+(loop + 1)+")", 300)
          }
      &lt;/script&gt;
      &lt;div style="margin:50px"&gt;&lt;button onclick="playNote(1)"&gt;Play Note&lt;/button&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This does not work. It does not stop and restart, whether or not <code>n.currentTime = 0</code> is used.</p>
  
  <p>Here's a WAV file if you need one for testing: <a href="http://popstrip.com/misc/0440.a4.wav" rel="noreferrer">http://popstrip.com/misc/0440.a4.wav</a></p>