title: How to control the sound volume of (audio buffer) AudioContext()?
body: <p>I have following AudioContext() sound object in JavaScript.
  <br>Its volume is 100%. I want to play its volume in 10% (where volume = 0.1).
  <br>How can I reduce its volume to 10%?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const aCtx = new AudioContext();
  let source = aCtx.createBufferSource();
  let buf;
  fetch('https://dl.dropboxusercontent.com/s/knpo4d2yooe2u4h/tank_driven.wav') // can be XHR as well
    .then(resp =&gt; resp.arrayBuffer())
    .then(buf =&gt; aCtx.decodeAudioData(buf)) // can be callback as well
    .then(decoded =&gt; {
      source.buffer = buf = decoded;
      source.loop = true;
      source.connect(aCtx.destination);
      check.disabled = false;
    });
  
  check.onchange = e =&gt; {
    if (check.checked) {
      source.start(0); // start our bufferSource
    } else {
      source.stop(0); // this destroys the buffer source
      source = aCtx.createBufferSource(); // so we need to create a new one
      source.buffer = buf;
      source.loop = true;
      source.connect(aCtx.destination);
    }
  };</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;label&gt;Start Playing&lt;/label&gt;
  &lt;input type="checkbox" id="check" disabled&gt;&lt;br&gt;
  &lt;br&gt;Its volume is 100%. Please help me to reduce it to 10%.</code></pre>
  </div>
  </div>
  </p>