title: WebAudio API change volume for one of sources
body: <p>I'm reading this <a href="https://www.html5rocks.com/en/tutorials/webaudio/intro/" rel="nofollow noreferrer">article</a></p>
  <p>My goal is to play two sounds at the same time. One sound is in a different volume. Having regular &quot;audio&quot; tags is not a solution because it's not working well on mobile devices. So I started to dive into Web Audio API.</p>
  <p>I wrote the code below, that works well across all devices. The single issue - I can't figure out how to control the volume. Code from example is not working(</p>
  <p>Please help </p>
  <pre><code>function init() {
  // Fix up prefixing
  window.AudioContext = window.AudioContext || window.webkitAudioContext;
  context = new AudioContext();
  bufferLoader = new BufferLoader(
      context,
      [
      'mp3/speech.mp3',
      'mp3/bg-melody.mp3',
      ],
      finishedLoading
      );
  
  bufferLoader.load();
  }
  
  function finishedLoading(bufferList) {
     document.querySelector('.message').innerHTML = &quot;Ready to play&quot;
    // Create two sources and play them both together.
    source1 = context.createBufferSource();
    source2 = context.createBufferSource();
    source1.buffer = bufferList[0];
    source2.buffer = bufferList[1];
    source1.connect(context.destination);
  
    // This code is not working
    var gainNode = context.createGain();
    gainNode.gain.value = 0.1;
    source2.connect(gainNode);
    source2.connect(context.destination);
   source2.loop = true;
  }
  </code></pre>
  <p><strong>Update:</strong></p>
  <p>This change fixed the issue</p>
  <pre><code>source2.connect(gainNode).connect(context.destination);
  </code></pre>