You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The test_microphone.js example does not work due to an issue in [email protected] package it uses. This package is a JS binding for SoX audio tool. On Windows, it calls sox.exe with the parameter -p that is a shortcut for -t sox -, i.e. sets the data format equal to sox. The sox format is always 32-bit, while vosk.Recognizer expects 16-bit data captured from a microphone. Configuring the data value size with -b parameter set to 16 (bitwidth: '16' when creating mic instance in the test_microphone.js) does not help, it is simply ignored.
The issue can be solved by modifying mic.js file from the mic package on line 50 and replacing '-p' with '-t', 'raw', '-'. A solution could be forking this package (as the author does not maintain it anymore) and correcting the set of parameters passed to sox.exe. Similar package, node-microphone, is providing same -p parameter when launching sox.exe on Windows, thus same issue could be expected.
The text was updated successfully, but these errors were encountered:
Yeap, this solved the issue for me as well :). For sure need to change Microphone example in Node.js.
I created a simple example without any external lib to deal with a microphone but using Sox anyway.
The test_microphone.js example does not work due to an issue in [email protected] package it uses. This package is a JS binding for SoX audio tool. On Windows, it calls
sox.exe
with the parameter-p
that is a shortcut for-t sox -
, i.e. sets the data format equal tosox
. Thesox
format is always 32-bit, whilevosk.Recognizer
expects 16-bit data captured from a microphone. Configuring the data value size with-b
parameter set to16
(bitwidth: '16'
when creatingmic
instance in thetest_microphone.js
) does not help, it is simply ignored.The issue can be solved by modifying mic.js file from the
mic
package on line 50 and replacing'-p'
with'-t', 'raw', '-'
. A solution could be forking this package (as the author does not maintain it anymore) and correcting the set of parameters passed tosox.exe
. Similar package, node-microphone, is providing same-p
parameter when launchingsox.exe
on Windows, thus same issue could be expected.The text was updated successfully, but these errors were encountered: