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

149
Visualizações
Streaming raw PCM over socket.io results in noise

I'm working off the fantastic sample here.

In essence, I am capturing audio from the mic using getUserMedia and then downsampling each frame to an Int16Array of 16000 samples per second.

On the server side, I am able to receive the audio and using the wav package, I am able to save WAV files as well.

The problem is when I don't want to downsample (yes, I know the bandwidth implication but that's my requirement).

I'm able to stream raw audio (in Float32Array) and able to save it as a WAV. However, there's a lot of white noise added in.

When I downsample on the server side, the WAV package is unable to handle it because it is no longer a viable WAV frame.

I tried to wrap the mic samples using

var samples = new Float32Array(e.inputBuffer.getChannelData(0))
socket.emit('binaryData',samples.buffer);

and received it on the server side with

socket.on('binaryData',function (data){
 var recovered = new Float32Array(data);
 wavFileWriter.write(recovered.buffer);
});

But that doesn't work either.

I'm now wondering if Socket.io does something to the data that trips the downsample function.

Or am I missing something obvious here?

Edit 1: in my quest to rule out Socket.io issues, I created the server with these settings without any improvement:

{
    perMessageDeflate: false,
    httpCompression: false,
    maxHttpBufferSize:1e8
  }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Solved it with:

const f32 = new Float32Array(data.buffer, 0, data.byteLength / Float32Array.BYTES_PER_ELEMENT);
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