Watson Text to Speech 空白

Watson Text to Speech blank

我有一个使用 Watson Text to Speech 的简单示例,但即使有这些示例,返回的音频文件始终为空白。

我的代码:

$result = shell_exec("/usr/bin/curl -k -u 'xxxx':'xxxx' -X POST \
  --header 'Content-Type: application/json' \
  --header 'Accept: audio/wav' \
  --output 'test.wav'  \
  --data '{\"text\":\"hello world\", \"voice\":\"en-US_AllisonVoice\"}' \
  'https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize/'");
print_r($result);

这是因为 --output 'test.wav' 标志:音频文件被保存到 test.wav 而不是通过标准输出传递到 $result。