title: Reduce audio playback latency from microphone input in javascript?
body: <p>I need to capture some input from microphone in javascript (from a browser) and playback audio in real time. But the latency I get is really ugly (about 200ms).</p>
  
  <p>How can I reduce this ? Is javascript a good option to expect latency like 20 ms ?</p>
  
  <p>I simply tried to capture the audio using <code>getUserMedia()</code> and <code>AudioContext</code> utils from <code>Web Audio API</code> and play it : </p>
  
  <pre><code>const constraints = {
    video: false,
    audio: {
      echoCancellation: false,
      noiseSuppression: false,
      autoGainControl: false
    }
  }
  
  var context = new AudioContext({
    latencyHint: 'interactive',
    sampleRate: 44100,
  });
  
  navigator.mediaDevices.getUserMedia(constraints)
    .then((stream) =&gt; {
      var source = context.createMediaStreamSource(stream);
      source.connect(context.destination);
    });
  </code></pre>
  
  <p>Any suggestion is welcome to minimize latency. 
  Thanks</p>