包含 google 云语音 API 的 .flac 文件失败
.flac file with google cloud speech API fails
我已经成功了 运行 this nodejs demo from my local machine with the supplied .raw
file. Now I would like to use my own file, which started as a .wav
file which I converted using the following sox command (as per step 3 of the google speech troubleshoot page):
sox resources/my-audio.wav --channels=1 --bits=16 --rate=16000 --endian=little resources/my-audio.flac
然而,当我尝试使用 my-audio.flac
时,我仍然从 google 收到空响应(没有记录,没有错误)。我可以在我的机器上播放 flac 文件。
有什么建议吗?
我明白了...事实证明支持页面上用于转换 wav 的 sox 命令不太正确。这是对我有用的命令:
sox resources/my-audio.wav \
--channels=1 \
--bits=16 \
--rate=16000 \
--encoding=signed-integer \
--endian=little resources/my-audio.raw
与我的原始命令的两个主要区别是 (1) 添加 --encoding=signed-integer
(感谢 this)和 (2) 在输出文件名上使用 .raw
扩展名。
我已经成功了 运行 this nodejs demo from my local machine with the supplied .raw
file. Now I would like to use my own file, which started as a .wav
file which I converted using the following sox command (as per step 3 of the google speech troubleshoot page):
sox resources/my-audio.wav --channels=1 --bits=16 --rate=16000 --endian=little resources/my-audio.flac
然而,当我尝试使用 my-audio.flac
时,我仍然从 google 收到空响应(没有记录,没有错误)。我可以在我的机器上播放 flac 文件。
有什么建议吗?
我明白了...事实证明支持页面上用于转换 wav 的 sox 命令不太正确。这是对我有用的命令:
sox resources/my-audio.wav \
--channels=1 \
--bits=16 \
--rate=16000 \
--encoding=signed-integer \
--endian=little resources/my-audio.raw
与我的原始命令的两个主要区别是 (1) 添加 --encoding=signed-integer
(感谢 this)和 (2) 在输出文件名上使用 .raw
扩展名。