2
votes

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

  • localhost-server receives first 4 seconds of binary data #lets say Binary 1
  • Binary 1 is sent to Watson
  • {interim_result_1 for first chunk}
  • {interim_result_2 for first chunk}
  • localhost-server receives last 4 seconds of binary data #lets say Binary 2
  • Binary 2 is sent to Watson
  • Send {"action": "stop"} to Watson
  • {interim_result_3 for first chunk}
  • final result for the first chunk
  • I am not receiving any transcription for the second chunk

Link to code

3
Can you post your code?Nathan Friedly
Also, double-check the init json - this sounds like the expected behavior when continuous is omitted (or set to false)Nathan Friedly
I did double check my init json. I made a [gist] (gist.github.com/paritosh-gupta/7984bcfc0ec6871c3f83ee0541cd4bfd) for viewing code. Once it is working I will move my code into a public repository and put a link here. Thanks!Paritosh Gupta

3 Answers

1
votes

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

1
votes

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.

0
votes

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