A simple stream wrapper for arecord (Linux (including Raspbian)) and sox (Mac, Windows). Returns a Passthrough stream object so that stream control like pause(), resume(), pipe(), etc. are all available.
MIT License
103
stars
61
forks
source link
How to get a valid wav file from micInputStream.on('data') ? #44
I'm using vosk-api for nodejs and in its sample, they use mic:
https://github.com/alphacep/vosk-api/blob/master/nodejs/demo/test_microphone.js#L27
I'm trying to understand what kind of buffer is the data object and why is compatible with vosk
According to the vosk lib, buffer is
@param {Buffer} data audio data in PCM 16-bit mono format
But if I try to read the data object as wav file with the following libraries, I got this error: Not a supported format
Also if I try to get the standard wav sections (header, data, etc) of the data object I got this:
The received buffer from microphone (https://www.npmjs.com/package/mic) is not a valid wav file but works for vosk
Question
Related issues
https://github.com/alphacep/vosk-api/issues/1504
If anyone here can point me in the right direction of documentation, I will appreciate.
Thanks!