Paritosh Gupta
Paritosh Gupta

Reputation: 37

Dont receive results other than those from first audio chunk

I want some level of real-time speech to text conversion. I am using the web-sockets interface with interim_results=true. However, I am receiving results for the first audio chunk only. The second,third... audio chunks that I am sending are not getting transcribed. I do know that my receiver is not blocked since I do receive the inactivity message.

json {"error": "Session timed out due to inactivity after 30 seconds."}

Please let me know if I am missing something if I need to provide more contextual information.

Just for reference this is my init json.

{
 "action": "start",
 "content-type":"audio/wav",
 "interim_results": true,
 "continuous": true,
 "inactivity_timeout": 10
}

In the result that I get for the first audio chunk, the final json field is always received as false.

Also, I am using golang but that should not really matter.

EDIT:

Consider the following pseudo log

Link to code

Upvotes: 2

Views: 267

Answers (3)

Paritosh Gupta
Paritosh Gupta

Reputation: 37

The solution to this question was to set the size header of the wav file to 0.

Upvotes: 0

liviosoares
liviosoares

Reputation: 94

This is a bit late, but I've open-sourced a Go SDK for Watson services here: https://github.com/liviosoares/go-watson-sdk

There is some documentation about speech-to-text binding here: https://godoc.org/github.com/liviosoares/go-watson-sdk/watson/speech_to_text

There is also an example of streaming data to the API in the _test.go file: https://github.com/liviosoares/go-watson-sdk/blob/master/watson/speech_to_text/speech_to_text_test.go

Perhaps this can help you.

Upvotes: 1

Daniel Bolanos
Daniel Bolanos

Reputation: 795

You are getting the time-out message because the service waits for you to either send more audio or send a message signalling the end of an audio submission. Are you sending that message? It's very easy:

  • By sending a JSON text message with the action key set to the value stop: {"action": "stop"}

  • By sending an empty binary message

https://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/speech-to-text/websockets.shtml

Please let me know if this does not resolve your problem

Upvotes: 1

Related Questions