Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

183
Vistas
Lag when playing mic audio directly to output using web audio api

I simply want to play audio coming in the microphone directly to the output, using the code below. But there is a lag, about 0.2 seconds. Is there a way to reduce this delay ?

navigator.getUserMedia = navigator.getUserMedia ||navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
    
var aCtx;
var analyser;
var microphone;
if (navigator.getUserMedia) {
  navigator.getUserMedia(
    {audio: true}, 
    function(stream) {
      aCtx = new AudioContext();
      microphone = aCtx.createMediaStreamSource(stream);
      var destination=aCtx.destination;
      microphone.connect(destination);
    },
    function(){ console.log("Error 003.")}
  );
}
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can disable any pre-processing which should reduce the delay to a minimum.

Instead of this ...

navigator.getUserMedia({
    audio: true
})

... you would then write this ...

navigator.mediaDevices.getUserMedia({
    audio: {
        autoGainControl: false,
        echoCancellation: false,
        noiseSuppression: false
    }
})

... to disable all pre-processing.

Please note that I also used navigator.mediaDevices.getUserMedia instead of navigator.getUserMedia. Usage of the latter is deprecated.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda