I am currently using this command in terminal to try transcribe my telephonic mono voice sample wav with 16 bps at 8 kHz sample rate, to the IBM Speech-to-Text engine.
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"
The output, however, states that input wav is unsupported:
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"
}
According to IBM supported audio format list, I have changed my model to "NarrowbandModel" to allow the minimum input sampling rate of 8 kHz as stated.
My question: Is there something wrong with my request or audio file?
Update: I have tried converting the .wav to the MP3 format at constant 8 and 48 kHz sampling rate. With the changes to "Content-Type: audio/mp3", also result in the same output as mentioned above.
Try passing the model=en-US_NarrowbandModel as parameter in the URL. Following curl command works for me for your wav file.
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
},