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

147
Vistas
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 Respuestas
Responde la pregunta

0

Solved it with:

const f32 = new Float32Array(data.buffer, 0, data.byteLength / Float32Array.BYTES_PER_ELEMENT);
about 4 years ago · Juan Pablo Isaza 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