如何解决“此处没有配置默认音频设备”的语音转文本问题

the*_*shy 4 windows speech-to-text sox node.js google-speech-api

Am trying to call the speech-to-text api of google console for nodejs and apparently is working, but when i try to run the example provider for here the example node MicrophoneStream.js and doing the installation like this here, am having the following error.

STDERR: sox FAIL sox: Sorry, there is no default audio device configured

i dont really know how to pass the device with arguments and i assuming is the default microphone but not sure cause in some page i found a possible value for this like "AUDIOWAVE", also configured in my system and still not working.

the recorder object have a function record and i can start the recorder from that passing arguments ( i suppose are passed to sox binaries ), like this

  .record({
      sampleRateHertz: sampleRateHertz,
      threshold: 0, //silence threshold
      recordProgram: 'rec', // Try also "arecord" or "sox"
      silence: '5.0', //seconds of silence before ending
    })
Run Code Online (Sandbox Code Playgroud)

所以我尝试传递STDERR参数,因为我虽然是默认设备参数,但不起作用。

无论如何,如果有人可以提供帮助,我将不胜感激,并且如果可以与我分享所有可能的.record arg和描述的文档参考,那就太好了。谢谢。

这是完整的跟踪

record Started recording +0ms
  record { sampleRate: 16000,
  record   channels: 1,
  record   compress: false,
  record   threshold: 0,
  record   thresholdStart: null,
  record   thresholdEnd: null,
  record   silence: '5.0',
  record   recorder: 'sox',
  record   endOnSilence: false,
  record   audioType: 'wav',
  record   sampleRateHertz: 16000,
  record   STDERR: '2- USB2.0 MIC',
  record   recordProgram: 'rec' } +2ms
  record  sox --default-device --no-show-progress --rate 16000 --channels 1 --encoding signed-integer --bits 16 --type wav - +10ms
Listening, press Ctrl+C to stop.
  record STDERR: sox FAIL sox: Sorry, there is no default audio device configured
  record  +131ms
  record Recording ended +2ms
sox has exited with error code 1.
Run Code Online (Sandbox Code Playgroud)

the*_*shy 7

好吧,我看到这个问题没有得到任何答案,但我很抱歉,因为几个月前我找到了解决方案。

在恢复中,sox版本14.4.2在我的Windows 10操作系统中存在一些问题(我在 Fedora 30.1发行版的 Linux 版本中进行测试并且工作正常) ,所以我在Node-Speakable存储库中找到了解决方案,只需将版本降级为14.4.1 .

我通过安装 sox 14.4.1 而不是 14.4.2 解决了这个问题(此处

我用同样的方式解决了这个问题。

无论如何()在同一篇文章中还有另一种方法可以使用版本 14.4.2 解决,但我认为这有点棘手,因为您使用命令而不实现库或脚本文件,但仍然是一个选项。