Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
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 answers
Answer question

0

Solved it with:

const f32 = new Float32Array(data.buffer, 0, data.byteLength / Float32Array.BYTES_PER_ELEMENT);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!