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

219
Views
Concat stream audio buffers into one file and store it

I was using the Google Cloud Speech to recognize streaming audios (from microphone) on the node server. At the same time I would like to store the streamed audio into a file. Since the streaming recognition is operated on chunks of buffers, how could I combine all the buffers and store it as a single audio file?

The actual code I was using is adapted from this library, where the audio encoding on the server side is defined as

const encoding = 'LINEAR16';
const sampleRateHertz = 16000;

And each time there's a audio stream it will be sent via the cloud api:

client.on('binaryData', function (data) {
    if (recognizeStream !== null) {
      recognizeStream.write(data);
    }
  });

On the client side, the buffer was preprocessed in this file (downsampled into a Int16Array).

So can I just concatenate each buffer and save to a pcm file on the server side, when the streaming finishes? Or do I need to merge the buffers in a complex way (such as using audiobuffer-to-wav?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

There is a SO answer here which solves exactly my question. It uses the wav library to add a header, and then write the audio buffer to a file.

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!