如何在 node-red 中设置 watson text to speech 的音频文件采样率

how to set the audio file sample rate for watson text to speech in node-red

watson text to speech 接受采样等额外参数(默认为 44khz)

请参阅 https://www.ibm.com/watson/developercloud/text-to-speech/api/v1/#synthesize_audio 以了解诸如此类的选项

(...)
audio/l16;rate=rate 
(You can optionally specify endianness=big-endian 
or endianness=little-endian; the default is little endian.) 
(...)

但我看不到在节点红色中设置这些选项的方法

在Node-red中没有这个选项,因为你需要在你的cURL中添加。

如您所见,您可以使用Acceptaccept查询参数header来指定音频格式。

例如:

curl -X POST -u "{username}":"{password}"
--header "Content-Type: application/json"
--header "Accept: audio/l16;endianness=big-endian"
--data "{\"text\":\"Hello world\"}"
--output hello_world.wav
"https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize?voice=en-US_AllisonVoice"

请将此作为节点的 github 存储库的改进请求提出,我们可以在那里继续讨论。没有承诺,但如果做得好,我愿意接受拉取请求。