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

HTTP request to send wav file #124

Open
Sultan91 opened this issue Dec 26, 2016 · 3 comments
Open

HTTP request to send wav file #124

Sultan91 opened this issue Dec 26, 2016 · 3 comments

Comments

@Sultan91
Copy link

Hi, as far as I know http post request has a feature for sending .wav file:

screenshot

Can you please guide me of how to make the same with jQuery Ajax POST. I've tried this way:

screenshot001

data geenrated like that: 'var data = new FormData(); data.append('file',$('input[type=file]')[0].files[0]);'
It gives illegal invocation error.

@Sultan91
Copy link
Author

Sultan91 commented Dec 27, 2016

Finaly tried nodejs type request for the same POST request, received succes output, but i guess haven't managed to send correctly .wav file:
`var request = require('request');

var data1 = new FormData();
data1.append('file',$('input[type=file]')[0].files[0]);
var headers = {
'Authorization': 'Bearer token',
'Content-Type': 'audio/wav'
};

var dataString = '@sample.wav';

var options = {
url: 'https://api.wit.ai/speech?v=20141022',
method: 'POST',
headers: headers,
body: data1
};

function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
else {console.log(error+response);}
}

request(options, callback);`

Output gave the following result: { "msg_id" : "3f6228bb-5c0b-4505-b033-7c42932d284d", "_text" : "", "outcomes" : [ ], "WARNING" : "DEPRECATED" }

@Sultan91
Copy link
Author

BTW is sending a speech file won't be supported anymore? And any other form of audio - voice recognition?

@umezy
Copy link

umezy commented Feb 2, 2017

Is it solved? I also find speech to text platform. what reference do you use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants