node-wit icon indicating copy to clipboard operation
node-wit copied to clipboard

HTTP request to send wav file

Open Sultan91 opened this issue 9 years ago • 3 comments

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 avatar Dec 26 '16 12:12 Sultan91

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 avatar Dec 27 '16 09:12 Sultan91

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

Sultan91 avatar Dec 27 '16 16:12 Sultan91

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

umezy avatar Feb 02 '17 13:02 umezy