IBM Speech 中的 curl "Unsupported Media Type" 错误

curl "Unsupported Media Type" error in IBM Speech

我目前正在终端中使用此命令尝试以 8 kHz 采样率以 16 bps 的速度将我的 telephonic mono voice sample wav 转录到 IBM Speech-to-Text 引擎。

curl -X POST \
-u "apikey goes here" \
--header "Content-Type: audio/wav", "model: en-US_NarrowbandModel" \
--data-binary @{path_url_goes_here)/OSR_us_000_0010_8k.wav \
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize"

但是,输出表明不支持输入 wav:

 curl: (3) Port number ended with ' '
{
   "code_description": "Unsupported Media Type", 
   "code": 415, 
   "error": "Unable to transcode from audio/wav, to one of: audio/x-float-array; rate=16000; channels=1, application/srgs, application/srgs+xml, application/jsgf, application/fsm, application/bnf"
}

根据 IBM supported audio format list,我已将我的模型更改为 "NarrowbandModel" 以允许 8 kHz 的最小输入采样率,如所述。

我的问题: 我的请求或音频文件有问题吗?

更新:我试过以恒定的 8 和 48 kHz 采样率将 .wav 格式转换为 MP3 格式。随着对 "Content-Type: audio/mp3" 的更改,也会产生与上述相同的输出。

尝试将模型=en-US_NarrowbandModel 作为 URL 中的参数传递。以下 curl 命令适用于我的 wav 文件。

curl -X POST \
-u "apikey:XXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-H "Content-Type:audio/wav" \
--data-binary @OSR_us_000_0010_8k.wav \
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?model=en-US_NarrowbandModel"

{
 "results": [
  {
     "alternatives": [
        {
           "confidence": 0.985, 
           "transcript": "the birch canoes slid on the smooth planks "
        }
     ], 
     "final": true
  },