title: Web Audio API Delay sounds distored in Chrome
body: <p>I'm using Web Audio API with javascript.</p>
  
  <p>I create an oscillator, connect it to the volume (gainNode), connect it to a destination.</p>
  
  <p>Ok. Nice.</p>
  
  <p>I want a delay effect, I stick it between oscillator and volume.</p>
  
  <p>Well, that doesn't work, I only hear the delay. Although, it is clean.</p>
  
  <p>Ok, so I connect the osc to the delay to the volume, and the osc to the volume, then the volume to the destination.</p>
  
  <p>Now it seems to be distorted.</p>
  
  <p>I tried osc to delay to volume to destination, with osc to destination so there are two connections to the destination. That too is distorted.</p>
  
  <p>That's on chrome.</p>
  
  <p>In the little time I've had to try it, it seems to work right on iOS6. Don't know about safari.</p>
  
  <p>Try it by going to <a href="http://cloudmusiccompany.appspot.com/watch.jsp" rel="nofollow">http://cloudmusiccompany.appspot.com/watch.jsp</a> and clicking red and drawing. That's a normal sine osc. Now click white and draw, that is the same withing with the delay, and on chrome (Ubuntu) it is distorted. Don't know about Safar.</p>
  
  <p>Obviously you can see the full source at the link because its javascript. </p>
  
  <p>Relevant source:</p>
  
  <pre><code>function makeNewChannel(color){
    var info = getInstrumentInfo(color);
    var chan = {osc: acontext.createOscillator(),
      freqs: [],
      times: [],
      pxdata: [],
      i: 0,
      muted: true,
      finishedLoop: false, 
      volume: acontext.createGainNode(), 
      gate: acontext.createGainNode(), 
      delay: acontext.createDelayNode(),
      delayGain: acontext.createGainNode(), 
      mute: function(){
        this.muted = true;
        this.volume.gain.value = 0;
      },
      unmute: function(){
        this.muted = false;
        this.volume.gain.value = player.defaultGain / (info.soft ? 2 : 1);
      }
    }
    chan.osc.type = info.type;
  
    //        chan.osc.connect(chan.gate);
    chan.osc.connect(chan.volume);
  
    chan.delayGain.gain.value = player.defaultGain ;
    /* ugh , the wet sounds ok, but somehow its distorting or doubling the dry signal
     * although it seems ok on iphone?
     * */
    if (info.delay){
      chan.delay.delayTime.value = 0.5;
      chan.volume.connect(chan.delay)
      chan.delay.connect(chan.delayGain);
  
      chan.delayGain.connect(acontext.destination);
  
    }
    chan.volume.gain.value = 0; //player.defaultGain;
    chan.gate.gain.value = 0;
    chan.volume.connect(acontext.destination);
    chan.osc.frequency.value = 0;
  
    chan.osc.noteOn(0);
    return chan;
  }
  </code></pre>