Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

148
Visualizações
Web Audio API - Automatic Gain Control?

Is there a way to create automatic gain control with the web-audio api? In my case, I'm building a web-based video chat app that takes multiple audio streams (people talking) and plays them. Is there a way to adjust their relative volume-levels such that everyone has roughly the same loudness? I don't want one person to sound very quiet while another person sounds very loud.

GainNodes appear to be very manually; they expect you to figure out what the .gain.value should be. I suppose I could run every audio track through an analyserNode, compute a volume level, and then manually adjust each person's individual gain-node based on that, but I'm wondering if there's an easier way to do automatic gain control? Thanks.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you're making a web-based chat app, automatic gain control is actually easily handled when you capture microphone audio in the first place:

const stream = await navigator.mediaDevices.getUserMedia({
  audio: {
    autoGainControl: true
  },
  video: true
});

(Note that autoGainControl is actually on by default. You don't need to manually enable it.)

However, if you still want to reduce the dynamics range on playback, what you're looking for is a DynamicsCompressorNode. This will squash variances between the loud and quiet parts. After that node, you can add a fixed GainNode to make up for the losses in the compressor.

The specific compression settings you use are a matter of taste, and there is a great deal of debate on this. You might start with a 2ms attack time, 10ms release time, 3:1 ratio, -20 dB threshold, and perhaps 6 dB of makeup gain, and tweak from there.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda