watson-developer-cloud / speech-to-text-swift

Speech-to-Text example using the Swift SDK
Apache License 2.0
34 stars 17 forks source link

Timeout error while transcribing long audios #3

Closed aravieshancar closed 7 years ago

aravieshancar commented 7 years ago

I am using the Watson Speech-to-text example as it is, just that I have replaced the 7 seconds audio sample with a 2 minute one. It gives me the following error -

Error Domain=NSPOSIXErrorDomain Code=60 "Operation timed out" UserInfo={_kCFStreamErrorCodeKey=60, _kCFStreamErrorDomainKey=1}

And does not transcribe the complete audio. Happens all the time.

glennrfisher commented 7 years ago

Hi @aravieshancar. This looks like a networking issue, since the operation is timing out. Does the example work when you use the provided 7-second audio clip?

I just followed the instructions in the readme to clone the repository and run the app in the simulator. It seems to work just fine for me.

aravieshancar commented 7 years ago

Thanks @glennrfisher. But how's this to be used for longer audios - 1hr or so in length and slightly poorer network conditions. I guess it will keep timing out then. Is there a minimum upload speed that it expects?

glennrfisher commented 7 years ago

Good question, @aravieshancar. The underlying networking libraries that we use will retry a few times before timing out. But if network connectivity has been lost or is intermittent, then they will time out. Neither the networking libraries nor the SDK will buffer large amounts of audio data--that's not always the preferred behavior, and could quickly fill up memory / device storage.

A good production app should make it clear that certain functionality is only available when online (or even just when on WiFi). When a timeout occurs, you could configure your app to retry or present an error to the user.

If you want to store audio data, you can use the onMicrophoneData callback function of the SpeechToTextSession class (here's the section of the readme). Then send the audio for transcription once the network connection is more stable.

I'm going to close this issue for now, but feel free to reply if you're still having trouble.