Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[speech-to-text] The same audio can got text before,Now is Error 1006 #815

Closed
JimZhang1028 opened this issue Dec 16, 2018 · 6 comments
Closed
Assignees

Comments

@JimZhang1028
Copy link

JimZhang1028 commented Dec 16, 2018

The same code that used to work is now returning an error code: 1006.
We have 5 audios and only the shortest one works
This problem started in 2018-11-19

When I use curl I get a response.

curl -X POST -u "username":"password" --header "Content-Type: audio/wav" \
--data-binary @./sound16000.wav \
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?timestamps=true"

The Watson support team tested my service and they said it works fine.

This issue's SDK version.

  • Node: 6.12.3
  • SDK: 3.0.3

We use Visual Recognition and we need IAM so we updated the SDK version to 3.15.0

I've attached the audio file(sound16000.zip) to reproduce the error

@germanattanasio
Copy link
Contributor

@JimZhang1028 can you add the code you are using so that we can reproduce the problem?

@JimZhang1028
Copy link
Author

JimZhang1028 commented Dec 18, 2018

@germanattanasio
Our system use watson-developer-cloud nodejs sdk for development. It normally works for 6 month,But suddenly the audio can not get text from STT from 2018-11.
I have used the audio which they can successfully got text via STT before. But now all of them are failed.

So I write the code as below for test. All the parameter is the same as our system. (watson-developer-cloud version is 3.15.0)

var SpeechToTextV1 = require('watson-developer-cloud/speech-to-text/v1'); 
var fs = require('fs'); 
var STT = new SpeechToTextV1({ 
	username: 'my user name', 
	password: 'my password', 
	url: 'https://stream.watsonplatform.net/speech-to-text/api/' 
}); 
var params = { 
	content_type: 'audio/wav;rate=16000', 
	continuous: true, 
	'x-watson-learning-opt-out': true, 
	objectMode: true, 
	timestamps: true 
}; 
var recognizeStream = STT.recognizeUsingWebSocket(params); 

function onEvent(name, event) { console.log(name, JSON.stringify(event, null, 2)); }; 

function speechToText(){ 
// pipe in some audio fs.createReadStream('./sound16000.wav').pipe(recognizeStream) 
.on('data', function(event) { onEvent('Data:', event); }) 
.on('error', function(event) { onEvent('Error:', event); }) 
.on('readable', function(event) { onEvent('Readable:', event); }) 
.on('end', function(event) { onEvent('End:', event); }) 
.on('close', function(event) { onEvent('Close:', event); }); 
} 

speechToText();

My result is

node .\speechToText.js 
Readable: undefined 
Close: 1006 
End: undefined 

PS: The system is use ffmpeg to get audio from video. ffmpeg -i ./test_0.mp4 -y -ar 16000 -f wav ./test_0.wav

@JimZhang1028
Copy link
Author

JimZhang1028 commented Jan 10, 2019

This issue as same as #202,Please confirm.

@dpopp07 dpopp07 self-assigned this Jan 11, 2019
@dpopp07
Copy link
Contributor

dpopp07 commented Jan 15, 2019

@JimZhang1028 I think I have a solution for you. For this code to work now, you need to use the interim_results parameter. Add interim_results: true, to your parameters list and you will receive data back from the service. Please confirm this works with your application.

@JimZhang1028
Copy link
Author

@dpopp07 After added interim_results ,It works.
This interim_results parameter means we will get text for several times.
If we don't add this, we will get the whole text for one time.
Do you plan to find out why we don't use this parameter we can not get text?

@dpopp07
Copy link
Contributor

dpopp07 commented Jan 17, 2019

I'm glad that worked for you. I do plan to try and find that out but it will be difficult and I cannot guarantee it will be done soon. Closing this issue as the problem is solved, the other work will be tracked internally for now

@dpopp07 dpopp07 closed this as completed Jan 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants